From b4db679ae991689907e518bf1e721c47cc72f2a5 Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Tue, 13 Aug 2019 10:17:01 +0200 Subject: [PATCH] Fix #47 by not showing coords based on gamerule --- src/com/massivecraft/factions/util/AsciiMap.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/massivecraft/factions/util/AsciiMap.java b/src/com/massivecraft/factions/util/AsciiMap.java index bde62f99..3573ba62 100644 --- a/src/com/massivecraft/factions/util/AsciiMap.java +++ b/src/com/massivecraft/factions/util/AsciiMap.java @@ -9,6 +9,7 @@ import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.util.Txt; import org.bukkit.ChatColor; +import org.bukkit.GameRule; import org.bukkit.entity.Player; import java.util.ArrayList; @@ -37,6 +38,7 @@ public class AsciiMap private static final int HEIGHT_EXTRA_HALF = HEIGHT_EXTRA / 2; private static final String TITLE_FORMAT = "(%d,%d) %s"; + private static final String TITLE_FORMAT_NO_COORDS = "%s"; private static final Mson KEY_MIDDLE = mson("+").color(ChatColor.AQUA); private static final Mson KEY_WILDERNESS = mson("-").color(ChatColor.GRAY).tooltip(); private static final Mson KEY_OVERFLOW = mson("-").style(ChatColor.MAGIC).add(mson("").style(ChatColor.RESET)); @@ -122,9 +124,16 @@ public class AsciiMap int chunkX = chunk.getChunkX(); int chunkZ = chunk.getChunkZ(); String factionName = faction.getName(this.getRelationParticipator()); - + + Boolean reduced = chunk.asBukkitWorld().getGameRuleValue(GameRule.REDUCED_DEBUG_INFO); + boolean showCoords = !reduced; + + String title; + if (showCoords) title = String.format(TITLE_FORMAT, chunkX, chunkZ, factionName); + else title = String.format(TITLE_FORMAT_NO_COORDS, factionName); + // Titleize - return Txt.titleize(String.format(TITLE_FORMAT, chunkX, chunkZ, factionName)); + return Txt.titleize(title); } private List getLines()