Various code simplification/fixes and a lot of typo/grammar fixes (may brake some stuff)

This commit is contained in:
2023-06-20 00:15:46 +02:00
parent c984b63cee
commit 5edd8cdfec
151 changed files with 909 additions and 983 deletions

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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());
}
}

View File

@@ -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);