List commands, more refactoring work

This commit is contained in:
William278 committed 2023-03-17 17:00:44 +00:00
1 parent 9903503f03
commit f746d67339
23 files changed
+361 -450

No files matched your search

@@ -1,6 +1,7 @@
package net.william278.huskhomes.command;
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.teleport.Teleportable;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.user.ConsoleUser;
import org.jetbrains.annotations.NotNull;
@@ -114,4 +115,9 @@ public abstract class Node implements Executable {
return Optional.empty();
}
protected Optional<Teleportable> resolveTeleportable(@NotNull CommandUser executor, @NotNull String[] args) {
return parseStringArg(args, 0).map(Teleportable::username)
.or(() -> executor instanceof Teleportable ? Optional.of((Teleportable) executor) : Optional.empty());
}
}