SteamWar/BauSystem2.0
Archiviert
12
0

Consolidate Item Generation

Fix Back arrow in element gui
Dieser Commit ist enthalten in:
yoyosource 2023-10-22 13:24:50 +02:00
Ursprung 933e4fe7d9
Commit 327dded73b
14 geänderte Dateien mit 120 neuen und 165 gelöschten Zeilen

Datei anzeigen

@ -19,10 +19,13 @@
package de.steamwar.bausystem.features.simulator2.data; package de.steamwar.bausystem.features.simulator2.data;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -41,4 +44,8 @@ public class Simulator {
simulatorGroup.move(x, y, z); simulatorGroup.move(x, y, z);
}); });
} }
public SWItem toItem(Player player, InvCallback invCallback) {
return new SWItem(material, "§e" + name, invCallback);
}
} }

Datei anzeigen

@ -19,9 +19,12 @@
package de.steamwar.bausystem.features.simulator2.data; package de.steamwar.bausystem.features.simulator2.data;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.ArrayList; import java.util.ArrayList;
@ -70,4 +73,19 @@ public abstract class SimulatorElement<T extends SimulatorPhase> {
position.setY(position.getY() + y); position.setY(position.getY() + y);
position.setZ(position.getZ() + z); position.setZ(position.getZ() + z);
} }
public SWItem toItem(Player player, InvCallback invCallback) {
List<String> lore = new ArrayList<>();
lore.add("§7Phase count§8:§e " + phases.size());
lore.add("§7Tick§8:§e " + getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + position.getX());
lore.add("§7Y§8:§e " + position.getY());
lore.add("§7Z§8:§e " + position.getZ());
if (disabled) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(material, "§e" + getName(), lore, disabled, invCallback);
}
} }

Datei anzeigen

@ -19,9 +19,12 @@
package de.steamwar.bausystem.features.simulator2.data; package de.steamwar.bausystem.features.simulator2.data;
import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
@ -61,4 +64,19 @@ public class SimulatorGroup {
simulatorElement.move(x, y, z); simulatorElement.move(x, y, z);
}); });
} }
public SWItem toItem(Player player, InvCallback groupCallback, InvCallback itemCallback) {
if (elements.size() == 1) {
return elements.get(0).toItem(player, itemCallback);
} else {
List<String> lore = new ArrayList<>();
lore.add("§7Element count§8:§e " + elements.size());
lore.add("§7Tick§8:§e " + getBaseTick());
if (disabled) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(material, "§eGroup", lore, disabled, groupCallback);
}
}
} }

Datei anzeigen

@ -23,17 +23,14 @@ 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.SimulatorElement; import de.steamwar.bausystem.features.simulator2.data.SimulatorElement;
import de.steamwar.bausystem.features.simulator2.data.SimulatorGroup; import de.steamwar.bausystem.features.simulator2.data.SimulatorGroup;
import de.steamwar.bausystem.features.simulator2.data.redstone.RedstoneElement;
import de.steamwar.bausystem.features.simulator2.data.tnt.TNTElement;
import de.steamwar.bausystem.features.simulator2.gui.base.SimulatorBaseGui; import de.steamwar.bausystem.features.simulator2.gui.base.SimulatorBaseGui;
import de.steamwar.bausystem.features.simulator2.gui.base.SimulatorPageGui; import de.steamwar.bausystem.features.simulator2.gui.base.SimulatorPageGui;
import de.steamwar.bausystem.features.simulator2.gui.utils.SimulatorMaterialGui; import de.steamwar.inventory.InvCallback;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.stream.Collectors;
import java.util.List;
public class SimulatorGroupChooserGui extends SimulatorPageGui<SimulatorGroup> { public class SimulatorGroupChooserGui extends SimulatorPageGui<SimulatorGroup> {
@ -41,8 +38,8 @@ public class SimulatorGroupChooserGui extends SimulatorPageGui<SimulatorGroup> {
private final SimulatorGroup parent; private final SimulatorGroup parent;
private final SimulatorBaseGui back; private final SimulatorBaseGui back;
public SimulatorGroupChooserGui(Player player, Simulator simulator, List<SimulatorGroup> data, SimulatorElement<?> subject, SimulatorGroup parent, SimulatorBaseGui back){ public SimulatorGroupChooserGui(Player player, Simulator simulator, SimulatorElement<?> subject, SimulatorGroup parent, SimulatorBaseGui back) {
super(player, simulator, 6*9, data); super(player, simulator, 6 * 9, simulator.getElements().stream().filter(e -> e != parent).collect(Collectors.toList()));
this.subject = subject; this.subject = subject;
this.parent = parent; this.parent = parent;
this.back = back; this.back = back;
@ -50,9 +47,8 @@ public class SimulatorGroupChooserGui extends SimulatorPageGui<SimulatorGroup> {
@Override @Override
public void headerAndFooter() { public void headerAndFooter() {
simulator.getElements().removeIf(element -> element.getElements().isEmpty()); inventory.setItem(4, new SWItem(simulator.getMaterial(), "§e" + simulator.getName(), clickType -> {
}));
inventory.setItem(4, new SWItem(simulator.getMaterial(), "§e" + simulator.getName(), clickType -> {}));
if (parent.getElements().size() != 1) { if (parent.getElements().size() != 1) {
inventory.setItem(49, new SWItem(Material.BARRIER, "§cRemove from Group", clickType -> { inventory.setItem(49, new SWItem(Material.BARRIER, "§cRemove from Group", clickType -> {
SimulatorGroup newParent = new SimulatorGroup(); SimulatorGroup newParent = new SimulatorGroup();
@ -63,51 +59,20 @@ public class SimulatorGroupChooserGui extends SimulatorPageGui<SimulatorGroup> {
})); }));
} }
} }
@Override @Override
public String baseTitle() { public String baseTitle() {
return "§eChoose group to add to or element, to create new group"; return "Choose Group";
} }
@Override @Override
public SWItem convert(SimulatorGroup simulatorGroup) { public SWItem convert(SimulatorGroup simulatorGroup) {
List<SimulatorElement<?>> elements = simulatorGroup.getElements(); InvCallback invCallback = clickType -> {
if (elements.size() == 1) {
SimulatorElement<?> element = elements.get(0);
List<String> lore = new ArrayList<>();
lore.add("§7Phase count§8:§e " + element.getPhases().size());
lore.add("§7Tick§8:§e " + element.getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + element.getPosition().getX());
lore.add("§7Y§8:§e " + element.getPosition().getY());
lore.add("§7Z§8:§e " + element.getPosition().getZ());
if (element.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(element.getMaterial(), "§e" + element.getName(), lore, element.isDisabled(), clickType -> {
SimulatorGroup newParent = new SimulatorGroup();
newParent.add(subject);
newParent.add(element);
simulatorGroup.getElements().remove(element);
parent.getElements().remove(subject);
simulator.getElements().add(newParent);
back.open();
SimulatorWatcher.update(simulator);
});
}
List<String> lore = new ArrayList<>();
lore.add("§7Element count§8:§e " + elements.size());
lore.add("§7Tick§8:§e " + simulatorGroup.getBaseTick());
if (simulatorGroup.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(simulatorGroup.getMaterial(), "§eGroup", lore, simulatorGroup.isDisabled(), clickType -> {
simulatorGroup.add(subject); simulatorGroup.add(subject);
parent.getElements().remove(subject); parent.getElements().remove(subject);
back.open(); back.open();
SimulatorWatcher.update(simulator); SimulatorWatcher.update(simulator);
}); };
return simulatorGroup.toItem(player, invCallback, invCallback);
} }
} }

Datei anzeigen

@ -32,10 +32,7 @@ import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList; public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> {
import java.util.List;
public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> { //TODO Disolve group option ?
private final SimulatorGroup simulatorGroup; private final SimulatorGroup simulatorGroup;
private final SimulatorBaseGui back; private final SimulatorBaseGui back;
@ -64,16 +61,9 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> { /
back.open(); back.open();
})); }));
List<String> lore = new ArrayList<>(); inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
lore.add("§7Element count§8:§e " + data.size());
lore.add("§7Tick§8:§e " + simulatorGroup.getBaseTick());
if (simulatorGroup.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
inventory.setItem(4, new SWItem(simulatorGroup.getMaterial(), "§eGroup", lore, simulatorGroup.isDisabled(), clickType -> {
new SimulatorMaterialGui(player, simulator, simulatorGroup::getMaterial, simulatorGroup::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, simulatorGroup::getMaterial, simulatorGroup::setMaterial, this).open();
})); }, clickType -> {}));
inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(48, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open(); new SimulatorGroupSettingsGui(player, simulator, simulatorGroup, this).open();
@ -86,18 +76,7 @@ public class SimulatorGroupGui extends SimulatorPageGui<SimulatorElement<?>> { /
@Override @Override
public SWItem convert(SimulatorElement<?> element) { public SWItem convert(SimulatorElement<?> element) {
List<String> lore = new ArrayList<>(); return element.toItem(player, clickType -> {
lore.add("§7Phase count§8:§e " + element.getPhases().size());
lore.add("§7Tick§8:§e " + element.getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + element.getPosition().getX());
lore.add("§7Y§8:§e " + element.getPosition().getY());
lore.add("§7Z§8:§e " + element.getPosition().getZ());
if (element.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(element.getMaterial(), "§e" + element.getName(), lore, element.isDisabled(), clickType -> {
if (element instanceof TNTElement) { if (element instanceof TNTElement) {
new SimulatorTNTGui(player, simulator, (TNTElement) element, simulatorGroup, this).open(); new SimulatorTNTGui(player, simulator, (TNTElement) element, simulatorGroup, this).open();
} else if (element instanceof RedstoneElement) { } else if (element instanceof RedstoneElement) {

Datei anzeigen

@ -28,9 +28,7 @@ import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
public class SimulatorGroupSettingsGui extends SimulatorBaseGui { public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
@ -61,16 +59,9 @@ public class SimulatorGroupSettingsGui extends SimulatorBaseGui {
})); }));
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); inventory.setItem(4, simulatorGroup.toItem(player, clickType -> {
lore.add("§7Element count§8:§e " + simulatorGroup.getElements().size());
lore.add("§7Tick§8:§e " + simulatorGroup.getBaseTick());
if (simulatorGroup.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
inventory.setItem(4, new SWItem(simulatorGroup.getMaterial(), "§eGroup", lore, simulatorGroup.isDisabled(), clickType -> {
new SimulatorMaterialGui(player, simulator, simulatorGroup::getMaterial, simulatorGroup::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, simulatorGroup::getMaterial, simulatorGroup::setMaterial, this).open();
})); }, clickType -> {}));
// Base Tick // Base Tick
int baseTicks = simulatorGroup.getBaseTick(); int baseTicks = simulatorGroup.getBaseTick();

Datei anzeigen

@ -30,11 +30,7 @@ import de.steamwar.inventory.SWItem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList; public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {
import java.util.Iterator;
import java.util.List;
public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {//TODO Groupcreation
public SimulatorGui(Player player, Simulator simulator) { public SimulatorGui(Player player, Simulator simulator) {
super(player, simulator, 6 * 9, simulator.getElements()); super(player, simulator, 6 * 9, simulator.getElements());
@ -49,7 +45,7 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {//TODO Group
public void headerAndFooter() { public void headerAndFooter() {
simulator.getElements().removeIf(element -> element.getElements().isEmpty()); simulator.getElements().removeIf(element -> element.getElements().isEmpty());
inventory.setItem(4, new SWItem(simulator.getMaterial(), "§e" + simulator.getName(), clickType -> { inventory.setItem(4, simulator.toItem(player, clickType -> {
new SimulatorMaterialGui(player, simulator, simulator::getMaterial, simulator::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, simulator::getMaterial, simulator::setMaterial, this).open();
})); }));
inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> { inventory.setItem(49, new SWItem(Material.REPEATER, "§eSettings", clickType -> {
@ -59,21 +55,10 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {//TODO Group
@Override @Override
public SWItem convert(SimulatorGroup simulatorGroup) { public SWItem convert(SimulatorGroup simulatorGroup) {
List<SimulatorElement<?>> elements = simulatorGroup.getElements(); return simulatorGroup.toItem(player, clickType -> {
if (elements.size() == 1) { new SimulatorGroupGui(player, simulator, simulatorGroup, this).open();
SimulatorElement<?> element = elements.get(0); }, clickType -> {
List<String> lore = new ArrayList<>(); SimulatorElement<?> element = simulatorGroup.getElements().get(0);
lore.add("§7Phase count§8:§e " + element.getPhases().size());
lore.add("§7Tick§8:§e " + element.getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + element.getPosition().getX());
lore.add("§7Y§8:§e " + element.getPosition().getY());
lore.add("§7Z§8:§e " + element.getPosition().getZ());
if (element.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(element.getMaterial(), "§e" + element.getName(), lore, element.isDisabled(), clickType -> {
if (element instanceof TNTElement) { if (element instanceof TNTElement) {
new SimulatorTNTGui(player, simulator, (TNTElement) element, simulatorGroup,this).open(); new SimulatorTNTGui(player, simulator, (TNTElement) element, simulatorGroup,this).open();
} else if (element instanceof RedstoneElement) { } else if (element instanceof RedstoneElement) {
@ -81,16 +66,4 @@ public class SimulatorGui extends SimulatorPageGui<SimulatorGroup> {//TODO Group
} }
}); });
} }
List<String> lore = new ArrayList<>();
lore.add("§7Element count§8:§e " + elements.size());
lore.add("§7Tick§8:§e " + simulatorGroup.getBaseTick());
if (simulatorGroup.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
return new SWItem(simulatorGroup.getMaterial(), "§eGroup", lore, simulatorGroup.isDisabled(), clickType -> {
new SimulatorGroupGui(player, simulator, simulatorGroup, this).open();
});
}
} }

Datei anzeigen

@ -35,17 +35,16 @@ import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class SimulatorRedstoneGui extends SimulatorScrollGui<RedstonePhase> { public class SimulatorRedstoneGui extends SimulatorScrollGui<RedstonePhase> {
private final SimulatorGroup simulatorGroup; private final SimulatorGroup parent;
private final RedstoneElement redstone; private final RedstoneElement redstone;
private final SimulatorBaseGui back; private final SimulatorBaseGui back;
public SimulatorRedstoneGui(Player player, Simulator simulator, SimulatorGroup simulatorGroup, RedstoneElement redstone, SimulatorBaseGui back) { public SimulatorRedstoneGui(Player player, Simulator simulator, SimulatorGroup parent, RedstoneElement redstone, SimulatorBaseGui back) {
super(player, simulator, 6 * 9, redstone.getPhases()); super(player, simulator, 6 * 9, redstone.getPhases());
this.simulatorGroup = simulatorGroup; this.parent = parent;
this.redstone = redstone; this.redstone = redstone;
this.back = back; this.back = back;
} }
@ -66,22 +65,28 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<RedstonePhase> {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
if (parent.getElements().contains(redstone)) {
back.open(); back.open();
} else {
SimulatorGroup newParent = simulator.getElements().stream()
.filter(simulatorGroup -> simulatorGroup.getElements().contains(redstone))
.findFirst()
.orElse(null);
if (newParent == null) {
player.closeInventory();
return;
}
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
if (newParent.getElements().size() == 1) {
simulatorGui.open();
} else {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
}
}
})); }));
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); inventory.setItem(4, redstone.toItem(player, clickType -> {
lore.add("§7Activation count§8:§e " + data.size());
lore.add("§7Tick§8:§e " + redstone.getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + redstone.getPosition().getX());
lore.add("§7Y§8:§e " + redstone.getPosition().getY());
lore.add("§7Z§8:§e " + redstone.getPosition().getZ());
if (redstone.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
inventory.setItem(4, new SWItem(redstone.getMaterial(), "§eTNT", lore, redstone.isDisabled(), clickType -> {
new SimulatorMaterialGui(player, simulator, redstone::getMaterial, redstone::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, redstone::getMaterial, redstone::setMaterial, this).open();
})); }));
@ -92,7 +97,7 @@ public class SimulatorRedstoneGui extends SimulatorScrollGui<RedstonePhase> {
//Group chooser //Group chooser
inventory.setItem(49, new SWItem(Material.LEAD, "§eMove", clickType -> { inventory.setItem(49, new SWItem(Material.LEAD, "§eMove", clickType -> {
new SimulatorGroupChooserGui(player, simulator, simulator.getElements().stream().filter( e -> e != simulatorGroup).collect(Collectors.toList()), redstone, simulatorGroup, this).open(); new SimulatorGroupChooserGui(player, simulator, redstone, parent, this).open();
})); }));
//Enable/Disable //Enable/Disable

Datei anzeigen

@ -62,7 +62,7 @@ public class SimulatorRedstonePhaseSettingsGui extends SimulatorBaseGui {
})); }));
// Material Chooser // Material Chooser
inventory.setItem(4, new SWItem(redstoneElement.getMaterial(), "§eRedstone", clickType -> { inventory.setItem(4, redstoneElement.toItem(player, clickType -> {
new SimulatorMaterialGui(player, simulator, redstoneElement::getMaterial, redstoneElement::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, redstoneElement::getMaterial, redstoneElement::setMaterial, this).open();
})); }));

Datei anzeigen

@ -60,14 +60,7 @@ public class SimulatorRedstoneSettingsGui extends SimulatorBaseGui {
})); }));
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); inventory.setItem(4, redstone.toItem(player, clickType -> {
lore.add("§7Activation count§8:§e " + redstone.getPhases().size());
lore.add("§7Tick§8:§e " + redstone.getBaseTick());
if (redstone.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
inventory.setItem(4, new SWItem(redstone.getMaterial(), "§eRedstone", lore, redstone.isDisabled(), clickType -> {
new SimulatorMaterialGui(player, simulator, redstone::getMaterial, redstone::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, redstone::getMaterial, redstone::setMaterial, this).open();
})); }));

Datei anzeigen

@ -51,7 +51,7 @@ public class SimulatorSettingsGui extends SimulatorBaseGui {
})); }));
// Material Chooser // Material Chooser
inventory.setItem(4, new SWItem(simulator.getMaterial(), "§e" + simulator.getName(), clickType -> { inventory.setItem(4, simulator.toItem(player, clickType -> {
new SimulatorMaterialGui(player, simulator, simulator::getMaterial, simulator::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, simulator::getMaterial, simulator::setMaterial, this).open();
})); }));

Datei anzeigen

@ -67,22 +67,28 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
// Back Arrow // Back Arrow
inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> { inventory.setItem(0, new SWItem(Material.ARROW, "§eBack", clickType -> {
if (parent.getElements().contains(tnt)) {
back.open(); back.open();
} else {
SimulatorGroup newParent = simulator.getElements().stream()
.filter(simulatorGroup -> simulatorGroup.getElements().contains(tnt))
.findFirst()
.orElse(null);
if (newParent == null) {
player.closeInventory();
return;
}
SimulatorGui simulatorGui = new SimulatorGui(player, simulator);
if (newParent.getElements().size() == 1) {
simulatorGui.open();
} else {
new SimulatorGroupGui(player, simulator, newParent, simulatorGui).open();
}
}
})); }));
// Material Chooser // Material Chooser
List<String> lore = new ArrayList<>(); inventory.setItem(4, tnt.toItem(player, clickType -> {
lore.add("§7Phase count§8:§e " + data.size());
lore.add("§7Tick§8:§e " + tnt.getBaseTick());
lore.add("");
lore.add("§7X§8:§e " + tnt.getPosition().getX());
lore.add("§7Y§8:§e " + tnt.getPosition().getY());
lore.add("§7Z§8:§e " + tnt.getPosition().getZ());
if (tnt.isDisabled()) {
lore.add("");
lore.add("§cDisabled");
}
inventory.setItem(4, new SWItem(tnt.getMaterial(), "§eTNT", lore, tnt.isDisabled(), clickType -> {
new SimulatorMaterialGui(player, simulator, tnt::getMaterial, tnt::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, tnt::getMaterial, tnt::setMaterial, this).open();
})); }));
@ -90,7 +96,7 @@ public class SimulatorTNTGui extends SimulatorScrollGui<TNTPhase> {
new SimulatorTNTSettingsGui(player, simulator, tnt, this).open(); new SimulatorTNTSettingsGui(player, simulator, tnt, this).open();
})); }));
inventory.setItem(49, new SWItem(Material.LEAD, "§eMove", clickType -> { inventory.setItem(49, new SWItem(Material.LEAD, "§eMove", clickType -> {
new SimulatorGroupChooserGui(player, simulator, simulator.getElements().stream().filter( e -> e != parent).collect(Collectors.toList()), tnt, parent, this).open(); new SimulatorGroupChooserGui(player, simulator, tnt, parent, this).open();
})); }));
inventory.setItem(50, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> { inventory.setItem(50, new SWItem(tnt.isDisabled() ? Material.ENDER_PEARL : Material.ENDER_EYE, tnt.isDisabled() ? "§cDisabled" : "§aEnabled", clickType -> {
tnt.setDisabled(!tnt.isDisabled()); tnt.setDisabled(!tnt.isDisabled());

Datei anzeigen

@ -62,7 +62,7 @@ public class SimulatorTNTPhaseSettingsGui extends SimulatorBaseGui {
})); }));
// Material Chooser // Material Chooser
inventory.setItem(4, new SWItem(tntElement.getMaterial(), "§TNT", clickType -> { inventory.setItem(4, tntElement.toItem(player, clickType -> {
new SimulatorMaterialGui(player, simulator, tntElement::getMaterial, tntElement::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, tntElement::getMaterial, tntElement::setMaterial, this).open();
})); }));

Datei anzeigen

@ -68,7 +68,7 @@ public class SimulatorTNTSettingsGui extends SimulatorBaseGui {
lore.add(""); lore.add("");
lore.add("§cDisabled"); lore.add("§cDisabled");
} }
inventory.setItem(4, new SWItem(tnt.getMaterial(), "§eTNT", lore, tnt.isDisabled(), clickType -> { inventory.setItem(4, tnt.toItem(player, clickType -> {
new SimulatorMaterialGui(player, simulator, tnt::getMaterial, tnt::setMaterial, this).open(); new SimulatorMaterialGui(player, simulator, tnt::getMaterial, tnt::setMaterial, this).open();
})); }));