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

57 lines
1.3 KiB
Java
Raw Normal View History

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
2014-10-08 09:24:03 +02:00
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
2014-06-04 14:02:23 +02:00
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
2014-10-08 09:24:03 +02:00
import com.massivecraft.massivecore.util.Txt;
2014-09-18 13:41:20 +02:00
public class CmdFactionsSeeChunk extends FactionsCommand
{
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
2013-04-10 13:12:22 +02:00
public CmdFactionsSeeChunk()
{
2013-11-11 09:31:04 +01:00
// Aliases
2013-04-16 10:11:59 +02:00
this.addAliases("sc", "seechunk");
2014-10-08 09:24:03 +02:00
// Args
this.addOptionalArg("active", "toggle");
2013-11-11 09:31:04 +01:00
// Requirements
2014-10-08 09:24:03 +02:00
this.addRequirements(ReqHasPerm.get(Perm.SEECHUNK.node));
this.addRequirements(ReqIsPlayer.get());
}
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// Args
2014-10-08 09:24:03 +02:00
boolean old = msender.isSeeingChunk();
boolean targetDefault = !old;
Boolean target = this.arg(0, ARBoolean.get(), targetDefault);
if (target == null) return;
String targetDesc = Txt.parse(target ? "<g>ON": "<b>OFF");
2014-10-08 09:24:03 +02:00
// NoChange
if (target.equals(old))
{
msg("<i>See Chunk is already %s<i>.", targetDesc);
return;
}
2014-10-08 09:24:03 +02:00
// Apply
msender.setSeeingChunk(target);
// Inform
2014-10-08 09:24:03 +02:00
msg("<i>See Chunk is now %s<i>.", targetDesc);
}
2014-10-08 09:24:03 +02:00
}