forked from GeyserMC/Geyser
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1c5744e52a
3 changed files with 62 additions and 24 deletions
|
@ -9,4 +9,37 @@
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>plugin</artifactId>
|
<artifactId>plugin</artifactId>
|
||||||
|
|
||||||
|
<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>
|
</project>
|
|
@ -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);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue