diff --git a/.github/workflows/maven-pr.yml b/.github/workflows/maven-pr.yml index 2e7b8558..4c746752 100644 --- a/.github/workflows/maven-pr.yml +++ b/.github/workflows/maven-pr.yml @@ -26,7 +26,7 @@ jobs: java -version mvn --version - - name: Build Spigot and Paper versions + - name: Build Spigot versions # See https://issues.apache.org/jira/browse/MDEP-568 and https://github.com/apache/maven-dependency-plugin/pull/2 run: | mvn com.offbytwo.maven.plugins:maven-dependency-plugin:3.1.1.MDEP568:go-offline -DexcludeGroupIds=de.dustplanet -B || rm -r ~/.m2/repository/org/ @@ -44,50 +44,5 @@ jobs: [ -f ~/.m2/repository/org/spigotmc/spigot/1.9.4-R0.1-SNAPSHOT/spigot-1.9.4-R0.1-SNAPSHOT.jar ] || java -jar BuildTools.jar --rev 1.9.4 [ -f ~/.m2/repository/org/spigotmc/spigot/1.8.8-R0.1-SNAPSHOT/spigot-1.8.8-R0.1-SNAPSHOT.jar ] || java -jar BuildTools.jar --rev 1.8.8 [ -f ~/.m2/repository/org/spigotmc/spigot/1.8-R0.1-SNAPSHOT/spigot-1.8-R0.1-SNAPSHOT.jar ] || java -jar BuildTools.jar --rev 1.8 - cd .. - - git clone https://github.com/PaperMC/Paper.git - cd Paper - - if [ ! -f ~/.m2/repository/com/destroystokyo/paper/paper/1.16.5-R0.1-SNAPSHOT/paper-1.16.5-R0.1-SNAPSHOT.jar ]; then - git checkout ver/1.16.5 - git clean -xfd - git submodule foreach --recursive git clean -xfd - git reset --hard - git submodule foreach --recursive git reset --hard - git submodule update --init --recursive - ./paper jar - fi - - if [ ! -f ~/.m2/repository/com/destroystokyo/paper/paper/1.16.3-R0.1-SNAPSHOT/paper-1.16.3-R0.1-SNAPSHOT.jar ]; then - git checkout 4bcebab1675d88d144d2896734f4a940345f76c2 - git clean -xfd - git submodule foreach --recursive git clean -xfd - git reset --hard - git submodule foreach --recursive git reset --hard - git submodule update --init --recursive - ./paper jar - fi - - if [ ! -f ~/.m2/repository/com/destroystokyo/paper/paper/1.16.1-R0.1-SNAPSHOT/paper-1.16.1-R0.1-SNAPSHOT.jar ]; then - git checkout 627f4b8561115d40d6a39587d1ad94b0104f7e14 - git clean -xfd - git submodule foreach --recursive git clean -xfd - git reset --hard - git submodule foreach --recursive git reset --hard - git submodule update --init --recursive - ./paper jar - fi - - if [ ! -f ~/.m2/repository/com/destroystokyo/paper/paper/1.15.2-R0.1-SNAPSHOT/paper-1.15.2-R0.1-SNAPSHOT.jar ]; then - git checkout ver/1.15.2 - git clean -xfd - git submodule foreach --recursive git clean -xfd - git reset --hard - git submodule foreach --recursive git reset --hard - git submodule update --init --recursive - ./paper jar - fi - - 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 632c7db2..31066a12 100644 --- a/README.md +++ b/README.md @@ -308,12 +308,13 @@ Please follow the Sun Coding Guidelines, thanks! ## Building -Unfortunately, I can't give access to https://repo.dustplanet.de/artifactory/private due to the DMCA of CraftBukkit and the prohibiton to distribute those or Spigot's nor Paper's binaries. To successfully build SilkSpawners using Maven, you must first run Spigot's BuildTools and Paper for several versions in order to compile each module - this will populate the local `.m2` cache of yours. +Unfortunately, I can't give access to https://repo.dustplanet.de/artifactory/private due to the DMCA of CraftBukkit and the prohibiton to distribute those or Spigot's binaries. To successfully build SilkSpawners using Maven, you must first run Spigot's BuildTools for several versions in order to compile each module - this will populate the local `.m2` cache of yours. ```sh 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.18.2 --remapped java -jar BuildTools.jar --rev 1.18.1 --remapped java -jar BuildTools.jar --rev 1.17.1 --remapped java -jar BuildTools.jar --rev 1.14.4 @@ -326,48 +327,6 @@ java -jar BuildTools.jar --rev 1.8.8 java -jar BuildTools.jar --rev 1.8 ``` -For Minecraft 1.15 and newer, Paper is required to be present (there is currently an exception for 1.17+): - -```sh -git clone https://github.com/PaperMC/Paper.git -cd Paper -# 1.16.5 (v1_16_R3) -git checkout ver/1.16.5 -git clean -xfd -git submodule foreach --recursive git clean -xfd -git reset --hard -git submodule foreach --recursive git reset --hard -git submodule update --init --recursive -./paper jar - -# 1.16.3 (v1_16_R2) -git checkout 4bcebab1675d88d144d2896734f4a940345f76c2 -git clean -xfd -git submodule foreach --recursive git clean -xfd -git reset --hard -git submodule foreach --recursive git reset --hard -git submodule update --init --recursive -./paper jar - -# 1.16.1 (v1_16_R1) -git checkout 627f4b8561115d40d6a39587d1ad94b0104f7e14 -git clean -xfd -git submodule foreach --recursive git clean -xfd -git reset --hard -git submodule foreach --recursive git reset --hard -git submodule update --init --recursive -./paper jar - -# 1.15.2 (v1_15_R1) -git checkout ver/1.15.2 -git clean -xfd -git submodule foreach --recursive git clean -xfd -git reset --hard -git submodule foreach --recursive git reset --hard -git submodule update --init --recursive -./paper jar -``` - The final `SilkSpawners.jar` can now be generated by invoking `mvn clean package`. The location of this output can be found in the `modules/SilkSpawners/target` folder. ## Usage statistics diff --git a/modules/v1_15_R1/pom.xml b/modules/v1_15_R1/pom.xml index 7575fb4b..ebc325f1 100644 --- a/modules/v1_15_R1/pom.xml +++ b/modules/v1_15_R1/pom.xml @@ -13,8 +13,8 @@ - com.destroystokyo.paper - paper + org.spigotmc + spigot 1.15.2-R0.1-SNAPSHOT diff --git a/modules/v1_15_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_15_R1/NMSHandler.java b/modules/v1_15_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_15_R1/NMSHandler.java index 42fb01dd..7cd7a02d 100644 --- a/modules/v1_15_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_15_R1/NMSHandler.java +++ b/modules/v1_15_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_15_R1/NMSHandler.java @@ -38,7 +38,6 @@ import org.bukkit.scheduler.BukkitRunnable; import org.spigotmc.SpigotWorldConfig; -import com.destroystokyo.paper.PaperWorldConfig; import com.google.common.base.CaseFormat; import com.mojang.authlib.GameProfile; @@ -98,12 +97,17 @@ public NMSHandler(final boolean checkForNerfFlags) { } try { - final PaperWorldConfig paperConfig = handle.paperConfig; - if (!paperConfig.ironGolemsCanSpawnInAir) { + final Field paperConfigField = World.class.getDeclaredField("paperConfig"); + paperConfigField.setAccessible(true); + + final Field ironGolemsCanSpawnInAirField = paperConfigField.getType().getDeclaredField("ironGolemsCanSpawnInAir"); + ironGolemsCanSpawnInAirField.setAccessible(true); + if (!ironGolemsCanSpawnInAirField.getBoolean(paperConfigField.get(handle))) { Bukkit.getLogger().warning( "[SilkSpawners] Warning! \"iron-golems-can-spawn-in-air\" is set to false in the paper.yml! Iron Golem farms might not work!"); } - } catch (@SuppressWarnings("unused") final NoSuchFieldError e) { + } catch (@SuppressWarnings("unused") final NoSuchFieldError | IllegalArgumentException | IllegalAccessException + | NoSuchFieldException | SecurityException e) { // Silence } } diff --git a/modules/v1_16_R1/pom.xml b/modules/v1_16_R1/pom.xml index 49afcab2..bd5595a5 100644 --- a/modules/v1_16_R1/pom.xml +++ b/modules/v1_16_R1/pom.xml @@ -13,8 +13,8 @@ - com.destroystokyo.paper - paper + org.spigotmc + spigot 1.16.1-R0.1-SNAPSHOT diff --git a/modules/v1_16_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R1/NMSHandler.java b/modules/v1_16_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R1/NMSHandler.java index db4aed0b..62eeff1c 100644 --- a/modules/v1_16_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R1/NMSHandler.java +++ b/modules/v1_16_R1/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R1/NMSHandler.java @@ -38,7 +38,6 @@ import org.bukkit.scheduler.BukkitRunnable; import org.spigotmc.SpigotWorldConfig; -import com.destroystokyo.paper.PaperWorldConfig; import com.google.common.base.CaseFormat; import com.mojang.authlib.GameProfile; @@ -97,12 +96,17 @@ public NMSHandler(final boolean checkForNerfFlags) { } try { - final PaperWorldConfig paperConfig = handle.paperConfig; - if (!paperConfig.ironGolemsCanSpawnInAir) { + final Field paperConfigField = World.class.getDeclaredField("paperConfig"); + paperConfigField.setAccessible(true); + + final Field ironGolemsCanSpawnInAirField = paperConfigField.getType().getDeclaredField("ironGolemsCanSpawnInAir"); + ironGolemsCanSpawnInAirField.setAccessible(true); + if (!ironGolemsCanSpawnInAirField.getBoolean(paperConfigField.get(handle))) { Bukkit.getLogger().warning( "[SilkSpawners] Warning! \"iron-golems-can-spawn-in-air\" is set to false in the paper.yml! Iron Golem farms might not work!"); } - } catch (@SuppressWarnings("unused") final NoSuchFieldError e) { + } catch (@SuppressWarnings("unused") final NoSuchFieldError | IllegalArgumentException | IllegalAccessException + | NoSuchFieldException | SecurityException e) { // Silence } } diff --git a/modules/v1_16_R2/pom.xml b/modules/v1_16_R2/pom.xml index 1e0befc3..41266685 100644 --- a/modules/v1_16_R2/pom.xml +++ b/modules/v1_16_R2/pom.xml @@ -13,12 +13,12 @@ - com.destroystokyo.paper - paper + org.spigotmc + spigot 1.16.3-R0.1-SNAPSHOT - io.papermc + org.spigotmc minecraft-server diff --git a/modules/v1_16_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R2/NMSHandler.java b/modules/v1_16_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R2/NMSHandler.java index 9b2ce5df..27255028 100644 --- a/modules/v1_16_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R2/NMSHandler.java +++ b/modules/v1_16_R2/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R2/NMSHandler.java @@ -38,7 +38,6 @@ import org.bukkit.scheduler.BukkitRunnable; import org.spigotmc.SpigotWorldConfig; -import com.destroystokyo.paper.PaperWorldConfig; import com.google.common.base.CaseFormat; import com.mojang.authlib.GameProfile; @@ -97,12 +96,17 @@ public NMSHandler(final boolean checkForNerfFlags) { } try { - final PaperWorldConfig paperConfig = handle.paperConfig; - if (!paperConfig.ironGolemsCanSpawnInAir) { + final Field paperConfigField = World.class.getDeclaredField("paperConfig"); + paperConfigField.setAccessible(true); + + final Field ironGolemsCanSpawnInAirField = paperConfigField.getType().getDeclaredField("ironGolemsCanSpawnInAir"); + ironGolemsCanSpawnInAirField.setAccessible(true); + if (!ironGolemsCanSpawnInAirField.getBoolean(paperConfigField.get(handle))) { Bukkit.getLogger().warning( "[SilkSpawners] Warning! \"iron-golems-can-spawn-in-air\" is set to false in the paper.yml! Iron Golem farms might not work!"); } - } catch (@SuppressWarnings("unused") final NoSuchFieldError e) { + } catch (@SuppressWarnings("unused") final NoSuchFieldError | IllegalArgumentException | IllegalAccessException + | NoSuchFieldException | SecurityException e) { // Silence } } diff --git a/modules/v1_16_R3/pom.xml b/modules/v1_16_R3/pom.xml index 316e5ee5..c57c9e3a 100644 --- a/modules/v1_16_R3/pom.xml +++ b/modules/v1_16_R3/pom.xml @@ -13,12 +13,12 @@ - com.destroystokyo.paper - paper + org.spigotmc + spigot 1.16.5-R0.1-SNAPSHOT - io.papermc + org.spigotmc minecraft-server diff --git a/modules/v1_16_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R3/NMSHandler.java b/modules/v1_16_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R3/NMSHandler.java index 6c5432c1..a3af2e43 100644 --- a/modules/v1_16_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R3/NMSHandler.java +++ b/modules/v1_16_R3/src/main/java/de/dustplanet/silkspawners/compat/v1_16_R3/NMSHandler.java @@ -38,7 +38,6 @@ import org.bukkit.scheduler.BukkitRunnable; import org.spigotmc.SpigotWorldConfig; -import com.destroystokyo.paper.PaperWorldConfig; import com.google.common.base.CaseFormat; import com.mojang.authlib.GameProfile; @@ -97,12 +96,17 @@ public NMSHandler(final boolean checkForNerfFlags) { } try { - final PaperWorldConfig paperConfig = handle.paperConfig; - if (!paperConfig.ironGolemsCanSpawnInAir) { + final Field paperConfigField = World.class.getDeclaredField("paperConfig"); + paperConfigField.setAccessible(true); + + final Field ironGolemsCanSpawnInAirField = paperConfigField.getType().getDeclaredField("ironGolemsCanSpawnInAir"); + ironGolemsCanSpawnInAirField.setAccessible(true); + if (!ironGolemsCanSpawnInAirField.getBoolean(paperConfigField.get(handle))) { Bukkit.getLogger().warning( "[SilkSpawners] Warning! \"iron-golems-can-spawn-in-air\" is set to false in the paper.yml! Iron Golem farms might not work!"); } - } catch (@SuppressWarnings("unused") final NoSuchFieldError e) { + } catch (@SuppressWarnings("unused") final NoSuchFieldError | IllegalArgumentException | IllegalAccessException + | NoSuchFieldException | SecurityException e) { // Silence } }