diff --git a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java index 0b514996f..7ac0db4b8 100644 --- a/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java +++ b/Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java @@ -181,7 +181,13 @@ public class ComponentPresetManager { } allowedPresets.add(componentPreset); } - final int size = (int) Math.ceil((double) allowedPresets.size() / 9.0D); + final int size; + if (allowedPresets.isEmpty()) { + player.sendMessage(TranslatableCaption.of("preset.empty")); + return null; + } else { + size = (int) Math.ceil((double) allowedPresets.size() / 9.0D); + } final PlotInventory plotInventory = new PlotInventory(this.inventoryUtil, player, size, TranslatableCaption.of("preset.title").getComponent(player)) { @Override diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 6ca0e0229..6ffe3b3e2 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -463,6 +463,7 @@ "preset.preset_lore_cost": "Cost: ", "preset.preset_lore_component": "Component: ", "preset.title": "Plot Components", + "preset.empty": "No plot component presets available.", "generic.generic_other": "other", "generic.generic_merged": "merged", "generic.generic_unowned": "unowned",