Refactor bootstrap procedure, use enum for command loading

This commit is contained in:
William committed 2022-08-09 14:18:48 +01:00
1 parent eff21a16d5
commit ec1c0b744f
42 files changed
+982 -718

No files matched your search

@@ -1,10 +1,8 @@
package net.william278.huskhomes.command;
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.player.Player;
import net.william278.huskhomes.player.User;
import net.william278.huskhomes.player.OnlineUser;
import net.william278.huskhomes.util.Permission;
import net.william278.huskhomes.util.RegexUtil;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -17,12 +15,12 @@ public class DelWarpCommand extends CommandBase implements TabCompletable, Conso
}
@Override
public void onExecute(@NotNull Player player, @NotNull String[] args) {
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
if (args.length == 1) {
plugin.getSavedPositionManager().deleteWarp(args[0]);
} else {
plugin.getLocales().getLocale("error_invalid_syntax", "/delwarp <name>")
.ifPresent(player::sendMessage);
.ifPresent(onlineUser::sendMessage);
}
}
@@ -32,7 +30,7 @@ public class DelWarpCommand extends CommandBase implements TabCompletable, Conso
}
@Override
public List<String> onTabComplete(@NotNull Player player, @NotNull String[] args) {
public List<String> onTabComplete(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
return plugin.getCache().warps.stream()
.filter(s -> s.startsWith(args.length >= 1 ? args[0] : ""))
.sorted().collect(Collectors.toList());