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;
|
2014-06-04 14:02:23 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
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
|
2013-04-16 10:30:21 +02:00
|
|
|
this.addOptionalArg("on/off", "flip");
|
2011-10-09 14:53:38 +02:00
|
|
|
|
2013-11-11 09:31:04 +01:00
|
|
|
// Requirements
|
|
|
|
// this.addRequirements(ReqFactionsEnabled.get());
|
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
|
2011-10-09 14:53:38 +02:00
|
|
|
public void perform()
|
2013-04-25 13:25:15 +02:00
|
|
|
{
|
|
|
|
Boolean target = this.arg(0, ARBoolean.get(), !msender.isUsingAdminMode());
|
2013-04-16 11:27:03 +02:00
|
|
|
if (target == null) return;
|
2011-10-09 18:35:39 +02:00
|
|
|
|
2013-04-25 13:25:15 +02:00
|
|
|
msender.setUsingAdminMode(target);
|
2013-04-16 11:27:03 +02:00
|
|
|
|
2013-04-25 13:25:15 +02:00
|
|
|
if (msender.isUsingAdminMode())
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-04-25 13:25:15 +02:00
|
|
|
msender.msg("<i>You have enabled admin bypass mode.");
|
|
|
|
Factions.get().log(msender.getId() + " has ENABLED admin bypass mode.");
|
2011-10-09 14:53:38 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-25 13:25:15 +02:00
|
|
|
msender.msg("<i>You have disabled admin bypass mode.");
|
|
|
|
Factions.get().log(msender.getId() + " DISABLED admin bypass mode.");
|
2011-04-06 12:04:57 +02:00
|
|
|
}
|
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
2011-04-06 12:04:57 +02:00
|
|
|
}
|