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

@@ -2,11 +2,9 @@ package net.william278.huskhomes.command;
import net.william278.huskhomes.HuskHomes;
import net.william278.huskhomes.position.Home;
import net.william278.huskhomes.teleport.Teleport;
import net.william278.huskhomes.teleport.Teleportable;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.user.OnlineUser;
import net.william278.huskhomes.util.Permission;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -15,7 +13,7 @@ import java.util.Optional;
public abstract class HomeCommand extends SavedPositionCommand<Home> {
protected HomeCommand(@NotNull String name, @NotNull List<String> aliases, @NotNull HuskHomes plugin) {
super(name, aliases, Home.class, List.of(), plugin);
super(name, aliases, Home.class, List.of("player"), plugin);
}
@Override
@@ -36,18 +34,7 @@ public abstract class HomeCommand extends SavedPositionCommand<Home> {
return;
}
final Teleportable teleporter = optionalTeleporter.get();
if (!teleporter.equals(executor) && !executor.hasPermission(Permission.COMMAND_TP_OTHER.node)) {
plugin.getLocales().getLocale("error_no_permission")
.ifPresent(executor::sendMessage);
return;
}
Teleport.builder(plugin)
.teleporter(teleporter)
.target(home)
.toTimedTeleport()
.execute();
this.teleport(executor, optionalTeleporter.get(), home);
}
}