Fix #388
This commit is contained in:
parent
73a0386a85
commit
4179bc4290
4 changed files with 15 additions and 4 deletions
|
|
@ -273,7 +273,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> implements Brigad
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether or not Brigadier can be used on the server instance
|
* Check whether Brigadier can be used on the server instance
|
||||||
*
|
*
|
||||||
* @throws BrigadierFailureException An exception is thrown if Brigadier isn't available. The exception
|
* @throws BrigadierFailureException An exception is thrown if Brigadier isn't available. The exception
|
||||||
* will contain the reason for this.
|
* will contain the reason for this.
|
||||||
|
|
@ -320,6 +320,9 @@ public class BukkitCommandManager<C> extends CommandManager<C> implements Brigad
|
||||||
public void registerBrigadier() throws BrigadierFailureException {
|
public void registerBrigadier() throws BrigadierFailureException {
|
||||||
this.requireState(RegistrationState.BEFORE_REGISTRATION);
|
this.requireState(RegistrationState.BEFORE_REGISTRATION);
|
||||||
this.checkBrigadierCompatibility();
|
this.checkBrigadierCompatibility();
|
||||||
|
if (!this.hasCapability(CloudBukkitCapabilities.COMMODORE_BRIGADIER)) {
|
||||||
|
throw new BrigadierFailureException(BrigadierFailureReason.VERSION_TOO_HIGH);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
final CloudCommodoreManager<C> cloudCommodoreManager = new CloudCommodoreManager<>(this);
|
final CloudCommodoreManager<C> cloudCommodoreManager = new CloudCommodoreManager<>(this);
|
||||||
cloudCommodoreManager.initialize(this);
|
cloudCommodoreManager.initialize(this);
|
||||||
|
|
@ -408,6 +411,7 @@ public class BukkitCommandManager<C> extends CommandManager<C> implements Brigad
|
||||||
public enum BrigadierFailureReason {
|
public enum BrigadierFailureReason {
|
||||||
COMMODORE_NOT_PRESENT,
|
COMMODORE_NOT_PRESENT,
|
||||||
VERSION_TOO_LOW,
|
VERSION_TOO_LOW,
|
||||||
|
VERSION_TOO_HIGH,
|
||||||
PAPER_BRIGADIER_INITIALIZATION_FAILURE
|
PAPER_BRIGADIER_INITIALIZATION_FAILURE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ public enum CloudBukkitCapabilities implements CloudCapability {
|
||||||
NATIVE_BRIGADIER(CraftBukkitReflection.classExists(
|
NATIVE_BRIGADIER(CraftBukkitReflection.classExists(
|
||||||
"com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent")),
|
"com.destroystokyo.paper.event.brigadier.CommandRegisteredEvent")),
|
||||||
|
|
||||||
COMMODORE_BRIGADIER(BRIGADIER.capable() && !NATIVE_BRIGADIER.capable()),
|
COMMODORE_BRIGADIER(BRIGADIER.capable()
|
||||||
|
&& !NATIVE_BRIGADIER.capable()
|
||||||
|
&& !CraftBukkitReflection.classExists("org.bukkit.entity.Warden")),
|
||||||
|
|
||||||
ASYNCHRONOUS_COMPLETION(CraftBukkitReflection.classExists(
|
ASYNCHRONOUS_COMPLETION(CraftBukkitReflection.classExists(
|
||||||
"com.destroystokyo.paper.event.server.AsyncTabCompleteEvent"));
|
"com.destroystokyo.paper.event.server.AsyncTabCompleteEvent"));
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,12 @@ class CloudCommodoreManager<C> extends BukkitPluginRegistrationHandler<C> {
|
||||||
try {
|
try {
|
||||||
final Class<?> commodoreImpl = this.commodore.getClass();
|
final Class<?> commodoreImpl = this.commodore.getClass();
|
||||||
|
|
||||||
final Method removeChild = commodoreImpl.getDeclaredMethod("removeChild", RootCommandNode.class, String.class);
|
Method removeChild;
|
||||||
|
try {
|
||||||
|
removeChild = commodoreImpl.getDeclaredMethod("removeChild", RootCommandNode.class, String.class);
|
||||||
|
} catch (final NoSuchMethodException ex) {
|
||||||
|
removeChild = commodoreImpl.getSuperclass().getDeclaredMethod("removeChild", RootCommandNode.class, String.class);
|
||||||
|
}
|
||||||
removeChild.setAccessible(true);
|
removeChild.setAccessible(true);
|
||||||
|
|
||||||
removeChild.invoke(
|
removeChild.invoke(
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ versions:
|
||||||
guava: 21.0-jre
|
guava: 21.0-jre
|
||||||
brigadier: 1.0.17
|
brigadier: 1.0.17
|
||||||
bukkit: 1.13.2-R0.1-SNAPSHOT
|
bukkit: 1.13.2-R0.1-SNAPSHOT
|
||||||
commodore: 2.0
|
commodore: 2.2
|
||||||
bungeecord: 1.8-SNAPSHOT
|
bungeecord: 1.8-SNAPSHOT
|
||||||
cloudburst: 1.0.0-SNAPSHOT
|
cloudburst: 1.0.0-SNAPSHOT
|
||||||
adventureApi: 4.9.3
|
adventureApi: 4.9.3
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue