Remove remaining deprecated APIs

This commit is contained in:
Andrew Steinborn
2020-10-22 00:41:56 -04:00
parent a1eebc6502
commit d8d469af0b
7 changed files with 32 additions and 88 deletions

View File

@@ -120,13 +120,7 @@ public class VelocityCommandManager implements CommandManager {
return eventManager.fire(new CommandExecuteEvent(source, cmdLine));
}
@Override
public boolean execute(final CommandSource source, final String cmdLine) {
return executeAsync(source, cmdLine).join();
}
@Override
public boolean executeImmediately(final CommandSource source, final String cmdLine) {
private boolean executeImmediately0(final CommandSource source, final String cmdLine) {
Preconditions.checkNotNull(source, "source");
Preconditions.checkNotNull(cmdLine, "cmdLine");
@@ -150,27 +144,27 @@ public class VelocityCommandManager implements CommandManager {
}
@Override
public CompletableFuture<Boolean> executeAsync(final CommandSource source, final String cmdLine) {
public CompletableFuture<Boolean> execute(final CommandSource source, final String cmdLine) {
Preconditions.checkNotNull(source, "source");
Preconditions.checkNotNull(cmdLine, "cmdLine");
return callCommandEvent(source, cmdLine).thenApply(event -> {
return callCommandEvent(source, cmdLine).thenApplyAsync(event -> {
CommandResult commandResult = event.getResult();
if (commandResult.isForwardToServer() || !commandResult.isAllowed()) {
return false;
}
return executeImmediately(source, commandResult.getCommand().orElse(event.getCommand()));
});
return executeImmediately0(source, commandResult.getCommand().orElse(event.getCommand()));
}, eventManager.getService());
}
@Override
public CompletableFuture<Boolean> executeImmediatelyAsync(
public CompletableFuture<Boolean> executeImmediately(
final CommandSource source, final String cmdLine) {
Preconditions.checkNotNull(source, "source");
Preconditions.checkNotNull(cmdLine, "cmdLine");
return CompletableFuture.supplyAsync(
() -> executeImmediately(source, cmdLine), eventManager.getService());
() -> executeImmediately0(source, cmdLine), eventManager.getService());
}
/**

View File

@@ -505,7 +505,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
return CompletableFuture.runAsync(() -> smc.write(Chat.createServerbound("/"
+ commandToRun)), smc.eventLoop());
} else {
return server.getCommandManager().executeImmediatelyAsync(player, commandToRun)
return server.getCommandManager().executeImmediately(player, commandToRun)
.thenAcceptAsync(hasRun -> {
if (!hasRun) {
smc.write(Chat.createServerbound("/" + commandToRun));

View File

@@ -87,7 +87,7 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Cons
@Override
protected void runCommand(String command) {
try {
if (!this.server.getCommandManager().execute(this, command)) {
if (!this.server.getCommandManager().execute(this, command).join()) {
sendMessage(Component.text("Command not found.", NamedTextColor.RED));
}
} catch (Exception e) {