respect denylist module
@@ -6,6 +6,7 @@ import net.geforcemods.securitycraft.SCContent;
import net.geforcemods.securitycraft.items.KeycardItem;
import net.geforcemods.securitycraft.misc.ModuleType;
import net.geforcemods.securitycraft.tileentity.KeycardReaderTileEntity;
+import net.geforcemods.securitycraft.util.ClientUtils;
import net.geforcemods.securitycraft.util.ModuleUtils;
import net.geforcemods.securitycraft.util.PlayerUtils;
import net.minecraft.block.Block;
@@ -53,10 +54,18 @@ public class KeycardReaderBlock extends DisguisableBlock {
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit)
{
if(!world.isRemote)
+ {
+ KeycardReaderTileEntity te = (KeycardReaderTileEntity)world.getTileEntity(pos);
+
+ if(te.hasModule(ModuleType.BLACKLIST) && ModuleUtils.getPlayersFromModule(te.getModule(ModuleType.BLACKLIST)).contains(player.getName().getString()))
+ {
+ if(te.sendsMessages())
+ PlayerUtils.sendMessageToPlayer(player, new TranslationTextComponent(getTranslationKey()), ClientUtils.localize("messages.securitycraft:module.blacklisted"), TextFormatting.RED);
+ }
+ else
{
ItemStack stack = player.getHeldItem(hand);
Item item = stack.getItem();
- KeycardReaderTileEntity te = (KeycardReaderTileEntity)world.getTileEntity(pos);
boolean isCodebreaker = item == SCContent.CODEBREAKER.get();
//either no keycard, or an unlinked keycard, or an admin tool
@@ -85,6 +94,7 @@ public class KeycardReaderBlock extends DisguisableBlock {
}
}
}
+ }
return ActionResultType.SUCCESS;
}
@@ -105,7 +115,7 @@ public class KeycardReaderBlock extends DisguisableBlock {
//the keycard's level
if(!te.getAcceptedLevels()[level]) //both are 0 indexed, so it's ok
- return new TranslationTextComponent("messages.securitycraft:keycardReader.wrongLevel", level + 1);
+ return new TranslationTextComponent("messages.securitycraft:keycardReader.wrongLevel", level + 1); //level is 0-indexed, so it has to be increased by one to match with the item name
boolean powered = world.getBlockState(pos).get(POWERED);
