From c8fe54e685bc8ec49b2bf8fc529a4541821db2cc Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Oct 2014 14:13:33 +1100 Subject: [PATCH 1/5] changed version number --- .../src/com/intellectualcrafters/plot/commands/Copy.java | 2 +- PlotSquared/src/plugin.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java index 269840725..12d15a629 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Copy.java @@ -18,7 +18,7 @@ import org.bukkit.entity.Player; public class Copy extends SubCommand { public Copy() { - super(Command.COPY, "Copy a plot", "clear", CommandCategory.ACTIONS, true); + super(Command.COPY, "Copy a plot", "copy", CommandCategory.ACTIONS, true); } @Override diff --git a/PlotSquared/src/plugin.yml b/PlotSquared/src/plugin.yml index 0f0b9b4dd..272adf151 100644 --- a/PlotSquared/src/plugin.yml +++ b/PlotSquared/src/plugin.yml @@ -1,6 +1,6 @@ name: PlotSquared main: com.intellectualcrafters.plot.PlotMain -version: 2.0.5 +version: 2.1 load: STARTUP description: > Easy, yet powerful Plot World generation and management. From 093b38c4c34e7e4452658887604c1973c87b6139 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Oct 2014 17:15:13 +1100 Subject: [PATCH 2/5] fixes --- .../src/com/intellectualcrafters/plot/commands/Kick.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Purge.java | 2 +- PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java | 2 +- .../src/com/intellectualcrafters/plot/commands/Setup.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java index f5d323172..d4c315096 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Kick.java @@ -40,7 +40,7 @@ public class Kick extends SubCommand { PlayerFunctions.sendMessage(plr, "&c/plot kick "); return false; } - if (Bukkit.getPlayer(args[0]) != null) { + if (Bukkit.getPlayer(args[0]) == null) { PlayerFunctions.sendMessage(plr, C.INVALID_PLAYER.s().replaceAll("%player%", args[0])); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Purge.java index 37fcbbd1b..7c483e223 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Purge.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Purge.java @@ -22,7 +22,7 @@ import com.intellectualcrafters.plot.database.DBFunc; public class Purge extends SubCommand { public Purge() { - super("purge", "plots.admin", "Purge all plots for a world", "", "purge", CommandCategory.ACTIONS, false); + super("purge", "plots.admin", "Purge all plots for a world", "purge", "", CommandCategory.ACTIONS, false); } @Override diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java index 1bc032a3a..50467f732 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java @@ -111,7 +111,7 @@ public class Set extends SubCommand { PlayerFunctions.sendMessage(plr, C.NOT_VALID_FLAG); return false; } - if (!plr.hasPermission("plots.set.flag" + args[1].toLowerCase())) { + if (!plr.hasPermission("plots.set.flag." + args[1].toLowerCase())) { PlayerFunctions.sendMessage(plr, C.NO_PERMISSION); return false; } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Setup.java index f04dede7c..1385e9b03 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Setup.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Setup.java @@ -54,7 +54,7 @@ public class Setup extends SubCommand implements Listener { } public Setup() { - super("setup", "plots.admin", "Setup a PlotWorld", "setup {world}", "setup", CommandCategory.ACTIONS, false); + super("setup", "plots.admin", "Setup a PlotWorld", "setup {world} {generator}", "setup", CommandCategory.ACTIONS, false); } @Override From 7ce30ee95519169cea1e835c72f08b6d3d56c725 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Oct 2014 17:19:01 +1100 Subject: [PATCH 3/5] more fixes --- .../intellectualcrafters/plot/PlotWorld.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java index 76b196818..4cb57e8ec 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java @@ -112,11 +112,11 @@ public abstract class PlotWorld { this.SELL_PRICE = config.getDouble("economy.prices.sell"); this.PLOT_CHAT = config.getBoolean("chat.enabled"); this.DEFAULT_FLAGS = config.getStringList("flags.default"); - this.PVP = config.getBoolean("events.pvp"); - this.PVE = config.getBoolean("events.pve"); - this.SPAWN_EGGS = config.getBoolean("events.spawn.egg"); - this.SPAWN_CUSTOM = config.getBoolean("events.spawn.custom"); - this.SPAWN_BREEDING = config.getBoolean("events.spawn.breeding"); + this.PVP = config.getBoolean("event.pvp"); + this.PVE = config.getBoolean("event.pve"); + this.SPAWN_EGGS = config.getBoolean("event.spawn.egg"); + this.SPAWN_CUSTOM = config.getBoolean("event.spawn.custom"); + this.SPAWN_BREEDING = config.getBoolean("event.spawn.breeding"); loadConfiguration(config); } @@ -143,11 +143,11 @@ public abstract class PlotWorld { options.put("economy.prices.sell", PlotWorld.SELL_PRICE_DEFAULT); options.put("chat.enabled", PlotWorld.PLOT_CHAT_DEFAULT); options.put("flags.default", PlotWorld.DEFAULT_FLAGS_DEFAULT); - options.put("events.pvp", PlotWorld.PVP_DEFAULT); - options.put("events.pve", PlotWorld.PVE_DEFAULT); - options.put("events.spawn.egg", PlotWorld.SPAWN_EGGS_DEFAULT); + options.put("event.pvp", PlotWorld.PVP_DEFAULT); + options.put("event.pve", PlotWorld.PVE_DEFAULT); + options.put("event.spawn.egg", PlotWorld.SPAWN_EGGS_DEFAULT); options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT); - options.put("events.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT); + options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT); ConfigurationNode[] settings = getSettingNodes(); /* From b4f987e4709d5afa9f9fb41baf22b44d46a9b3fa Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Oct 2014 17:37:17 +1100 Subject: [PATCH 4/5] fixed concurrentModificationException --- .../src/com/intellectualcrafters/plot/PlotMain.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java index c6cce82e8..4c7c3b6aa 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java @@ -9,6 +9,7 @@ package com.intellectualcrafters.plot; import ca.mera.CameraAPI; + import com.intellectualcrafters.plot.Logger.LogLevel; import com.intellectualcrafters.plot.Settings.Web; import com.intellectualcrafters.plot.commands.Camera; @@ -29,8 +30,10 @@ import com.intellectualcrafters.plot.uuid.PlotUUIDSaver; import com.intellectualcrafters.plot.uuid.UUIDSaver; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + import me.confuser.barapi.BarAPI; import net.milkbowl.vault.economy.Economy; + import org.bukkit.*; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; @@ -426,6 +429,9 @@ public class PlotMain extends JavaPlugin { public void run() { for (String world : getPlotWorldsString()) { if (plots.containsKey(world)) { + + ArrayList toDeletePlot = new ArrayList(); + for (Plot plot : plots.get(world).values()) { if (plot.owner == null) { continue; @@ -442,10 +448,13 @@ public class PlotMain extends JavaPlugin { event.setCancelled(true); } else { - DBFunc.delete(world, plot); + toDeletePlot.add(plot); } } } + for (Plot plot: toDeletePlot) { + DBFunc.delete(world, plot); + } } } } From c8c4f1d848a914fec24aad1cde5839763dff1a72 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 19 Oct 2014 18:29:39 +1100 Subject: [PATCH 5/5] made changes to plot clear/signs being removed --- .../intellectualcrafters/plot/PlotHelper.java | 13 +- .../plot/commands/Delete.java | 1 - .../plot/generator/DefaultPlotManager.java | 10 +- .../plot/listeners/WorldGuardListener.java | 121 ++++++++++-------- 4 files changed, 81 insertions(+), 64 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java index f3732dad3..61ccfa7bb 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java @@ -9,7 +9,9 @@ package com.intellectualcrafters.plot; import com.intellectualcrafters.plot.database.DBFunc; + import net.milkbowl.vault.economy.Economy; + import org.bukkit.*; import org.bukkit.block.Biome; import org.bukkit.block.Block; @@ -17,6 +19,7 @@ import org.bukkit.block.BlockState; import org.bukkit.block.Sign; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import java.io.File; import java.util.ArrayList; @@ -202,17 +205,18 @@ public class PlotHelper { long r = ((nextLong() >>> 32) * n) >> 32; return (int) r; } + /* + * End of random number gen section + */ public static void removeSign(Player plr, Plot p) { World world = plr.getWorld(); PlotManager manager = PlotMain.getPlotManager(world); PlotWorld plotworld = PlotMain.getWorldSettings(world); Location loc = manager.getSignLoc(plr, plotworld, p); - loc.getBlock().setType(Material.AIR); + Block bs = loc.getBlock(); + bs.setType(Material.AIR); } - /* - * End of random number gen section - */ @SuppressWarnings("deprecation") public static void setSign(Player plr, Plot p) { @@ -673,7 +677,6 @@ public class PlotHelper { manager.clearPlot(requester, plot); removeSign(requester, plot); - setSign(requester, plot); PlayerFunctions.sendMessage(requester, C.CLEARING_DONE.s().replaceAll("%time%", "" + ((System.nanoTime() - start) / 1000000.0))); diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java index d0d3bd0d8..de2569746 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Delete.java @@ -56,7 +56,6 @@ public class Delete extends SubCommand { } boolean result = PlotMain.removePlot(plr.getWorld().getName(), plot.id, true); if (result) { - PlotHelper.removeSign(plr, plot); plot.clear(plr); DBFunc.delete(plr.getWorld().getName(), plot); } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java index 4342fe6a6..64e96e468 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/generator/DefaultPlotManager.java @@ -252,23 +252,23 @@ public class DefaultPlotManager extends PlotManager { for (int i = startX; i < chunkX; i += 16) { for (int j = startZ; j < chunkZ; j += 16) { Plot plot1 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j)); - if ((plot1 != null) && (plot1.getId() != plot.getId()) && plot1.hasOwner()) { + if ((plot1 != null) && (plot1.getId() != plot.getId())) { break; } Plot plot2 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j)); - if ((plot2 != null) && (plot2.getId() != plot.getId()) && plot2.hasOwner()) { + if ((plot2 != null) && (plot2.getId() != plot.getId())) { break; } Plot plot3 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15)); - if ((plot3 != null) && (plot3.getId() != plot.getId()) && plot3.hasOwner()) { + if ((plot3 != null) && (plot3.getId() != plot.getId())) { break; } Plot plot4 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j + 15)); - if ((plot4 != null) && (plot4.getId() != plot.getId()) && plot4.hasOwner()) { + if ((plot4 != null) && (plot4.getId() != plot.getId())) { break; } Plot plot5 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15)); - if ((plot5 != null) && (plot5.getId() != plot.getId()) && plot5.hasOwner()) { + if ((plot5 != null) && (plot5.getId() != plot.getId())) { break; } if (min == null) { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java index b27bf429e..aa6f4221b 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java @@ -119,66 +119,81 @@ public class WorldGuardListener implements Listener { @EventHandler( priority = EventPriority.MONITOR, ignoreCancelled = true) public void onUnlink(PlotUnlinkEvent event) { - World w = event.getWorld(); - ArrayList plots = event.getPlots(); - Plot main = PlotMain.getPlots(w).get(plots.get(0)); - - RegionManager manager = PlotMain.worldGuard.getRegionManager(w); - ProtectedRegion region = manager.getRegion(main.id.x + "-" + main.id.y); - - DefaultDomain owner = region.getOwners(); - Map, Object> flags = region.getFlags(); - DefaultDomain members = region.getMembers(); - - manager.removeRegion(main.id.x + "-" + main.id.y); - for (int i = 1; i < plots.size(); i++) { - PlotId id = plots.get(i); - Location location1 = PlotHelper.getPlotBottomLocAbs(w, id); - Location location2 = PlotHelper.getPlotTopLocAbs(w, id); - - BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ()); - BlockVector vector2 = new BlockVector(location2.getBlockX(), w.getMaxHeight(), location2.getBlockZ()); - ProtectedRegion rg = new ProtectedCuboidRegion(id.x + "-" + id.y, vector1, vector2); - - rg.setFlags(flags); - - rg.setOwners(owner); - - rg.setMembers(members); - - manager.addRegion(rg); - } + try { + World w = event.getWorld(); + ArrayList plots = event.getPlots(); + Plot main = PlotMain.getPlots(w).get(plots.get(0)); + + RegionManager manager = PlotMain.worldGuard.getRegionManager(w); + ProtectedRegion region = manager.getRegion(main.id.x + "-" + main.id.y); + + DefaultDomain owner = region.getOwners(); + Map, Object> flags = region.getFlags(); + DefaultDomain members = region.getMembers(); + + manager.removeRegion(main.id.x + "-" + main.id.y); + for (int i = 1; i < plots.size(); i++) { + PlotId id = plots.get(i); + Location location1 = PlotHelper.getPlotBottomLocAbs(w, id); + Location location2 = PlotHelper.getPlotTopLocAbs(w, id); + + BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ()); + BlockVector vector2 = new BlockVector(location2.getBlockX(), w.getMaxHeight(), location2.getBlockZ()); + ProtectedRegion rg = new ProtectedCuboidRegion(id.x + "-" + id.y, vector1, vector2); + + rg.setFlags(flags); + + rg.setOwners(owner); + + rg.setMembers(members); + + manager.addRegion(rg); + } + } + catch (Exception e) { + + } } @EventHandler public void onPlotClaim(PlayerClaimPlotEvent event) { - Player player = event.getPlayer(); - Plot plot = event.getPlot(); - RegionManager manager = PlotMain.worldGuard.getRegionManager(plot.getWorld()); - - Location location1 = PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()); - Location location2 = PlotHelper.getPlotTopLoc(plot.getWorld(), plot.getId()); - - BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ()); - BlockVector vector2 = - new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ()); - - ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + "-" + plot.getId().y, vector1, vector2); - - DefaultDomain owner = new DefaultDomain(); - owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player)); - - region.setOwners(owner); - - manager.addRegion(region); + try { + Player player = event.getPlayer(); + Plot plot = event.getPlot(); + RegionManager manager = PlotMain.worldGuard.getRegionManager(plot.getWorld()); + + Location location1 = PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId()); + Location location2 = PlotHelper.getPlotTopLoc(plot.getWorld(), plot.getId()); + + BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ()); + BlockVector vector2 = + new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ()); + + ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + "-" + plot.getId().y, vector1, vector2); + + DefaultDomain owner = new DefaultDomain(); + owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player)); + + region.setOwners(owner); + + manager.addRegion(region); + } + catch (Exception e) { + + } } @EventHandler public void onPlotDelete(PlotDeleteEvent event) { - PlotId plot = event.getPlotId(); - World world = Bukkit.getWorld(event.getWorld()); - - RegionManager manager = PlotMain.worldGuard.getRegionManager(world); - manager.removeRegion(plot.x + "-" + plot.y); + try { + PlotId plot = event.getPlotId(); + World world = Bukkit.getWorld(event.getWorld()); + + RegionManager manager = PlotMain.worldGuard.getRegionManager(world); + manager.removeRegion(plot.x + "-" + plot.y); + } + catch (Exception e) { + + } } }