mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Correct error handling on player destination resolution logic
This commit is contained in:
1 parent
a5ffd223cf
commit
5874bc9992
2 files changed
+11
-5
No files matched your search
@@ -24,7 +24,7 @@ public class Message {
|
|||||||
public MessageType type;
|
public MessageType type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The kind of message this is - {@link RelayType#MESSAGE} or a {@link RelayType#REPLY} to a message.
|
* Represents the context under which this message is being relayed; an outbound {@link RelayType#MESSAGE} or a {@link RelayType#REPLY} to one.
|
||||||
*/
|
*/
|
||||||
@SerializedName("relay_type")
|
@SerializedName("relay_type")
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -91,7 +91,13 @@ public class Message {
|
|||||||
* Identifies the source of the message being relayed - a {@link RelayType#MESSAGE} or a {@link RelayType#REPLY} to a message.
|
* Identifies the source of the message being relayed - a {@link RelayType#MESSAGE} or a {@link RelayType#REPLY} to a message.
|
||||||
*/
|
*/
|
||||||
public enum RelayType {
|
public enum RelayType {
|
||||||
|
/**
|
||||||
|
* An outbound message to/from a server
|
||||||
|
*/
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
|
/**
|
||||||
|
* A reply to an outbound message
|
||||||
|
*/
|
||||||
REPLY
|
REPLY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,12 +226,12 @@ public class TeleportBuilder {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
return plugin.getNetworkMessenger()
|
return plugin.getNetworkMessenger()
|
||||||
.sendMessage(executor, new Message(Message.MessageType.POSITION_REQUEST, executor.username,
|
.sendMessage(executor, new Message(Message.MessageType.POSITION_REQUEST,
|
||||||
playerName, MessagePayload.empty(), Message.RelayType.MESSAGE,
|
executor.username, playerName, MessagePayload.empty(),
|
||||||
plugin.getSettings().clusterId))
|
Message.RelayType.MESSAGE, plugin.getSettings().clusterId))
|
||||||
.orTimeout(3, TimeUnit.SECONDS)
|
.orTimeout(3, TimeUnit.SECONDS)
|
||||||
.exceptionally(throwable -> null)
|
.exceptionally(throwable -> null)
|
||||||
.thenApply(reply -> Optional.ofNullable(reply.payload.position)).join();
|
.thenApply(reply -> Optional.ofNullable(reply == null ? null : reply.payload.position)).join();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return CompletableFuture.supplyAsync(Optional::empty);
|
return CompletableFuture.supplyAsync(Optional::empty);
|
||||||
|
|||||||
Reference in new issue
Block a user