SteamWar/BauSystem2.0
Archiviert
12
0

Update TNTSimulator.edit to better reflect interactability
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-04-30 12:39:11 +02:00
Ursprung c3838138b4
Commit 4dafaab5d9

Datei anzeigen

@ -167,7 +167,30 @@ public class TNTSimulator {
if (elements.size() == 1) {
TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
} else {
TNTSimulatorGui.open(player, null, null, () -> elements, null);
List<TNTGroup> tntGroups = tntElementList.stream().filter(TNTGroup.class::isInstance).map(TNTGroup.class::cast).collect(Collectors.toList());
List<SimulatorElement> newElementList = new ArrayList<>();
for (TNTGroup tntGroup : tntGroups) {
if (new HashSet<>(elements).containsAll(tntGroup.getElements())) {
newElementList.add(tntGroup);
elements.removeAll(tntGroup.getElements());
}
}
newElementList.addAll(elements);
if (newElementList.size() == 1) {
SimulatorElement element = newElementList.get(0);
if (element instanceof TNTGroup) {
TNTGroup tntGroup = (TNTGroup) element;
TNTSimulatorGui.open(player, null, tntGroup, () -> {
List<SimulatorElement> elementList = new ArrayList<>();
elementList.addAll(tntGroup.getElements());
return elementList;
}, null);
} else {
TNTElementGUI.open(player, (TNTElement) elements.get(0), null);
}
} else {
TNTSimulatorGui.open(player, null, null, () -> newElementList, null);
}
}
return;
}