Toggle particle slots with a click and label entry editor rows

A slot with entries is switched on or off with a click in the particle
menu and edited with a shift click; empty slots still open the editor.
The entry editor rows get distinct glowing header icons.
This commit is contained in:
2026-10-26 09:48:25 +01:00
parent b60cdfc88d
commit 0c7ee052e8
4 changed files with 42 additions and 19 deletions
@@ -67,16 +67,19 @@ PARTICLE_DEACTIVATED = §cThere are too many players online, particles are deact
PARTICLE_BACK = §7Back
PARTICLE_SLOT_OPEN = §eClick to open
PARTICLE_SLOT_CLICK_USE = §eClick to use
PARTICLE_SLOT_CLICK_STOP = §eClick to stop using
PARTICLE_SLOT_SHIFT_EDIT = §eShift click to edit
PARTICLE_SLOT_NAME = §f{0} §8(§e{1}§8/§7{2}§8)
PARTICLE_SLOT_TITLE = §0{0} §8({1}/{2})
PARTICLE_SLOT_USE = §aUse this slot
PARTICLE_SLOT_STOP_USING = §cStop using this slot
PARTICLE_SHIFT_TO_DELETE = §7Shift click to delete
PARTICLE_SECTION_DESIGN = §fDesign
PARTICLE_SECTION_PARTICLE = §fParticle
PARTICLE_SECTION_SHAPE = §fShape
PARTICLE_SECTION_TIMING = §fTiming and position
PARTICLE_SECTION_CONDITIONS = §fConditions
PARTICLE_SECTION_DESIGN = §6§lDesign
PARTICLE_SECTION_PARTICLE = §6§lParticle
PARTICLE_SECTION_SHAPE = §6§lShape
PARTICLE_SECTION_TIMING = §6§lTiming and position
PARTICLE_SECTION_CONDITIONS = §6§lConditions
PARTICLE_FIXED_LOOK = §7This design always looks the same
PARTICLE_VALUE_CLICK = §eClick to change
PARTICLE_VALUE_TOGGLE = §eClick to toggle
@@ -67,16 +67,19 @@ PARTICLE_DEACTIVATED = §cEs sind zu viele Spieler online! Partikel sind deaktiv
PARTICLE_BACK = §7Zurück
PARTICLE_SLOT_OPEN = §eZum Öffnen klicken
PARTICLE_SLOT_CLICK_USE = §eZum Verwenden klicken
PARTICLE_SLOT_CLICK_STOP = §eZum Beenden klicken
PARTICLE_SLOT_SHIFT_EDIT = §eZum Bearbeiten Shift-Klick
PARTICLE_SLOT_NAME = §f{0} §8(§e{1}§8/§7{2}§8)
PARTICLE_SLOT_TITLE = §0{0} §8({1}/{2})
PARTICLE_SLOT_USE = §aDiesen Slot verwenden
PARTICLE_SLOT_STOP_USING = §cDiesen Slot nicht mehr verwenden
PARTICLE_SHIFT_TO_DELETE = §7Zum Löschen Shift-Klick
PARTICLE_SECTION_DESIGN = §fDesign
PARTICLE_SECTION_PARTICLE = §fPartikel
PARTICLE_SECTION_SHAPE = §fForm
PARTICLE_SECTION_TIMING = §fZeit und Position
PARTICLE_SECTION_CONDITIONS = §fBedingungen
PARTICLE_SECTION_DESIGN = §6§lDesign
PARTICLE_SECTION_PARTICLE = §6§lPartikel
PARTICLE_SECTION_SHAPE = §6§lForm
PARTICLE_SECTION_TIMING = §6§lZeit und Position
PARTICLE_SECTION_CONDITIONS = §6§lBedingungen
PARTICLE_FIXED_LOOK = §7Dieses Design sieht immer gleich aus
PARTICLE_VALUE_CLICK = §eZum Ändern klicken
PARTICLE_VALUE_TOGGLE = §eZum Umschalten klicken
@@ -98,11 +98,11 @@ class EntryEditor {
ParticleDesign design = entry.getDesign();
SWInventory inventory = new SWInventory(player, 54, msg("PARTICLE_ENTRY_EDITOR", player, designName(design, player)));
header(inventory, ROW_DESIGN, "PARTICLE_SECTION_DESIGN", player);
header(inventory, ROW_PARTICLE, "PARTICLE_SECTION_PARTICLE", player);
header(inventory, ROW_SHAPE, "PARTICLE_SECTION_SHAPE", player);
header(inventory, ROW_TIMING, "PARTICLE_SECTION_TIMING", player);
header(inventory, ROW_CONDITIONS, "PARTICLE_SECTION_CONDITIONS", player);
header(inventory, ROW_DESIGN, Material.PAINTING, "PARTICLE_SECTION_DESIGN", player);
header(inventory, ROW_PARTICLE, Material.FIREWORK_STAR, "PARTICLE_SECTION_PARTICLE", player);
header(inventory, ROW_SHAPE, Material.ARMOR_STAND, "PARTICLE_SECTION_SHAPE", player);
header(inventory, ROW_TIMING, Material.DAYLIGHT_DETECTOR, "PARTICLE_SECTION_TIMING", player);
header(inventory, ROW_CONDITIONS, Material.OBSERVER, "PARTICLE_SECTION_CONDITIONS", player);
inventory.setItem(ROW_DESIGN * 9 + 1, new SWItem(design.getIcon(), designName(design, player), List.of(msg("PARTICLE_VALUE_CLICK", player)), false,
clickType -> Pickers.design(player, design, picked -> changeDesign(context, picked), context::reopen)));
@@ -132,8 +132,9 @@ class EntryEditor {
inventory.open();
}
private void header(SWInventory inventory, int row, String key, Player player) {
inventory.setItem(row * 9, new SWItem(Material.LIGHT_GRAY_STAINED_GLASS_PANE, msg(key, player), clickType -> {
// Glowing so the row labels stand apart from the settings next to them
private void header(SWInventory inventory, int row, Material icon, String key, Player player) {
inventory.setItem(row * 9, new SWItem(icon, msg(key, player), List.of(), true, clickType -> {
}));
}
@@ -102,12 +102,28 @@ public class ParticleMenu {
lore.add(msg("PARTICLE_SLOT_VIEW", player));
return new SWItem(slot.getDisplayIcon(), name, lore, false, clickType -> SlotEditor.open(player, index));
}
if (slot.getEntries().isEmpty()) {
lore.add(msg("PARTICLE_SLOT_OPEN", player));
return new SWItem(slot.getDisplayIcon(), name, lore, false, clickType -> SlotEditor.open(player, index));
}
// A slot with entries is switched on and off with a click; shift click edits it
boolean active = lobbyPlayer.getActiveSlot() == index;
if (active) {
lore.add(msg("PARTICLE_SLOT_ACTIVE", player));
}
lore.add(msg("PARTICLE_SLOT_OPEN", player));
return new SWItem(slot.getDisplayIcon(), name, lore, active, clickType -> SlotEditor.open(player, index));
lore.add(msg(active ? "PARTICLE_SLOT_CLICK_STOP" : "PARTICLE_SLOT_CLICK_USE", player));
lore.add(msg("PARTICLE_SLOT_SHIFT_EDIT", player));
return new SWItem(slot.getDisplayIcon(), name, lore, active, clickType -> {
if (clickType.isShiftClick()) {
SlotEditor.open(player, index);
} else if (active) {
lobbyPlayer.deselect();
open(player);
} else if (lobbyPlayer.selectSlot(index)) {
selected(player);
}
});
}
void selected(Player player) {