public static List<FlagType> getFlagsForTile(Class<? extends TileEntity> te) { List<FlagType> flags = new ArrayList<FlagType>(); for (Protection protection : Protections.instance.getProtectionList()) { if (protection.isTileTracked(te)) flags.addAll(protection.getFlagsForTile(te)); } return flags; }
/** Checks if an entity is hostile */ public static boolean isEntityTracked(Class<? extends Entity> ent) { for (Protection prot : Protections.instance.getProtectionList()) { if (prot.isEntityTracked(ent)) { return true; } } return false; }
/** Removes from the whitelist. Used when breaking blocks. */ public static void removeFromWhitelist( Class<? extends TileEntity> te, int dim, int x, int y, int z, Town town) { for (Protection prot : Protections.instance.getProtectionList()) { if (prot.isTileTracked(te)) for (FlagType flagType : prot.getFlagsForTile(te)) { BlockWhitelist bw = town.getBlockWhitelist(dim, x, y, z, flagType); if (bw != null) { bw.delete(); } } } }
/** Adds to the whitelist of the specified town. Used when placing blocks. */ public static void addToBlockWhitelist( Class<? extends TileEntity> te, int dim, int x, int y, int z, Town town) { for (Protection prot : Protections.instance.getProtectionList()) { if (prot.isTileTracked(te)) for (FlagType flagType : prot.getFlagsForTile(te)) { if (!town.hasBlockWhitelist(dim, x, y, z, flagType)) { BlockWhitelist bw = new BlockWhitelist(dim, x, y, z, flagType); DatasourceProxy.getDatasource().saveBlockWhitelist(bw, town); } } } }
public static boolean isTileEntityOwnable(Class<? extends TileEntity> clsTe) { for (Protection protection : Protections.instance.getProtectionList()) { if (protection.isTileEntityOwnable(clsTe)) return true; } return false; }
/** Checks the block if it can be activated by a right-click */ public static boolean checkActivatedBlocks(Block block, int meta) { for (Protection prot : Protections.instance.getProtectionList()) { if (prot.isBlockTracked(block.getClass(), meta)) return true; } return false; }
/** Checks the tile entity with all the protections */ public static boolean checkTileEntity(TileEntity te) { for (Protection prot : Protections.instance.getProtectionList()) if (prot.checkTileEntity(te)) return true; return false; }
public static boolean canEntityTrespassPvp(Class<? extends Entity> entity) { for (Protection protection : Protections.instance.getProtectionList()) { if (protection.canEntityTrespassPvp(entity)) return true; } return false; }