Using parent & hopefully fixed #109

This commit is contained in:
Norbi Peti 2019-10-23 02:40:34 +02:00
parent f1cec2ced1
commit 88c1d100e9
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
3 changed files with 15 additions and 33 deletions

View file

@ -9,9 +9,8 @@ before_install: | # Wget BuildTools and run if cached folder not found
fi fi
language: java language: java
jdk: jdk:
- oraclejdk8 - oraclejdk11
sudo: true sudo: true
dist: trusty # Needed for Java 8, although we might not need Java 8
deploy: deploy:
# deploy develop to the staging environment # deploy develop to the staging environment
- provider: script - provider: script

22
pom.xml
View file

@ -2,6 +2,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
<artifactId>CorePOM</artifactId>
<version>master-SNAPSHOT</version>
</parent>
<groupId>com.github.TBMCPlugins</groupId> <groupId>com.github.TBMCPlugins</groupId>
<artifactId>DiscordPlugin</artifactId> <artifactId>DiscordPlugin</artifactId>
<version>master-SNAPSHOT</version> <version>master-SNAPSHOT</version>
@ -34,22 +40,6 @@
</resources> </resources>
<finalName>DiscordPlugin</finalName> <finalName>DiscordPlugin</finalName>
<plugins> <plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<source>10</source>
<target>10</target>
<!-- <compilerArgs>
<arg>-processor</arg>
<arg>buttondevteam.buttonproc.ButtonProcessor, lombok.core.AnnotationProcessor</arg>
</compilerArgs> -->
<!-- <annotationProcessors>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
<annotationProcessor>buttondevteam.buttonproc.ButtonProcessor</annotationProcessor>
</annotationProcessors> -->
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>

View file

@ -142,22 +142,15 @@ public class PlayerListWatcher {
} }
}); });
plist = currentPL; plist = currentPL;
try { for (var plc = dplc; plc != null; plc = plc.getSuperclass()) { //Set all fields
Field mpf = mock.getClass().getField("maxPlayers"); for (var f : plc.getDeclaredFields()) {
mpf.setAccessible(true); f.setAccessible(true);
Field modf = mpf.getClass().getDeclaredField("modifiers"); Field modf = f.getClass().getDeclaredField("modifiers");
modf.setAccessible(true); modf.setAccessible(true);
modf.set(mpf, mpf.getModifiers() & ~Modifier.FINAL); modf.set(f, f.getModifiers() & ~Modifier.FINAL);
mpf.set(mock, mpf.get(plist)); f.set(mock, f.get(plist));
} catch (NoSuchFieldException ignored) { }
//The field no longer exists on 1.14
} }
Field plf = mock.getClass().getField("players");
plf.setAccessible(true);
Field modf = plf.getClass().getDeclaredField("modifiers");
modf.setAccessible(true);
modf.set(plf, plf.getModifiers() & ~Modifier.FINAL);
plf.set(mock, plf.get(plist));
} }
try { try {
server.getClass().getMethod("a", dplc).invoke(server, up ? mock : plist); server.getClass().getMethod("a", dplc).invoke(server, up ? mock : plist);