SteamWar/BauSystem
Archiviert
13
0

Tracer-entity #147

Manuell gemergt
YoyoNow hat 47 Commits von Tracer-entity nach master 2020-12-27 22:16:04 +01:00 zusammengeführt
Nur Änderungen aus Commit 5a881be746 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -22,7 +22,6 @@
package de.steamwar.bausystem.tracer.show.mode; package de.steamwar.bausystem.tracer.show.mode;
import de.steamwar.bausystem.tracer.*; import de.steamwar.bausystem.tracer.*;
import de.steamwar.bausystem.tracer.show.ShowMode;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -30,32 +29,20 @@ import org.bukkit.util.Vector;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class Advanced implements ShowMode { public class Advanced extends Basic {
private final Player player; private final Player player;
private Map<RoundedTNTPosition, AbstractTraceEntity> tntEntityMap = new HashMap<>();
private Map<RoundedTNTPosition, AbstractTraceEntity> updateEntityMap = new HashMap<>(); private Map<RoundedTNTPosition, AbstractTraceEntity> updateEntityMap = new HashMap<>();
public Advanced(Player player) { public Advanced(Player player) {
super(player);
this.player = player; this.player = player;
} }
@Override @Override
public void show(TNTPosition position) { public void show(TNTPosition position) {
RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position); super.show(position);
if (tntEntityMap.containsKey(roundedTNTPosition)) {
return;
}
switch (Core.getVersion()) {
case 12:
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position, player));
break;
default:
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position, player));
break;
}
if (position.getPrevious() == null) return; if (position.getPrevious() == null) return;
@ -102,11 +89,7 @@ public class Advanced implements ShowMode {
@Override @Override
public void hide() { public void hide() {
tntEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> { super.hide();
abstractTraceEntity.hide(player);
abstractTraceEntity.remove();
});
tntEntityMap.clear();
updateEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> { updateEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> {
abstractTraceEntity.hide(player); abstractTraceEntity.hide(player);