Merge remote-tracking branch 'origin/master'

This commit is contained in:
EOT3000 2019-09-14 11:34:15 -04:00
commit 1c5744e52a
3 changed files with 62 additions and 24 deletions

View file

@ -1,12 +1,45 @@
<?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>
<parent> <parent>
<groupId>org.geysermc</groupId> <groupId>org.geysermc</groupId>
<artifactId>geyser-parent</artifactId> <artifactId>geyser-parent</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>plugin</artifactId> <artifactId>plugin</artifactId>
</project>
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.14-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.14-SNAPSHOT</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.whirvis</groupId>
<artifactId>jraknet</artifactId>
<version>2.11.8</version>
</dependency>
</dependencies>
</project>

View file

@ -1,42 +1,47 @@
package org.geysermc.plugin; package org.geysermc.plugin;
import com.whirvis.jraknet.RakNetPacket;
import com.whirvis.jraknet.peer.RakNetClientPeer;
import com.whirvis.jraknet.server.RakNetServer;
import com.whirvis.jraknet.server.RakNetServerListener;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ConnectedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
public class GeyserPlugin { import java.lang.reflect.Field;
/*private List<ConnectedPlayer> players; import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class GeyserPlugin extends Plugin {
private List<ConnectedPlayer> players;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public void onEnable() { public void onEnable() {
try { try {
Class<? extends ProxyServer> clazz = getProxy().getClass(); Class<? extends ProxyServer> clazz = getProxy().getClass();
Field field = clazz.getDeclaredField("connections"); Field field = clazz.getDeclaredField("connections");
field.setAccessible(true); field.setAccessible(true);
players = (List<ConnectedPlayer>) field.get(getProxy()); players = (List<ConnectedPlayer>) field.get(getProxy());
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
RakNetServer server = new RakNetServer(new InetSocketAddress("0.0.0.0", 65500), 1000000); RakNetServer server = new RakNetServer(new InetSocketAddress("0.0.0.0", 65500), 1000000);
server.addListener(new RakNetServerListener() { server.addListener(new RakNetServerListener() {
@Override @Override
public void handleMessage(RakNetServer server, RakNetClientPeer peer, RakNetPacket packet, int channel) { public void handleMessage(RakNetServer server, RakNetClientPeer peer, RakNetPacket packet, int channel) {
if(packet.getId() == 0) { if(packet.getId() == 0) {
} }
} }
}); });
} }
private UUID fromXUID(String XUID) { private UUID fromXUID(String XUID) {
String one = XUID.substring(0, XUID.length()/2); String one = XUID.substring(0, XUID.length()/2);
String two = XUID.substring(XUID.length()/2, XUID.length()); String two = XUID.substring(XUID.length()/2, XUID.length());
long L1 = Long.parseLong(one); long L1 = Long.parseLong(one);
long L2 = Long.parseLong(two); long L2 = Long.parseLong(two);
return new UUID(L1, L2); return new UUID(L1, L2);
}*/ }
} }

View file

@ -112,4 +112,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>