mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Add more unit tests
This commit is contained in:
8 files changed
+368
-18
No files matched your search
@@ -55,7 +55,7 @@ public class EditWarpCommand extends SavedPositionCommand<Warp> {
|
||||
warp.getMeta().setName(optionalName.get());
|
||||
plugin.fireEvent(plugin.getWarpEditEvent(warp, executor), (event) -> {
|
||||
try {
|
||||
plugin.getManager().warps().renameWarp(warp, warp.getName());
|
||||
plugin.getManager().warps().setWarpName(warp, warp.getName());
|
||||
} catch (ValidationException e) {
|
||||
e.dispatchWarpError(executor, plugin, warp.getName());
|
||||
return;
|
||||
|
||||
@@ -170,7 +170,7 @@ public abstract class Node implements Executable {
|
||||
}
|
||||
|
||||
|
||||
protected Optional<Teleportable> resolveTeleportable(@NotNull CommandUser executor, @NotNull String[] args) {
|
||||
protected Optional<Teleportable> resolveTeleporter(@NotNull CommandUser executor, @NotNull String[] args) {
|
||||
return parseStringArg(args, 0).map(Teleportable::username)
|
||||
.or(() -> executor instanceof Teleportable ? Optional.of((Teleportable) executor) : Optional.empty());
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class SpawnCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
final Optional<Teleportable> optionalTeleporter = resolveTeleportable(executor, args);
|
||||
final Optional<Teleportable> optionalTeleporter = resolveTeleporter(executor, args);
|
||||
if (optionalTeleporter.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_invalid_syntax", getUsage())
|
||||
.ifPresent(executor::sendMessage);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WarpCommand extends SavedPositionCommand<Warp> {
|
||||
}
|
||||
}
|
||||
|
||||
final Optional<Teleportable> optionalTeleporter = resolveTeleportable(executor, args);
|
||||
final Optional<Teleportable> optionalTeleporter = resolveTeleporter(executor, args);
|
||||
if (optionalTeleporter.isEmpty()) {
|
||||
plugin.getLocales().getLocale("error_invalid_syntax", getUsage())
|
||||
.ifPresent(executor::sendMessage);
|
||||
|
||||
Reference in new issue
Block a user