Skip to content

Commit

Permalink
Add support for Minecraft 1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Sep 22, 2023
1 parent dad5b79 commit d912248
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,19 +409,23 @@ public void setTempOp(Boolean value) throws ClassNotFoundException, NoSuchFieldE
// Get some version specific strings
String nms = "net.minecraft.server";
String playersPackage = nms + ".players";
String ops = "o";
String ops = "p";
String getPlayerList = "ac";
if(Static.getServer().getMinecraftVersion().equals(MCVersion.MC1_19_3)) {
getPlayerList = "ab";
} else if(Static.getServer().getMinecraftVersion().lt(MCVersion.MC1_19_1)) {
ops = "n";
if(Static.getServer().getMinecraftVersion().lt(MCVersion.MC1_18)) {
getPlayerList = "getPlayerList";
if(Static.getServer().getMinecraftVersion().lt(MCVersion.MC1_17)) {
String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
nms = "net.minecraft.server." + version;
playersPackage = nms;
ops = "operators";
MCVersion mcversion = Static.getServer().getMinecraftVersion();
if(mcversion.lt(MCVersion.MC1_20_X)) {
ops = "o";
if(mcversion.equals(MCVersion.MC1_19_3)) {
getPlayerList = "ab";
} else if(mcversion.lt(MCVersion.MC1_19_1)) {
ops = "n";
if(mcversion.lt(MCVersion.MC1_18)) {
getPlayerList = "getPlayerList";
if(mcversion.lt(MCVersion.MC1_17)) {
String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
nms = "net.minecraft.server." + version;
playersPackage = nms;
ops = "operators";
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ public enum MCAttribute {
GENERIC_MAX_HEALTH,
GENERIC_MOVEMENT_SPEED,
HORSE_JUMP_STRENGTH,
MAX_ABSORPTION,
ZOMBIE_SPAWN_REINFORCEMENTS
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum MCGameRule {
DOWARDENSPAWNING("doWardenSpawning"),
DOWEATHERCYCLE("doWeatherCycle"),
DROWNINGDAMAGE("drowningDamage"),
ENDERPEARLSVANISHONDEATH("enderPearlsVanishOnDeath"),
FALLDAMAGE("fallDamage"),
FIREDAMAGE("fireDamage"),
FORGIVEDEADPLAYERS("forgiveDeadPlayers"),
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/laytonsmith/abstraction/enums/MCSound.java
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,19 @@ public enum MCVanillaSound {
MUSIC_OVERWORLD_JUNGLE(MCVersion.MC1_20),
MUSIC_OVERWORLD_SPARSE_JUNGLE(MCVersion.MC1_20),

// 1.20.2 additions
BLOCK_SPONGE_ABSORB(MCVersion.MC1_20_X),
BLOCK_SPONGE_BREAK(MCVersion.MC1_20_X),
BLOCK_SPONGE_FALL(MCVersion.MC1_20_X),
BLOCK_SPONGE_HIT(MCVersion.MC1_20_X),
BLOCK_SPONGE_PLACE(MCVersion.MC1_20_X),
BLOCK_SPONGE_STEP(MCVersion.MC1_20_X),
BLOCK_WET_SPONGE_BREAK(MCVersion.MC1_20_X),
BLOCK_WET_SPONGE_FALL(MCVersion.MC1_20_X),
BLOCK_WET_SPONGE_HIT(MCVersion.MC1_20_X),
BLOCK_WET_SPONGE_PLACE(MCVersion.MC1_20_X),
BLOCK_WET_SPONGE_STEP(MCVersion.MC1_20_X),

UNKNOWN(MCVersion.NEVER);

private final MCVersion since;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public enum MCVersion implements Version {
MC1_19_3,
MC1_19_X,
MC1_20,
MC1_20_1,
MC1_20_X,
MC1_X,
MC2_X,
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/docs/Compatibility
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ with build 1498, so earlier builds may not be accurate. In general, the compatib
the same as the previous milestone build. The minimum requirements for the current builds are:

* Java 16
* Spigot/Paper 1.16.5 - 1.20.1 (when CH is used as a plugin)
* Spigot/Paper 1.16.5 - 1.20.2 (when CH is used as a plugin)

Also note that CommandHelper may still be backwards and forward compatible to a large degree, many of the advanced
features that normally have hard dependencies on certain versions of external dependencies have been configured to
Expand Down

0 comments on commit d912248

Please sign in to comment.