From 02de9c20a288d337fed2fe854d043eb75e4ab7f0 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 18 Feb 2015 23:15:55 +1100 Subject: [PATCH] . --- .../plot/commands/Claim.java | 20 +++--- .../plot/commands/DebugClear.java | 6 +- .../plot/commands/Trim.java | 64 +++++++++---------- 3 files changed, 44 insertions(+), 46 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index e044494a7..15e1367ca 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -24,11 +24,13 @@ package com.intellectualcrafters.plot.commands; import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; +import org.bukkit.World; import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; +import com.intellectualcrafters.plot.generator.ClassicPlotWorld; import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotWorld; @@ -62,29 +64,25 @@ public class Claim extends SubCommand { if (teleport) { PlotMain.teleportPlayer(player, player.getLocation(), plot); } - final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld()); + World world = plot.getWorld(); + final PlotWorld plotworld = PlotMain.getWorldSettings(world); final Plot plot2 = PlotMain.getPlots(player.getWorld()).get(plot.id); - if (world.SCHEMATIC_ON_CLAIM) { + if (plotworld.SCHEMATIC_ON_CLAIM) { SchematicHandler.Schematic sch; if (schematic.equals("")) { - sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE); + sch = SchematicHandler.getSchematic(plotworld.SCHEMATIC_FILE); } else { sch = SchematicHandler.getSchematic(schematic); if (sch == null) { - sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE); + sch = SchematicHandler.getSchematic(plotworld.SCHEMATIC_FILE); } } SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0); } - if (world instanceof HybridPlotWorld) { - final HybridPlotWorld pW = (HybridPlotWorld) world; - if (!(pW.CLAIMED_WALL_BLOCK.equals(pW.WALL_BLOCK))) { - PlotMain.getPlotManager(plot.getWorld()).claimPlot(player.getWorld(), world, plot); - PlotHelper.update(player.getLocation()); - } - } + PlotMain.getPlotManager(plot.world).claimPlot(world, plotworld, plot); + PlotHelper.update(player.getLocation()); } return event.isCancelled(); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index 4d8fbecd5..2bc50ca22 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -28,7 +28,7 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.generator.HybridPlotWorld; +import com.intellectualcrafters.plot.generator.SquarePlotWorld; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.ChunkManager; @@ -54,7 +54,7 @@ public class DebugClear extends SubCommand { if (id == null) { PlotMain.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]); } else { - if (!PlotMain.isPlotWorld(world) || !(PlotMain.getWorldSettings(world) instanceof HybridPlotWorld)) { + if (!PlotMain.isPlotWorld(world) || !(PlotMain.getWorldSettings(world) instanceof SquarePlotWorld)) { PlotMain.sendConsoleSenderMessage("Invalid plot world: " + world); } else { final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id); @@ -84,7 +84,7 @@ public class DebugClear extends SubCommand { return true; } - if (!PlayerFunctions.isInPlot(plr) || !(PlotMain.getWorldSettings(plr.getWorld()) instanceof HybridPlotWorld)) { + if (!PlayerFunctions.isInPlot(plr) || !(PlotMain.getWorldSettings(plr.getWorld()) instanceof SquarePlotWorld)) { return sendMessage(plr, C.NOT_IN_PLOT); } final Plot plot = PlayerFunctions.getCurrentPlot(plr); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index 4b37169aa..b3e200b1c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -37,8 +37,8 @@ import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.generator.HybridPlotManager; -import com.intellectualcrafters.plot.generator.HybridPlotWorld; +import com.intellectualcrafters.plot.generator.SquarePlotManager; +import com.intellectualcrafters.plot.generator.SquarePlotWorld; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; @@ -222,36 +222,36 @@ public class Trim extends SubCommand { public static ArrayList expired = null; - public static void updateUnmodifiedPlots(final World world) { - final HybridPlotManager manager = (HybridPlotManager) PlotMain.getPlotManager(world); - final HybridPlotWorld plotworld = (HybridPlotWorld) PlotMain.getWorldSettings(world); - final ArrayList expired = new ArrayList<>(); - final Set plots = ExpireManager.getOldPlots(world.getName()).keySet(); - sendMessage("Checking " + plots.size() +" plots! This may take a long time..."); - Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { - @Override - public void run() { - if (manager != null && plots.size() > 0) { - Plot plot = plots.iterator().next(); - if (plot.hasOwner()) { - HybridPlotManager.checkModified(plot, 0); - } - if (plot.owner == null || !HybridPlotManager.checkModified(plot, plotworld.REQUIRED_CHANGES)) { - expired.add(plot); - sendMessage("found expired: " + plot); - } - } - else { - Trim.expired = expired; - Trim.TASK = false; - sendMessage("Done!"); - Bukkit.getScheduler().cancelTask(Trim.TASK_ID); - return; - } - } - }, 1, 1); - } - +// public static void updateUnmodifiedPlots(final World world) { +// final SquarePlotManager manager = (SquarePlotManager) PlotMain.getPlotManager(world); +// final SquarePlotWorld plotworld = (SquarePlotWorld) PlotMain.getWorldSettings(world); +// final ArrayList expired = new ArrayList<>(); +// final Set plots = ExpireManager.getOldPlots(world.getName()).keySet(); +// sendMessage("Checking " + plots.size() +" plots! This may take a long time..."); +// Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { +// @Override +// public void run() { +// if (manager != null && plots.size() > 0) { +// Plot plot = plots.iterator().next(); +// if (plot.hasOwner()) { +// SquarePlotManager.checkModified(plot, 0); +// } +// if (plot.owner == null || !SquarePlotManager.checkModified(plot, plotworld.REQUIRED_CHANGES)) { +// expired.add(plot); +// sendMessage("found expired: " + plot); +// } +// } +// else { +// Trim.expired = expired; +// Trim.TASK = false; +// sendMessage("Done!"); +// Bukkit.getScheduler().cancelTask(Trim.TASK_ID); +// return; +// } +// } +// }, 1, 1); +// } +// public static void deleteChunks(World world, ArrayList chunks) { String worldname = world.getName(); for (ChunkLoc loc : chunks) {