diff --git a/build.gradle b/build.gradle index 209fa02..1511def 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ dependencies { shadow 'org.jetbrains:annotations:16.0.2' shadow 'me.clip:placeholderapi:2.10.4' shadow 'org.xerial:sqlite-jdbc:3.23.1' - shadow 'org.spigotmc:spigot-api:1.15-R0.1-SNAPSHOT' + shadow 'org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT' } shadowJar { diff --git a/src/main/java/dev/esophose/playerparticles/command/DefaultCommandModule.java b/src/main/java/dev/esophose/playerparticles/command/DefaultCommandModule.java index 482a274..dd2fc98 100644 --- a/src/main/java/dev/esophose/playerparticles/command/DefaultCommandModule.java +++ b/src/main/java/dev/esophose/playerparticles/command/DefaultCommandModule.java @@ -18,7 +18,8 @@ public class DefaultCommandModule implements CommandModule { List matches = new ArrayList<>(); List commandNames = PlayerParticles.getInstance().getManager(CommandManager.class).getCommandNames(); - if (args.length == 0) return commandNames; + if (args.length == 0) + return commandNames; StringUtil.copyPartialMatches(args[0], commandNames, matches); diff --git a/src/main/java/dev/esophose/playerparticles/command/GUICommandModule.java b/src/main/java/dev/esophose/playerparticles/command/GUICommandModule.java index 5c4dd23..d7508aa 100644 --- a/src/main/java/dev/esophose/playerparticles/command/GUICommandModule.java +++ b/src/main/java/dev/esophose/playerparticles/command/GUICommandModule.java @@ -35,7 +35,8 @@ public class GUICommandModule implements CommandModule { return; } - if (!Setting.GUI_PRESETS_ONLY.getBoolean() && (permissionManager.getEffectsUserHasPermissionFor(pplayer).isEmpty() || permissionManager.getStylesUserHasPermissionFor(pplayer).isEmpty())) { + boolean hasEffectsAndStyles = permissionManager.getEffectsUserHasPermissionFor(pplayer).isEmpty() || permissionManager.getStylesUserHasPermissionFor(pplayer).isEmpty(); + if (!Setting.GUI_PRESETS_ONLY.getBoolean() && (Setting.GUI_REQUIRE_EFFECTS_AND_STYLES.getBoolean() && !hasEffectsAndStyles)) { if (byDefault) { localeManager.sendMessage(pplayer, "command-error-missing-effects-or-styles"); } else { diff --git a/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditEffect.java b/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditEffect.java index d355041..301e66a 100644 --- a/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditEffect.java +++ b/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditEffect.java @@ -27,7 +27,7 @@ public class GuiInventoryEditEffect extends GuiInventory { List effectsUserHasPermissionFor = PlayerParticles.getInstance().getManager(PermissionManager.class).getEffectsUserHasPermissionFor(pplayer); int numberOfItems = effectsUserHasPermissionFor.size(); int itemsPerPage = 28; - int maxPages = (int) Math.ceil((double) numberOfItems / itemsPerPage); + int maxPages = (int) Math.max(1, Math.ceil((double) numberOfItems / itemsPerPage)); int slot = 10; int nextWrap = 17; int maxSlot = 43; diff --git a/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditStyle.java b/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditStyle.java index 1b4b498..8347801 100644 --- a/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditStyle.java +++ b/src/main/java/dev/esophose/playerparticles/gui/GuiInventoryEditStyle.java @@ -27,7 +27,7 @@ public class GuiInventoryEditStyle extends GuiInventory { List stylesUserHasPermissionFor = PlayerParticles.getInstance().getManager(PermissionManager.class).getStylesUserHasPermissionFor(pplayer); int numberOfItems = stylesUserHasPermissionFor.size(); int itemsPerPage = 28; - int maxPages = (int) Math.ceil((double) numberOfItems / itemsPerPage); + int maxPages = (int) Math.max(1, Math.ceil((double) numberOfItems / itemsPerPage)); int slot = 10; int nextWrap = 17; int maxSlot = 43; diff --git a/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java b/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java index 06be3dd..eb9200b 100644 --- a/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java +++ b/src/main/java/dev/esophose/playerparticles/manager/ConfigurationManager.java @@ -37,6 +37,7 @@ public class ConfigurationManager extends Manager { USE_MESSAGE_PREFIX("use-message-prefix", true, "Whether or not to use the message-prefix field when displaying messages"), GUI_ENABLED("gui-enabled", true, "If the command /pp gui is enabled", "Disable this if you have your own custom GUI through another plugin"), GUI_REQUIRE_PERMISSION("gui-require-permission", false, "If the GUI should require the permission playerparticles.gui to open"), + GUI_REQUIRE_EFFECTS_AND_STYLES("gui-require-effects-and-styles", true, "If the GUI should require the player to have permission for at least", "one effect and one style to be able to open the GUI"), GUI_PRESETS_ONLY("gui-presets-only", false, "If true, only the preset groups will be available in the GUI", "Permissions to open the GUI will change to only open if the user has any preset groups available"), GUI_CLOSE_AFTER_GROUP_SELECTED("gui-close-after-group-selected", true, "If true, the GUI will close after selecting a group (either saved or preset)"), GUI_BUTTON_SOUND("gui-button-sound", true, "If clicking a GUI button should make a noise"),