Skip to content

Commit

Permalink
Fixed NullPointerException on command aliases
Browse files Browse the repository at this point in the history
- Updated ImageCommandBridge#fixPermissions()
  • Loading branch information
josemmo committed Jun 26, 2021
1 parent dcaf704 commit 0976308
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;

public class ImageCommandBridge {
public static final String COMMAND_NAME = "yamipa";
Expand Down Expand Up @@ -161,7 +160,8 @@ public static void register(@NotNull YamipaPlugin plugin) {

private static void fixPermissions(@NotNull String commandName) {
org.bukkit.command.Command command = Internals.getCommandMap().getCommand(commandName);
Objects.requireNonNull(command);
command.setPermission(null);
if (command != null) { // Command may have been aliased to null in "commands.yml"
command.setPermission(null);
}
}
}

0 comments on commit 0976308

Please sign in to comment.