From e5acf550975fd4e57835f528da07570063c457db Mon Sep 17 00:00:00 2001 From: Tim Brust Date: Tue, 12 Dec 2023 15:58:44 +0100 Subject: [PATCH] feat: adds support for Minecraft 1.20.4 --- .github/workflows/maven-pr.yml | 2 +- README.md | 4 ++-- modules/API/pom.xml | 5 +++-- modules/SilkSpawners/pom.xml | 4 ++-- .../dustplanet/silkspawners/SilkSpawners.java | 6 +++--- modules/{v1_20_R2 => v1_20_R3}/pom.xml | 14 ++++++------- .../compat/v1_20_R3}/NMSHandler.java | 20 +++++++++---------- pom.xml | 2 +- 8 files changed, 28 insertions(+), 29 deletions(-) rename modules/{v1_20_R2 => v1_20_R3}/pom.xml (85%) rename modules/{v1_20_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R2 => v1_20_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R3}/NMSHandler.java (97%) diff --git a/.github/workflows/maven-pr.yml b/.github/workflows/maven-pr.yml index 8bbe4451..db68df9b 100644 --- a/.github/workflows/maven-pr.yml +++ b/.github/workflows/maven-pr.yml @@ -73,7 +73,7 @@ jobs: [ -f ~/.m2/repository/org/spigotmc/spigot/1.19.3-R0.1-SNAPSHOT/spigot-1.19.3-R0.1-SNAPSHOT-remapped-mojang.jar ] || java -jar BuildTools.jar --rev 1.19.3 --remapped [ -f ~/.m2/repository/org/spigotmc/spigot/1.19.4-R0.1-SNAPSHOT/spigot-1.19.4-R0.1-SNAPSHOT-remapped-mojang.jar ] || java -jar BuildTools.jar --rev 1.19.4 --remapped [ -f ~/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT/spigot-1.20.1-R0.1-SNAPSHOT-remapped-mojang.jar ] || java -jar BuildTools.jar --rev 1.20.1 --remapped - [ -f ~/.m2/repository/org/spigotmc/spigot/1.20.2-R0.1-SNAPSHOT/spigot-1.20.2-R0.1-SNAPSHOT-remapped-mojang.jar ] || java -jar BuildTools.jar --rev 1.20.2 --remapped + [ -f ~/.m2/repository/org/spigotmc/spigot/1.20.4-R0.1-SNAPSHOT/spigot-1.20.4-R0.1-SNAPSHOT-remapped-mojang.jar ] || java -jar BuildTools.jar --rev 1.20.4 --remapped - name: Build with Maven run: mvn -D"http.keepAlive=false" -D"maven.wagon.http.pool=false" -D"maven.wagon.httpconnectionManager.ttlSeconds=120" "-Dhttps.protocols=TLSv1.2" -DskipTests=true "-Dmaven.javadoc.skip=true" -B clean package diff --git a/README.md b/README.md index 58a74c0a..63dc903e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This Bukkit (compatible with CraftBukkit, Spigot, Paper) plugin adds a way to ob - Economy addon [SilkSpawnersEcoAddon](https://dev.bukkit.org/projects/silkspawnersecoaddon) - Shop addon [SilkSpawnersShopAddon](https://spigotmc.org/resources/12028/) (login required, Premium Plugin) - BossBarAPI support for >= 1.9, otherwise BarAPI can be used -- Support for multiple Minecraft versions, from 1.8.8 to 1.20.2 (with exlusion of 1.9 and 1.10) +- Support for multiple Minecraft versions, from 1.8.8 to 1.20.4 (with exlusion of 1.9 and 1.10) _Third party features, all of them can be disabled_ @@ -315,7 +315,7 @@ Unfortunately, I can't give access to https://repo.dustplanet.de/artifactory/pri mkdir -p BuildTools cd BuildTools wget -q https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -java -jar BuildTools.jar --rev 1.20.2 --remapped +java -jar BuildTools.jar --rev 1.20.4 --remapped java -jar BuildTools.jar --rev 1.20.1 --remapped java -jar BuildTools.jar --rev 1.19.4 --remapped java -jar BuildTools.jar --rev 1.19.3 --remapped diff --git a/modules/API/pom.xml b/modules/API/pom.xml index 874332d3..67a4c020 100644 --- a/modules/API/pom.xml +++ b/modules/API/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 silkspawners-API jar @@ -23,7 +24,7 @@ org.spigotmc spigot-api - 1.20.2-R0.1-SNAPSHOT + 1.20.4-R0.1-SNAPSHOT diff --git a/modules/SilkSpawners/pom.xml b/modules/SilkSpawners/pom.xml index 3b43cf6e..b086714f 100644 --- a/modules/SilkSpawners/pom.xml +++ b/modules/SilkSpawners/pom.xml @@ -42,7 +42,7 @@ org.spigotmc spigot-api - 1.20.2-R0.1-SNAPSHOT + 1.20.4-R0.1-SNAPSHOT com.sk89q @@ -190,7 +190,7 @@ de.dustplanet - silkspawners-v1_20_R2 + silkspawners-v1_20_R3 7.5.1-SNAPSHOT diff --git a/modules/SilkSpawners/src/main/java/de/dustplanet/silkspawners/SilkSpawners.java b/modules/SilkSpawners/src/main/java/de/dustplanet/silkspawners/SilkSpawners.java index 51c4b19b..ff0d4c90 100644 --- a/modules/SilkSpawners/src/main/java/de/dustplanet/silkspawners/SilkSpawners.java +++ b/modules/SilkSpawners/src/main/java/de/dustplanet/silkspawners/SilkSpawners.java @@ -53,9 +53,9 @@ public class SilkSpawners extends JavaPlugin { private String nmsVersion; private static final int PLUGIN_ID = 35_890; private static final int BSTATS_PLUGIN_ID = 273; - private static final String[] COMPATIBLE_MINECRAFT_VERSIONS = { "v1_8_R3", "v1_11_R1", "v1_12_R1", - "v1_13_R2", "v1_14_R1", "v1_15_R1", "v1_16_R1", "v1_16_R2", "v1_16_R3", "v1_17_R1", "v1_18_R1", "v1_18_R2", "v1_19_R1", - "v1_19_R2", "v1_19_R3", "v1_20_R1", "v1_20_R2" }; + private static final String[] COMPATIBLE_MINECRAFT_VERSIONS = { "v1_8_R3", "v1_11_R1", "v1_12_R1", "v1_13_R2", "v1_14_R1", "v1_15_R1", + "v1_16_R1", "v1_16_R2", "v1_16_R3", "v1_17_R1", "v1_18_R1", "v1_18_R2", "v1_19_R1", "v1_19_R2", "v1_19_R3", "v1_20_R1", + "v1_20_R3" }; public CommentedConfiguration config; public CommentedConfiguration localization; @Getter diff --git a/modules/v1_20_R2/pom.xml b/modules/v1_20_R3/pom.xml similarity index 85% rename from modules/v1_20_R2/pom.xml rename to modules/v1_20_R3/pom.xml index 305bf876..7b1ea13d 100644 --- a/modules/v1_20_R2/pom.xml +++ b/modules/v1_20_R3/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - silkspawners-v1_20_R2 + silkspawners-v1_20_R3 jar - SilkSpawners for v1_20_R2 + SilkSpawners for v1_20_R3 de.dustplanet @@ -16,7 +16,7 @@ org.spigotmc spigot - 1.20.2-R0.1-SNAPSHOT + 1.20.4-R0.1-SNAPSHOT provided remapped-mojang @@ -47,9 +47,9 @@ remap-mojang - org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:txt:maps-mojang + org.spigotmc:minecraft-server:1.20.4-R0.1-SNAPSHOT:txt:maps-mojang true - org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-mojang + org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT:jar:remapped-mojang true remapped-mojang @@ -62,8 +62,8 @@ remap-spigot ${project.build.directory}/${project.artifactId}-${project.version}-remapped-mojang.jar - org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-mojang + org.spigotmc:minecraft-server:1.20.4-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT:jar:remapped-mojang diff --git a/modules/v1_20_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R2/NMSHandler.java b/modules/v1_20_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R3/NMSHandler.java similarity index 97% rename from modules/v1_20_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R2/NMSHandler.java rename to modules/v1_20_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R3/NMSHandler.java index 969683e0..6898d002 100644 --- a/modules/v1_20_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R2/NMSHandler.java +++ b/modules/v1_20_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_20_R3/NMSHandler.java @@ -1,4 +1,4 @@ -package de.dustplanet.silkspawners.compat.v1_20_R2; +package de.dustplanet.silkspawners.compat.v1_20_R3; import java.lang.reflect.Field; import java.util.ArrayList; @@ -22,12 +22,12 @@ import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.boss.BossBar; -import org.bukkit.craftbukkit.v1_20_R2.CraftServer; -import org.bukkit.craftbukkit.v1_20_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R2.block.CraftBlockEntityState; -import org.bukkit.craftbukkit.v1_20_R2.block.CraftCreatureSpawner; -import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_20_R3.CraftServer; +import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R3.block.CraftBlockEntityState; +import org.bukkit.craftbukkit.v1_20_R3.block.CraftCreatureSpawner; +import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.inventory.ItemStack; @@ -53,7 +53,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerPlayerConnection; -import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; @@ -202,9 +201,8 @@ public boolean setMobNameOfSpawner(final BlockState blockState, final String mob final SpawnerBlockEntity tile = (SpawnerBlockEntity) tileField.get(spawner); final Registry> entityTypeRegistry = BuiltInRegistries.ENTITY_TYPE; final ResourceLocation resourceLocation = new ResourceLocation(safeMobID); - final RandomSource rand = RandomSource.create(); - tile.getSpawner().setEntityId(entityTypeRegistry.get(resourceLocation), spawner.getWorldHandle().getMinecraftWorld(), rand, - spawner.getPosition()); + tile.getSpawner().setEntityId(entityTypeRegistry.get(resourceLocation), spawner.getWorldHandle().getMinecraftWorld(), + spawner.getWorldHandle().getRandom(), spawner.getPosition()); return true; } catch (IllegalArgumentException | IllegalAccessException e) { Bukkit.getLogger().warning("[SilkSpawners] Reflection failed: " + e.getMessage()); diff --git a/pom.xml b/pom.xml index 0e08bd56..73cf0d03 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ modules/v1_19_R2 modules/v1_19_R3 modules/v1_20_R1 - modules/v1_20_R2 + modules/v1_20_R3 modules/SilkSpawners