@SuppressWarnings("deprecation") public void UpdateBarrier(Barrier barrier) { CustomConfig conf = plugin.configManager.getConfig("ArenaConfig"); if (game.mode == ArenaStatus.DISABLED || game.mode == ArenaStatus.WAITING) { boolean same = false; for (Barrier b : barriers) { if (b.getLocation().equals(b.getLocation())) { same = true; } } if (!same) { Location loc = barrier.getLocation(); Location loc2 = barrier.getRepairLoc(); SpawnPoint sp = barrier.getSpawnPoint(); int name = barrier.getNum(); conf.set(game.getName() + ".Barriers." + name + ".x", loc.getBlockX()); conf.set(game.getName() + ".Barriers." + name + ".y", loc.getBlockY()); conf.set(game.getName() + ".Barriers." + name + ".z", loc.getBlockZ()); conf.set(game.getName() + ".Barriers." + name + ".rx", loc2.getBlockX()); conf.set(game.getName() + ".Barriers." + name + ".ry", loc2.getBlockY()); conf.set(game.getName() + ".Barriers." + name + ".rz", loc2.getBlockZ()); conf.set(game.getName() + ".Barriers." + name + ".sp", sp.getNumber()); conf.set(game.getName() + ".Barriers." + name + ".bb", barrier.getBlock().getTypeId()); conf.set(game.getName() + ".Barriers." + name + ".reward", barrier.getReward()); conf.saveConfig(); barriers.add(barrier); } } }
public Barrier getBarrier(Location loc) { for (Barrier b : barriers) { if (b.getLocation().equals(loc)) { return b; } } return null; }