Various code simplification/fixes and a lot of typo/grammar fixes (may brake some stuff)
This commit is contained in:
@@ -15,7 +15,7 @@ import java.util.function.Predicate;
|
||||
public abstract class CLIBrigadierCommand extends BrigadierCommand<CLICommandSender> {
|
||||
|
||||
/**
|
||||
* Instanciate this command instance.
|
||||
* Instantiate this command instance.
|
||||
*/
|
||||
public CLIBrigadierCommand() {
|
||||
LiteralCommandNode<CLICommandSender> commandNode = buildCommand().build();
|
||||
|
@@ -27,7 +27,7 @@ public class CLIBrigadierDispatcher extends BrigadierDispatcher<CLICommandSender
|
||||
|
||||
/**
|
||||
* Executes the provided command as the console.
|
||||
* @param commandWithoutSlash the command, without the eventual slash at the begining.
|
||||
* @param commandWithoutSlash the command, without the eventual slash at the beginning.
|
||||
* @return the value returned by the executed command.
|
||||
*/
|
||||
public int execute(String commandWithoutSlash) {
|
||||
|
@@ -4,6 +4,7 @@ import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A command sender.
|
||||
@@ -41,5 +42,5 @@ public interface CLICommandSender extends Audience {
|
||||
void sendMessage(String message);
|
||||
|
||||
@Override // force implementation of super-interface default method
|
||||
void sendMessage(Identity source, Component message, MessageType type);
|
||||
void sendMessage(@NotNull Identity source, @NotNull Component message, @NotNull MessageType type);
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import fr.pandacube.lib.util.Log;
|
||||
import net.kyori.adventure.audience.MessageType;
|
||||
import net.kyori.adventure.identity.Identity;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* The console command sender.
|
||||
@@ -31,7 +32,7 @@ public class CLIConsoleCommandSender implements CLICommandSender {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(Identity source, Component message, MessageType type) {
|
||||
public void sendMessage(@NotNull Identity source, @NotNull Component message, @NotNull MessageType type) {
|
||||
sendMessage(Chat.chatComponent(message).getLegacyText());
|
||||
}
|
||||
}
|
||||
|
@@ -170,13 +170,13 @@ public class CommandAdmin extends CLIBrigadierCommand {
|
||||
}
|
||||
|
||||
|
||||
ChatTreeNode dispTree = new ChatTreeNode(d);
|
||||
ChatTreeNode displayTree = new ChatTreeNode(d);
|
||||
|
||||
for (DisplayCommandNode child : displayNode.children) {
|
||||
dispTree.addChild(buildDisplayTree(child, sender));
|
||||
displayTree.addChild(buildDisplayTree(child, sender));
|
||||
}
|
||||
|
||||
return dispTree;
|
||||
return displayTree;
|
||||
|
||||
}
|
||||
|
||||
@@ -257,8 +257,8 @@ public class CommandAdmin extends CLIBrigadierCommand {
|
||||
|
||||
|
||||
private static class DisplayCommandNode {
|
||||
List<CommandNode<CLICommandSender>> nodes = new ArrayList<>();
|
||||
List<DisplayCommandNode> children = new ArrayList<>();
|
||||
final List<CommandNode<CLICommandSender>> nodes = new ArrayList<>();
|
||||
final List<DisplayCommandNode> children = new ArrayList<>();
|
||||
|
||||
void addInline(CommandNode<CLICommandSender> node) {
|
||||
nodes.add(node);
|
||||
|
Reference in New Issue
Block a user