mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
Adjust schema, fix commands and user data refactoring
This commit is contained in:
1 parent
ec1c0b744f
commit
ff2465ac85
12 files changed
+120
-105
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package net.william278.huskhomes.command;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.list.WarpList;
|
||||
import net.william278.huskhomes.player.OnlineUser;
|
||||
import net.william278.huskhomes.util.Permission;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -16,11 +17,21 @@ public class WarpCommand extends CommandBase implements TabCompletable, ConsoleE
|
||||
|
||||
@Override
|
||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||
if (args.length == 1) {
|
||||
final String warpName = args[0];
|
||||
plugin.getTeleportManager().teleportToWarp(onlineUser, warpName);
|
||||
} else {
|
||||
plugin.getLocales().getLocale("error_invalid_syntax", "/warp [name]")
|
||||
switch (args.length) {
|
||||
case 0 -> plugin.getDatabase().getWarps().thenAccept(warps -> {
|
||||
if (warps.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_no_warps_set").ifPresent(onlineUser::sendMessage);
|
||||
return;
|
||||
}
|
||||
final WarpList warpList = new WarpList(warps, plugin);
|
||||
plugin.getCache().positionLists.put(onlineUser.uuid, warpList);
|
||||
warpList.getDisplay(1).forEach(onlineUser::sendMessage);
|
||||
});
|
||||
case 1 -> {
|
||||
final String warpName = args[0];
|
||||
plugin.getTeleportManager().teleportToWarp(onlineUser, warpName);
|
||||
}
|
||||
default -> plugin.getLocales().getLocale("error_invalid_syntax", "/warp [name]")
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user