Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -2,8 +2,11 @@ package com.massivecraft.factions.cmd.claim;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdClaimAt extends FCommand {
|
||||
@@ -16,28 +19,26 @@ public class CmdClaimAt extends FCommand {
|
||||
this.requiredArgs.add("x");
|
||||
this.requiredArgs.add("z");
|
||||
|
||||
this.permission = Permission.CLAIMAT.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
this.requirements = new CommandRequirements.Builder(Permission.CLAIMAT)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.withAction(PermissableAction.TERRITORY)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
int x = argAsInt(1);
|
||||
int z = argAsInt(2);
|
||||
FLocation location = new FLocation(argAsString(0), x, z);
|
||||
if (!((fme.getPlayer().getLocation().getX() + (x * 16)) > (fme.getPlayer().getLocation().getX() + (Conf.mapWidth * 16))) &&
|
||||
!((fme.getPlayer().getLocation().getZ() + (z * 16)) > (fme.getPlayer().getLocation().getZ() + (Conf.mapHeight * 16)))) {
|
||||
fme.attemptClaim(myFaction, location, true);
|
||||
} else fme.msg(TL.COMMAND_CLAIM_DENIED);
|
||||
public void perform(CommandContext context) {
|
||||
int x = context.argAsInt(1);
|
||||
int z = context.argAsInt(2);
|
||||
FLocation location = new FLocation(context.argAsString(0), x, z);
|
||||
if (!((context.player.getLocation().getX() + (x * 16)) > (context.player.getLocation().getX() + (Conf.mapWidth * 16))) &&
|
||||
!((context.player.getLocation().getZ() + (z * 16)) > (context.player.getLocation().getZ() + (Conf.mapHeight * 16))) &&
|
||||
!context.argAsString(0).equals(context.player.getLocation().getWorld().getName())) {
|
||||
context.fPlayer.attemptClaim(context.faction, location, true);
|
||||
} else context.fPlayer.msg(TL.COMMAND_CLAIM_DENIED);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user