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;
import de.steamwar.bausystem.tracer.*;
import de.steamwar.bausystem.tracer.show.ShowMode;
import de.steamwar.core.Core;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@ -30,32 +29,20 @@ import org.bukkit.util.Vector;
import java.util.HashMap;
import java.util.Map;
public class Advanced implements ShowMode {
public class Advanced extends Basic {
private final Player player;
private Map<RoundedTNTPosition, AbstractTraceEntity> tntEntityMap = new HashMap<>();
private Map<RoundedTNTPosition, AbstractTraceEntity> updateEntityMap = new HashMap<>();
public Advanced(Player player) {
super(player);
this.player = player;
}
@Override
public void show(TNTPosition position) {
RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(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;
}
super.show(position);
if (position.getPrevious() == null) return;
@ -102,11 +89,7 @@ public class Advanced implements ShowMode {
@Override
public void hide() {
tntEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> {
abstractTraceEntity.hide(player);
abstractTraceEntity.remove();
});
tntEntityMap.clear();
super.hide();
updateEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> {
abstractTraceEntity.hide(player);