2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-04-06 12:04:57 +02:00
|
|
|
|
2013-04-09 13:00:09 +02:00
|
|
|
import com.massivecraft.factions.Factions;
|
2015-02-12 12:00:55 +01:00
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
2016-06-08 13:00:15 +02:00
|
|
|
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
2014-10-02 11:45:06 +02:00
|
|
|
import com.massivecraft.massivecore.util.IdUtil;
|
|
|
|
import com.massivecraft.massivecore.util.Txt;
|
2011-04-06 12:04:57 +02:00
|
|
|
|
2016-02-02 19:03:11 +01:00
|
|
|
public class CmdFactionsOverride extends FactionsCommand
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2016-02-02 19:03:11 +01:00
|
|
|
public CmdFactionsOverride()
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// Aliases
|
2017-02-10 16:38:36 +01:00
|
|
|
this.addAliases("admin");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
2015-10-21 19:35:41 +02:00
|
|
|
// Parameters
|
2016-06-08 13:00:15 +02:00
|
|
|
this.addParameter(TypeBooleanYes.get(), "on/off", "flip");
|
2011-04-06 12:04:57 +02:00
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
2011-04-06 12:04:57 +02:00
|
|
|
|
|
|
|
@Override
|
2015-02-12 12:00:55 +01:00
|
|
|
public void perform() throws MassiveException
|
2014-10-02 11:45:06 +02:00
|
|
|
{
|
|
|
|
// Args
|
2016-02-02 19:03:11 +01:00
|
|
|
boolean target = this.readArg( ! msender.isOverriding());
|
2011-10-09 18:35:39 +02:00
|
|
|
|
2014-10-02 11:45:06 +02:00
|
|
|
// Apply
|
2016-02-02 19:03:11 +01:00
|
|
|
msender.setOverriding(target);
|
2013-04-16 11:27:03 +02:00
|
|
|
|
2014-10-02 11:45:06 +02:00
|
|
|
// Inform
|
2016-02-02 19:03:11 +01:00
|
|
|
String desc = Txt.parse(msender.isOverriding() ? "<g>ENABLED" : "<b>DISABLED");
|
2014-10-02 11:45:06 +02:00
|
|
|
|
2016-02-02 19:03:11 +01:00
|
|
|
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);
|
2014-10-02 11:45:06 +02:00
|
|
|
|
2015-09-03 09:33:01 +02:00
|
|
|
msender.message(messageYou);
|
2014-10-02 11:45:06 +02:00
|
|
|
Factions.get().log(messageLog);
|
2011-04-06 12:04:57 +02:00
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
2011-04-06 12:04:57 +02:00
|
|
|
}
|