Hotfix: Fixed supports() function detecting invalid major/minor version combination for newer versions; closes #22
This commit is contained in:
parent
15640e5886
commit
c390ebbd5e
4 changed files with 3 additions and 4 deletions
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
|
@ -1,4 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ComposerSettings">
|
||||
<execution />
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -24,7 +24,7 @@
|
|||
|
||||
<groupId>tech.sbdevelopment</groupId>
|
||||
<artifactId>MapReflectionAPI</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.5.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MapReflectionAPI</name>
|
||||
|
|
|
@ -143,7 +143,7 @@ public class PacketListener implements Listener {
|
|||
private Channel getChannel(Player player) {
|
||||
Object playerHandle = getHandle(player);
|
||||
Object playerConnection = getDeclaredField(playerHandle, ReflectionUtil.supports(20) ? "c" : ReflectionUtil.supports(17) ? "b" : "playerConnection"); //1.20 = c, 1.17-1.19 = b, 1.16 = playerConnection
|
||||
Object networkManager = getDeclaredField(playerConnection, ReflectionUtil.supports(19, 3) ? "h" : ReflectionUtil.supports(19) ? "b" : ReflectionUtil.supports(17) ? "a" : "networkManager"); //1.19.4 = h, >= 1.19.3 = b, 1.18 = a, 1.16 = networkManager
|
||||
Object networkManager = getDeclaredField(playerConnection, ReflectionUtil.supports(19, 3) ? "h" : ReflectionUtil.supports(19) ? "b" : ReflectionUtil.supports(17) ? "a" : "networkManager"); //1.20 & 1.19.4 = h, >= 1.19.3 = b, 1.18 = a, 1.16 = networkManager
|
||||
return (Channel) getDeclaredField(networkManager, ReflectionUtil.supports(18) ? "m" : ReflectionUtil.supports(17) ? "k" : "channel"); //1.19 & 1.18 = m, 1.17 = k, 1.16 = channel
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ public class ReflectionUtil {
|
|||
* @since 4.0.0
|
||||
*/
|
||||
public static boolean supports(int major, int minor) {
|
||||
return VER >= major && VER_MINOR >= minor;
|
||||
return (VER == major && VER_MINOR >= minor) || VER > major;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue