mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-15 11:45:42 +00:00
Use Minecraft's "can use command blocks" check
Just means we're a little more consistent, and hopefully can remove canPlayerUseCommands in the future, once Plethora stops using it.
This commit is contained in:
parent
41429bdc0b
commit
cbfd5aeeee
@ -386,16 +386,6 @@ public class ComputerCraft
|
||||
return new File( getBaseDir(), "resourcepacks" );
|
||||
}
|
||||
|
||||
public static boolean canPlayerUseCommands( EntityPlayer player )
|
||||
{
|
||||
MinecraftServer server = player.getServer();
|
||||
if( server != null )
|
||||
{
|
||||
return server.getPlayerList().canSendCommands( player.getGameProfile() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void registerPermissionProvider( ITurtlePermissionProvider provider )
|
||||
{
|
||||
@ -730,5 +720,12 @@ public class ComputerCraft
|
||||
{
|
||||
return Peripherals.getPeripheral( world, pos, side );
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean canPlayerUseCommands( EntityPlayer player )
|
||||
{
|
||||
MinecraftServer server = player.getServer();
|
||||
return server != null && server.getPlayerList().canSendCommands( player.getGameProfile() );
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class ContainerViewComputer extends Container implements IContainerComput
|
||||
player.sendMessage( new TextComponentTranslation( "advMode.notEnabled" ) );
|
||||
return false;
|
||||
}
|
||||
else if( !ComputerCraft.canPlayerUseCommands( player ) || !player.capabilities.isCreativeMode )
|
||||
else if( !player.canUseCommandBlock() )
|
||||
{
|
||||
player.sendMessage( new TextComponentTranslation( "advMode.notAllowed" ) );
|
||||
return false;
|
||||
|
@ -176,14 +176,14 @@ public class TileCommandComputer extends TileComputer
|
||||
player.sendMessage( new TextComponentTranslation( "advMode.notEnabled" ) );
|
||||
return false;
|
||||
}
|
||||
else if( ComputerCraft.canPlayerUseCommands( player ) && player.capabilities.isCreativeMode )
|
||||
{
|
||||
return super.isUsable( player, ignoreRange );
|
||||
}
|
||||
else
|
||||
else if( !player.canUseCommandBlock() )
|
||||
{
|
||||
player.sendMessage( new TextComponentTranslation( "advMode.notAllowed" ) );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.isUsable( player, ignoreRange );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user