2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2013-04-09 12:56:29 +02:00
|
|
|
import com.massivecraft.factions.Perm;
|
2013-04-25 13:25:15 +02:00
|
|
|
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
2013-04-22 12:26:13 +02:00
|
|
|
import com.massivecraft.factions.entity.BoardColls;
|
2014-06-04 14:02:23 +02:00
|
|
|
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
|
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
|
|
|
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
|
|
|
|
import com.massivecraft.massivecore.ps.PS;
|
2011-03-22 15:45:41 +01:00
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public class CmdFactionsMap extends FCommand
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-10 13:12:22 +02:00
|
|
|
public CmdFactionsMap()
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-11-11 09:31:04 +01:00
|
|
|
// Aliases
|
2013-04-16 10:11:59 +02:00
|
|
|
this.addAliases("map");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// Args
|
2013-04-16 10:30:21 +02:00
|
|
|
this.addOptionalArg("on/off", "once");
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// Requirements
|
2013-04-25 13:25:15 +02:00
|
|
|
this.addRequirements(ReqFactionsEnabled.get());
|
2013-04-16 10:11:59 +02:00
|
|
|
this.addRequirements(ReqHasPerm.get(Perm.MAP.node));
|
2013-04-16 09:48:57 +02:00
|
|
|
this.addRequirements(ReqIsPlayer.get());
|
2011-03-23 17:39:56 +01:00
|
|
|
}
|
2013-11-11 09:31:04 +01:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// OVERRIDE
|
|
|
|
// -------------------------------------------- //
|
2011-03-23 17:39:56 +01:00
|
|
|
|
2011-06-21 07:38:31 +02:00
|
|
|
@Override
|
2011-10-09 14:53:38 +02:00
|
|
|
public void perform()
|
|
|
|
{
|
2013-04-16 11:27:03 +02:00
|
|
|
if (!this.argIsSet(0))
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-04-16 11:27:03 +02:00
|
|
|
showMap();
|
|
|
|
return;
|
2011-10-09 14:53:38 +02:00
|
|
|
}
|
2013-04-16 11:27:03 +02:00
|
|
|
|
2013-04-25 07:29:19 +02:00
|
|
|
if (this.arg(0, ARBoolean.get(), !msender.isMapAutoUpdating()))
|
2011-10-09 14:53:38 +02:00
|
|
|
{
|
2013-04-25 12:04:01 +02:00
|
|
|
// And show the map once
|
|
|
|
showMap();
|
|
|
|
|
2013-04-16 11:27:03 +02:00
|
|
|
// Turn on
|
2013-04-25 07:29:19 +02:00
|
|
|
msender.setMapAutoUpdating(true);
|
2013-04-16 11:27:03 +02:00
|
|
|
msg("<i>Map auto update <green>ENABLED.");
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
2013-04-16 11:27:03 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Turn off
|
2013-04-25 07:29:19 +02:00
|
|
|
msender.setMapAutoUpdating(false);
|
2013-04-16 11:27:03 +02:00
|
|
|
msg("<i>Map auto update <red>DISABLED.");
|
|
|
|
}
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
2011-10-09 14:53:38 +02:00
|
|
|
public void showMap()
|
|
|
|
{
|
2013-04-26 10:32:02 +02:00
|
|
|
sendMessage(BoardColls.get().getMap(usenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
|
2011-03-22 15:45:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|