mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 04:00:30 +00:00
parent
9fbcbae5b3
commit
3396fe2871
@ -56,18 +56,17 @@ public enum UserLevel implements Predicate<CommandSource>
|
||||
public boolean test( CommandSource source )
|
||||
{
|
||||
if( this == ANYONE ) return true;
|
||||
|
||||
if( this == OWNER || this == OWNER_OP )
|
||||
{
|
||||
MinecraftServer server = source.getServer();
|
||||
Entity sender = source.getEntity();
|
||||
if( server.isSingleplayer() && sender instanceof PlayerEntity &&
|
||||
((PlayerEntity) sender).getGameProfile().getName().equalsIgnoreCase( server.getServerModName() ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( this == OWNER ) return isOwner( source );
|
||||
if( this == OWNER_OP && isOwner( source ) ) return true;
|
||||
return source.hasPermission( toLevel() );
|
||||
}
|
||||
|
||||
private static boolean isOwner( CommandSource source )
|
||||
{
|
||||
MinecraftServer server = source.getServer();
|
||||
Entity sender = source.getEntity();
|
||||
return server.isDedicatedServer()
|
||||
? source.getEntity() == null && source.hasPermission( 4 ) && source.getTextName().equals( "Server" )
|
||||
: sender instanceof PlayerEntity && ((PlayerEntity) sender).getGameProfile().getName().equalsIgnoreCase( server.getServerModName() );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user