Dieser Commit ist enthalten in:
Ursprung
f1f783f0ec
Commit
be0f15891b
@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
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.show.SimulatorEntityShowMode;
|
||||||
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
|
import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement;
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
|
@ -72,6 +72,12 @@ public class SimulatorStorage implements Enable, Disable {
|
|||||||
return tntSimulators.get(name);
|
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) {
|
public static TNTSimulator getSimulator(ItemStack itemStack) {
|
||||||
if (itemStack == null) {
|
if (itemStack == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -109,7 +109,7 @@ public class TNTElementGUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Runnable editObserver = () -> {
|
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));
|
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 = () -> {
|
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 -> {
|
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()) {
|
if (clickType.isShiftClick()) {
|
||||||
|
@ -60,7 +60,7 @@ public class TNTGroupEditGUI {
|
|||||||
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_LORE", player));
|
List<String> lore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_LORE", player));
|
||||||
|
|
||||||
Runnable editObserver = () -> {
|
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));
|
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));
|
ChangeMaterial.show(inv, player, 14, tntGroup, Material.BARREL, () -> open(player, tntGroup, back));
|
||||||
|
@ -121,7 +121,7 @@ public class TNTSimulatorGui {
|
|||||||
currentTntSimulator.getTntElementList().clear();
|
currentTntSimulator.getTntElementList().clear();
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
} else {
|
} else {
|
||||||
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand());
|
TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player);
|
||||||
tntSimulator.remove(currentTntGroup);
|
tntSimulator.remove(currentTntGroup);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren