From b9e2abce9f6a2d268efedc0b0ecc72acdd62b9da Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 22 Feb 2015 17:47:15 +1100 Subject: [PATCH] debug road regen --- .../plot/commands/Condense.java | 1 - .../plot/commands/Debug.java | 4 ---- .../plot/commands/DebugClear.java | 1 - .../plot/commands/DebugExec.java | 2 +- .../plot/commands/DebugFixFlags.java | 8 +++---- .../plot/commands/DebugRoadRegen.java | 22 +++++++++---------- .../plot/listeners/PlayerEvents_1_8.java | 1 - .../plot/util/ClusterManager.java | 1 - .../plot/util/RUtils.java | 1 - .../util/bukkit/BukkitPlayerFunctions.java | 1 - .../plot/util/bukkit/BukkitUtil.java | 1 - .../plot/util/bukkit/PWE.java | 2 -- .../plot/uuid/DefaultUUIDWrapper.java | 3 ++- 13 files changed, 16 insertions(+), 32 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java index e91a1cc1a..eb47b126f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java @@ -35,7 +35,6 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public class Condense extends SubCommand { public static boolean TASK = false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java index d0b81aa3c..8c9ed5e36 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java @@ -20,16 +20,12 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import org.bukkit.Bukkit; -import org.bukkit.World; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.Lag; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.RUtils; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public class Debug extends SubCommand { public Debug() { 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 c142e72e8..a741fb0ad 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -29,7 +29,6 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; -import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions; import com.intellectualcrafters.plot.util.bukkit.ChunkManager; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index ea27418db..66358b578 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.UUID; +import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import com.intellectualcrafters.plot.PlotSquared; @@ -38,7 +39,6 @@ import com.intellectualcrafters.plot.object.BukkitOfflinePlayer; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.AChunkManager; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.ExpireManager; import com.intellectualcrafters.plot.util.MainUtil; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java index ed770bd18..d37f12a7d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java @@ -23,9 +23,6 @@ package com.intellectualcrafters.plot.commands; import java.util.ArrayList; import java.util.Set; -import org.bukkit.Bukkit; -import org.bukkit.World; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -34,6 +31,7 @@ import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; public class DebugFixFlags extends SubCommand { @@ -51,8 +49,8 @@ public class DebugFixFlags extends SubCommand { MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot debugfixflags "); return false; } - final World world = Bukkit.getWorld(args[0]); - if ((world == null) || !PlotSquared.isPlotWorld(world)) { + final String world = args[0]; + if (!BlockManager.manager.isWorld(world) || !PlotSquared.isPlotWorld(world)) { MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD, args[0]); return false; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index e08655e7c..e15ce7ce9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -20,17 +20,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import java.util.Arrays; - -import org.bukkit.Chunk; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotWorld; +import com.intellectualcrafters.plot.generator.HybridUtils; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.bukkit.SetBlockManager; public class DebugRoadRegen extends SubCommand { public DebugRoadRegen() { @@ -39,16 +36,17 @@ public class DebugRoadRegen extends SubCommand { @Override public boolean execute(final PlotPlayer player, final String... args) { - if (!(PlotSquared.getPlotWorld(player.getWorld()) instanceof HybridPlotWorld)) { + Location loc = player.getLocation(); + String world = loc.getWorld(); + if (!(PlotSquared.getPlotWorld(world) instanceof HybridPlotWorld)) { return sendMessage(player, C.NOT_IN_PLOT_WORLD); } - final HybridPlotManager manager = (HybridPlotManager) PlotSquared.getPlotManager(player.getWorld()); - final Chunk chunk = BukkitUtil.getLocation(entity).getChunk(); - final boolean result = manager.regenerateRoad(chunk); + ChunkLoc chunk = new ChunkLoc(loc.getX() >> 4, loc.getZ() >> 4); + boolean result = HybridUtils.manager.regenerateRoad(world, chunk); if (result) { - SetBlockManager.setBlockManager.update(Arrays.asList(new Chunk[] { chunk })); + MainUtil.update(loc); } - MainUtil.sendMessage(BukkitUtil.getPlayer(player), "&6Regenerating chunk: " + chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed")); + MainUtil.sendMessage(player, "&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed")); return true; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java index 70060112f..9c52f184f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java @@ -15,7 +15,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; public class PlayerEvents_1_8 extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java index 4a9c77f8d..42634a86c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java @@ -9,7 +9,6 @@ import java.util.Random; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; -import org.bukkit.entity.Player; import org.bukkit.generator.BlockPopulator; import com.intellectualcrafters.plot.PlotSquared; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java index 8ec02fae4..3c2803a98 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java @@ -21,7 +21,6 @@ package com.intellectualcrafters.plot.util; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Settings; /** * Random utilities diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java index 8dde1d571..7e789a4bc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java @@ -27,7 +27,6 @@ import java.util.UUID; import net.milkbowl.vault.economy.Economy; -import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import com.intellectualcrafters.plot.PlotSquared; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java index 8a028c753..842cfd920 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java @@ -16,7 +16,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import com.intellectualcrafters.plot.object.BukkitPlayer; -import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotPlayer; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/PWE.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/PWE.java index c398a4fc6..e9b68b1a9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/PWE.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/PWE.java @@ -20,8 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.util.bukkit; -import org.bukkit.entity.Player; - import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.FlagManager; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/DefaultUUIDWrapper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/DefaultUUIDWrapper.java index ca0427ae9..f3d6a78b8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/DefaultUUIDWrapper.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/DefaultUUIDWrapper.java @@ -3,9 +3,10 @@ package com.intellectualcrafters.plot.uuid; import java.util.UUID; import org.bukkit.Bukkit; + import com.intellectualcrafters.plot.object.BukkitOfflinePlayer; +import com.intellectualcrafters.plot.object.BukkitPlayer; import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.object.BukkitPlayer;; public class DefaultUUIDWrapper extends UUIDWrapper { @Override