forked from SteamWar/SteamWar
Settle open particle slot questions
Slots hold up to 9 entries, so the slot editor is one entry row plus the bottom bar, and the server team may spawn 90 particles per tick. The water and lava rings for taking part in any event return as reward designs, and locked slots can be deleted from their read-only view.
This commit is contained in:
@@ -39,11 +39,12 @@ import java.util.List;
|
||||
|
||||
import static de.steamwar.lobby.particle.gui.ParticleGuiText.*;
|
||||
|
||||
// Lists a slot's entries; slots the player has lost access to are shown read-only
|
||||
// Lists a slot's entries; slots the player has lost access to are shown read-only but can still be deleted
|
||||
@UtilityClass
|
||||
public class SlotEditor {
|
||||
|
||||
private final int SIZE = 54;
|
||||
// One row of entries above the bottom bar
|
||||
private final int SIZE = (ParticleSlots.MAX_ENTRIES + 8) / 9 * 9 + 9;
|
||||
private final int BACK = BottomBar.position(SIZE, BottomBar.BACK);
|
||||
private final int STATUS = BottomBar.position(SIZE, BottomBar.STATUS);
|
||||
private final int ADD_ENTRY = BottomBar.position(SIZE, BottomBar.ADD);
|
||||
@@ -79,13 +80,22 @@ public class SlotEditor {
|
||||
}
|
||||
|
||||
inventory.setItem(BACK, new SWItem(Material.ARROW, msg("PARTICLE_BACK", player), clickType -> ParticleMenu.open(player)));
|
||||
inventory.setItem(COST, costItem(player, user, slot));
|
||||
// Locked slots can still be deleted, so players can clear what they made before losing the rank
|
||||
inventory.setItem(DELETE, new SWItem(Material.LAVA_BUCKET, msg("PARTICLE_SLOT_DELETE", player), List.of(msg("PARTICLE_SHIFT_TO_DELETE", player)), false, clickType -> {
|
||||
if (!clickType.isShiftClick()) return;
|
||||
if (lobbyPlayer.getActiveSlot() == index) {
|
||||
lobbyPlayer.deselect();
|
||||
}
|
||||
lobbyPlayer.setSlot(index, null);
|
||||
ParticleMenu.open(player);
|
||||
}));
|
||||
if (!editable) {
|
||||
List<String> lore = new ArrayList<>(requirement(ParticleSlots.requirement(index), player));
|
||||
inventory.setItem(STATUS, new SWItem(Material.BARRIER, msg("PARTICLE_LOCKED", player), lore, false, clickType -> {
|
||||
}));
|
||||
inventory.setItem(COST, costItem(player, user, slot));
|
||||
BottomBar.fillUnused(inventory, SIZE, false);
|
||||
fill(inventory, 0, SIZE);
|
||||
fill(inventory, 0, SIZE);
|
||||
inventory.open();
|
||||
return;
|
||||
}
|
||||
@@ -124,15 +134,6 @@ public class SlotEditor {
|
||||
save(player, index, slot);
|
||||
open(player, index);
|
||||
}, () -> open(player, index))));
|
||||
inventory.setItem(COST, costItem(player, user, slot));
|
||||
inventory.setItem(DELETE, new SWItem(Material.LAVA_BUCKET, msg("PARTICLE_SLOT_DELETE", player), List.of(msg("PARTICLE_SHIFT_TO_DELETE", player)), false, clickType -> {
|
||||
if (!clickType.isShiftClick()) return;
|
||||
if (lobbyPlayer.getActiveSlot() == index) {
|
||||
lobbyPlayer.deselect();
|
||||
}
|
||||
lobbyPlayer.setSlot(index, null);
|
||||
ParticleMenu.open(player);
|
||||
}));
|
||||
BottomBar.fillUnused(inventory, SIZE, false);
|
||||
fill(inventory, 0, SIZE);
|
||||
inventory.open();
|
||||
|
||||
Reference in New Issue
Block a user