2013-04-29 10:23:39 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
2015-10-21 19:35:41 +02:00
|
|
|
import com.massivecraft.factions.cmd.type.TypeMPlayer;
|
2014-09-17 13:17:33 +02:00
|
|
|
import com.massivecraft.factions.entity.BoardColl;
|
2014-10-02 14:02:07 +02:00
|
|
|
import com.massivecraft.factions.entity.MPerm;
|
2014-09-17 13:17:33 +02:00
|
|
|
import com.massivecraft.factions.entity.MPlayer;
|
2015-02-12 12:00:55 +01:00
|
|
|
import com.massivecraft.massivecore.MassiveException;
|
2016-06-08 13:00:15 +02:00
|
|
|
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanYes;
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
public CmdFactionsAccessPlayer()
|
|
|
|
{
|
2015-10-21 19:35:41 +02:00
|
|
|
// Parameters
|
|
|
|
this.addParameter(TypeMPlayer.get(), "player");
|
2016-06-08 13:00:15 +02:00
|
|
|
this.addParameter(TypeBooleanYes.get(), "yes/no", "toggle");
|
2013-04-29 10:23:39 +02:00
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
@Override
|
2015-02-12 12:00:55 +01:00
|
|
|
public void innerPerform() throws MassiveException
|
2013-04-29 10:23:39 +02:00
|
|
|
{
|
|
|
|
// Args
|
2015-05-06 17:04:35 +02:00
|
|
|
MPlayer mplayer = this.readArg();
|
2017-03-25 00:47:01 +01:00
|
|
|
boolean newValue = this.readArg(!ta.isMPlayerGranted(mplayer));
|
2013-04-29 10:23:39 +02:00
|
|
|
|
2014-10-02 14:02:07 +02:00
|
|
|
// MPerm
|
2014-10-03 09:01:36 +02:00
|
|
|
if (!MPerm.getPermAccess().has(msender, hostFaction, true)) return;
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
// Apply
|
2014-09-17 13:29:58 +02:00
|
|
|
ta = ta.withPlayerId(mplayer.getId(), newValue);
|
2014-09-17 13:17:33 +02:00
|
|
|
BoardColl.get().setTerritoryAccessAt(chunk, ta);
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
// Inform
|
|
|
|
this.sendAccessInfo();
|
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
}
|