SteamWar/BauSystem2.0
Archiviert
12
0

Add sorting of phases

Dieser Commit ist enthalten in:
D4rkr34lm 2023-10-13 13:00:36 +02:00 committet von yoyosource
Ursprung 68f81c8c3e
Commit 4eb3a310a7
4 geänderte Dateien mit 9 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -25,6 +25,7 @@ import org.bukkit.Material;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
@Getter @Getter
@ -45,6 +46,10 @@ public abstract class SimulatorElement<T extends SimulatorPhase> {
return this; return this;
} }
public void sort(){
phases.sort(Comparator.comparingInt(SimulatorPhase::getTickOffset));
}
public abstract String getName(); public abstract String getName();
public int getBaseTick() { public int getBaseTick() {

Datei anzeigen

@ -55,7 +55,7 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<RedstonePhase> {
@Override @Override
public void headerAndFooter() { public void headerAndFooter() {
// TODO Sort Data List redstoneElement.sort();
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.simulator2.gui;
import de.steamwar.bausystem.features.simulator2.SimulatorWatcher; import de.steamwar.bausystem.features.simulator2.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator2.data.Simulator; import de.steamwar.bausystem.features.simulator2.data.Simulator;
import de.steamwar.bausystem.features.simulator2.data.redstone.RedstonePhase;
import de.steamwar.bausystem.features.simulator2.data.tnt.TNTElement; import de.steamwar.bausystem.features.simulator2.data.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator2.data.tnt.TNTPhase; import de.steamwar.bausystem.features.simulator2.data.tnt.TNTPhase;
import de.steamwar.bausystem.features.simulator2.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator2.gui.base.SimulatorBaseGui;
@ -53,15 +52,13 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
@Override @Override
public void headerAndFooter() { public void headerAndFooter() {
// TODO Back Jump tntElement.sort();
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
back.open(); back.open();
})); }));
// TODO Sort Data List
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); List<String> lore = new ArrayList<>();
lore.add("§7Phase count§8:§e " + data.size()); lore.add("§7Phase count§8:§e " + data.size());

Datei anzeigen

@ -19,18 +19,15 @@
package de.steamwar.bausystem.features.simulator2.gui.base; package de.steamwar.bausystem.features.simulator2.gui.base;
import de.steamwar.bausystem.features.simulator2.SimulatorWatcher;
import de.steamwar.bausystem.features.simulator2.data.Simulator; import de.steamwar.bausystem.features.simulator2.data.Simulator;
import de.steamwar.bausystem.features.simulator2.data.redstone.RedstonePhase;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.List; import java.util.List;
public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui { // TODO: Last Column? public abstract class SimulatorScrollGui<T> extends SimulatorBaseGui {
protected int scroll = 0; protected int scroll = 0;
protected final List<T> data; protected final List<T> data;