2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +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:
Tux 2015-06-21 18:11:27 -04:00
parent 8e6447c8e0
commit 85eea7746e

View File

@ -200,14 +200,25 @@ public class RedisBungeeListener implements Listener {
out.writeLong(RedisBungee.getApi().getLastOnline(plugin.getUuidTranslator().getTranslatedUuid(user, true)));
break;
case "ServerPlayers":
String type1 = "COUNT";
try {
type1 = in.readUTF();
} catch (Exception e) {}
String type1 = in.readUTF();
out.writeUTF("ServerPlayers");
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) {
Multimap<String, String> human = HashMultimap.create();
@ -230,7 +241,7 @@ public class RedisBungeeListener implements Listener {
out.writeUTF(RedisBungee.getConfiguration().getServerId());
break;
default:
break;
return;
}
((Server) event.getSender()).sendData("RedisBungee", out.toByteArray());