Skip to content

Teleport #5679

Description

@Cyeclops1

Describe the feature

Hi Meteor devs! I’m looking for help compiling a simple Meteor Addon module.

I’d like an addon that adds these chat commands:

  • :tm — Teleport me to coordinates
  • :tm — Teleport me to another player
  • :tpp — Teleport another player to coordinates
  • :tpp — Teleport another player to me
  • :track — Track any player (shows their coords in chat)

Here’s the full source code for the module:

// TeleportTools.java
package com.cyeclops1.teleporttools;

import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.events.game.SendMessageEvent;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;

public class TeleportTools extends Module {
    public TeleportTools() {
        super(Category.Misc, "TeleportTools", "Teleport and track players using custom chat commands.");
    }

    @EventHandler
    private void onSendMessage(SendMessageEvent event) {
        String msg = event.message.trim();

        MinecraftClient mc = MinecraftClient.getInstance();
        if (mc.world == null || mc.player == null) return;

        if (msg.startsWith(":tm ")) {
            event.cancel();
            String[] args = msg.substring(4).split(" ");
            if (args.length == 3) {
                try {
                    double x = Double.parseDouble(args[0]);
                    double y = Double.parseDouble(args[1]);
                    double z = Double.parseDouble(args[2]);
                    mc.player.updatePosition(x, y, z);
                    ChatUtils.info("Teleported you to (%.2f, %.2f, %.2f)".formatted(x, y, z));
                } catch (Exception ignored) {
                    ChatUtils.info("Invalid coordinates!");
                }
            } else if (args.length == 1) {
                String targetName = args[0];
                for (PlayerEntity player : mc.world.getPlayers()) {
                    if (player.getName().getString().equalsIgnoreCase(targetName)) {
                        mc.player.updatePosition(player.getX(), player.getY(), player.getZ());
                        ChatUtils.info("Teleported you to %s".formatted(targetName));
                        return;
                    }
                }
                ChatUtils.info("Player not found: " + targetName);
            } else {
                ChatUtils.info("Usage: :tm <x> <y> <z> OR :tm <playerName>");
            }
        } else if (msg.startsWith(":tpp ")) {
            event.cancel();
            String[] args = msg.substring(5).split(" ");
            if (args.length == 4) {
                String targetName = args[0];
                try {
                    double x = Double.parseDouble(args[1]);
                    double y = Double.parseDouble(args[2]);
                    double z = Double.parseDouble(args[3]);
                    for (PlayerEntity player : mc.world.getPlayers()) {
                        if (player.getName().getString().equalsIgnoreCase(targetName)) {
                            player.updatePosition(x, y, z);
                            ChatUtils.info("Teleported %s to (%.2f, %.2f, %.2f)".formatted(targetName, x, y, z));
                            return;
                        }
                    }
                    ChatUtils.info("Player not found: " + targetName);
                } catch (Exception ignored) {
                    ChatUtils.info("Invalid coordinates!");
                }
            } else if (args.length == 1) {
                String targetName = args[0];
                for (PlayerEntity player : mc.world.getPlayers()) {
                    if (player.getName().getString().equalsIgnoreCase(targetName)) {
                        player.updatePosition(mc.player.getX(), mc.player.getY(), mc.player.getZ());
                        ChatUtils.info("Teleported %s to you.".formatted(targetName));
                        return;
                    }
                }
                ChatUtils.info("Player not found: " + targetName);
            } else {
                ChatUtils.info("Usage: :tpp <playerName> <x> <y> <z> OR :tpp <playerName>");
            }
        } else if (msg.startsWith(":track ")) {
            event.cancel();
            String targetName = msg.substring(7).trim();
            for (PlayerEntity player : mc.world.getPlayers()) {
                if (player.getName().getString().equalsIgnoreCase(targetName)) {
                    String coords = "(%.2f, %.2f, %.2f)".formatted(player.getX(), player.getY(), player.getZ());
                    ChatUtils.info("%s is at %s".formatted(targetName, coords));
                    return;
                }
            }
            ChatUtils.info("Player not found: " + targetName);
        }
    }
}

[TeleportTools_Version2.java](https://github.com/user-attachments/files/22089262/TeleportTools_Version2.java)

Could someone please compile this as a Meteor addon .jar for me? I just want to drop it in my mods folder and use these commands in chat. Thank you!


### Before submitting a suggestion

- [x] This feature doesn't already exist in the client. (I have checked every module and their settings on the **latest dev build**)

- [x] This wasn't already suggested. (I have searched suggestions on GitHub and read the FAQ)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions