mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 06:28:49 +00:00
Add additional teleport execution handling
This commit is contained in:
8 files changed
+87
-40
No files matched your search
@@ -4,6 +4,7 @@ import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.teleport.Teleport;
|
||||
import net.william278.huskhomes.teleport.TeleportationException;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -35,11 +36,17 @@ public abstract class Broker {
|
||||
}
|
||||
switch (message.getType()) {
|
||||
case TELEPORT_TO_POSITION -> message.getPayload()
|
||||
.getPosition().ifPresent(position -> Teleport.builder(plugin)
|
||||
.teleporter(receiver)
|
||||
.target(position)
|
||||
.toTeleport()
|
||||
.execute());
|
||||
.getPosition().ifPresent(position -> {
|
||||
try {
|
||||
Teleport.builder(plugin)
|
||||
.teleporter(receiver)
|
||||
.target(position)
|
||||
.toTeleport()
|
||||
.execute();
|
||||
} catch (TeleportationException e) {
|
||||
e.displayMessage(plugin.getConsole(), plugin, new String[]{});
|
||||
}
|
||||
});
|
||||
case TELEPORT_TO_NETWORKED_POSITION -> Message.builder()
|
||||
.type(Message.Type.TELEPORT_TO_POSITION)
|
||||
.target(message.getSender())
|
||||
|
||||
Reference in new issue
Block a user