Fix inconsistencies with /tpignore, close #238

This commit is contained in:
William committed 2022-10-18 20:06:36 +01:00
1 parent ca70ed4ae9
commit febb177f6c
4 files changed
+34 -9

No files matched your search

@@ -19,20 +19,28 @@ public class TpaHereCommand extends CommandBase implements TabCompletable {
@Override
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
if (plugin.getRequestManager().isIgnoringRequests(onlineUser)) {
plugin.getLocales().getLocale("error_ignoring_teleport_requests")
.ifPresent(onlineUser::sendMessage);
return;
}
if (args.length == 1) {
plugin.getRequestManager()
.sendTeleportRequest(onlineUser, args[0], TeleportRequest.RequestType.TPA_HERE)
.thenAccept(sent -> {
if (sent.isEmpty()) {
if (plugin.findPlayer(args[0]).isPresent()) {
if (args[0].equalsIgnoreCase(onlineUser.username)) {
plugin.getLocales().getLocale("error_teleport_request_self")
.ifPresent(onlineUser::sendMessage);
return;
}
plugin.getLocales().getLocale("error_player_not_found", args[0])
.ifPresent(onlineUser::sendMessage);
return;
}
plugin.getLocales().getLocale("tpahere_request_sent", sent.get().getRecipientName())
.ifPresent(onlineUser::sendMessage);
});