Merge remote-tracking branch 'origin/master'

This commit is contained in:
William committed 2023-03-27 23:47:47 +01:00
commit aaea118bed
3 files changed
+31 -7

No files matched your search

@@ -96,19 +96,31 @@ public class EventListener {
}
}, 40L);
} else {
teleporter.teleportLocally(spawn, plugin.getSettings().doAsynchronousTeleports());
try {
teleporter.teleportLocally(spawn, plugin.getSettings().doAsynchronousTeleports());
} catch (TeleportationException e) {
e.displayMessage(teleporter, plugin, new String[0]);
}
}
teleporter.sendTranslatableMessage("block.minecraft.spawn.not_valid");
});
} else {
teleporter.teleportLocally(bedPosition.get(), plugin.getSettings().doAsynchronousTeleports());
try {
teleporter.teleportLocally(bedPosition.get(), plugin.getSettings().doAsynchronousTeleports());
} catch (TeleportationException e) {
e.displayMessage(teleporter, plugin, new String[0]);
}
}
plugin.getDatabase().setCurrentTeleport(teleporter, null);
plugin.getDatabase().setRespawnPosition(teleporter, bedPosition.orElse(null));
return;
}
teleporter.teleportLocally((Position) teleport.getTarget(), plugin.getSettings().doAsynchronousTeleports());
try {
teleporter.teleportLocally((Position) teleport.getTarget(), plugin.getSettings().doAsynchronousTeleports());
} catch (TeleportationException e) {
e.displayMessage(teleporter, plugin, new String[0]);
}
plugin.getDatabase().setCurrentTeleport(teleporter, null);
teleport.displayTeleportingComplete(teleporter);
});
@@ -187,7 +199,7 @@ public class EventListener {
// Display the return by death via /back notification
final boolean canReturnByDeath = plugin.getCommand(BackCommand.class)
.map(command -> onlineUser.hasPermission(command.getPermission())
&& onlineUser.hasPermission(command.getPermission("death")))
&& onlineUser.hasPermission(command.getPermission("death")))
.orElse(false);
if (plugin.getSettings().doBackCommandReturnByDeath() && canReturnByDeath) {
plugin.getLocales().getLocale("return_by_death_notification")
@@ -12,6 +12,7 @@ import net.william278.huskhomes.config.Locales;
import net.william278.huskhomes.position.Location;
import net.william278.huskhomes.position.Position;
import net.william278.huskhomes.teleport.Teleportable;
import net.william278.huskhomes.teleport.TeleportationException;
import org.intellij.lang.annotations.Subst;
import org.jetbrains.annotations.NotNull;
@@ -159,7 +160,7 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
* @param location the {@link Location} to teleport the player to
* @param asynchronous if the teleport should be asynchronous
*/
public abstract void teleportLocally(@NotNull Location location, boolean asynchronous);
public abstract void teleportLocally(@NotNull Location location, boolean asynchronous) throws TeleportationException;
/**
* Send a plugin message to the user