SteamWar/BauSystem2.0
Archiviert
12
0

Fix offhand simulator
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-07-18 16:25:26 +02:00
Ursprung f1f783f0ec
Commit be0f15891b
5 geänderte Dateien mit 10 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.bausystem.features.simulator;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity;
import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode;
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
import lombok.experimental.UtilityClass;

Datei anzeigen

@ -72,6 +72,12 @@ public class SimulatorStorage implements Enable, Disable {
return tntSimulators.get(name);
}
public static TNTSimulator getSimulator(Player player) {
TNTSimulator current = getSimulator(player.getInventory().getItemInMainHand());
if (current != null) return current;
return getSimulator(player.getInventory().getItemInOffHand());
}
public static TNTSimulator getSimulator(ItemStack itemStack) {
if (itemStack == null) {
return null;

Datei anzeigen

@ -109,7 +109,7 @@ public class TNTElementGUI {
}
Runnable editObserver = () -> {
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand());
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player);
ChangePosition.show(inv, player, tntSimulator, tntElement, tntElement::getOwnPosition, x -> x - tntElement.getParentPosition().getX(), y -> y - tntElement.getParentPosition().getY(), z -> z - tntElement.getParentPosition().getZ(), () -> editLocation(player, tntElement, back));
@ -286,7 +286,7 @@ public class TNTElementGUI {
}
Runnable editObserver = () -> {
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand());
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player);
inv.setItem(19, new SWItem(tntElement.getOrder(), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ACTIVATED_NAME", player), OrderUtils.orderList(tntElement.getOrder(), player), false, clickType -> {
if (clickType.isShiftClick()) {

Datei anzeigen

@ -60,7 +60,7 @@ public class TNTGroupEditGUI {
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_LORE", player));
Runnable editObserver = () -> {
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand());
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player);
ChangePosition.show(inv, player, tntSimulator, tntGroup, tntGroup::getPosition, UnaryOperator.identity(), UnaryOperator.identity(), UnaryOperator.identity(), () -> open(player, tntGroup, back));
ChangeMaterial.show(inv, player, 14, tntGroup, Material.BARREL, () -> open(player, tntGroup, back));

Datei anzeigen

@ -121,7 +121,7 @@ public class TNTSimulatorGui {
currentTntSimulator.getTntElementList().clear();
player.closeInventory();
} else {
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand());
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player);
tntSimulator.remove(currentTntGroup);
}
}));