From 4276359219effe5f99d62a63e081ea529b50dd12 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sat, 9 May 2015 23:41:36 +1000 Subject: [PATCH] Setup & PlotPlayer caching - Fixed setup for empty configuration nodes - Fixed PlotPlayer caching (@Byteflux) #305 --- .../java/com/intellectualcrafters/plot/commands/Setup.java | 6 ++++++ .../intellectualcrafters/plot/util/bukkit/BukkitUtil.java | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index 30aff6d6d..ab3caf767 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -144,6 +144,12 @@ public class Setup extends SubCommand { object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes(); ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).processSetup(object); } + if (object.step.length == 0) { + object.current = 4; + MainUtil.sendMessage(plr, "&6What do you want your world to be called?"); + object.setup_index = 0; + return true; + } final ConfigurationNode step = object.step[object.setup_index]; sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + ""); } else { 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 efe1a7f64..1f44a1567 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 @@ -50,8 +50,13 @@ public class BukkitUtil extends BlockManager { if (player == lastPlayer) { return lastPlotPlayer; } + String name = player.getName(); + PlotPlayer pp = UUIDHandler.players.get(name); + if (pp != null) { + return pp; + } lastPlotPlayer = new BukkitPlayer(player); - UUIDHandler.players.put(lastPlotPlayer.getName(), lastPlotPlayer); + UUIDHandler.players.put(name, lastPlotPlayer); lastPlayer = player; return lastPlotPlayer; }