mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
Initial support for BungeeCord 1.7 server list ping changes.
This commit is contained in:
parent
bce3f0ffb7
commit
23944f7313
4
pom.xml
4
pom.xml
@ -14,7 +14,7 @@
|
||||
|
||||
<groupId>com.imaginarycode.minecraft</groupId>
|
||||
<artifactId>RedisBungee</artifactId>
|
||||
<version>0.2-SNAPSHOT</version>
|
||||
<version>0.2.1-SNAPSHOT</version>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
@ -106,7 +106,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.6.2-SNAPSHOT</version>
|
||||
<version>1.7-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
@ -319,8 +319,17 @@ public class RedisBungee extends Plugin implements Listener {
|
||||
@EventHandler
|
||||
public void onPing(ProxyPingEvent event) {
|
||||
ServerPing old = event.getResponse();
|
||||
int players = getCount();
|
||||
ServerPing newResponse = new ServerPing(old.getProtocolVersion(), old.getGameVersion(), old.getMotd(), players, old.getMaxPlayers());
|
||||
event.setResponse(newResponse);
|
||||
List<ServerPing.PlayerInfo> players = new ArrayList<>();
|
||||
for (String player : getPlayers()) {
|
||||
// TODO: Find a better way of doing the UUIDs - right now I'm simply flunking it rather badly.
|
||||
players.add(new ServerPing.PlayerInfo(player, new UUID(player.hashCode() + System.currentTimeMillis(), player.hashCode() + System.nanoTime()).toString()));
|
||||
}
|
||||
ServerPing reply = new ServerPing();
|
||||
reply.setPlayers(new ServerPing.Players(players.size(), old.getPlayers().getMax()));
|
||||
reply.setSample((ServerPing.PlayerInfo[]) players.toArray());
|
||||
reply.setDescription(old.getDescription());
|
||||
reply.setFavicon(old.getFavicon());
|
||||
reply.setVersion(old.getVersion());
|
||||
event.setResponse(reply);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: RedisBungee
|
||||
main: com.imaginarycode.minecraft.redisbungee.RedisBungee
|
||||
version: 0.2
|
||||
version: 0.2.1
|
||||
author: tuxed
|
Loading…
Reference in New Issue
Block a user