diff --git a/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java b/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java index 20026aac..7f98c0c7 100644 --- a/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java +++ b/src/main/java/net/buildtheearth/modules/common/components/pluginmessaging/PluginMessagingComponent.java @@ -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); } diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java index 3f8778c5..a8c34743 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/TpllComponent.java @@ -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."); } diff --git a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java index 06a16509..cf3cef57 100644 --- a/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java +++ b/src/main/java/net/buildtheearth/modules/navigation/components/tpll/listeners/TpllListener.java @@ -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); @@ -85,7 +87,8 @@ private CompletableFuture 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()) {