예제 #1
0
 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;
 }
예제 #2
0
 /** 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;
 }
예제 #3
0
 /** 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();
         }
       }
   }
 }
예제 #4
0
 /** 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);
         }
       }
   }
 }
예제 #5
0
 public static boolean isTileEntityOwnable(Class<? extends TileEntity> clsTe) {
   for (Protection protection : Protections.instance.getProtectionList()) {
     if (protection.isTileEntityOwnable(clsTe)) return true;
   }
   return false;
 }
예제 #6
0
 /** 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;
 }
예제 #7
0
 /** 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;
 }
예제 #8
0
 public static boolean canEntityTrespassPvp(Class<? extends Entity> entity) {
   for (Protection protection : Protections.instance.getProtectionList()) {
     if (protection.canEntityTrespassPvp(entity)) return true;
   }
   return false;
 }