Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Fix compiling the plugin (#32)
* fix compiling the plugin part 1 * fix plugin compile part 2
Dieser Commit ist enthalten in:
Ursprung
77c8acefdb
Commit
c52177af9f
@ -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);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
24
pom.xml
24
pom.xml
@ -19,6 +19,30 @@
|
|||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<organization>
|
<organization>
|
||||||
<name>GeyserMC</name>
|
<name>GeyserMC</name>
|
||||||
<url>https://github.com/GeyserMC/Geyser/blob/master/pom.xml</url>
|
<url>https://github.com/GeyserMC/Geyser/blob/master/pom.xml</url>
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren