tests with redis command interface
parent
3787a206ed
commit
3fb37a34cb
5
pom.xml
5
pom.xml
|
@ -45,6 +45,11 @@
|
|||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.msgpack</groupId>
|
||||
<artifactId>msgpack-core</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.lettuce</groupId>
|
||||
<artifactId>lettuce-core</artifactId>
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.mongodb.client.model.Updates;
|
|||
import earth.krakatao.protocol.KraSocketClientProtocolDest;
|
||||
import earth.krakatao.protocol.KraSocketClientProtocolMessage;
|
||||
import earth.krakatao.protocol.KraSocketClientProtocolStatus;
|
||||
import java.io.IOException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -24,11 +25,13 @@ import net.md_5.bungee.api.plugin.Listener;
|
|||
import net.md_5.bungee.event.EventHandler;
|
||||
import org.bson.Document;
|
||||
import org.bson.conversions.Bson;
|
||||
import org.msgpack.core.MessageBufferPacker;
|
||||
import org.msgpack.core.MessagePack;
|
||||
|
||||
public class PostLoginListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPostLogin(PostLoginEvent event) {
|
||||
public void onPostLogin(PostLoginEvent event) throws IOException {
|
||||
ProxiedPlayer proxiedPlayer = event.getPlayer();
|
||||
|
||||
String uuid = ProxySystem.getInstance().getFormatter()
|
||||
|
@ -98,8 +101,15 @@ public class PostLoginListener implements Listener {
|
|||
}
|
||||
});
|
||||
|
||||
MessageBufferPacker packer = MessagePack.newDefaultBufferPacker();
|
||||
|
||||
packer.packString(proxiedPlayer.getName());
|
||||
|
||||
packer.close();
|
||||
|
||||
ProxySystem.getInstance().getRedisManager().getRedisKeyCommands()
|
||||
.set("player:" + proxiedPlayer.getUniqueId().toString(), proxiedPlayer.getName());
|
||||
.set("player:" + proxiedPlayer.getUniqueId().toString(),
|
||||
packer.toByteArray());
|
||||
}
|
||||
|
||||
public void sendVoiceWebCodeUrl(ProxiedPlayer proxiedPlayer, String voiceWebCode) {
|
||||
|
|
|
@ -7,6 +7,8 @@ public interface RedisKeyCommands extends Commands {
|
|||
|
||||
String get(String key);
|
||||
|
||||
String set(String key, byte[] byteArray);
|
||||
|
||||
String set(String key, String value);
|
||||
|
||||
Long del(Key... keys);
|
||||
|
|
Loading…
Reference in New Issue