Factions/src/com/massivecraft/factions/cmd/CmdFactionsOverride.java

53 lines
1.5 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2013-04-09 13:00:09 +02:00
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
2015-02-12 12:00:55 +01:00
import com.massivecraft.massivecore.MassiveException;
2015-11-06 02:10:29 +01:00
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.primitive.TypeBoolean;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsOverride extends FactionsCommand
{
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsOverride()
{
2013-11-11 09:31:04 +01:00
// Aliases
this.addAliases("override", "admin");
2013-11-11 09:31:04 +01:00
// Parameters
2015-11-06 02:10:29 +01:00
this.addParameter(TypeBoolean.getOn(), "on/off", "flip");
2013-11-11 09:31:04 +01:00
// Requirements
this.addRequirements(RequirementHasPerm.get(Perm.OVERRIDE));
}
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
2015-02-12 12:00:55 +01:00
public void perform() throws MassiveException
{
// Args
boolean target = this.readArg( ! msender.isOverriding());
2011-10-09 18:35:39 +02:00
// Apply
msender.setOverriding(target);
2013-04-16 11:27:03 +02:00
// Inform
String desc = Txt.parse(msender.isOverriding() ? "<g>ENABLED" : "<b>DISABLED");
String messageYou = Txt.parse("<i>%s %s <i>override mode.", msender.getDisplayName(msender), desc);
String messageLog = Txt.parse("<i>%s %s <i>override mode.", msender.getDisplayName(IdUtil.getConsole()), desc);
2015-09-03 09:33:01 +02:00
msender.message(messageYou);
Factions.get().log(messageLog);
}
2013-11-11 09:31:04 +01:00
}