unnecessary list deleted
parent
43995d580f
commit
eb2deaef14
|
@ -1,6 +1,5 @@
|
||||||
package net.krakatoa.proxy;
|
package net.krakatoa.proxy;
|
||||||
|
|
||||||
import com.mongodb.async.client.MongoCollection;
|
|
||||||
import earth.krakatao.KraSocketClient;
|
import earth.krakatao.KraSocketClient;
|
||||||
import earth.krakatao.KraSocketClientConfig;
|
import earth.krakatao.KraSocketClientConfig;
|
||||||
import earth.krakatao.events.KraSocketClientEventInitiater;
|
import earth.krakatao.events.KraSocketClientEventInitiater;
|
||||||
|
@ -22,7 +21,6 @@ import net.krakatoa.proxy.redis.RedisManager;
|
||||||
import net.krakatoa.proxy.util.Formatter;
|
import net.krakatoa.proxy.util.Formatter;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.api.plugin.PluginManager;
|
import net.md_5.bungee.api.plugin.PluginManager;
|
||||||
import org.bson.Document;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class ProxySystem extends Plugin {
|
public class ProxySystem extends Plugin {
|
||||||
|
@ -39,8 +37,6 @@ public class ProxySystem extends Plugin {
|
||||||
private MongoManager mongoManager;
|
private MongoManager mongoManager;
|
||||||
private RedisManager redisManager;
|
private RedisManager redisManager;
|
||||||
|
|
||||||
private MongoCollection<Document> players;
|
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -71,8 +67,6 @@ public class ProxySystem extends Plugin {
|
||||||
this.configHandler.getMongodbPassword());
|
this.configHandler.getMongodbPassword());
|
||||||
this.mongoManager.connect(this.configHandler.getMongodbDatabase());
|
this.mongoManager.connect(this.configHandler.getMongodbDatabase());
|
||||||
|
|
||||||
this.players = this.mongoManager.getMongoDatabase().getCollection("players");
|
|
||||||
|
|
||||||
this.redisManager = new RedisManager("redis://127.0.0.1:6379");
|
this.redisManager = new RedisManager("redis://127.0.0.1:6379");
|
||||||
this.redisManager.connect();
|
this.redisManager.connect();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PostLoginListener implements Listener {
|
||||||
String uuid = ProxySystem.getInstance().getFormatter()
|
String uuid = ProxySystem.getInstance().getFormatter()
|
||||||
.formatUuid(proxiedPlayer.getUniqueId().toString());
|
.formatUuid(proxiedPlayer.getUniqueId().toString());
|
||||||
|
|
||||||
ProxySystem.getInstance().getPlayers()
|
ProxySystem.getInstance().getMongoManager().getPlayers()
|
||||||
.find(Filters.eq("uuid", uuid))
|
.find(Filters.eq("uuid", uuid))
|
||||||
.first((document, throwable) -> {
|
.first((document, throwable) -> {
|
||||||
if (document == null) { // new player - create entries in databases
|
if (document == null) { // new player - create entries in databases
|
||||||
|
@ -46,9 +46,10 @@ public class PostLoginListener implements Listener {
|
||||||
|
|
||||||
document = new Document("uuid", uuid).append("voiceWebCode", voiceWebCode);
|
document = new Document("uuid", uuid).append("voiceWebCode", voiceWebCode);
|
||||||
|
|
||||||
ProxySystem.getInstance().getPlayers().insertOne(document, (unused, throwable1) -> {
|
ProxySystem.getInstance().getMongoManager().getPlayers()
|
||||||
System.out.println("insertOne");
|
.insertOne(document, (unused, throwable1) -> {
|
||||||
});
|
System.out.println("insertOne");
|
||||||
|
});
|
||||||
|
|
||||||
sendVoiceWebCodeUrl(proxiedPlayer, voiceWebCode);
|
sendVoiceWebCodeUrl(proxiedPlayer, voiceWebCode);
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ public class PostLoginListener implements Listener {
|
||||||
|
|
||||||
UpdateOptions options = new UpdateOptions().upsert(true);
|
UpdateOptions options = new UpdateOptions().upsert(true);
|
||||||
|
|
||||||
ProxySystem.getInstance().getPlayers()
|
ProxySystem.getInstance().getMongoManager().getPlayers()
|
||||||
.updateOne(finalDocument, updates, options, (updateResult, throwable1) -> {
|
.updateOne(finalDocument, updates, options, (updateResult, throwable1) -> {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue