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

57 lines
1.5 KiB
Java
Raw Normal View History

package com.massivecraft.factions.cmd;
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.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.command.type.primitive.TypeBoolean;
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
// Parameters
2015-11-06 02:10:29 +01:00
this.addParameter(TypeBoolean.getOn(), "active", "toggle");
2013-11-11 09:31:04 +01:00
// Requirements
2015-11-06 02:10:29 +01:00
this.addRequirements(RequirementHasPerm.get(Perm.SEECHUNK.node));
this.addRequirements(RequirementIsPlayer.get());
}
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
2015-02-12 12:00:55 +01:00
public void perform() throws MassiveException
{
// Args
2014-10-08 09:24:03 +02:00
boolean old = msender.isSeeingChunk();
boolean targetDefault = !old;
2015-05-06 17:04:35 +02:00
boolean target = this.readArg(targetDefault);
2014-10-08 09:24:03 +02:00
String targetDesc = Txt.parse(target ? "<g>ON": "<b>OFF");
2014-10-08 09:24:03 +02:00
// NoChange
2015-05-06 17:04:35 +02:00
if (target == old)
2014-10-08 09:24:03 +02:00
{
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
}