Skip to content

Commit

Permalink
Remove radiusSquared() method in favour of radius
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 19, 2022
1 parent fb163b8 commit 2b7c759
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions src/main/java/net/citizensnpcs/api/command/CommandContext.java
Expand Up @@ -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<org.bukkit.Material>) null, 50).getLocation();
else if (sender instanceof BlockCommandSender)
} else if (sender instanceof BlockCommandSender) {
location = ((BlockCommandSender) sender).getBlock().getLocation();
}
return location;
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/citizensnpcs/api/npc/BlockBreaker.java
Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit 2b7c759

Please sign in to comment.