Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/buildtools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ checkVersion "1.21.3" "21"
checkVersion "1.21.4" "21"
checkVersion "1.21.5" "21"
checkVersion "1.21.6" "21"
checkVersion "1.21.9" "21"
checkVersion "1.21.10" "21"
checkVersion "1.21.11" "21"
29 changes: 21 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<plugin.compile.version>3.10.1</plugin.compile.version>
<plugin.shade.version>3.4.0</plugin.shade.version>
<plugin.jar.version>3.4.2</plugin.jar.version>
<plugin.flatten.version>1.2.7</plugin.flatten.version>
<plugin.specialsource.version>2.0.2</plugin.specialsource.version>

Expand All @@ -51,14 +52,6 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.compile.version}</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -90,6 +83,26 @@
</filters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${plugin.jar.version}</version>
<configuration>
<archive>
<manifestEntries>
<paperweight-mappings-namespace>mojang</paperweight-mappings-namespace>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.compile.version}</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ private static final class NmsMapping {
private static final List<NmsMapping> MAPPINGS = new ArrayList<>();

static {
MAPPINGS.add(new NmsMapping("1.21.9", "v1_21_R6"));
MAPPINGS.add(new NmsMapping("1.21.11", "v1_21_R7"));
MAPPINGS.add(new NmsMapping("1.21.10", "v1_21_R6"));
MAPPINGS.add(new NmsMapping("1.21.6", "v1_21_R5"));
MAPPINGS.add(new NmsMapping("1.21.5", "v1_21_R4"));
MAPPINGS.add(new NmsMapping("1.21.4", "v1_21_R3"));
Expand Down
48 changes: 48 additions & 0 deletions zip-common/src/main/java/net/imprex/zip/common/ServerVersion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @author Imprex-Development
* @see <a href="https://github.com/Imprex-Development/orebfuscator/blob/master/orebfuscator-nms/orebfuscator-nms-api/src/main/java/net/imprex/orebfuscator/util/ServerVersion.java">ServerVersion.java</a>
*/
package net.imprex.zip.common;

public class ServerVersion {

private static final boolean IS_MOJANG_MAPPED = classExists("net.minecraft.core.BlockPos")
&& fieldExists("net.minecraft.world.level.block.Blocks", "AIR");
private static final boolean IS_FOLIA = classExists("io.papermc.paper.threadedregions.RegionizedServer");
private static final boolean IS_PAPER = !IS_FOLIA && classExists("com.destroystokyo.paper.PaperConfig");
private static final boolean IS_BUKKIT = !IS_FOLIA && !IS_PAPER;

private static boolean classExists(String className) {
try {
Class.forName(className);
return true;
} catch (ClassNotFoundException e) {
return false;
}
}

private static boolean fieldExists(String className, String fieldName) {
try {
Class<?> target = Class.forName(className);
return target.getDeclaredField(fieldName) != null;
} catch (Exception e) {
return false;
}
}

public static boolean isMojangMapped() {
return IS_MOJANG_MAPPED;
}

public static boolean isFolia() {
return IS_FOLIA;
}

public static boolean isPaper() {
return IS_PAPER;
}

public static boolean isBukkit() {
return IS_BUKKIT;
}
}
1 change: 1 addition & 0 deletions zip-nms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
<module>zip-nms-v1_21_R4</module>
<module>zip-nms-v1_21_R5</module>
<module>zip-nms-v1_21_R6</module>
<module>zip-nms-v1_21_R7</module>
</modules>
</project>
84 changes: 84 additions & 0 deletions zip-nms/zip-nms-v1_21_R7/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>net.imprex</groupId>
<artifactId>zip-nms</artifactId>
<version>${revision}</version>
</parent>

<artifactId>zip-nms-v1_21_R7</artifactId>

<dependencies>
<dependency>
<groupId>net.imprex</groupId>
<artifactId>zip-nms-api</artifactId>
<version>${revision}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.21.11-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>mojang-mapped</shadedClassifierName>
<relocations>
<relocation>
<pattern>net.imprex.zip.nms.v1_21_R7</pattern>
<shadedPattern>net.imprex.zip.nms.v1_21_R7_mojang</shadedPattern>
</relocation>
</relocations>
</configuration>
</plugin>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>${plugin.specialsource.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>
org.spigotmc:minecraft-server:1.21.11-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>
org.spigotmc:spigot:1.21.11-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>
${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>
org.spigotmc:minecraft-server:1.21.11-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>
org.spigotmc:spigot:1.21.11-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading