From fe7bd4145520cb9c2144d4ef44656f0c7215d48d Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Sat, 12 Oct 2019 11:57:25 +0200 Subject: [PATCH] Don't show coords based on gamerule --- .../factions/cmd/CmdFactionsSeeChunkOld.java | 5 ++++- .../massivecraft/factions/entity/MPlayer.java | 7 +++++++ src/com/massivecraft/factions/util/AsciiMap.java | 16 +++++++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java index 3acde462..fc0c3f71 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java @@ -1,5 +1,6 @@ package com.massivecraft.factions.cmd; +import com.massivecraft.factions.util.AsciiMap; import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer; import com.massivecraft.massivecore.ps.PS; @@ -58,7 +59,9 @@ public class CmdFactionsSeeChunkOld extends FactionsCommand showPillar(me, world, blockX, blockZ); // Inform - msg("Visualized %s", chunk.toString(PSFormatHumanSpace.get())); + boolean showCoords = AsciiMap.showChunkCoords(chunk); + String chunkDesc = showCoords ? chunk.toString(PSFormatHumanSpace.get()) : "chunk"; + msg("Visualized %s", chunkDesc); } public static void showPillar(Player player, World world, int blockX, int blockZ) diff --git a/src/com/massivecraft/factions/entity/MPlayer.java b/src/com/massivecraft/factions/entity/MPlayer.java index 6d666031..bf8eee75 100644 --- a/src/com/massivecraft/factions/entity/MPlayer.java +++ b/src/com/massivecraft/factions/entity/MPlayer.java @@ -12,6 +12,7 @@ import com.massivecraft.factions.event.EventFactionsDisband; import com.massivecraft.factions.event.EventFactionsMembershipChange; import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason; import com.massivecraft.factions.mixin.PowerMixin; +import com.massivecraft.factions.util.AsciiMap; import com.massivecraft.factions.util.RelationUtil; import com.massivecraft.massivecore.mixin.MixinSenderPs; import com.massivecraft.massivecore.mixin.MixinTitle; @@ -847,6 +848,12 @@ public class MPlayer extends SenderEntity implements FactionsParticipat String chunkString = oldChunk.toString(PSFormatHumanSpace.get()); String typeString = type.past; + if (!AsciiMap.showChunkCoords(oldChunk)) + { + chunkString = ""; + formatMany = formatMany.replace(" near ", ""); + } + for (MPlayer informee : informees) { informee.msg((oldChunks.size() == 1 ? formatOne : formatMany), this.describeTo(informee, true), typeString, oldChunks.size(), chunkString); diff --git a/src/com/massivecraft/factions/util/AsciiMap.java b/src/com/massivecraft/factions/util/AsciiMap.java index 3573ba62..ba62ccac 100644 --- a/src/com/massivecraft/factions/util/AsciiMap.java +++ b/src/com/massivecraft/factions/util/AsciiMap.java @@ -10,6 +10,7 @@ import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.util.Txt; import org.bukkit.ChatColor; import org.bukkit.GameRule; +import org.bukkit.World; import org.bukkit.entity.Player; import java.util.ArrayList; @@ -125,8 +126,7 @@ public class AsciiMap int chunkZ = chunk.getChunkZ(); String factionName = faction.getName(this.getRelationParticipator()); - Boolean reduced = chunk.asBukkitWorld().getGameRuleValue(GameRule.REDUCED_DEBUG_INFO); - boolean showCoords = !reduced; + boolean showCoords = showChunkCoords(chunk); String title; if (showCoords) title = String.format(TITLE_FORMAT, chunkX, chunkZ, factionName); @@ -226,5 +226,15 @@ public class AsciiMap // Return return Mson.implode(ret, SPACE); } - + + public static boolean showChunkCoords(PS chunk) + { + return showChunkCoords(chunk.asBukkitWorld(true)); + } + + public static boolean showChunkCoords(World w) + { + return ! w.getGameRuleValue(GameRule.REDUCED_DEBUG_INFO); + } + }