SteamWar/BauSystem2.0
Archiviert
12
0

Fix some NPE's
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-02-25 14:29:26 +01:00
Ursprung 2dd5e16bda
Commit 1086808cf0
2 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -88,14 +88,22 @@ public class TNTSimulator {
} }
public void show(Player player) { public void show(Player player) {
if (!players.contains(player)) {
entityServer.addPlayer(player); entityServer.addPlayer(player);
players.add(player); players.add(player);
} }
}
public void hide(Player player) { public void hide(Player player) {
if (players.contains(player)) {
entityServer.removePlayer(player); entityServer.removePlayer(player);
players.remove(player); players.remove(player);
} }
}
void _hide(Player player) {
players.remove(player);
}
public List<REntity> getEntities() { public List<REntity> getEntities() {
return tntElementList.stream().flatMap(element -> element.getEntities().stream()).collect(Collectors.toList()); return tntElementList.stream().flatMap(element -> element.getEntities().stream()).collect(Collectors.toList());

Datei anzeigen

@ -88,6 +88,9 @@ public class TNTSimulatorListener implements Listener {
@EventHandler @EventHandler
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
SimulatorCursor.hide(event.getPlayer(), null); SimulatorCursor.hide(event.getPlayer(), null);
SimulatorStorage.getSimulatorNames().forEach(s -> {
SimulatorStorage.getSimulator(s)._hide(event.getPlayer());
});
} }
@EventHandler @EventHandler