Update to Spigot 1.18 api

+ Add legacy jar for 1.17 and previous
This commit is contained in:
Gabriele C 2021-11-28 18:17:10 +01:00
parent c4534e9546
commit b74496fb15
3 changed files with 32 additions and 22 deletions

View File

@ -116,7 +116,7 @@ You can also create your own translation file and, if you want, you can share it
## Requirements ## Requirements
##### Compiling requirements: ##### Compiling requirements:
>- JDK 8 (JDK 11 is recommended) >- JDK 8 (JDK 17 is recommended)
>- Maven >- Maven
>- Git/Github (Optional) >- Git/Github (Optional)

45
pom.xml
View File

@ -64,7 +64,7 @@
<maven.minimumVersion>3.6.0</maven.minimumVersion> <maven.minimumVersion>3.6.0</maven.minimumVersion>
<!-- Dependencies versions --> <!-- Dependencies versions -->
<spigot.version>1.17.1-R0.1-SNAPSHOT</spigot.version> <spigot.version>1.18-rc3-R0.1-SNAPSHOT</spigot.version>
<!-- Versioning properties --> <!-- Versioning properties -->
<project.outputName>AuthMe</project.outputName> <project.outputName>AuthMe</project.outputName>
@ -290,17 +290,15 @@
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<!--
<configuration> <configuration>
<artifactSet> <artifactSet>
<excludes> <excludes>
<exclude>mysql:mysql-connector-java</exclude> <exclude>com.google.guava:guava</exclude>
<exclude>com.google.code.gson:gson</exclude>
</excludes> </excludes>
</artifactSet> </artifactSet>
</configuration> </configuration>
-->
</execution> </execution>
<!--
<execution> <execution>
<id>shaded-jar-legacy</id> <id>shaded-jar-legacy</id>
<phase>package</phase> <phase>package</phase>
@ -308,11 +306,23 @@
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
Use the base jar name, to help server owners download the right jar
<finalName>${project.finalNameBase}-legacy</finalName> <finalName>${project.finalNameBase}-legacy</finalName>
<relocations>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>fr.xephi.authme.libs.com.google.common</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.thirdparty</pattern>
<shadedPattern>fr.xephi.authme.libs.com.google.thirdparty</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>fr.xephi.authme.libs.com.google.gson</shadedPattern>
</relocation>
</relocations>
</configuration> </configuration>
</execution> </execution>
-->
</executions> </executions>
<configuration> <configuration>
<!-- Don't create the reduced pom file, as we don't deploy the shaded jar --> <!-- Don't create the reduced pom file, as we don't deploy the shaded jar -->
@ -326,7 +336,7 @@
Relocate all lib we use in order to fix class loading errors if we use different versions Relocate all lib we use in order to fix class loading errors if we use different versions
than already loaded libs than already loaded libs
--> -->
<relocations> <relocations combine.children="append">
<relocation> <relocation>
<pattern>ch.jalu</pattern> <pattern>ch.jalu</pattern>
<shadedPattern>fr.xephi.authme.libs.ch.jalu</shadedPattern> <shadedPattern>fr.xephi.authme.libs.ch.jalu</shadedPattern>
@ -399,13 +409,10 @@
<exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude> <exclude>META-INF/*.RSA</exclude>
</excludes> <exclude>META-INF/*.RSA</exclude>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude> <exclude>META-INF/*.MF</exclude>
<exclude>META-INF/DEPENDENCIES</exclude> <exclude>META-INF/DEPENDENCIES</exclude>
<exclude>META-INF/**/module-info.class</exclude>
</excludes> </excludes>
</filter> </filter>
</filters> </filters>
@ -682,19 +689,19 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Keep in sync with spigot 1.8.8 --> <!-- Keep in sync with spigot 1.18 -->
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>17.0</version> <version>31.0.1-jre</version>
<scope>provided</scope> <optional>true</optional>
</dependency> </dependency>
<!-- Keep in sync with spigot 1.8.8 --> <!-- Keep in sync with spigot 1.18 -->
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.2.4</version> <version>2.8.8</version>
<scope>provided</scope> <optional>true</optional>
</dependency> </dependency>
<!-- Bukkit Libraries --> <!-- Bukkit Libraries -->

View File

@ -2,7 +2,6 @@ package fr.xephi.authme.events;
import fr.xephi.authme.ClassCollector; import fr.xephi.authme.ClassCollector;
import fr.xephi.authme.TestHelper; import fr.xephi.authme.TestHelper;
import org.apache.commons.lang.reflect.MethodUtils;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -49,7 +48,11 @@ public class EventsConsistencyTest {
@Test @Test
public void shouldHaveStaticEventHandlerMethod() { public void shouldHaveStaticEventHandlerMethod() {
for (Class<?> clazz : classes) { for (Class<?> clazz : classes) {
Method handlerListMethod = MethodUtils.getAccessibleMethod(clazz, "getHandlerList", new Class<?>[]{}); Method handlerListMethod = null;
try {
handlerListMethod = clazz.getMethod("getHandlerList");
} catch (NoSuchMethodException ignored) {
}
if (canBeInstantiated(clazz)) { if (canBeInstantiated(clazz)) {
assertThat("Class " + clazz.getSimpleName() + " has static method getHandlerList()", assertThat("Class " + clazz.getSimpleName() + " has static method getHandlerList()",
handlerListMethod != null && Modifier.isStatic(handlerListMethod.getModifiers()), equalTo(true)); handlerListMethod != null && Modifier.isStatic(handlerListMethod.getModifiers()), equalTo(true));