From 54015f668a1f4bb7e2876306aac99276ff2ff722 Mon Sep 17 00:00:00 2001 From: Video Date: Sat, 2 Mar 2024 14:38:49 -0700 Subject: [PATCH] Fixes NPE if Prism or CoreProtect are not installed (#87) --- server/src/main/java/dev/plex/command/impl/BanCMD.java | 4 ++-- server/src/main/java/dev/plex/command/impl/TempbanCMD.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/dev/plex/command/impl/BanCMD.java b/server/src/main/java/dev/plex/command/impl/BanCMD.java index caec846..05d59c0 100644 --- a/server/src/main/java/dev/plex/command/impl/BanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/BanCMD.java @@ -94,7 +94,7 @@ public class BanCMD extends PlexCommand if (rollBack) { - if (plugin.getPrismHook().hasPrism()) + if (plugin.getPrismHook() != null && plugin.getPrismHook().hasPrism()) { PrismParameters parameters = plugin.getPrismHook().prismApi().createParameters(); parameters.addActionType("block-place"); @@ -119,7 +119,7 @@ public class BanCMD extends PlexCommand } }); } - else if (plugin.getCoreProtectHook().hasCoreProtect()) + else if (plugin.getCoreProtectHook() != null && plugin.getCoreProtectHook().hasCoreProtect()) { PlexLog.debug("Testing coreprotect"); Bukkit.getGlobalRegionScheduler().run(plugin, scheduledTask -> diff --git a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java index 6be7313..bada248 100644 --- a/server/src/main/java/dev/plex/command/impl/TempbanCMD.java +++ b/server/src/main/java/dev/plex/command/impl/TempbanCMD.java @@ -104,7 +104,7 @@ public class TempbanCMD extends PlexCommand }); } else */ - if (plugin.getCoreProtectHook().hasCoreProtect()) + if (plugin.getCoreProtectHook() != null && plugin.getCoreProtectHook().hasCoreProtect()) { PlexLog.debug("Testing coreprotect"); Bukkit.getAsyncScheduler().runNow(plugin, scheduledTask ->