Merge branch 'development'

This commit is contained in:
Christian Koop 2021-12-10 19:46:28 +01:00
commit 7c778fc90a
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
24 changed files with 74 additions and 52 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -170,10 +170,7 @@ public enum CompatibleBiome {
}
public boolean isCompatible() {
Version version = versions.getLast();
ServerVersion.isServerVersionAtLeast(version.version);
return true;
return getBiome() != null;
}
public List<Version> getVersions() {
@ -181,10 +178,13 @@ public enum CompatibleBiome {
}
public Biome getBiome() {
for (Version version : versions) {
if (ServerVersion.isServerVersionAtLeast(version.version)) {
return Biome.valueOf(version.biome);
try {
for (Version version : versions) {
if (ServerVersion.isServerVersionAtLeast(version.version)) {
return Biome.valueOf(version.biome);
}
}
} catch (IllegalArgumentException ignore) { // This means the supporter biome server version is wrongly configured
}
return null;

View File

@ -6,46 +6,53 @@ import java.lang.reflect.Method;
public enum MethodMapping {
MC_ITEM_STACK__GET_TAG("getTag", "s"),
MC_ITEM_STACK__SET_TAG("setTag", "c", ClassMapping.NBT_TAG_COMPOUND.getClazz()),
MC_ITEM_STACK__GET_TAG("getTag", "getTag", "s"),
MC_ITEM_STACK__SET_TAG("setTag", "setTag", "c", ClassMapping.NBT_TAG_COMPOUND.getClazz()),
MC_NBT_TAG_COMPOUND__SET("set", "a", String.class, ClassMapping.NBT_BASE.getClazz()),
MC_NBT_TAG_COMPOUND__SET_SHORT("setShort", "a", String.class),
MC_NBT_TAG_COMPOUND__SET_STRING("setString", "a", String.class, String.class),
MC_NBT_TAG_COMPOUND__REMOVE("remove", "r", String.class, short.class),
MC_NBT_TAG_COMPOUND__SET("set", "set", "a", String.class, ClassMapping.NBT_BASE.getClazz()),
MC_NBT_TAG_COMPOUND__SET_SHORT("setShort", "setShort", "a", String.class),
MC_NBT_TAG_COMPOUND__SET_STRING("setString", "setString", "a", String.class, String.class),
MC_NBT_TAG_COMPOUND__REMOVE("remove", "remove", "r", String.class, short.class),
CB_ITEM_STACK__AS_NMS_COPY("asNMSCopy", ItemStack.class),
CB_ITEM_STACK__AS_CRAFT_MIRROR("asCraftMirror", ClassMapping.ITEM_STACK.getClazz()),
CB_ITEM_STACK__AS_NMS_COPY("asNMSCopy", "asNMSCopy", ItemStack.class),
CB_ITEM_STACK__AS_CRAFT_MIRROR("asCraftMirror", "asCraftMirror", ClassMapping.ITEM_STACK.getClazz()),
MC_NBT_TAG_LIST__ADD("a", "add", "add", ClassMapping.NBT_BASE.getClazz()),
MC_NBT_TAG_LIST__ADD("add", "a", "add", "add", ClassMapping.NBT_BASE.getClazz()),
WORLD_BOARDER__SET_CENTER("setCenter", "setCenter", "c", double.class, double.class),
WORLD_BOARDER__SET_SIZE("setSize", "setSize", "a", double.class),
WORLD_BOARDER__SET_CENTER("setCenter", "setCenter", "setCenter", "c", double.class, double.class),
WORLD_BOARDER__SET_SIZE("setSize", "setSize", "setSize", "a", double.class),
WORLD_BOARDER__SET_WARNING_TIME("setWarningTime", "setWarningTime", "b", int.class),
WORLD_BOARDER__SET_WARNING_DISTANCE("setWarningDistance", "setWarningDistance", "c", int.class),
WORLD_BOARDER__TRANSITION_SIZE_BETWEEN("transitionSizeBetween", "transitionSizeBetween", "a", double.class, double.class, long.class);
WORLD_BOARDER__SET_WARNING_TIME("setWarningTime", "setWarningTime", "setWarningTime", "b", int.class),
WORLD_BOARDER__SET_WARNING_DISTANCE("setWarningDistance", "setWarningDistance", "setWarningDistance", "c", int.class),
WORLD_BOARDER__TRANSITION_SIZE_BETWEEN("transitionSizeBetween", "transitionSizeBetween", "transitionSizeBetween", "a", double.class, double.class, long.class);
private final String saneFallback;
private final String _1_14;
private final String _1_17;
private final String _1_18;
private final Class<?>[] paramaters;
MethodMapping(String _1_14, String _1_17, String _1_18, Class<?>... paramaters) {
MethodMapping(String saneFallback, String _1_14, String _1_17, String _1_18, Class<?>... paramaters) {
this.saneFallback = saneFallback;
this._1_14 = _1_14;
this._1_17 = _1_17;
this._1_18 = _1_18;
this.paramaters = paramaters;
}
MethodMapping(String _1_17, String _1_18, Class<?>... paramaters) {
MethodMapping(String saneFallback, String _1_17, String _1_18, Class<?>... paramaters) {
this.saneFallback = saneFallback;
this._1_14 = null;
this._1_17 = _1_17;
this._1_18 = _1_18;
this.paramaters = paramaters;
}
MethodMapping(String _1_18, Class<?>... paramaters) {
MethodMapping(String saneFallback, String _1_18, Class<?>... paramaters) {
this.saneFallback = saneFallback;
this._1_14 = null;
this._1_17 = null;
this._1_18 = _1_18;
@ -54,7 +61,6 @@ public enum MethodMapping {
public Method getMethod(Class<?> clazz) {
try {
String methodName = _1_18;
switch (ServerVersion.getServerVersion()) {
case V1_14:
@ -67,12 +73,28 @@ public enum MethodMapping {
break;
}
Method method = clazz.getDeclaredMethod(methodName, paramaters);
method.setAccessible(true);
try {
Method method = clazz.getDeclaredMethod(methodName, paramaters);
method.setAccessible(true);
return method;
} catch (Exception e) {
return null;
return method;
} catch (NoSuchMethodException ex) {
if (saneFallback != null) {
try {
Method method = clazz.getDeclaredMethod(saneFallback, paramaters);
method.setAccessible(true);
return method;
} catch (NoSuchMethodException innerEx) {
ex.printStackTrace();
innerEx.printStackTrace();
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -53,7 +53,7 @@ public class SongodaCore {
/**
* @since coreRevision 6
*/
private final static String coreVersion = "2.6.4";
private final static String coreVersion = "2.6.5";
/**
* This is specific to the website api

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -19,7 +19,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<groupId>com.songoda</groupId>
<artifactId>SongodaCore-Modules</artifactId>
<version>2.6.4</version>
<version>2.6.5</version>
<packaging>pom</packaging>
<!-- Run 'mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.Y.Z' to update version recursively -->