Fix permission issues and erroneous messages with homes and warps, close #252

This commit is contained in:
William committed 2022-10-26 21:25:26 +01:00
1 parent 9385b8aace
commit 88802db702
3 files changed
+23 -11

No files matched your search

@@ -57,7 +57,7 @@ public class HomeCommand extends CommandBase implements TabCompletable, ConsoleE
}
private void teleportToNamedHome(@NotNull OnlineUser teleporter, @NotNull User owner, @NotNull String homeName) {
final boolean otherHome = owner.uuid.equals(teleporter.uuid);
final boolean otherHome = !owner.uuid.equals(teleporter.uuid);
plugin.getDatabase()
.getHome(owner, homeName)
.thenAccept(homeResult -> homeResult.ifPresentOrElse(home -> {
@@ -65,6 +65,7 @@ public class HomeCommand extends CommandBase implements TabCompletable, ConsoleE
if (!teleporter.hasPermission(Permission.COMMAND_HOME_OTHER.node)) {
plugin.getLocales().getLocale("error_no_permission")
.ifPresent(teleporter::sendMessage);
return;
}
}
Teleport.builder(plugin, teleporter)
@@ -73,10 +74,10 @@ public class HomeCommand extends CommandBase implements TabCompletable, ConsoleE
.thenAccept(TimedTeleport::execute);
}, () -> {
if (otherHome) {
plugin.getLocales().getLocale("error_home_invalid", homeName)
plugin.getLocales().getLocale("error_home_invalid_other", owner.username, homeName)
.ifPresent(teleporter::sendMessage);
} else {
plugin.getLocales().getLocale("error_home_invalid_other", owner.username, homeName)
plugin.getLocales().getLocale("error_home_invalid", homeName)
.ifPresent(teleporter::sendMessage);
}
}));