mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
fix: Handle an empty component GUI gracefully
This commit is contained in:
parent
951767dc64
commit
400f856c9a
@ -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
|
||||
|
@ -463,6 +463,7 @@
|
||||
"preset.preset_lore_cost": "<prefix><gray>Cost: </gray><gold><cost></gold>",
|
||||
"preset.preset_lore_component": "<gray>Component: </gray><gold><component></gold>",
|
||||
"preset.title": "Plot Components",
|
||||
"preset.empty": "<prefix><red>No plot component presets available.</red>",
|
||||
"generic.generic_other": "<gray>other</gray>",
|
||||
"generic.generic_merged": "<gray>merged</gray>",
|
||||
"generic.generic_unowned": "<gray>unowned</gray>",
|
||||
|
Loading…
Reference in New Issue
Block a user