mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 22:16:22 +00:00
Add missing catch blocks for inbound local teleports
This commit is contained in:
1 parent
7b857e9149
commit
db988349ca
2 files changed
+14
-1
No files matched your search
@@ -96,19 +96,31 @@ public class EventListener {
|
||||
}
|
||||
}, 40L);
|
||||
} else {
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user