Skip to content

Commit

Permalink
Fix minor inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
iiAhmedYT committed Nov 7, 2024
1 parent 30b60c3 commit fbda832
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 20 deletions.
1 change: 0 additions & 1 deletion bukkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ dependencies {
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
compileOnly 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT'

compileOnly "${kyori(KyoriModule.API)}"
compileOnly "${kyoriPlatform(KyoriModule.BUKKIT)}"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class BukkitConfigBuilder extends ConfigBuilder<BukkitSource, BukkitImperat> {

Expand Down Expand Up @@ -90,7 +89,8 @@ public BukkitConfigBuilder applyBrigadier(boolean supportBrigadier) {
return new BukkitImperat(plugin, adventureProvider, supportBrigadier, this.config);
}

private AdventureProvider<CommandSender> loadAdventure() {
@SuppressWarnings("ConstantConditions")
private @NotNull AdventureProvider<CommandSender> loadAdventure() {
if (Reflections.findClass(() -> Audience.class)) {
if (Audience.class.isAssignableFrom(CommandSender.class)) {
return new CastingAdventure<>();
Expand Down
1 change: 0 additions & 1 deletion bukkit/src/main/java/dev/velix/imperat/BukkitImperat.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import dev.velix.imperat.adventure.AdventureProvider;
import dev.velix.imperat.brigadier.BukkitBrigadierManager;
import dev.velix.imperat.command.BaseImperat;
import dev.velix.imperat.command.Command;
import dev.velix.imperat.util.BukkitUtil;
import dev.velix.imperat.util.ImperatDebugger;
Expand Down
1 change: 0 additions & 1 deletion bungee/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
api project(":adventure")

compileOnly project(":core")
compileOnly "${kyori(KyoriModule.API)}"
compileOnly "${kyoriPlatform(KyoriModule.BUNGEE)}"
compileOnly("net.md-5:bungeecord-api:1.21-R0.1-SNAPSHOT")
}
2 changes: 0 additions & 2 deletions bungee/src/main/java/dev/velix/imperat/BungeeImperat.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package dev.velix.imperat;

import dev.velix.imperat.adventure.AdventureProvider;
import dev.velix.imperat.command.BaseImperat;
import dev.velix.imperat.command.Command;
import dev.velix.imperat.util.ImperatDebugger;
import dev.velix.imperat.util.StringUtils;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.HashSet;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.velix.imperat;

import dev.velix.imperat.command.BaseImperat;
import dev.velix.imperat.command.tree.CommandDispatch;

import java.io.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package dev.velix.imperat.command;
package dev.velix.imperat;

import dev.velix.imperat.Imperat;
import dev.velix.imperat.ImperatConfig;
import dev.velix.imperat.annotations.base.AnnotationParser;
import dev.velix.imperat.annotations.base.AnnotationReader;
import dev.velix.imperat.annotations.base.AnnotationReplacer;
import dev.velix.imperat.command.Command;
import dev.velix.imperat.command.CommandUsage;
import dev.velix.imperat.command.parameters.CommandParameter;
import dev.velix.imperat.command.processors.CommandPostProcessor;
import dev.velix.imperat.command.processors.CommandPreProcessor;
Expand Down Expand Up @@ -70,22 +70,19 @@ public void registerCommand(Command<S> command) {
try {
var verifier = config.getUsageVerifier();
for (CommandUsage<S> usage : command.usages()) {
if (!verifier.verify(usage))
throw new InvalidCommandUsageException(command, usage);
if (!verifier.verify(usage)) throw new InvalidCommandUsageException(command, usage);

for (CommandUsage<S> other : command.usages()) {
if (other.equals(usage)) continue;
if (verifier.areAmbiguous(usage, other))
throw new AmbiguousUsageAdditionException(command, usage, other);
}

}
commands.put(command.name().toLowerCase(), command);
} catch (RuntimeException ex) {
ImperatDebugger.error(BaseImperat.class, "registerCommand(CommandProcessingChain command)", ex);
shutdownPlatform();
}

}

/**
Expand Down Expand Up @@ -130,8 +127,8 @@ public void unregisterAllCommands() {
@Override
public @Nullable Command<S> getCommand(final String name) {
final String cmdName = name.toLowerCase();
final Command<S> result = commands.get(cmdName);

Command<S> result = commands.get(cmdName);
if (result != null) return result;
for (Command<S> headCommands : commands.values()) {
if (headCommands.hasName(cmdName)) return headCommands;
Expand Down Expand Up @@ -394,5 +391,4 @@ public void debug(boolean treeVisualizing) {
}
}


}
1 change: 0 additions & 1 deletion core/src/test/java/dev/velix/imperat/TestImperat.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.velix.imperat;

import dev.velix.imperat.command.BaseImperat;
import dev.velix.imperat.command.Command;

import java.io.PrintStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package dev.velix.imperat;

import dev.velix.imperat.command.BaseImperat;
import dev.velix.imperat.command.Command;
import net.minestom.server.MinecraftServer;
import net.minestom.server.ServerProcess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
import dev.velix.imperat.command.BaseImperat;
import dev.velix.imperat.command.Command;
import dev.velix.imperat.exception.SourceException;
import dev.velix.imperat.exception.UnknownPlayerException;
Expand Down

0 comments on commit fbda832

Please sign in to comment.