mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-01 02:58:02 +00:00
Plugin messaging API tweaks:
- Behavior on unknown commands made more consistent (don't send any messages). - ServerPlayers message requires a type of PLAYERS/COUNT.
This commit is contained in:
parent
8e6447c8e0
commit
85eea7746e
@ -200,14 +200,25 @@ public class RedisBungeeListener implements Listener {
|
|||||||
out.writeLong(RedisBungee.getApi().getLastOnline(plugin.getUuidTranslator().getTranslatedUuid(user, true)));
|
out.writeLong(RedisBungee.getApi().getLastOnline(plugin.getUuidTranslator().getTranslatedUuid(user, true)));
|
||||||
break;
|
break;
|
||||||
case "ServerPlayers":
|
case "ServerPlayers":
|
||||||
String type1 = "COUNT";
|
String type1 = in.readUTF();
|
||||||
try {
|
|
||||||
type1 = in.readUTF();
|
|
||||||
} catch (Exception e) {}
|
|
||||||
out.writeUTF("ServerPlayers");
|
out.writeUTF("ServerPlayers");
|
||||||
Multimap<String, UUID> multimap = RedisBungee.getApi().getServerToPlayers();
|
Multimap<String, UUID> multimap = RedisBungee.getApi().getServerToPlayers();
|
||||||
|
|
||||||
boolean includesUsers = type1.equals("PLAYERS");
|
boolean includesUsers;
|
||||||
|
|
||||||
|
switch (type1) {
|
||||||
|
case "COUNT":
|
||||||
|
includesUsers = false;
|
||||||
|
break;
|
||||||
|
case "PLAYERS":
|
||||||
|
includesUsers = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// TODO: Should I raise an error?
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
out.writeUTF(type1);
|
||||||
|
|
||||||
if (includesUsers) {
|
if (includesUsers) {
|
||||||
Multimap<String, String> human = HashMultimap.create();
|
Multimap<String, String> human = HashMultimap.create();
|
||||||
@ -230,7 +241,7 @@ public class RedisBungeeListener implements Listener {
|
|||||||
out.writeUTF(RedisBungee.getConfiguration().getServerId());
|
out.writeUTF(RedisBungee.getConfiguration().getServerId());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
((Server) event.getSender()).sendData("RedisBungee", out.toByteArray());
|
((Server) event.getSender()).sendData("RedisBungee", out.toByteArray());
|
||||||
|
Loading…
Reference in New Issue
Block a user