1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-09-29 15:30:48 +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:
SquidDev 2019-03-16 01:54:11 +00:00
parent 41429bdc0b
commit cbfd5aeeee
3 changed files with 13 additions and 16 deletions

View File

@ -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
}

View File

@ -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;

View File

@ -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 );
}
}
}