mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-23 04:28:01 +00:00
parent
47fc9792b0
commit
62eacc5816
@ -263,13 +263,14 @@ public class DataManager implements Listener {
|
||||
});
|
||||
break;
|
||||
case SERVER_CHANGE:
|
||||
final DataManagerMessage<ServerChangePayload> message3 = RedisBungee.getGson().fromJson(jsonObject, new TypeToken<DataManagerMessage<ServerChangePayload>>() {
|
||||
final DataManagerMessage<ServerChangePayload> message3 = RedisBungee.getGson().fromJson(jsonObject, new TypeToken<DataManagerMessage<ServerChangePayload>>()
|
||||
{
|
||||
}.getType());
|
||||
serverCache.put(message3.getTarget(), message3.getPayload().getServer());
|
||||
final String oldServer = serverCache.put(message3.getTarget(), message3.getPayload().getServer());
|
||||
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getProxy().getPluginManager().callEvent(new PlayerChangedServerNetworkEvent(message3.getTarget(), message3.getPayload().getServer()));
|
||||
plugin.getProxy().getPluginManager().callEvent(new PlayerChangedServerNetworkEvent(message3.getTarget(), oldServer, message3.getPayload().getServer()));
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -23,10 +23,12 @@ import java.util.UUID;
|
||||
@ToString
|
||||
public class PlayerChangedServerNetworkEvent extends Event {
|
||||
private final UUID uuid;
|
||||
private final String previousServer;
|
||||
private final String server;
|
||||
|
||||
public PlayerChangedServerNetworkEvent(UUID uuid, String server) {
|
||||
public PlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) {
|
||||
this.uuid = uuid;
|
||||
this.previousServer = previousServer;
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@ -37,4 +39,8 @@ public class PlayerChangedServerNetworkEvent extends Event {
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public String getPreviousServer() {
|
||||
return previousServer;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user