SteamWar/BauSystem
Archiviert
13
0

Simplify Advanced

Dieser Commit ist enthalten in:
jojo 2020-12-25 13:32:10 +01:00
Ursprung f554f595f8
Commit 5a881be746

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);