Setup & PlotPlayer caching

- Fixed setup for empty configuration nodes
- Fixed PlotPlayer caching (@Byteflux) #305
This commit is contained in:
boy0001 2015-05-09 23:41:36 +10:00
parent dcf1475d92
commit 4276359219
2 changed files with 12 additions and 1 deletions

View File

@ -144,6 +144,12 @@ public class Setup extends SubCommand {
object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes(); object.step = ((PlotGenerator) SetupUtils.generators.get(object.plotManager)).getNewPlotWorld(null).getSettingNodes();
((PlotGenerator) SetupUtils.generators.get(object.plotManager)).processSetup(object); ((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]; final ConfigurationNode step = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + ""); sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(), step.getDefaultValue() + "");
} else { } else {

View File

@ -50,8 +50,13 @@ public class BukkitUtil extends BlockManager {
if (player == lastPlayer) { if (player == lastPlayer) {
return lastPlotPlayer; return lastPlotPlayer;
} }
String name = player.getName();
PlotPlayer pp = UUIDHandler.players.get(name);
if (pp != null) {
return pp;
}
lastPlotPlayer = new BukkitPlayer(player); lastPlotPlayer = new BukkitPlayer(player);
UUIDHandler.players.put(lastPlotPlayer.getName(), lastPlotPlayer); UUIDHandler.players.put(name, lastPlotPlayer);
lastPlayer = player; lastPlayer = player;
return lastPlotPlayer; return lastPlotPlayer;
} }