fix skin reflection on 1.20.6 (fixes #140)
This commit is contained in:
parent
0e7196e2a9
commit
95ba3347b2
1 changed files with 3 additions and 3 deletions
|
@ -15,14 +15,14 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
public class ReflectionPackage {
|
public class ReflectionPackage {
|
||||||
private static final String VERSION = generateVersion();
|
private static final String VERSION = generateVersion();
|
||||||
public static final String BUKKIT = "org.bukkit.craftbukkit." + VERSION;
|
public static final String BUKKIT = "org.bukkit.craftbukkit" + VERSION;
|
||||||
private static final boolean flattened = !PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17);
|
private static final boolean flattened = !PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the classes are flattened, if so we need to add the version string into the
|
* Check if the classes are flattened, if so we need to add the version string into the
|
||||||
* package string which is another quirk of the old server jars.
|
* package string which is another quirk of the old server jars.
|
||||||
*/
|
*/
|
||||||
public static final String MINECRAFT = joinWithDot("net.minecraft", flattened ? "server." + VERSION : "");
|
public static final String MINECRAFT = joinWithDot("net.minecraft", flattened ? "server" + VERSION : "");
|
||||||
public static final String ENTITY = flattened ? MINECRAFT : joinWithDot(MINECRAFT, "world.entity");
|
public static final String ENTITY = flattened ? MINECRAFT : joinWithDot(MINECRAFT, "world.entity");
|
||||||
|
|
||||||
public static String joinWithDot(String... parts) {
|
public static String joinWithDot(String... parts) {
|
||||||
|
@ -34,7 +34,7 @@ public class ReflectionPackage {
|
||||||
|
|
||||||
private static String generateVersion() {
|
private static String generateVersion() {
|
||||||
String[] parts = Bukkit.getServer().getClass().getPackage().getName().split("\\.");
|
String[] parts = Bukkit.getServer().getClass().getPackage().getName().split("\\.");
|
||||||
if (parts.length > 3) return parts[3];
|
if (parts.length > 3) return "." + parts[3];
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue