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

56 lines
1.4 KiB
Java
Raw Normal View History

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARUPlayer;
import com.massivecraft.factions.entity.BoardColls;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.mcore.cmd.arg.ARBoolean;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
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
this.addAliases("p", "player");
2013-11-11 09:31:04 +01:00
// Args
this.addRequiredArg("player");
this.addOptionalArg("yes/no", "toggle");
2013-11-11 09:31:04 +01:00
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.ACCESS_PLAYER.node));
}
2013-11-11 09:31:04 +01:00
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void innerPerform()
{
// Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(usender));
if (uplayer == null) return;
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
if (newValue == null) return;
// FPerm
2013-04-29 10:26:15 +02:00
if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
// Apply
ta = ta.withPlayerId(uplayer.getId(), newValue);
BoardColls.get().setTerritoryAccessAt(chunk, ta);
// Inform
this.sendAccessInfo();
}
2013-11-11 09:31:04 +01:00
}