Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Commit c9b22de

Browse files
committed
Force teleport
1 parent 04f2fc2 commit c9b22de

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

src/main/java/com/github/minemaniauk/api/game/GlobalArena.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ public void activate() {
7272
final KerbClient client = MineManiaAPI.getInstance().getKerbClient();
7373

7474
// Check the client is valid.
75-
if (!client.isConnected() || !client.isValid()) return;
75+
if (!client.isConnected() || !client.isValid()) {
76+
throw new RuntimeException("Kerb client was not connected when a game was activated!");
77+
}
7678

7779
// Call the event.
7880
client.callEvent(new GameArenaActivate(this.getIdentifier(), this.getGameRoomIdentifier().orElseThrow()));

src/main/java/com/github/minemaniauk/api/user/MineManiaUserActionSet.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,22 @@ public boolean sendMessage(@NotNull List<String> message) {
210210
public @NotNull CompletableResultSet<Boolean> teleport(@NotNull MineManiaLocation location) {
211211
CompletableResultSet<Boolean> result = new CompletableResultSet<>(1);
212212

213-
// Check if the event contains a true value, they have the permission.
214-
new Thread(() -> result.addResult(
215-
MineManiaAPI.getInstance()
216-
.callEvent(new UserActionTeleportEvent(this.user, location))
217-
.waitForComplete()
218-
.containsSettable(true)
219-
)).start();
213+
new Thread(() -> {
214+
215+
// Check if it's been completed.
216+
boolean completed = MineManiaAPI.getInstance()
217+
.callEvent(new UserActionTeleportEvent(this.user, location))
218+
.waitForComplete()
219+
.containsSettable(true);
220+
221+
if (completed) {
222+
result.addResult(true);
223+
}
224+
225+
// Try again.
226+
this.teleport(location);
227+
});
228+
220229

221230
return result;
222231
}

0 commit comments

Comments
 (0)