Clean up CmdFactionsMotd

Remove unused variable

Make use of TypeNullable instead of recreating its functionality
This commit is contained in:
TheComputerGeek2
2017-04-21 11:12:41 -07:00
committed by Olof Larsson
parent ac7046275d
commit 063dd43f12
3 changed files with 30 additions and 45 deletions

View File

@ -237,15 +237,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public void setDescription(String description)
{
// Clean input
String target = description;
if (target != null)
{
target = target.trim();
if (target.isEmpty())
{
target = null;
}
}
String target = clean(description);
// Detect Nochange
if (MUtil.equals(this.description, target)) return;
@ -270,22 +262,14 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
public String getMotd()
{
if (this.hasMotd()) return Txt.parse(this.motd);
if (this.hasMotd()) return this.motd;
return NOMOTD;
}
public void setMotd(String description)
public void setMotd(String motd)
{
// Clean input
String target = description;
if (target != null)
{
target = target.trim();
if (target.isEmpty())
{
target = null;
}
}
String target = clean(motd);
// Detect Nochange
if (MUtil.equals(this.motd, target)) return;
@ -1203,4 +1187,20 @@ public class Faction extends Entity<Faction> implements FactionsParticipator
return MixinMessage.get().msgPredicate(new PredicateCommandSenderFaction(this), msgs);
}
// -------------------------------------------- //
// UTIL
// -------------------------------------------- //
// FIXME this probably needs to be moved elsewhere
public static String clean(String message)
{
String target = message;
if (target == null) return null;
target = target.trim();
if (target.isEmpty()) target = null;
return target;
}
}

View File

@ -350,15 +350,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements FactionsParticipat
public void setTitle(String title)
{
// Clean input
String target = title;
if (target != null)
{
target = target.trim();
if (target.length() == 0)
{
target = null;
}
}
String target = Faction.clean(title);
// Detect Nochange
if (MUtil.equals(this.title, target)) return;