SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'TNTTracer' (#74) from TNTTracer into master

Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2020-07-19 15:27:33 +02:00
Commit 32fbe9ddf3
7 geänderte Dateien mit 21 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,8 @@ public class PlayerTraceCache_15 {
private float[] pLocation;
private float locationThreshold = square(10.0F);
private boolean hiding = false;
public PlayerTraceCache_15() {
this.pLocation = new float[]{0.0F, 0.0F, 0.0F};
}
@ -49,7 +51,8 @@ public class PlayerTraceCache_15 {
return false;
}
public synchronized void show(Player player, TNTShowCallback_15.ShowMode showMode) {
public void show(Player player, TNTShowCallback_15.ShowMode showMode) {
if (hiding) return;
if (positions.length == 0 || positions.length % 3 != 0) return;
for (int i = 0; i < positions.length; i += 3) {
float x = positions[i + 0];
@ -84,6 +87,7 @@ public class PlayerTraceCache_15 {
}
public synchronized void hide(Player player) {
hiding = true;
if (positions.length == 0 || positions.length % 3 != 0) return;
for (int i = 0; i < positions.length; i += 3) {
float x = positions[i + 0];
@ -102,6 +106,7 @@ public class PlayerTraceCache_15 {
hideBlock(player, x, y + 0.49F, z);
}
updatePoints = new float[0];
hiding = false;
}
private static void showCorner(Player player, float x, float y, float z, Particle particle) {

Datei anzeigen

@ -326,6 +326,7 @@ public class TNTTracer15 {
Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§7Automatischer TNT-Tracer §8- §aAufnahme gestoppt")));
status = Status.IDLE_AUTO;
}
ShowManager.dirty();
if (task != null) task.cancel();
if (tntFrames.getLast().finish()) {
tntFrames.removeLast();

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.bausystem.tracer.trace;
import de.steamwar.bausystem.tracer.TNTTracer15;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.HashMap;
@ -15,6 +16,14 @@ public class ShowManager {
TNTTracer15.worldInit();
}
public static void dirty() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (showMap.get(player).getShow() != ShowStatus.Show.NONE) {
showMap.get(player).dirty = true;
}
}
}
public static void remove(Player player) {
showMap.remove(player);
}

Datei anzeigen

@ -16,7 +16,7 @@ public class ShowStatus {
private Player p;
private boolean dirty = false;
boolean dirty = false;
public ShowStatus(Player p) {
this.p = p;

Datei anzeigen

@ -50,7 +50,6 @@ public class TNTFrame {
private void delete(TNTPrimed tntPrimed, boolean delete) {
if (aliveTNT == null) return;
TNTTrace tntTrace = aliveTNT.get(tntPrimed);
tntTrace.addLocation(tntPrimed.getLocation());
if (delete) {
aliveTNT.remove(tntPrimed);
}