From 03a312274f021fe06b8ab87c35b9085654c46e1f Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Mon, 9 May 2022 19:57:06 +0200 Subject: [PATCH] Added and extra entry to the output byte array to clarify which data the plugin message was about --- src/main/java/com/alttd/datalock/EventListener.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/alttd/datalock/EventListener.java b/src/main/java/com/alttd/datalock/EventListener.java index 4ec0db5..a12cb6a 100644 --- a/src/main/java/com/alttd/datalock/EventListener.java +++ b/src/main/java/com/alttd/datalock/EventListener.java @@ -96,6 +96,7 @@ public class EventListener { if (lockSet.contains(lock)) { //An entry from this server already exists, so we can say that it's locked out.writeBoolean(true); + out.writeUTF(lock.getData()); serverConnection.sendPluginMessage(identifier, out.toByteArray()); return; } @@ -113,6 +114,7 @@ public class EventListener { else { //An entry from another server exists, so we can't lock it out.writeBoolean(false); + out.writeUTF(lock.getData()); serverConnection.sendPluginMessage(identifier, out.toByteArray()); queueLock(queuedLocks.getOrDefault(identifier, new HashSet<>()), identifier, lock, serverConnection); return; @@ -124,6 +126,7 @@ public class EventListener { channelLockMap.put(identifier, lockSet); out.writeBoolean(true); + out.writeUTF(lock.getData()); serverConnection.sendPluginMessage(identifier, out.toByteArray()); } @@ -139,6 +142,7 @@ public class EventListener { else out.writeBoolean(false); //The data is not locked + out.writeUTF(lock.getData()); serverConnection.sendPluginMessage(identifier, out.toByteArray()); } @@ -150,6 +154,7 @@ public class EventListener { if (lockSet.contains(lock)) //Lock is in the list, but it's made by this server, so we can unlock it { out.writeBoolean(true); + out.writeUTF(lock.getData()); lockSet.remove(lock); channelLockMap.put(identifier, lockSet); serverConnection.sendPluginMessage(identifier, out.toByteArray()); @@ -161,6 +166,7 @@ public class EventListener { if (first.isEmpty()) //There is no entry with this data, so we can say it's unlocked { out.writeBoolean(true); + out.writeUTF(lock.getData()); serverConnection.sendPluginMessage(identifier, out.toByteArray()); queueNextLock(lockSet, lock, identifier); return; @@ -168,6 +174,7 @@ public class EventListener { //There is an entry with this data, but it's not owned by this server, so we can't unlock it out.writeBoolean(false); + out.writeUTF(lock.getData()); serverConnection.sendPluginMessage(identifier, out.toByteArray()); }