1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2026-02-01 00:10:15 +00:00

Add button to view computer's folder

Implementation is a little awkward, as we can't send OPEN_FILE links
from the server, so we ensure the client runs a
/computercraft open-computer ID command instead. We then intercept this
on the client side and use that to open the folder.
This commit is contained in:
Jonathan Coates
2021-05-28 22:19:04 +01:00
parent b129ae627b
commit 9f7cc00fcb
8 changed files with 107 additions and 79 deletions

View File

@@ -57,14 +57,15 @@ public enum UserLevel implements Predicate<CommandSource>
{
if( this == ANYONE ) return true;
// We *always* allow level 0 stuff, even if the
MinecraftServer server = source.getServer();
Entity sender = source.getEntity();
if( server.isSingleplayer() && sender instanceof PlayerEntity &&
((PlayerEntity) sender).getGameProfile().getName().equalsIgnoreCase( server.getServerModName() ) )
if( this == OWNER || this == OWNER_OP )
{
if( this == OWNER || this == OWNER_OP ) return true;
MinecraftServer server = source.getServer();
Entity sender = source.getEntity();
if( server.isSingleplayer() && sender instanceof PlayerEntity &&
((PlayerEntity) sender).getGameProfile().getName().equalsIgnoreCase( server.getServerModName() ) )
{
return true;
}
}
return source.hasPermission( toLevel() );