Skip to content

Commit a240794

Browse files
Budderman18Rigner
andauthored
Add support for 1.20 (#35)
* Update BukkitPluginMessageSender.java * Keep 1.17-1.19 support * Fixed version check * Fixed spaces instead of tabs --------- Co-authored-by: PSNRigner <[email protected]>
1 parent 65eda34 commit a240794

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bukkit-1.17/src/main/java/net/badlion/bukkitapi/BukkitPluginMessageSender.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ public BukkitPluginMessageSender(AbstractBukkitBadlionPlugin apiBukkit) {
121121
throw new RuntimeException("Failed to find CraftPlayer.getHandle()");
122122
}
123123

124-
this.playerConnectionField = this.getField(nmsPlayerClass, "b");
124+
if (this.versionSuffix.contains("v1_17") || this.versionSuffix.contains("v1_18") || this.versionSuffix.contains("v1_19")) {
125+
this.playerConnectionField = this.getField(nmsPlayerClass, "b");
126+
} else {
127+
this.playerConnectionField = this.getField(nmsPlayerClass, "c");
128+
}
129+
125130
if (this.playerConnectionField == null) {
126131
throw new RuntimeException("Failed to find EntityPlayer.playerConnection");
127132
}
@@ -220,4 +225,4 @@ public Field getField(Class<?> clazz, String fieldName) {
220225

221226
return null;
222227
}
223-
}
228+
}

0 commit comments

Comments
 (0)