diff --git a/src/main/java/net/citizensnpcs/api/command/CommandContext.java b/src/main/java/net/citizensnpcs/api/command/CommandContext.java index 8871304e..f8ca3c1a 100644 --- a/src/main/java/net/citizensnpcs/api/command/CommandContext.java +++ b/src/main/java/net/citizensnpcs/api/command/CommandContext.java @@ -211,24 +211,28 @@ public String[] getPaddedSlice(int index, int padding) { public Location getSenderLocation() throws CommandException { if (location != null || sender == null) return location; + if (hasValueFlag("location")) { + return parseLocation(location, getFlag("location")); + } if (sender instanceof Player) { location = ((Player) sender).getLocation(); } else if (sender instanceof BlockCommandSender) { location = ((BlockCommandSender) sender).getBlock().getLocation(); } - if (hasValueFlag("location")) { - location = parseLocation(location, getFlag("location")); - } return location; } - public Location getSenderTargetBlockLocation() { + public Location getSenderTargetBlockLocation() throws CommandException { if (sender == null) return location; - if (sender instanceof Player) + if (hasValueFlag("location")) { + return parseLocation(location, getFlag("location")); + } + if (sender instanceof Player) { location = ((Player) sender).getTargetBlock((java.util.Set) null, 50).getLocation(); - else if (sender instanceof BlockCommandSender) + } else if (sender instanceof BlockCommandSender) { location = ((BlockCommandSender) sender).getBlock().getLocation(); + } return location; } diff --git a/src/main/java/net/citizensnpcs/api/npc/BlockBreaker.java b/src/main/java/net/citizensnpcs/api/npc/BlockBreaker.java index 9ad1081c..b120875b 100644 --- a/src/main/java/net/citizensnpcs/api/npc/BlockBreaker.java +++ b/src/main/java/net/citizensnpcs/api/npc/BlockBreaker.java @@ -60,6 +60,10 @@ public BlockBreakerConfiguration item(org.bukkit.inventory.ItemStack stack) { return this; } + public double radius() { + return radius; + } + /** * @param radius * The maximum radius to be from the target block. The NPC will attempt to pathfind towards the @@ -69,10 +73,6 @@ public BlockBreakerConfiguration radius(double radius) { this.radius = radius; return this; } - - public double radiusSquared() { - return Math.pow(radius, 2); - } } public static final BlockBreakerConfiguration EMPTY_CONFIG = new BlockBreakerConfiguration();