diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java index 5a83ae6..269fcbd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java @@ -23,6 +23,7 @@ package de.steamwar.bausystem.tracer.show.mode; import de.steamwar.bausystem.tracer.*; import de.steamwar.core.Core; +import de.steamwar.core.VersionedCallable; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -60,30 +61,16 @@ public class Advanced extends Basic { if (updateEntityMap.containsKey(updatePointPosition)) { return; } - - switch (Core.getVersion()) { - case 12: - updateEntityMap.put(updatePointPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointY).getLocation(), player)); - break; - default: - updateEntityMap.put(updatePointPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointY).getLocation(), player)); - break; - } + updateEntityMap.put(updatePointPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.createUpdatePoint(player.getWorld(), updatePointY, player), 8), + new VersionedCallable<>(() -> TNTTracer_15.createUpdatePoint(player.getWorld(), updatePointY, player), 14))); } if (!position.getLocation().equals(updatePointXZ)) { RoundedTNTPosition updatePointPosition = new RoundedTNTPosition(updatePointXZ); if (updateEntityMap.containsKey(updatePointPosition)) { return; } - - switch (Core.getVersion()) { - case 12: - updateEntityMap.put(updatePointPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointXZ).getLocation(), player)); - break; - default: - updateEntityMap.put(updatePointPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointXZ).getLocation(), player)); - break; - } + updateEntityMap.put(updatePointPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.createUpdatePoint(player.getWorld(), updatePointXZ, player), 8), + new VersionedCallable<>(() -> TNTTracer_15.createUpdatePoint(player.getWorld(), updatePointXZ, player), 14))); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java index 8326b6e..a9a94b2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Basic.java @@ -3,6 +3,7 @@ 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 de.steamwar.core.VersionedCallable; import org.bukkit.entity.Player; import java.util.HashMap; @@ -24,15 +25,8 @@ public class Basic implements ShowMode { if (tntEntityMap.containsKey(roundedTNTPosition)) { return; } - - switch (Core.getVersion()) { - case 12: - tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded())); - break; - default: - tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded())); - break; - } + tntEntityMap.put(roundedTNTPosition, VersionedCallable.call(new VersionedCallable<>(() -> TNTTracer_12.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded()), 8), + new VersionedCallable<>(() -> TNTTracer_15.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded()), 14))); } @Override