mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-02 13:31:38 +01:00
Remove unnecessary checks and add comments
This commit is contained in:
parent
6030bea13e
commit
60590acfe3
@ -191,13 +191,12 @@ public void teleport(Location location, String successMessage, String failMessag
|
||||
PaperLib.teleportAsync(getPlayer(), BukkitAdapter.adapt(location))
|
||||
.thenApply(success -> {
|
||||
if (success) {
|
||||
if (successMessage != null && !successMessage.isEmpty()) {
|
||||
// The success message can be cleared via flag
|
||||
if (!successMessage.isEmpty()) {
|
||||
MessagingUtil.sendStringToChat(this, successMessage);
|
||||
}
|
||||
} else {
|
||||
if (failMessage != null && !failMessage.isEmpty()) {
|
||||
printError(failMessage);
|
||||
}
|
||||
printError(failMessage);
|
||||
}
|
||||
return success;
|
||||
});
|
||||
|
@ -1112,8 +1112,15 @@ public void teleport(CommandContext args, Actor sender) throws CommandException
|
||||
}
|
||||
|
||||
String message = existing.getFlag(Flags.TELE_MESSAGE);
|
||||
|
||||
// If the flag isn't set, use the default message
|
||||
// If message.isEmpty(), no message is sent by LocalPlayer#teleport(...)
|
||||
if (message == null) {
|
||||
message = Flags.TELE_MESSAGE.getDefault();
|
||||
}
|
||||
|
||||
player.teleport(teleportLocation,
|
||||
(message == null ? Flags.TELE_MESSAGE.getDefault() : message).replace("%id%", existing.getId()),
|
||||
message.replace("%id%", existing.getId()),
|
||||
"Unable to teleport to region '" + existing.getId() + "'.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user