F Home and ClaimAt Fix

This commit is contained in:
Driftay 2019-11-14 03:42:47 -05:00
parent 8bde1385fc
commit d3a7fc67a5
2 changed files with 12 additions and 13 deletions

View File

@ -23,7 +23,7 @@ public class CmdHome extends FCommand {
public CmdHome() { public CmdHome() {
super(); super();
this.aliases.add("home"); this.aliases.add("home");
this.optionalArgs.put("home", "faction-name"); this.optionalArgs.put("faction", "yours");
this.requirements = new CommandRequirements.Builder(Permission.HOME) this.requirements = new CommandRequirements.Builder(Permission.HOME)
.playerOnly() .playerOnly()
@ -45,10 +45,14 @@ public class CmdHome extends FCommand {
return; return;
} }
if (context.args.size() == 1) { if (context.args.size() >= 1) {
Faction faction = context.argAsFaction(0); Faction target = context.argAsFaction(0);
if (faction == null) return; if (target == null) return;
context.faction = faction; context.faction = target;
if (target.getAccess(context.fPlayer, PermissableAction.HOME) != Access.ALLOW) {
context.fPlayer.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
} }
if (!context.faction.hasHome()) { if (!context.faction.hasHome()) {
@ -83,9 +87,8 @@ public class CmdHome extends FCommand {
if (Conf.homesTeleportAllowedEnemyDistance > 0 if (Conf.homesTeleportAllowedEnemyDistance > 0
&& !faction.isSafeZone() && !faction.isSafeZone()
&& (!context.fPlayer.isInOwnTerritory() && (!context.fPlayer.isInOwnTerritory()
|| !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory) || (context.fPlayer.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) {
&& (!Conf.homesTeleportIgnoreEnemiesIfInNoClaimingWorld
|| !Conf.worldsNoClaiming.contains(context.fPlayer.getPlayer().getWorld().getName()))) {
World w = loc.getWorld(); World w = loc.getWorld();
double x = loc.getX(); double x = loc.getX();
double y = loc.getY(); double y = loc.getY();

View File

@ -31,11 +31,7 @@ public class CmdClaimAt extends FCommand {
int x = context.argAsInt(1); int x = context.argAsInt(1);
int z = context.argAsInt(2); int z = context.argAsInt(2);
FLocation location = new FLocation(context.argAsString(0), x, z); FLocation location = new FLocation(context.argAsString(0), x, z);
if (!((context.player.getLocation().getX() + (x * 16)) > (context.player.getLocation().getX() + (Conf.mapWidth * 16))) && context.fPlayer.attemptClaim(context.faction, location, true);
!((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);
} }