SteamWar/SpigotCore
Archiviert
13
0

Spigot 1.18 Support #142

Zusammengeführt
Lixfel hat 3 Commits von mc1.18 nach master 2021-12-16 15:49:48 +01:00 zusammengeführt
4 geänderte Dateien mit 12 neuen und 15 gelöschten Zeilen
Nur Änderungen aus Commit 1ba50faad3 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -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))

Datei anzeigen

@ -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

Datei anzeigen

@ -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) {

Datei anzeigen

@ -7,4 +7,5 @@ softdepend:
- WorldEdit
main: de.steamwar.core.Core
commands:
libraries:
- mysql:mysql-connector-java:5.1.49