Fix getters for motd and description
This commit is contained in:
		@@ -48,7 +48,7 @@ public class CmdFactionsDescription extends FactionsCommand
 | 
			
		||||
		// Inform
 | 
			
		||||
		for (MPlayer follower : msenderFaction.getMPlayers())
 | 
			
		||||
		{
 | 
			
		||||
			follower.msg("<i>%s <i>set your faction description to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getDescription());
 | 
			
		||||
			follower.msg("<i>%s <i>set your faction description to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getDescriptionDesc());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
package com.massivecraft.factions.cmd;
 | 
			
		||||
 | 
			
		||||
import com.massivecraft.factions.entity.Faction;
 | 
			
		||||
import com.massivecraft.factions.entity.MPerm;
 | 
			
		||||
import com.massivecraft.factions.entity.MPlayer;
 | 
			
		||||
import com.massivecraft.factions.event.EventFactionsMotdChange;
 | 
			
		||||
@@ -42,22 +41,17 @@ public class CmdFactionsMotd extends FactionsCommand
 | 
			
		||||
		
 | 
			
		||||
		// Args
 | 
			
		||||
		String target = this.readArg();
 | 
			
		||||
		
 | 
			
		||||
		// Clean input
 | 
			
		||||
		target = Faction.clean(target);
 | 
			
		||||
 | 
			
		||||
		target = target.trim();
 | 
			
		||||
		target = Txt.parse(target);
 | 
			
		||||
 | 
			
		||||
		// Get Old
 | 
			
		||||
		String old = null;
 | 
			
		||||
		if (msenderFaction.hasMotd())
 | 
			
		||||
		{
 | 
			
		||||
			old = msenderFaction.getMotd();
 | 
			
		||||
		}
 | 
			
		||||
		String old = msenderFaction.getMotd();
 | 
			
		||||
		
 | 
			
		||||
		// NoChange
 | 
			
		||||
		if (MUtil.equals(old, target))
 | 
			
		||||
		{
 | 
			
		||||
			msg("<i>The motd for %s <i>is already: <h>%s", msenderFaction.describeTo(msender, true), old == null ? Txt.parse("<silver>none") : old);
 | 
			
		||||
			msg("<i>The motd for %s <i>is already: <h>%s", msenderFaction.describeTo(msender, true), msenderFaction.getMotdDesc());
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -73,7 +67,7 @@ public class CmdFactionsMotd extends FactionsCommand
 | 
			
		||||
		// Inform
 | 
			
		||||
		for (MPlayer follower : msenderFaction.getMPlayers())
 | 
			
		||||
		{
 | 
			
		||||
			follower.msg("<i>%s <i>set your faction motd to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getMotd());
 | 
			
		||||
			follower.msg("<i>%s <i>set your faction motd to:\n%s", MixinDisplayName.get().getDisplayName(sender, follower), msenderFaction.getMotdDesc());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -114,7 +114,7 @@ public class EngineMoveChunk extends Engine
 | 
			
		||||
 | 
			
		||||
		string = string.replace("{name}", faction.getName());
 | 
			
		||||
		string = string.replace("{relcolor}", faction.getColorTo(mplayer).toString());
 | 
			
		||||
		string = string.replace("{desc}", faction.getDescription());
 | 
			
		||||
		string = string.replace("{desc}", faction.getDescriptionDesc());
 | 
			
		||||
 | 
			
		||||
		return string;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ public class EngineShow extends Engine
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// DESCRIPTION
 | 
			
		||||
		show(idPriorityLiness, Const.SHOW_ID_FACTION_DESCRIPTION, Const.SHOW_PRIORITY_FACTION_DESCRIPTION, "Description", faction.getDescription());
 | 
			
		||||
		show(idPriorityLiness, Const.SHOW_ID_FACTION_DESCRIPTION, Const.SHOW_PRIORITY_FACTION_DESCRIPTION, "Description", faction.getDescriptionDesc());
 | 
			
		||||
 | 
			
		||||
		// SECTION: NORMAL
 | 
			
		||||
		if (normal)
 | 
			
		||||
 
 | 
			
		||||
@@ -237,8 +237,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
 | 
			
		||||
	
 | 
			
		||||
	public String getDescription()
 | 
			
		||||
	{
 | 
			
		||||
		if (this.hasDescription()) return this.description;
 | 
			
		||||
		return NODESCRIPTION;
 | 
			
		||||
		return this.description;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setDescription(String description)
 | 
			
		||||
@@ -256,6 +255,15 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
 | 
			
		||||
		this.changed();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// FINER
 | 
			
		||||
	
 | 
			
		||||
	public String getDescriptionDesc()
 | 
			
		||||
	{
 | 
			
		||||
		String motd = this.getDescription();
 | 
			
		||||
		if (motd == null) motd = NODESCRIPTION;
 | 
			
		||||
		return motd;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
	// FIELD: motd
 | 
			
		||||
	// -------------------------------------------- //
 | 
			
		||||
@@ -269,8 +277,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
 | 
			
		||||
	
 | 
			
		||||
	public String getMotd()
 | 
			
		||||
	{
 | 
			
		||||
		if (this.hasMotd()) return this.motd;
 | 
			
		||||
		return NOMOTD;
 | 
			
		||||
		return this.motd;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setMotd(String motd)
 | 
			
		||||
@@ -290,6 +297,17 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
 | 
			
		||||
	
 | 
			
		||||
	// FINER
 | 
			
		||||
	
 | 
			
		||||
	public String getMotdDesc()
 | 
			
		||||
	{
 | 
			
		||||
		return getMotdDesc(this.getMotd());
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static String getMotdDesc(String motd)
 | 
			
		||||
	{
 | 
			
		||||
		if (motd == null) motd = NOMOTD;
 | 
			
		||||
		return motd;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public List<Object> getMotdMessages()
 | 
			
		||||
	{
 | 
			
		||||
		// Create
 | 
			
		||||
@@ -300,7 +318,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
 | 
			
		||||
		title = Txt.titleize(title);
 | 
			
		||||
		ret.add(title);
 | 
			
		||||
		
 | 
			
		||||
		String motd = Txt.parse("<i>" + this.getMotd());
 | 
			
		||||
		String motd = Txt.parse("<i>") + this.getMotdDesc();
 | 
			
		||||
		ret.add(motd);
 | 
			
		||||
		
 | 
			
		||||
		ret.add("");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user