Skip to content

Commit

Permalink
tpll
Browse files Browse the repository at this point in the history
  • Loading branch information
Le4nderS committed Jun 13, 2022
1 parent a510817 commit 2e0505b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/main/java/dev/nachwahl/btemap/BTEMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


import co.aikar.commands.PaperCommandManager;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import dev.nachwahl.btemap.commands.MapCommand;
import dev.nachwahl.btemap.database.MySQLConnector;
import dev.nachwahl.btemap.listeners.LeaveEvent;
Expand Down Expand Up @@ -110,6 +112,17 @@ public static double[] fromGeo(double lon, double lat) {
}


public void sendPluginMessage(String command, Player player, String... message) {
//noinspection UnstableApiUsage
ByteArrayDataOutput output = ByteStreams.newDataOutput();
output.writeUTF(command);
for (String part : message) {
output.writeUTF(part);
}

player.sendPluginMessage(this, "bteplugin", output.toByteArray());

}
}


7 changes: 4 additions & 3 deletions src/main/java/dev/nachwahl/btemap/utils/SocketIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import dev.nachwahl.btemap.BTEMap;
import dev.nachwahl.btemap.projection.GeographicProjection;
import dev.nachwahl.btemap.projection.ModifiedAirocean;
import dev.nachwahl.btemap.projection.ScaleProjection;
Expand Down Expand Up @@ -52,10 +53,10 @@ public void call(Object... args) {
try {
Player player = Bukkit.getServer().getPlayer(UUID.fromString(uuid));

Location loc = new Location(player.getWorld(), coords[0], player.getWorld().getHighestBlockYAt((int) coords[0], (int) coords[1]), coords[1]);
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
player.teleport(loc);
//player.performCommand("/tpll " + coords[0] + ", " + coords[1]);

String coordinates = coords[0] + ", " + coords[1];
BTEMap.getPlugin(BTEMap.class).sendPluginMessage("tpll",player,player.getName(),coordinates);

} catch (Exception ignored) { }

Expand Down

0 comments on commit 2e0505b

Please sign in to comment.