From 0f6bd8eabdc3f564f1dc1ac6036a772fd354438d Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Sat, 10 Feb 2018 16:27:49 -0800 Subject: [PATCH] Fix default mapheight --- .../com/massivecraft/factions/cmd/CmdMapHeight.java | 12 ++++++------ .../factions/zcore/persist/MemoryFPlayer.java | 2 +- .../com/massivecraft/factions/zcore/util/TL.java | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMapHeight.java b/src/main/java/com/massivecraft/factions/cmd/CmdMapHeight.java index 43ba2bed..648061c1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMapHeight.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMapHeight.java @@ -11,7 +11,7 @@ public class CmdMapHeight extends FCommand { this.aliases.add("mapheight"); this.aliases.add("mh"); - this.requiredArgs.add("height"); + this.optionalArgs.put("height", "height"); this.permission = Permission.MAPHEIGHT.node; @@ -20,18 +20,18 @@ public class CmdMapHeight extends FCommand { @Override public void perform() { - int height = argAsInt(0, -1); - - if (height == -1) { - fme.sendMessage(TL.COMMAND_MAPHEIGHT_DESCRIPTION.toString()); + if (args.size() == 0) { + fme.sendMessage(TL.COMMAND_MAPHEIGHT_CURRENT.format(fme.getMapHeight())); return; } + int height = argAsInt(0); + fme.setMapHeight(height); fme.sendMessage(TL.COMMAND_MAPHEIGHT_SET.format(height)); } - @Override + @Override public TL getUsageTranslation() { return TL.COMMAND_MAPHEIGHT_DESCRIPTION; } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index ad5d356b..8952985c 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -59,7 +59,7 @@ public abstract class MemoryFPlayer implements FPlayer { protected boolean isAdminBypassing = false; protected int kills, deaths; protected boolean willAutoLeave = true; - protected int mapHeight; + protected int mapHeight = 8; // default to old value protected transient FLocation lastStoodAt = new FLocation(); // Where did this player stand the last time we checked? protected transient boolean mapAutoUpdating; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 076764f1..79934948 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -295,8 +295,9 @@ public enum TL { COMMAND_MAP_UPDATE_DISABLED("Map auto update DISABLED."), COMMAND_MAP_DESCRIPTION("Show the territory map, and set optional auto update"), - COMMAND_MAPHEIGHT_DESCRIPTION("Update the lines that /f map sends"), - COMMAND_MAPHEIGHT_SET("Set /f map lines to %1$d"), + COMMAND_MAPHEIGHT_DESCRIPTION("&eUpdate the lines that /f map sends"), + COMMAND_MAPHEIGHT_SET("&eSet /f map lines to &a%1$d"), + COMMAND_MAPHEIGHT_CURRENT("&eCurrent mapheight: &a%1$d"), COMMAND_MOD_CANDIDATES("Players you can promote: "), COMMAND_MOD_CLICKTOPROMOTE("Click to promote "),