mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-04-08 16:10:26 +00:00
more changes
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.DataManager;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.AbstractDataManager;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ServerConnection;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
@@ -29,9 +28,9 @@ public class RBUtils {
|
||||
pipeline.hmset("player:" + player.getUniqueId().toString(), playerData);
|
||||
|
||||
if (fireEvent) {
|
||||
pipeline.publish("redisbungee-data", gson.toJson(new DataManager.DataManagerMessage<>(
|
||||
player.getUniqueId(), RedisBungeeAPI.getRedisBungeeApi().getServerId(), DataManager.DataManagerMessage.Action.JOIN,
|
||||
new DataManager.LoginPayload(player.getRemoteAddress().getAddress()))));
|
||||
pipeline.publish("redisbungee-data", gson.toJson(new AbstractDataManager.DataManagerMessage<>(
|
||||
player.getUniqueId(), RedisBungeeAPI.getRedisBungeeApi().getServerId(), AbstractDataManager.DataManagerMessage.Action.JOIN,
|
||||
new AbstractDataManager.LoginPayload(player.getRemoteAddress().getAddress()))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.AbstractRedisBungeeListener;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.DataManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.AbstractDataManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.RedisBungeePlugin;
|
||||
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.RedisUtil;
|
||||
@@ -83,9 +83,9 @@ public class RedisBungeeListener extends AbstractRedisBungeeListener<LoginEvent,
|
||||
pipeline.sync();
|
||||
// the end of moved code.
|
||||
|
||||
jedis.publish("redisbungee-data", gson.toJson(new DataManager.DataManagerMessage<>(
|
||||
event.getPlayer().getUniqueId(), plugin.getApi().getServerId(), DataManager.DataManagerMessage.Action.JOIN,
|
||||
new DataManager.LoginPayload(event.getPlayer().getRemoteAddress().getAddress()))));
|
||||
jedis.publish("redisbungee-data", gson.toJson(new AbstractDataManager.DataManagerMessage<>(
|
||||
event.getPlayer().getUniqueId(), plugin.getApi().getServerId(), AbstractDataManager.DataManagerMessage.Action.JOIN,
|
||||
new AbstractDataManager.LoginPayload(event.getPlayer().getRemoteAddress().getAddress()))));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@@ -115,9 +115,9 @@ public class RedisBungeeListener extends AbstractRedisBungeeListener<LoginEvent,
|
||||
@Override
|
||||
protected Void call(Jedis jedis) {
|
||||
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "server", event.getServer().getServerInfo().getName());
|
||||
jedis.publish("redisbungee-data", gson.toJson(new DataManager.DataManagerMessage<>(
|
||||
event.getPlayer().getUniqueId(), plugin.getApi().getServerId(), DataManager.DataManagerMessage.Action.SERVER_CHANGE,
|
||||
new DataManager.ServerChangePayload(event.getServer().getServerInfo().getName(), currentServer))));
|
||||
jedis.publish("redisbungee-data", gson.toJson(new AbstractDataManager.DataManagerMessage<>(
|
||||
event.getPlayer().getUniqueId(), plugin.getApi().getServerId(), AbstractDataManager.DataManagerMessage.Action.SERVER_CHANGE,
|
||||
new AbstractDataManager.ServerChangePayload(event.getServer().getServerInfo().getName(), currentServer))));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -112,7 +112,7 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataManager<Player, ?, ?, ?> getDataManager() {
|
||||
public AbstractDataManager<Player, ?, ?, ?> getDataManager() {
|
||||
return this.dataManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.imaginarycode.minecraft.redisbungee;
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.DataManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.AbstractDataManager;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.RedisBungeePlugin;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.connection.DisconnectEvent;
|
||||
@@ -9,7 +9,7 @@ import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
|
||||
|
||||
public class VelocityDataManager extends DataManager<Player, PostLoginEvent, DisconnectEvent, PubSubMessageEvent> {
|
||||
public class VelocityDataManager extends AbstractDataManager<Player, PostLoginEvent, DisconnectEvent, PubSubMessageEvent> {
|
||||
|
||||
public VelocityDataManager(RedisBungeePlugin<Player> plugin) {
|
||||
super(plugin);
|
||||
|
||||
Reference in New Issue
Block a user