Merge pull request #50 from FrankHeijden/feature/1.19
Initial update for 1.19
This commit is contained in:
commit
32f4bd1572
4 changed files with 22 additions and 8 deletions
|
|
@ -58,12 +58,12 @@ public class BukkitPlugin extends ServerUtilsPlugin<Plugin, BukkitTask, BukkitAu
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandManager.queryCapability(CloudBukkitCapabilities.BRIGADIER)) {
|
if (commandManager.hasCapability(CloudBukkitCapabilities.BRIGADIER)) {
|
||||||
commandManager.registerBrigadier();
|
commandManager.registerBrigadier();
|
||||||
handleBrigadier(commandManager.brigadierManager());
|
handleBrigadier(commandManager.brigadierManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandManager.queryCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) {
|
if (commandManager.hasCapability(CloudBukkitCapabilities.ASYNCHRONOUS_COMPLETION)) {
|
||||||
commandManager.registerAsynchronousCompletions();
|
commandManager.registerAsynchronousCompletions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package net.frankheijden.serverutils.bukkit.reflection;
|
package net.frankheijden.serverutils.bukkit.reflection;
|
||||||
|
|
||||||
|
import dev.frankheijden.minecraftreflection.exceptions.MinecraftReflectionException;
|
||||||
import dev.frankheijden.minecraftreflection.MinecraftReflection;
|
import dev.frankheijden.minecraftreflection.MinecraftReflection;
|
||||||
import dev.frankheijden.minecraftreflection.MinecraftReflectionVersion;
|
import dev.frankheijden.minecraftreflection.MinecraftReflectionVersion;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
@ -12,6 +15,7 @@ import org.bukkit.plugin.Plugin;
|
||||||
public class RCraftingManager {
|
public class RCraftingManager {
|
||||||
|
|
||||||
private static final MinecraftReflection reflection;
|
private static final MinecraftReflection reflection;
|
||||||
|
private static final Method getCraftingManagerMethod;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (MinecraftReflectionVersion.MINOR >= 17) {
|
if (MinecraftReflectionVersion.MINOR >= 17) {
|
||||||
|
|
@ -19,6 +23,11 @@ public class RCraftingManager {
|
||||||
} else {
|
} else {
|
||||||
reflection = MinecraftReflection.of("net.minecraft.server.%s.CraftingManager");
|
reflection = MinecraftReflection.of("net.minecraft.server.%s.CraftingManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCraftingManagerMethod = Arrays.stream(RMinecraftServer.getReflection().getClazz().getDeclaredMethods())
|
||||||
|
.filter(m -> m.getReturnType().equals(reflection.getClazz()))
|
||||||
|
.findAny()
|
||||||
|
.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RCraftingManager() {}
|
private RCraftingManager() {}
|
||||||
|
|
@ -35,8 +44,12 @@ public class RCraftingManager {
|
||||||
RRegistryMaterials.removeKeysFor(reflection.get(null, "recipes"), plugin);
|
RRegistryMaterials.removeKeysFor(reflection.get(null, "recipes"), plugin);
|
||||||
} else if (MinecraftReflectionVersion.MINOR > 12) {
|
} else if (MinecraftReflectionVersion.MINOR > 12) {
|
||||||
Object server = RMinecraftServer.getReflection().invoke(null, "getServer");
|
Object server = RMinecraftServer.getReflection().invoke(null, "getServer");
|
||||||
String getCraftingManagerMethod = MinecraftReflectionVersion.MINOR >= 18 ? "aC" : "getCraftingManager";
|
Object craftingManager;
|
||||||
Object craftingManager = RMinecraftServer.getReflection().invoke(server, getCraftingManagerMethod);
|
try {
|
||||||
|
craftingManager = getCraftingManagerMethod.invoke(server);
|
||||||
|
} catch (ReflectiveOperationException ex) {
|
||||||
|
throw new MinecraftReflectionException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
Map recipes;
|
Map recipes;
|
||||||
if (MinecraftReflectionVersion.MINOR >= 17) {
|
if (MinecraftReflectionVersion.MINOR >= 17) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ plugins {
|
||||||
|
|
||||||
group = "net.frankheijden.serverutils"
|
group = "net.frankheijden.serverutils"
|
||||||
val dependencyDir = "${group}.dependencies"
|
val dependencyDir = "${group}.dependencies"
|
||||||
version = "3.4.5-SNAPSHOT"
|
version = "3.5.0-SNAPSHOT"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
@ -39,7 +39,7 @@ subprojects {
|
||||||
implementation("cloud.commandframework:cloud-brigadier:${VersionConstants.cloudVersion}")
|
implementation("cloud.commandframework:cloud-brigadier:${VersionConstants.cloudVersion}")
|
||||||
implementation("com.github.FrankHeijden:MinecraftReflection:1.0.0")
|
implementation("com.github.FrankHeijden:MinecraftReflection:1.0.0")
|
||||||
implementation("com.google.code.gson:gson:2.8.6")
|
implementation("com.google.code.gson:gson:2.8.6")
|
||||||
implementation("me.lucko:commodore:1.13")
|
implementation("me.lucko:commodore:2.0")
|
||||||
compileOnly("com.mojang:brigadier:1.0.18")
|
compileOnly("com.mojang:brigadier:1.0.18")
|
||||||
|
|
||||||
testImplementation("org.assertj:assertj-core:3.18.1")
|
testImplementation("org.assertj:assertj-core:3.18.1")
|
||||||
|
|
@ -55,6 +55,7 @@ subprojects {
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
|
options.isDeprecation = true
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
object VersionConstants {
|
object VersionConstants {
|
||||||
const val cloudVersion = "1.6.2"
|
const val cloudVersion = "1.7.0-SNAPSHOT"
|
||||||
const val adventureVersion = "4.9.3"
|
const val adventureVersion = "4.9.3"
|
||||||
const val adventurePlatformVersion = "4.0.1"
|
const val adventurePlatformVersion = "4.0.1"
|
||||||
const val adventureMinimessageVersion = "4.2.0-SNAPSHOT"
|
const val adventureMinimessageVersion = "4.2.0-SNAPSHOT"
|
||||||
const val bstatsVersion = "2.2.1"
|
const val bstatsVersion = "3.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue