Fix Bug #125
This commit is contained in:
parent
8ad2fdf848
commit
ec1501bf4f
@ -2,25 +2,27 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.WarmUpUtil;
|
import com.massivecraft.factions.util.WarmUpUtil;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public class CmdCheckpoint extends FCommand {
|
public class CmdCheckpoint extends FCommand
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Illyria Team
|
* @author Illyria Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public CmdCheckpoint() {
|
public CmdCheckpoint()
|
||||||
|
{
|
||||||
super();
|
super();
|
||||||
this.aliases.addAll(Aliases.checkpoint);
|
this.aliases.addAll(Aliases.checkpoint);
|
||||||
|
|
||||||
this.optionalArgs.put("set", "");
|
this.optionalArgs.put("set", "");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.CHECKPOINT)
|
this.requirements = new CommandRequirements.Builder(Permission.CHECKPOINT).playerOnly().memberOnly().build();
|
||||||
.playerOnly()
|
|
||||||
.memberOnly()
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,7 +31,29 @@ public class CmdCheckpoint extends FCommand {
|
|||||||
context.msg(TL.COMMAND_CHECKPOINT_DISABLED);
|
context.msg(TL.COMMAND_CHECKPOINT_DISABLED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (context.args.size() == 1) {
|
if (context.args.size() == 1 && context.args.get(0).equalsIgnoreCase("set")) {
|
||||||
|
if (context.fPlayer.getRole() == Role.LEADER)
|
||||||
|
{
|
||||||
|
FLocation myLocation = new FLocation(context.player.getLocation());
|
||||||
|
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
||||||
|
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
||||||
|
context.faction.setCheckpoint(context.player.getLocation());
|
||||||
|
context.msg(TL.COMMAND_CHECKPOINT_SET);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
context.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PermissableAction action = PermissableAction.SETWARP;
|
||||||
|
Access access = context.faction.getAccess(context.fPlayer, action);
|
||||||
|
if (access == Access.DENY) {
|
||||||
|
context.msg(TL.GENERIC_FPERM_NOPERMISSION, action.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
FLocation myLocation = new FLocation(context.player.getLocation());
|
FLocation myLocation = new FLocation(context.player.getLocation());
|
||||||
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
||||||
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
||||||
@ -41,6 +65,8 @@ public class CmdCheckpoint extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (context.faction.getCheckpoint() == null) {
|
if (context.faction.getCheckpoint() == null) {
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_NOT_SET);
|
context.msg(TL.COMMAND_CHECKPOINT_NOT_SET);
|
||||||
return;
|
return;
|
||||||
@ -57,12 +83,11 @@ public class CmdCheckpoint extends FCommand {
|
|||||||
} else {
|
} else {
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_CLAIMED);
|
context.msg(TL.COMMAND_CHECKPOINT_CLAIMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation()
|
||||||
|
{
|
||||||
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
|
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user