Compare commits
3 Commits
54f6ba503d
...
b54518cf14
Author | SHA1 | Date |
---|---|---|
|
b54518cf14 | |
|
144b0fc7fc | |
|
b5a830e4f5 |
231
pom.xml
231
pom.xml
|
@ -1,131 +1,116 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>net.krakatoa.proxy</groupId>
|
<groupId>net.krakatoa.proxy</groupId>
|
||||||
<artifactId>KraProxySystem</artifactId>
|
<artifactId>KraProxySystem</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>14</maven.compiler.source>
|
<maven.compiler.source>14</maven.compiler.source>
|
||||||
<maven.compiler.target>14</maven.compiler.target>
|
<maven.compiler.target>14</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean install</defaultGoal>
|
<defaultGoal>clean install</defaultGoal>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
</descriptorRefs>
|
</descriptorRefs>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>single</goal>
|
<goal>single</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<id>make-assembly</id>
|
<id>make-assembly</id>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>9</source>
|
<source>9</source>
|
||||||
<target>9</target>
|
<target>9</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.msgpack</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>msgpack-core</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>0.9.0</version>
|
<version>1.17-R0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
<type>jar</type>
|
||||||
<dependency>
|
<scope>provided</scope>
|
||||||
<groupId>org.redisson</groupId>
|
</dependency>
|
||||||
<artifactId>redisson</artifactId>
|
<dependency>
|
||||||
<version>3.17.0</version>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
<groupId>org.projectlombok</groupId>
|
||||||
<dependency>
|
<scope>provided</scope>
|
||||||
<groupId>net.md-5</groupId>
|
<version>1.18.22</version>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
</dependency>
|
||||||
<version>1.17-R0.1-SNAPSHOT</version>
|
<dependency>
|
||||||
<type>jar</type>
|
<groupId>de.dytanic.cloudnet</groupId>
|
||||||
<scope>provided</scope>
|
<artifactId>cloudnet-bridge</artifactId>
|
||||||
</dependency>
|
<version>3.4.0-RELEASE</version>
|
||||||
<dependency>
|
<scope>provided</scope>
|
||||||
<artifactId>lombok</artifactId>
|
</dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<dependency>
|
||||||
<scope>provided</scope>
|
<groupId>de.dytanic.cloudnet</groupId>
|
||||||
<version>1.18.22</version>
|
<artifactId>cloudnet-driver</artifactId>
|
||||||
</dependency>
|
<version>3.4.0-RELEASE</version>
|
||||||
<dependency>
|
<scope>provided</scope>
|
||||||
<artifactId>mongodb-driver-async</artifactId>
|
</dependency>
|
||||||
<groupId>org.mongodb</groupId>
|
<dependency>
|
||||||
<version>3.12.10</version> <!-- 3.0.4 -->
|
<groupId>earth.krakatoa</groupId>
|
||||||
</dependency>
|
<artifactId>KraSocketClient</artifactId>
|
||||||
<dependency>
|
<version>1.2-SNAPSHOT</version>
|
||||||
<groupId>de.dytanic.cloudnet</groupId>
|
</dependency>
|
||||||
<artifactId>cloudnet-bridge</artifactId>
|
<dependency>
|
||||||
<version>3.4.0-RELEASE</version>
|
<groupId>earth.krakatoa</groupId>
|
||||||
<scope>provided</scope>
|
<artifactId>KraCore</artifactId>
|
||||||
</dependency>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>de.dytanic.cloudnet</groupId>
|
</dependencies>
|
||||||
<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>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>bungeecord-repo</id>
|
<id>bungeecord-repo</id>
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
<!-- https://github.com/TooTallNate/Java-WebSocket -->
|
<!-- https://github.com/TooTallNate/Java-WebSocket -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>sonatype-nexus-snapshots</id>
|
<id>sonatype-nexus-snapshots</id>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>false</enabled>
|
<enabled>false</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>krakatoa-earth</id>
|
<id>krakatoa-earth</id>
|
||||||
<url>https://repo.krakatoa.umbach.dev/repository/krakatoa-earth/</url>
|
<url>https://repo.krakatoa.umbach.dev/repository/krakatoa-earth/</url>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>cloudnet-releases</id>
|
<id>cloudnet-releases</id>
|
||||||
<url>https://repo.cloudnetservice.eu/repository/releases/</url>
|
<url>https://repo.cloudnetservice.eu/repository/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
</project>
|
</project>
|
|
@ -69,9 +69,6 @@ public class ProxySystem extends Plugin {
|
||||||
this.configHandler.getMongodbUsername(), this.configHandler.getMongodbPassword(),
|
this.configHandler.getMongodbUsername(), this.configHandler.getMongodbPassword(),
|
||||||
this.configHandler.getMongodbDatabase()));
|
this.configHandler.getMongodbDatabase()));
|
||||||
|
|
||||||
this.getLogger().info("configRedis " + this.configHandler.getRedisHost() + " "
|
|
||||||
+ this.configHandler.getRedisPort());
|
|
||||||
|
|
||||||
this.redisManager = new RedisManager(
|
this.redisManager = new RedisManager(
|
||||||
new RedisConfig(this.configHandler.getRedisHost(), this.configHandler.getRedisPort()));
|
new RedisConfig(this.configHandler.getRedisHost(), this.configHandler.getRedisPort()));
|
||||||
this.redisManager.connect();
|
this.redisManager.connect();
|
||||||
|
|
|
@ -1,32 +1,23 @@
|
||||||
package net.krakatoa.proxy.listener;
|
package net.krakatoa.proxy.listener;
|
||||||
|
|
||||||
import com.mongodb.client.model.Filters;
|
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.io.IOException;
|
||||||
import java.security.SecureRandom;
|
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.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.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent.Action;
|
import net.md_5.bungee.api.chat.HoverEvent.Action;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.chat.hover.content.Text;
|
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.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.bson.conversions.Bson;
|
import org.reactivestreams.Publisher;
|
||||||
import org.redisson.api.RMap;
|
import org.reactivestreams.Subscriber;
|
||||||
|
import org.reactivestreams.Subscription;
|
||||||
|
|
||||||
public class PostLoginListener implements Listener {
|
public class PostLoginListener implements Listener {
|
||||||
|
|
||||||
|
@ -37,10 +28,33 @@ public class PostLoginListener implements Listener {
|
||||||
String uuid = ProxySystem.getInstance().getFormatter()
|
String uuid = ProxySystem.getInstance().getFormatter()
|
||||||
.formatUuid(proxiedPlayer.getUniqueId().toString());
|
.formatUuid(proxiedPlayer.getUniqueId().toString());
|
||||||
|
|
||||||
Document document = (Document) ProxySystem.getInstance().getMongoManager()
|
Publisher<Document> document = ProxySystem.getInstance().getMongoManager()
|
||||||
.getPlayersCollection()
|
.getPlayersCollection()
|
||||||
.find(Filters.eq("uuid", uuid)).first();
|
.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
|
if (document == null) { // new player - create entries in databases
|
||||||
System.out.println("create player in db");
|
System.out.println("create player in db");
|
||||||
String voiceWebCode = generateVoiceWebCode(uuid);
|
String voiceWebCode = generateVoiceWebCode(uuid);
|
||||||
|
|
Loading…
Reference in New Issue