Exemplo n.º 1
0
  /** Checks if the block whitelist is still valid */
  public static boolean isBlockWhitelistValid(BlockWhitelist bw) {
    // Delete if the town is gone
    if (MyTownUtils.getTownAtPosition(bw.getDim(), bw.getX() >> 4, bw.getZ() >> 4) == null)
      return false;

    if (bw.getFlagType() == FlagType.ACTIVATE
        && !checkActivatedBlocks(
            DimensionManager.getWorld(bw.getDim()).getBlock(bw.getX(), bw.getY(), bw.getZ()),
            DimensionManager.getWorld(bw.getDim())
                .getBlockMetadata(bw.getX(), bw.getY(), bw.getZ()))) return false;
    if (bw.getFlagType() == FlagType.MODIFY
        || bw.getFlagType() == FlagType.ACTIVATE
        || bw.getFlagType() == FlagType.USAGE) {
      TileEntity te =
          DimensionManager.getWorld(bw.getDim()).getTileEntity(bw.getX(), bw.getY(), bw.getZ());
      if (te == null) return false;
      return getFlagsForTile(te.getClass()).contains(bw.getFlagType());
    }
    return true;
  }
Exemplo n.º 2
0
  public static boolean isBlockWhitelistValid(BlockWhitelist bw) {
    // Delete if the town is gone
    if (MyTownUtils.getTownAtPosition(bw.getDim(), bw.getX() >> 4, bw.getZ() >> 4) == null) {
      return false;
    }

    if (!bw.getFlagType().isWhitelistable) {
      return false;
    }

    /*
    if (bw.getFlagType() == FlagType.ACTIVATE
            && !checkActivatedBlocks(MinecraftServer.getServer().worldServerForDimension(bw.getDim()).getBlock(bw.getX(), bw.getY(), bw.getZ()), MinecraftServer.getServer().worldServerForDimension(bw.getDim()).getBlockMetadata(bw.getX(), bw.getY(), bw.getZ())))
        return false;
    if (bw.getFlagType() == FlagType.MODIFY || bw.getFlagType() == FlagType.ACTIVATE || bw.getFlagType() == FlagType.USAGE) {
        TileEntity te = MinecraftServer.getServer().worldServerForDimension(bw.getDim()).getTileEntity(bw.getX(), bw.getY(), bw.getZ());
        if (te == null)
            return false;
        return getFlagsForTile(te.getClass()).contains(bw.getFlagType());
    }
    */
    return true;
  }