Hopefully fixed sending one plugin message per player online on the server the plugin message originated from
This commit is contained in:
parent
54ee7dab93
commit
b0d84cf5e4
|
|
@ -129,6 +129,9 @@ public class EventListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isValid(channel.toLowerCase(), data))
|
||||||
|
return;
|
||||||
|
|
||||||
if (Config.DEBUG)
|
if (Config.DEBUG)
|
||||||
Logger.info("Plugin message channel: [%]", channel.toLowerCase());
|
Logger.info("Plugin message channel: [%]", channel.toLowerCase());
|
||||||
|
|
||||||
|
|
@ -139,6 +142,23 @@ public class EventListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final HashMap<String, Long> validMap = new HashMap<>();
|
||||||
|
private synchronized boolean isValid(String channel, String data) {
|
||||||
|
String key = channel + data;
|
||||||
|
long currentTime = new Date().getTime();
|
||||||
|
if (validMap.containsKey(key)) {
|
||||||
|
Long time = validMap.get(key);
|
||||||
|
if (time < (currentTime - 1000)) {
|
||||||
|
validMap.remove(key);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
validMap.put(key, currentTime);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void tryLock(ChannelIdentifier identifier, HashSet<Lock> lockSet, String data, ServerConnection serverConnection) {
|
private void tryLock(ChannelIdentifier identifier, HashSet<Lock> lockSet, String data, ServerConnection serverConnection) {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
out.writeUTF("try-lock-result");
|
out.writeUTF("try-lock-result");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user