Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void onPluginMessageReceived(String channel, Player player, byte[] messag
}

// Add a new universal tpll target to the queue
if (subChannel.equals("Tpll")) {
if (subChannel.equals("TPLL")) {
NavigationModule.getInstance().getTpllComponent().addTpllToQueue(in, player);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ public void tpllPlayer(Player player, double[] coordinates, String targetServerN
ChatHelper.logDebug("Starting universal tpll teleportation for %s to %s.", player.getDisplayName(), targetServerName);
// Send a plugin message to the target server which adds the tpll to the queue
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Tpll");
out.writeUTF("TPLL");
out.writeUTF(targetServerName);
out.writeUTF(String.valueOf(coordinates[0]));
out.writeUTF(String.valueOf(coordinates[1]));
out.writeUTF(player.getUniqueId().toString());
out.writeUTF(String.valueOf(coordinates[0]) + coordinates[1]));
player.sendPluginMessage(BuildTeamTools.getInstance(), "buildteamtools:buildteam", out.toByteArray());

// Switch the player to the target server
NetworkModule.getInstance().switchServer(player, targetServerName);
ChatHelper.logDebug("Teleported player to the target server.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ public void onTpll(PlayerCommandPreprocessEvent event) {
*/
private boolean isTpllCommand(PlayerCommandPreprocessEvent event) {
// Check if the command starts with "tpll"
if (!event.getMessage().startsWith("tpll")) return false;
ChatHelper.logDebug(event.getMessage());
if (!event.getMessage().startsWith("/tpll")) return false;
ChatHelper.logDebug("Intercepted tpll command.");

// Split the command to extract coordinates
String[] splitMessage = event.getMessage().split(" ");
splitMessage[1] = splitMessage[1].replaceAll(",", " ").trim();
if (splitMessage.length < 3) return false;
ChatHelper.logDebug("Command had the correct length (%s).", splitMessage.length);

Expand All @@ -85,7 +87,8 @@ private CompletableFuture<Boolean> shouldIntercept(PlayerCommandPreprocessEvent

if (!networkModule.getBuildTeam().isConnected() || !region.isConnected()) {
event.getPlayer().sendMessage(ChatHelper.error("Either this server or the receiving server isn't connected to the network."));
return CompletableFuture.completedFuture(true);
event.setCancelled(true);
return CompletableFuture.completedFuture(false);
}

if (region.getBuildTeam().getID() != networkModule.getBuildTeam().getID()) {
Expand Down