Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
fix typos, update javadocs
Dieser Commit ist enthalten in:
Ursprung
c0b8e9d646
Commit
26bf94f08f
@ -36,22 +36,29 @@ public interface CommandManager {
|
||||
void unregister(String alias);
|
||||
|
||||
/**
|
||||
* Calls CommandExecuteEvent and attempts to execute a command from the specified {@code cmdLine}
|
||||
* sync.
|
||||
* Calls CommandExecuteEvent and attempts to execute a command using the specified {@code cmdLine}
|
||||
* in a blocking fashion.
|
||||
*
|
||||
* @param source the command's source
|
||||
* @param cmdLine the command to run
|
||||
* @return true if the command was found and executed, false if it was not
|
||||
*
|
||||
* @deprecated This method will block current thread during event call and command execution.
|
||||
* Prefer {@link #executeAsync(CommandSource, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean execute(CommandSource source, String cmdLine);
|
||||
|
||||
/**
|
||||
* Attempts to execute a command from the specified {@code cmdLine} sync
|
||||
* without calling CommandExecuteEvent.
|
||||
* Attempts to execute a command using the specified {@code cmdLine} in a blocking fashion without
|
||||
* calling CommandExecuteEvent.
|
||||
*
|
||||
* @param source the command's source
|
||||
* @param cmdLine the command to run
|
||||
* @return true if the command was found and executed, false if it was not
|
||||
*
|
||||
* @deprecated This method will block current thread during event and command execution.
|
||||
* Prefer {@link #executeImmediatelyAsync(CommandSource, String)} instead.
|
||||
*/
|
||||
boolean executeImmediately(CommandSource source, String cmdLine);
|
||||
|
||||
@ -61,7 +68,8 @@ public interface CommandManager {
|
||||
*
|
||||
* @param source the command's source
|
||||
* @param cmdLine the command to run
|
||||
* @return A future that will be completed with the result of the command execution
|
||||
* @return A future that will be completed with the result of the command execution.
|
||||
* Can be completed exceptionally if exception was thrown during execution.
|
||||
*/
|
||||
CompletableFuture<Boolean> executeAsync(CommandSource source, String cmdLine);
|
||||
|
||||
@ -71,7 +79,8 @@ public interface CommandManager {
|
||||
*
|
||||
* @param source the command's source
|
||||
* @param cmdLine the command to run
|
||||
* @return A future that will be completed with the result of the command execution
|
||||
* @return A future that will be completed with the result of the command execution.
|
||||
* Can be completed exceptionally if exception was thrown during execution.
|
||||
*/
|
||||
CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
private CommandResult result;
|
||||
|
||||
/**
|
||||
* Constructs a PlayerChatEvent.
|
||||
* Constructs a CommandExecuteEvent.
|
||||
* @param commandSource the source executing the command
|
||||
* @param command the command being executed without first slash
|
||||
*/
|
||||
@ -52,7 +52,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayerCommmandEvent{"
|
||||
return "CommandExecuteEvent{"
|
||||
+ "commandSource=" + commandSource
|
||||
+ ", command=" + command
|
||||
+ ", result=" + result
|
||||
|
@ -64,14 +64,14 @@ public class VelocityCommandManager implements CommandManager {
|
||||
* @return CompletableFuture of event
|
||||
*/
|
||||
public CompletableFuture<CommandExecuteEvent> callCommandEvent(CommandSource source, String cmd) {
|
||||
Preconditions.checkNotNull(source, "invoker");
|
||||
Preconditions.checkNotNull(source, "source");
|
||||
Preconditions.checkNotNull(cmd, "cmd");
|
||||
return eventManager.fire(new CommandExecuteEvent(source, cmd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSource source, String cmdLine) {
|
||||
Preconditions.checkNotNull(source, "invoker");
|
||||
Preconditions.checkNotNull(source, "source");
|
||||
Preconditions.checkNotNull(cmdLine, "cmdLine");
|
||||
|
||||
CommandExecuteEvent event = callCommandEvent(source, cmdLine).join();
|
||||
@ -86,7 +86,7 @@ public class VelocityCommandManager implements CommandManager {
|
||||
|
||||
@Override
|
||||
public boolean executeImmediately(CommandSource source, String cmdLine) {
|
||||
Preconditions.checkNotNull(source, "invoker");
|
||||
Preconditions.checkNotNull(source, "source");
|
||||
Preconditions.checkNotNull(cmdLine, "cmdLine");
|
||||
|
||||
String alias = cmdLine;
|
||||
@ -133,6 +133,8 @@ public class VelocityCommandManager implements CommandManager {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine) {
|
||||
Preconditions.checkNotNull(source, "source");
|
||||
Preconditions.checkNotNull(cmdLine, "cmdLine");
|
||||
CompletableFuture<Boolean> result = new CompletableFuture<>();
|
||||
eventManager.getService().execute(() -> {
|
||||
try {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren