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;
|
2013-04-09 12:56:29 +02:00
|
|
|
import com.massivecraft.factions.Perm;
|
2015-02-12 12:00:55 +01:00
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
2014-06-04 14:02:23 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
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
|
|
|
|
2014-09-18 13:41:20 +02:00
|
|
|
public class CmdFactionsAdmin extends FactionsCommand
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public CmdFactionsAdmin()
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// Aliases
|
2013-04-16 10:11:59 +02:00
|
|
|
this.addAliases("admin");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// Args
|
2015-05-06 17:04:35 +02:00
|
|
|
this.addArg(ARBoolean.get(), "on/off", "flip");
|
2011-10-09 14:53:38 +02:00
|
|
|
|
2013-11-11 09:31:04 +01:00
|
|
|
// Requirements
|
2013-04-16 10:11:59 +02:00
|
|
|
this.addRequirements(ReqHasPerm.get(Perm.ADMIN.node));
|
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
|
2015-05-06 17:04:35 +02:00
|
|
|
boolean target = this.readArg(!msender.isUsingAdminMode());
|
2011-10-09 18:35:39 +02:00
|
|
|
|
2014-10-02 11:45:06 +02:00
|
|
|
// Apply
|
2013-04-25 13:25:15 +02:00
|
|
|
msender.setUsingAdminMode(target);
|
2013-04-16 11:27:03 +02:00
|
|
|
|
2014-10-02 11:45:06 +02:00
|
|
|
// Inform
|
|
|
|
String desc = Txt.parse(msender.isUsingAdminMode() ? "<g>ENABLED" : "<b>DISABLED");
|
|
|
|
|
|
|
|
String messageYou = Txt.parse("<i>%s %s <i>admin bypass mode.", msender.getDisplayName(msender), desc);
|
|
|
|
String messageLog = Txt.parse("<i>%s %s <i>admin bypass mode.", msender.getDisplayName(IdUtil.getConsole()), desc);
|
|
|
|
|
|
|
|
msender.sendMessage(messageYou);
|
|
|
|
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
|
|
|
}
|