Don't show coords based on gamerule
This commit is contained in:
		@@ -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("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get()));
 | 
			
		||||
		boolean showCoords = AsciiMap.showChunkCoords(chunk);
 | 
			
		||||
		String chunkDesc = showCoords ? chunk.toString(PSFormatHumanSpace.get()) : "chunk";
 | 
			
		||||
		msg("<i>Visualized %s", chunkDesc);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static void showPillar(Player player, World world, int blockX, int blockZ)
 | 
			
		||||
 
 | 
			
		||||
@@ -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<MPlayer> 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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user