This commit is contained in:
D4rkr34lm
2025-05-08 18:02:56 +02:00
parent 42c9d6d612
commit 7a000efb93
@@ -52,13 +52,7 @@ public class RCursorManager implements Listener {
} }
void registerCursor(RCursor cursor) { void registerCursor(RCursor cursor) {
SoftReference<RCursor> currentPlayerCursorRef = activeCursors.get(cursor.getOwner()); closeCursorOf(cursor.getOwner());
if(currentPlayerCursorRef != null) {
RCursor currentCursor = currentPlayerCursorRef.get();
if(currentCursor != null) {
currentCursor.close();
};
};
activeCursors.put(cursor.getOwner(), new SoftReference<>(cursor)); activeCursors.put(cursor.getOwner(), new SoftReference<>(cursor));
} }
@@ -67,6 +61,16 @@ public class RCursorManager implements Listener {
activeCursors.remove(cursor.getOwner()); activeCursors.remove(cursor.getOwner());
} }
private void closeCursorOf(Player player) {
SoftReference<RCursor> currentPlayerCursorRef = activeCursors.get(player);
if(currentPlayerCursorRef != null) {
RCursor currentCursor = currentPlayerCursorRef.get();
if(currentCursor != null) {
currentCursor.close();
};
};
}
private void updateCursor(Player player) { private void updateCursor(Player player) {
if (!activeCursors.containsKey(player)) { if (!activeCursors.containsKey(player)) {