2011-11-24 16:27:14 +01:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
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;
|
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;
|
2011-11-24 16:27:14 +01:00
|
|
|
|
2014-09-18 13:41:20 +02:00
|
|
|
public class CmdFactionsSeeChunk extends FactionsCommand
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public CmdFactionsSeeChunk()
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
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
|
|
|
|
2015-10-21 19:35:41 +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());
|
2011-11-24 16:27:14 +01:00
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
2011-11-24 16:27:14 +01:00
|
|
|
|
|
|
|
@Override
|
2015-02-12 12:00:55 +01:00
|
|
|
public void perform() throws MassiveException
|
2011-11-24 16:27:14 +01:00
|
|
|
{
|
2013-04-26 20:22:12 +02:00
|
|
|
// 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");
|
2011-11-24 16:27:14 +01:00
|
|
|
|
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;
|
|
|
|
}
|
2011-11-24 16:27:14 +01:00
|
|
|
|
2014-10-08 09:24:03 +02:00
|
|
|
// Apply
|
|
|
|
msender.setSeeingChunk(target);
|
2013-04-26 20:22:12 +02:00
|
|
|
|
|
|
|
// Inform
|
2014-10-08 09:24:03 +02:00
|
|
|
msg("<i>See Chunk is now %s<i>.", targetDesc);
|
2011-11-24 16:27:14 +01:00
|
|
|
}
|
2014-10-08 09:24:03 +02:00
|
|
|
|
2011-11-24 16:27:14 +01:00
|
|
|
}
|