Compare commits

...

3 Commits

Author SHA1 Message Date
alex b54518cf14 mongodb find document test 2022-04-10 21:30:15 +02:00
alex 144b0fc7fc unused dependencies removed 2022-04-10 21:07:09 +02:00
alex b5a830e4f5 removed debug msg 2022-04-10 20:50:39 +02:00
3 changed files with 135 additions and 139 deletions

231
pom.xml
View File

@ -1,131 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.krakatoa.proxy</groupId>
<artifactId>KraProxySystem</artifactId>
<version>1.0-SNAPSHOT</version>
<groupId>net.krakatoa.proxy</groupId>
<artifactId>KraProxySystem</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<build>
<defaultGoal>clean install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<id>make-assembly</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
</plugins>
</build>
<build>
<defaultGoal>clean install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<id>make-assembly</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack-core</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.17.0</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<artifactId>lombok</artifactId>
<groupId>org.projectlombok</groupId>
<scope>provided</scope>
<version>1.18.22</version>
</dependency>
<dependency>
<artifactId>mongodb-driver-async</artifactId>
<groupId>org.mongodb</groupId>
<version>3.12.10</version> <!-- 3.0.4 -->
</dependency>
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-bridge</artifactId>
<version>3.4.0-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-driver</artifactId>
<version>3.4.0-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>earth.krakatoa</groupId>
<artifactId>KraSocketClient</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>earth.krakatoa</groupId>
<artifactId>KraCore</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<artifactId>lombok</artifactId>
<groupId>org.projectlombok</groupId>
<scope>provided</scope>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-bridge</artifactId>
<version>3.4.0-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.dytanic.cloudnet</groupId>
<artifactId>cloudnet-driver</artifactId>
<version>3.4.0-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>earth.krakatoa</groupId>
<artifactId>KraSocketClient</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>earth.krakatoa</groupId>
<artifactId>KraCore</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<!-- https://github.com/TooTallNate/Java-WebSocket -->
<repository>
<id>sonatype-nexus-snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>krakatoa-earth</id>
<url>https://repo.krakatoa.umbach.dev/repository/krakatoa-earth/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>cloudnet-releases</id>
<url>https://repo.cloudnetservice.eu/repository/releases/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<!-- https://github.com/TooTallNate/Java-WebSocket -->
<repository>
<id>sonatype-nexus-snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>krakatoa-earth</id>
<url>https://repo.krakatoa.umbach.dev/repository/krakatoa-earth/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>cloudnet-releases</id>
<url>https://repo.cloudnetservice.eu/repository/releases/</url>
</repository>
</repositories>
</project>

View File

@ -69,9 +69,6 @@ public class ProxySystem extends Plugin {
this.configHandler.getMongodbUsername(), this.configHandler.getMongodbPassword(),
this.configHandler.getMongodbDatabase()));
this.getLogger().info("configRedis " + this.configHandler.getRedisHost() + " "
+ this.configHandler.getRedisPort());
this.redisManager = new RedisManager(
new RedisConfig(this.configHandler.getRedisHost(), this.configHandler.getRedisPort()));
this.redisManager.connect();

View File

@ -1,32 +1,23 @@
package net.krakatoa.proxy.listener;
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.UpdateOptions;
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.Objects;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import net.krakatoa.proxy.ProxySystem;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.hover.content.Text;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.ServerSwitchEvent;
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.redisson.api.RMap;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
public class PostLoginListener implements Listener {
@ -37,10 +28,33 @@ public class PostLoginListener implements Listener {
String uuid = ProxySystem.getInstance().getFormatter()
.formatUuid(proxiedPlayer.getUniqueId().toString());
Document document = (Document) ProxySystem.getInstance().getMongoManager()
Publisher<Document> document = ProxySystem.getInstance().getMongoManager()
.getPlayersCollection()
.find(Filters.eq("uuid", uuid)).first();
document.subscribe(new Subscriber<Document>() {
@Override
public void onSubscribe(Subscription subscription) {
subscription.request(1);
ProxySystem.getInstance().getLogger().info("subscripe");
}
@Override
public void onNext(Document document) {
ProxySystem.getInstance().getLogger().info(("Inserted: " + document));
}
@Override
public void onError(Throwable throwable) {
ProxySystem.getInstance().getLogger().info("Failed " + throwable);
}
@Override
public void onComplete() {
ProxySystem.getInstance().getLogger().info("Completed");
}
});
/*
if (document == null) { // new player - create entries in databases
System.out.println("create player in db");
String voiceWebCode = generateVoiceWebCode(uuid);