Add sorting of phases
Dieser Commit ist enthalten in:
Ursprung
68f81c8c3e
Commit
4eb3a310a7
@ -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() {
|
||||||
|
@ -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 -> {
|
||||||
|
@ -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());
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren