Dieser Commit ist enthalten in:
Ursprung
65e4ebeb6d
Commit
1ba50faad3
@ -344,9 +344,9 @@ public final class Reflection {
|
||||
// Expand all detected variables
|
||||
if (variable.startsWith("nms")) {
|
||||
if(Core.getVersion() >= 17)
|
||||
replacement = NMS_PREFIX;
|
||||
else
|
||||
replacement = "net.minecraft" + variable.substring(3);
|
||||
else
|
||||
replacement = NMS_PREFIX;
|
||||
} else if ("obc".equals(variable))
|
||||
replacement = OBC_PREFIX;
|
||||
else if ("version".equals(variable))
|
||||
|
@ -34,7 +34,7 @@ public class TinyProtocol {
|
||||
|
||||
// Used in order to lookup a channel
|
||||
private static final MethodInvoker getPlayerHandle = Reflection.getMethod("{obc}.entity.CraftPlayer", "getHandle");
|
||||
private static final Class<Object> playerConnection = Reflection.getUntypedClass("{nms.network}.PlayerConnection");
|
||||
private static final Class<Object> playerConnection = Reflection.getUntypedClass("{nms.server.network}.PlayerConnection");
|
||||
private static final FieldAccessor<Object> getConnection = Reflection.getField("{nms.server.level}.EntityPlayer", playerConnection, 0);
|
||||
private static final Class<Object> networkManager = Reflection.getUntypedClass("{nms.network}.NetworkManager");
|
||||
private static final FieldAccessor<Object> getManager = Reflection.getField(playerConnection, networkManager, 0);
|
||||
@ -45,16 +45,7 @@ public class TinyProtocol {
|
||||
private static final Class<Object> serverConnectionClass = Reflection.getUntypedClass("{nms.server.network}.ServerConnection");
|
||||
private static final FieldAccessor<Object> getMinecraftServer = Reflection.getField("{obc}.CraftServer", minecraftServerClass, 0);
|
||||
private static final FieldAccessor<Object> getServerConnection = Reflection.getField(minecraftServerClass, serverConnectionClass, 0);
|
||||
private static final MethodInvoker getNetworkMarkers;
|
||||
static {
|
||||
MethodInvoker networkMarkers;
|
||||
try {
|
||||
networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, List.class, serverConnectionClass);
|
||||
} catch (IllegalStateException e) { // Paper, wtf why.
|
||||
networkMarkers = Reflection.getTypedMethod(serverConnectionClass, null, Queue.class, serverConnectionClass);
|
||||
}
|
||||
getNetworkMarkers = networkMarkers;
|
||||
}
|
||||
private static final FieldAccessor<Collection> getNetworkMarkers = Reflection.getField(serverConnectionClass, Collection.class, 1);
|
||||
|
||||
// Packets we have to intercept
|
||||
private static final Class<?> PACKET_LOGIN_IN_START = Reflection.getClass("{nms.network.protocol.login}.PacketLoginInStart");
|
||||
@ -86,6 +77,10 @@ public class TinyProtocol {
|
||||
|
||||
public static final TinyProtocol instance = new TinyProtocol(Core.getInstance());
|
||||
|
||||
public static void init() {
|
||||
//enforce init
|
||||
}
|
||||
|
||||
public TinyProtocol(final Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
@ -187,7 +182,7 @@ public class TinyProtocol {
|
||||
boolean looking = true;
|
||||
|
||||
// We need to synchronize against this list
|
||||
networkManagers = (Collection<Object>) getNetworkMarkers.invoke(null, serverConnection);
|
||||
networkManagers = getNetworkMarkers.get(serverConnection);
|
||||
createServerChannelHandler();
|
||||
|
||||
// Find the correct list, or implicitly throw an exception
|
||||
|
@ -82,6 +82,7 @@ public class Core extends JavaPlugin{
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new BungeeReceiver());
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge");
|
||||
AuthlibInjector.inject();
|
||||
TinyProtocol.init();
|
||||
try {
|
||||
Bukkit.getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine());
|
||||
} catch (IOException e) {
|
||||
|
@ -7,4 +7,5 @@ softdepend:
|
||||
- WorldEdit
|
||||
|
||||
main: de.steamwar.core.Core
|
||||
commands:
|
||||
libraries:
|
||||
- mysql:mysql-connector-java:5.1.49
|
In neuem Issue referenzieren
Einen Benutzer sperren