⚡ Fix dependency graph and replace Guava
This commit is contained in:
parent
4ca47777a3
commit
e914d04450
35 changed files with 184 additions and 191 deletions
|
|
@ -1,5 +1,5 @@
|
|||
dependencies {
|
||||
implementation project(':cloud-core')
|
||||
/* Needs to be provided by the platform */
|
||||
implementation 'com.mojang:brigadier:1.0.17'
|
||||
compileOnly 'com.mojang:brigadier:1.0.17'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.brigadier;
|
||||
|
||||
import io.leangen.geantyref.GenericTypeReflector;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.Command;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.CommandTree;
|
||||
|
|
@ -41,8 +43,6 @@ import cloud.commandframework.context.CommandContext;
|
|||
import cloud.commandframework.execution.preprocessor.CommandPreprocessingContext;
|
||||
import cloud.commandframework.permission.CommandPermission;
|
||||
import cloud.commandframework.permission.Permission;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.mojang.brigadier.LiteralMessage;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||
|
|
@ -61,6 +61,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -96,8 +97,8 @@ public final class CloudBrigadierManager<C, S> {
|
|||
public CloudBrigadierManager(@Nonnull final CommandManager<C> commandManager,
|
||||
@Nonnull final Supplier<CommandContext<C>>
|
||||
dummyContextProvider) {
|
||||
this.mappers = Maps.newHashMap();
|
||||
this.defaultArgumentTypeSuppliers = Maps.newHashMap();
|
||||
this.mappers = new HashMap<>();
|
||||
this.defaultArgumentTypeSuppliers = new HashMap<>();
|
||||
this.commandManager = commandManager;
|
||||
this.dummyContextProvider = dummyContextProvider;
|
||||
this.registerInternalMappings();
|
||||
|
|
@ -196,7 +197,7 @@ public final class CloudBrigadierManager<C, S> {
|
|||
public <T, K extends ArgumentParser<C, T>, O> void registerMapping(@Nonnull final TypeToken<K> argumentType,
|
||||
@Nonnull final Function<? extends K,
|
||||
? extends ArgumentType<O>> mapper) {
|
||||
this.mappers.put(argumentType.getRawType(), mapper);
|
||||
this.mappers.put(GenericTypeReflector.erase(argumentType.getType()), mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -217,7 +218,7 @@ public final class CloudBrigadierManager<C, S> {
|
|||
@Nonnull final TypeToken<T> argumentType,
|
||||
@Nonnull final K argument) {
|
||||
final ArgumentParser<C, ?> commandArgument = (ArgumentParser<C, ?>) argument;
|
||||
Function function = this.mappers.get(argumentType.getRawType());
|
||||
Function function = this.mappers.get(GenericTypeReflector.erase(argumentType.getType()));
|
||||
if (function == null) {
|
||||
return this.createDefaultMapper(valueType, commandArgument);
|
||||
}
|
||||
|
|
@ -350,7 +351,7 @@ public final class CloudBrigadierManager<C, S> {
|
|||
.executes(executor);
|
||||
} else {
|
||||
final Pair<ArgumentType<?>, Boolean> pair = this.getArgument(root.getValue().getValueType(),
|
||||
TypeToken.of(root.getValue().getParser().getClass()),
|
||||
TypeToken.get(root.getValue().getParser().getClass()),
|
||||
root.getValue().getParser());
|
||||
final SuggestionProvider<S> provider = pair.getRight() ? null : suggestionProvider;
|
||||
argumentBuilder = RequiredArgumentBuilder
|
||||
|
|
|
|||
|
|
@ -4,29 +4,7 @@ def adventureVersion = '4.0.0-SNAPSHOT'
|
|||
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include(project(':cloud-paper'))
|
||||
include(project(':cloud-annotations'))
|
||||
include(project(':cloud-minecraft-extras'))
|
||||
include(project(':cloud-core'))
|
||||
include(project(':cloud-services'))
|
||||
include(project(':cloud-brigadier'))
|
||||
include(project(':cloud-bukkit'))
|
||||
/* Commodore */
|
||||
include(dependency('me.lucko:commodore:1.9'))
|
||||
/* Adventure */
|
||||
include(dependency("net.kyori:adventure-platform-bukkit:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-text-minimessage:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-text-serializer-bungeecord:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-text-serializer-legacy:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-text-serializer-gson:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-api:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-platform-api:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-platform-common:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-platform-viaversion:${adventureVersion}"))
|
||||
include(dependency("net.kyori:adventure-nbt:${adventureVersion}"))
|
||||
/* Examination */
|
||||
include(dependency("net.kyori:examination-api:1.0.0"))
|
||||
include(dependency("net.kyori:examination-string:1.0.0"))
|
||||
exclude(dependency('org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT'))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
dependencies {
|
||||
api (project(':cloud-core')) {
|
||||
/* Exposed by Bukkit */
|
||||
exclude group: 'com.google.guava', module: 'guava'
|
||||
}
|
||||
api (project(':cloud-brigadier')) {
|
||||
/* Once again exposed by Bukkit */
|
||||
exclude group: 'com.google.guava', module: 'guava'
|
||||
}
|
||||
implementation 'org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT'
|
||||
implementation 'me.lucko:commodore:1.9'
|
||||
api project(':cloud-core')
|
||||
api project(':cloud-brigadier')
|
||||
compileOnly 'org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT'
|
||||
compileOnly 'me.lucko:commodore:1.9'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import cloud.commandframework.CommandTree;
|
|||
import cloud.commandframework.bukkit.parsers.MaterialArgument;
|
||||
import cloud.commandframework.bukkit.parsers.WorldArgument;
|
||||
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
|
@ -84,8 +84,8 @@ public class BukkitCommandManager<C> extends CommandManager<C> {
|
|||
this.backwardsCommandSenderMapper = backwardsCommandSenderMapper;
|
||||
|
||||
/* Register Bukkit parsers */
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.of(World.class), params -> new WorldArgument.WorldParser<>());
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.of(Material.class),
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.get(World.class), params -> new WorldArgument.WorldParser<>());
|
||||
this.getParserRegistry().registerParserSupplier(TypeToken.get(Material.class),
|
||||
params -> new MaterialArgument.MaterialParser<>());
|
||||
|
||||
/* Try to determine the Minecraft version */
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
dependencies {
|
||||
api (project(':cloud-bukkit')) {
|
||||
/* Exposed by Bukkit */
|
||||
exclude group: 'com.google.guava', module: 'guava'
|
||||
}
|
||||
api project(':cloud-bukkit')
|
||||
compileOnly 'com.destroystokyo.paper:paper-api:1.15.2-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.destroystokyo.paper:paper-mojangapi:1.15.2-R0.1-SNAPSHOT'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue