mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-04-08 16:10:26 +00:00
api changes in events, move Listener serialization into Util class
This commit is contained in:
@@ -18,9 +18,12 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
||||
|
||||
private static RedisBungeeAPI redisBungeeApi;
|
||||
|
||||
RedisBungeeAPI(RedisBungeePlugin<?> plugin) {
|
||||
public RedisBungeeAPI(RedisBungeePlugin<?> plugin) {
|
||||
super(plugin);
|
||||
redisBungeeApi = this;
|
||||
if (redisBungeeApi == null) {
|
||||
redisBungeeApi = this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,9 @@ import java.net.InetAddress;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.imaginarycode.minecraft.redisbungee.api.util.serialize.Serializations.serializeMultimap;
|
||||
import static com.imaginarycode.minecraft.redisbungee.api.util.serialize.Serializations.serializeMultiset;
|
||||
|
||||
public class RedisBungeeVelocityListener extends AbstractRedisBungeeListener<LoginEvent, PostLoginEvent, DisconnectEvent, ServerConnectedEvent, ProxyPingEvent, PluginMessageEvent, PubSubMessageEvent> {
|
||||
// Some messages are using legacy characters
|
||||
private final LegacyComponentSerializer serializer = LegacyComponentSerializer.legacySection();
|
||||
|
||||
@@ -6,7 +6,12 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.inject.Inject;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.*;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.config.ConfigLoader;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.tasks.*;
|
||||
import com.imaginarycode.minecraft.redisbungee.api.util.uuid.NameFetcher;
|
||||
@@ -43,7 +48,7 @@ import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Plugin(id = "redisbungee", name = "RedisBungee", version = PomData.VERSION, url = "https://github.com/ProxioDev/RedisBungee", authors = {"astei", "ProxioDev"})
|
||||
public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
|
||||
public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player>, ConfigLoader {
|
||||
private final ProxyServer server;
|
||||
private final Logger logger;
|
||||
private final Path dataFolder;
|
||||
@@ -169,7 +174,7 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callEvent(Object event) {
|
||||
public void fireEvent(Object event) {
|
||||
this.getProxy().getEventManager().fireAndForget(event);
|
||||
}
|
||||
|
||||
@@ -327,22 +332,22 @@ public class RedisBungeeVelocityPlugin implements RedisBungeePlugin<Player> {
|
||||
|
||||
|
||||
@Override
|
||||
public Object createPlayerChangedNetworkEvent(UUID uuid, String previousServer, String server) {
|
||||
public IPlayerChangedServerNetworkEvent createPlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) {
|
||||
return new PlayerChangedServerNetworkEvent(uuid, previousServer, server);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createPlayerJoinedNetworkEvent(UUID uuid) {
|
||||
public IPlayerJoinedNetworkEvent createPlayerJoinedNetworkEvent(UUID uuid) {
|
||||
return new PlayerJoinedNetworkEvent(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createPlayerLeftNetworkEvent(UUID uuid) {
|
||||
public IPlayerLeftNetworkEvent createPlayerLeftNetworkEvent(UUID uuid) {
|
||||
return new PlayerLeftNetworkEvent(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createPubSubEvent(String channel, String message) {
|
||||
public IPubSubMessageEvent createPubSubEvent(String channel, String message) {
|
||||
return new PubSubMessageEvent(channel, message);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.events;
|
||||
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -12,7 +14,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @since 0.3.4
|
||||
*/
|
||||
public class PlayerChangedServerNetworkEvent {
|
||||
public class PlayerChangedServerNetworkEvent implements IPlayerChangedServerNetworkEvent {
|
||||
private final UUID uuid;
|
||||
private final String previousServer;
|
||||
private final String server;
|
||||
@@ -23,14 +25,17 @@ public class PlayerChangedServerNetworkEvent {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreviousServer() {
|
||||
return previousServer;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.events;
|
||||
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -12,13 +14,14 @@ import java.util.UUID;
|
||||
*
|
||||
* @since 0.3.4
|
||||
*/
|
||||
public class PlayerJoinedNetworkEvent {
|
||||
public class PlayerJoinedNetworkEvent implements IPlayerJoinedNetworkEvent {
|
||||
private final UUID uuid;
|
||||
|
||||
public PlayerJoinedNetworkEvent(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.events;
|
||||
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -12,13 +14,14 @@ import java.util.UUID;
|
||||
*
|
||||
* @since 0.3.4
|
||||
*/
|
||||
public class PlayerLeftNetworkEvent {
|
||||
public class PlayerLeftNetworkEvent implements IPlayerLeftNetworkEvent {
|
||||
private final UUID uuid;
|
||||
|
||||
public PlayerLeftNetworkEvent(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.events;
|
||||
|
||||
|
||||
import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent;
|
||||
|
||||
/**
|
||||
* This event is posted when a PubSub message is received.
|
||||
@@ -10,7 +11,7 @@ package com.imaginarycode.minecraft.redisbungee.events;
|
||||
* @since 0.2.6
|
||||
*/
|
||||
|
||||
public class PubSubMessageEvent {
|
||||
public class PubSubMessageEvent implements IPubSubMessageEvent {
|
||||
private final String channel;
|
||||
private final String message;
|
||||
|
||||
@@ -19,10 +20,12 @@ public class PubSubMessageEvent {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user