From d3a7fc67a568f14f3d4606cdc20e1c78fb5317eb Mon Sep 17 00:00:00 2001 From: Driftay Date: Thu, 14 Nov 2019 03:42:47 -0500 Subject: [PATCH] F Home and ClaimAt Fix --- .../massivecraft/factions/cmd/CmdHome.java | 19 +++++++++++-------- .../factions/cmd/claim/CmdClaimAt.java | 6 +----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java index 24a31544..2a78acac 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java @@ -23,7 +23,7 @@ public class CmdHome extends FCommand { public CmdHome() { super(); this.aliases.add("home"); - this.optionalArgs.put("home", "faction-name"); + this.optionalArgs.put("faction", "yours"); this.requirements = new CommandRequirements.Builder(Permission.HOME) .playerOnly() @@ -45,10 +45,14 @@ public class CmdHome extends FCommand { return; } - if (context.args.size() == 1) { - Faction faction = context.argAsFaction(0); - if (faction == null) return; - context.faction = faction; + if (context.args.size() >= 1) { + Faction target = context.argAsFaction(0); + if (target == null) return; + 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()) { @@ -83,9 +87,8 @@ public class CmdHome extends FCommand { if (Conf.homesTeleportAllowedEnemyDistance > 0 && !faction.isSafeZone() && (!context.fPlayer.isInOwnTerritory() - || !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory) - && (!Conf.homesTeleportIgnoreEnemiesIfInNoClaimingWorld - || !Conf.worldsNoClaiming.contains(context.fPlayer.getPlayer().getWorld().getName()))) { + || (context.fPlayer.isInOwnTerritory() && !Conf.homesTeleportIgnoreEnemiesIfInOwnTerritory))) { + World w = loc.getWorld(); double x = loc.getX(); double y = loc.getY(); diff --git a/src/main/java/com/massivecraft/factions/cmd/claim/CmdClaimAt.java b/src/main/java/com/massivecraft/factions/cmd/claim/CmdClaimAt.java index b3759607..4da6446c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/claim/CmdClaimAt.java +++ b/src/main/java/com/massivecraft/factions/cmd/claim/CmdClaimAt.java @@ -31,11 +31,7 @@ public class CmdClaimAt extends FCommand { 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); + context.fPlayer.attemptClaim(context.faction, location, true); }