Clean up the requirements

This commit is contained in:
TheComputerGeek2 2017-03-07 11:28:52 -08:00 committed by ulumulu1510
parent 8ad812bea6
commit 52023a31ff
5 changed files with 27 additions and 10 deletions

View File

@ -10,6 +10,10 @@ import com.massivecraft.massivecore.util.Txt;
public class ReqBankCommandsEnabled extends RequirementAbstract public class ReqBankCommandsEnabled extends RequirementAbstract
{ {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// -------------------------------------------- // // -------------------------------------------- //
@ -32,11 +36,8 @@ public class ReqBankCommandsEnabled extends RequirementAbstract
@Override @Override
public String createErrorMessage(CommandSender sender, MassiveCommand command) public String createErrorMessage(CommandSender sender, MassiveCommand command)
{ {
if ( ! MConf.get().bankEnabled) String what = !MConf.get().bankEnabled ? "banks" : "economy features";
{ return Txt.parse("<b>Faction %s are disabled.", what);
return Txt.parse("<b>Faction banks are disabled.");
}
return Txt.parse("<b>Faction economy features are disabled.");
} }
} }

View File

@ -9,6 +9,10 @@ import com.massivecraft.massivecore.util.Txt;
public class ReqFactionHomesEnabled extends RequirementAbstract public class ReqFactionHomesEnabled extends RequirementAbstract
{ {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// -------------------------------------------- // // -------------------------------------------- //
@ -31,7 +35,7 @@ public class ReqFactionHomesEnabled extends RequirementAbstract
@Override @Override
public String createErrorMessage(CommandSender sender, MassiveCommand command) public String createErrorMessage(CommandSender sender, MassiveCommand command)
{ {
return Txt.parse("<b>Homes must be enabled on the server to "+(command == null ? "do that" : command.getDesc())+"."); return Txt.parse("<b>Homes must be enabled on the server to %s.", getDesc(command));
} }
} }

View File

@ -10,6 +10,10 @@ import com.massivecraft.massivecore.util.Txt;
public class ReqHasFaction extends RequirementAbstract public class ReqHasFaction extends RequirementAbstract
{ {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// -------------------------------------------- // // -------------------------------------------- //
@ -35,7 +39,7 @@ public class ReqHasFaction extends RequirementAbstract
@Override @Override
public String createErrorMessage(CommandSender sender, MassiveCommand command) public String createErrorMessage(CommandSender sender, MassiveCommand command)
{ {
return Txt.parse("<b>You must belong to a faction to "+(command == null ? "do that" : command.getDesc())+"."); return Txt.parse("<b>You must belong to a faction to %s.", getDesc(command));
} }
} }

View File

@ -10,6 +10,10 @@ import com.massivecraft.massivecore.util.Txt;
public class ReqHasntFaction extends RequirementAbstract public class ReqHasntFaction extends RequirementAbstract
{ {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// -------------------------------------------- // // -------------------------------------------- //
@ -35,7 +39,7 @@ public class ReqHasntFaction extends RequirementAbstract
@Override @Override
public String createErrorMessage(CommandSender sender, MassiveCommand command) public String createErrorMessage(CommandSender sender, MassiveCommand command)
{ {
return Txt.parse("<b>You must leave your current faction before you "+(command == null ? "do that" : command.getDesc())+"."); return Txt.parse("<b>You must leave your current faction before you %s.", getDesc(command));
} }
} }

View File

@ -11,6 +11,10 @@ import com.massivecraft.massivecore.util.Txt;
public class ReqRoleIsAtLeast extends RequirementAbstract public class ReqRoleIsAtLeast extends RequirementAbstract
{ {
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// -------------------------------------------- // // -------------------------------------------- //
@ -37,13 +41,13 @@ public class ReqRoleIsAtLeast extends RequirementAbstract
if (MUtil.isntSender(sender)) return false; if (MUtil.isntSender(sender)) return false;
MPlayer mplayer = MPlayer.get(sender); MPlayer mplayer = MPlayer.get(sender);
return mplayer.getRole().isAtLeast(this.rel); return mplayer.getRole().isAtLeast(this.getRel());
} }
@Override @Override
public String createErrorMessage(CommandSender sender, MassiveCommand command) public String createErrorMessage(CommandSender sender, MassiveCommand command)
{ {
return Txt.parse("<b>You must be <h>%s <b>or higher to "+(command == null ? "do that" : command.getDesc())+".", Txt.getNicedEnum(this.rel)); return Txt.parse("<b>You must be <h>%s <b>or higher to %s.", Txt.getNicedEnum(this.getRel()), getDesc(command));
} }
} }