Skip to content

Commit

Permalink
Safety check for spigotutil#getVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 6, 2023
1 parent 29d10c1 commit b76a620
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -254,9 +254,10 @@ public String getRawCommand() {
public Location getSenderLocation() throws CommandException {
if (location != null || sender == null)
return location;
if (hasValueFlag("location")) {

if (hasValueFlag("location"))
return parseLocation(location, getFlag("location"));
}

if (sender instanceof Player) {
location = ((Player) sender).getLocation();
} else if (sender instanceof BlockCommandSender) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/citizensnpcs/api/util/SpigotUtil.java
Expand Up @@ -60,6 +60,9 @@ public static int[] getVersion() {
return BUKKIT_VERSION = new int[] { 1, 8 };

String[] parts = version.split("\\.");
if (parts[1].contains("-")) {
parts[1] = parts[1].split("-")[0];
}
return BUKKIT_VERSION = new int[] { Integer.parseInt(parts[0]), Integer.parseInt(parts[1]) };
}
return BUKKIT_VERSION;
Expand Down

0 comments on commit b76a620

Please sign in to comment.