Fix synchronization Deadlock
Dieser Commit ist enthalten in:
Ursprung
df72a08f99
Commit
7e5d690c9d
@ -23,6 +23,8 @@ public class PlayerTraceCache_15 {
|
|||||||
private float[] pLocation;
|
private float[] pLocation;
|
||||||
private float locationThreshold = square(10.0F);
|
private float locationThreshold = square(10.0F);
|
||||||
|
|
||||||
|
private boolean hiding = false;
|
||||||
|
|
||||||
public PlayerTraceCache_15() {
|
public PlayerTraceCache_15() {
|
||||||
this.pLocation = new float[]{0.0F, 0.0F, 0.0F};
|
this.pLocation = new float[]{0.0F, 0.0F, 0.0F};
|
||||||
}
|
}
|
||||||
@ -49,7 +51,8 @@ public class PlayerTraceCache_15 {
|
|||||||
return false;
|
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;
|
if (positions.length == 0 || positions.length % 3 != 0) return;
|
||||||
for (int i = 0; i < positions.length; i += 3) {
|
for (int i = 0; i < positions.length; i += 3) {
|
||||||
float x = positions[i + 0];
|
float x = positions[i + 0];
|
||||||
@ -84,6 +87,7 @@ public class PlayerTraceCache_15 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void hide(Player player) {
|
public synchronized void hide(Player player) {
|
||||||
|
hiding = true;
|
||||||
if (positions.length == 0 || positions.length % 3 != 0) return;
|
if (positions.length == 0 || positions.length % 3 != 0) return;
|
||||||
for (int i = 0; i < positions.length; i += 3) {
|
for (int i = 0; i < positions.length; i += 3) {
|
||||||
float x = positions[i + 0];
|
float x = positions[i + 0];
|
||||||
@ -102,6 +106,7 @@ public class PlayerTraceCache_15 {
|
|||||||
hideBlock(player, x, y + 0.49F, z);
|
hideBlock(player, x, y + 0.49F, z);
|
||||||
}
|
}
|
||||||
updatePoints = new float[0];
|
updatePoints = new float[0];
|
||||||
|
hiding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showCorner(Player player, float x, float y, float z, Particle particle) {
|
private static void showCorner(Player player, float x, float y, float z, Particle particle) {
|
||||||
|
@ -29,7 +29,7 @@ public class TNTTracer12 {
|
|||||||
TNTTracer_12.remove(locations, tnt);
|
TNTTracer_12.remove(locations, tnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void start(){
|
public static void start() {
|
||||||
if(status == Status.RECORD)
|
if(status == Status.RECORD)
|
||||||
return;
|
return;
|
||||||
stop();
|
stop();
|
||||||
@ -39,7 +39,7 @@ public class TNTTracer12 {
|
|||||||
task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), TNTTracer12::run, 1, 1);
|
task = Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), TNTTracer12::run, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int show(){
|
public static int show() {
|
||||||
if(status == Status.SHOW)
|
if(status == Status.SHOW)
|
||||||
return printedLocs.size();
|
return printedLocs.size();
|
||||||
stop();
|
stop();
|
||||||
@ -48,7 +48,7 @@ public class TNTTracer12 {
|
|||||||
return TNTTracer_12.show(locations, printedLocs);
|
return TNTTracer_12.show(locations, printedLocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void stop(){
|
public static void stop() {
|
||||||
status = Status.IDLE;
|
status = Status.IDLE;
|
||||||
if(task != null)
|
if(task != null)
|
||||||
task.cancel();
|
task.cancel();
|
||||||
|
@ -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")));
|
Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§7Automatischer TNT-Tracer §8- §aAufnahme gestoppt")));
|
||||||
status = Status.IDLE_AUTO;
|
status = Status.IDLE_AUTO;
|
||||||
}
|
}
|
||||||
|
ShowManager.dirty();
|
||||||
if (task != null) task.cancel();
|
if (task != null) task.cancel();
|
||||||
if (tntFrames.getLast().finish()) {
|
if (tntFrames.getLast().finish()) {
|
||||||
tntFrames.removeLast();
|
tntFrames.removeLast();
|
||||||
|
@ -15,6 +15,14 @@ public class ShowManager {
|
|||||||
TNTTracer15.worldInit();
|
TNTTracer15.worldInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void dirty() {
|
||||||
|
for (Map.Entry<Player, ShowStatus> entry : showMap.entrySet()) {
|
||||||
|
if (entry.getValue().getShow() != ShowStatus.Show.NONE) {
|
||||||
|
entry.getValue().dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void remove(Player player) {
|
public static void remove(Player player) {
|
||||||
showMap.remove(player);
|
showMap.remove(player);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public class ShowStatus {
|
|||||||
|
|
||||||
private Player p;
|
private Player p;
|
||||||
|
|
||||||
private boolean dirty = false;
|
boolean dirty = false;
|
||||||
|
|
||||||
public ShowStatus(Player p) {
|
public ShowStatus(Player p) {
|
||||||
this.p = p;
|
this.p = p;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren