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

54 lines
1.5 KiB
Java
Raw Normal View History

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.type.TypeMPlayer;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer;
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.type.primitive.TypeBoolean;
public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
{
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsAccessPlayer()
{
2013-11-11 09:31:04 +01:00
// Aliases
2015-10-21 21:18:00 +02:00
this.addAliases("player");
2013-11-11 09:31:04 +01:00
// Parameters
this.addParameter(TypeMPlayer.get(), "player");
2015-11-06 02:10:29 +01:00
this.addParameter(TypeBoolean.getYes(), "yes/no", "toggle");
2013-11-11 09:31:04 +01:00
// Requirements
this.addRequirements(RequirementHasPerm.get(Perm.ACCESS_PLAYER));
}
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
2015-02-12 12:00:55 +01:00
public void innerPerform() throws MassiveException
{
// Args
2015-05-06 17:04:35 +02:00
MPlayer mplayer = this.readArg();
boolean newValue = this.readArg(!ta.isPlayerIdGranted(mplayer.getId()));
// MPerm
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;
// Apply
2014-09-17 13:29:58 +02:00
ta = ta.withPlayerId(mplayer.getId(), newValue);
BoardColl.get().setTerritoryAccessAt(chunk, ta);
// Inform
this.sendAccessInfo();
}
2013-11-11 09:31:04 +01:00
}