Files
NitoriBot/src/modules/position.js
T

25 lines
492 B
JavaScript
Raw Normal View History

2025-05-07 07:27:41 -04:00
class PositionModule {
constructor(context) {
const bot = context.bot;
const config = context.config;
bot.position = null;
2024-07-07 15:44:16 -04:00
2025-05-07 07:27:41 -04:00
bot.on("packet.position", (packet) => {
bot.position = {
x: packet.x,
y: packet.y,
z: packet.z,
};
2024-07-07 15:44:16 -04:00
2025-05-07 07:27:41 -04:00
bot._client.write("teleport_confirm", { teleportId: packet.teleportId });
2024-07-07 15:44:16 -04:00
2025-05-07 07:27:41 -04:00
bot.emit("move");
});
2024-07-07 15:44:16 -04:00
2025-05-07 07:27:41 -04:00
bot.on("end", () => {
bot.position = null;
});
}
2024-07-07 15:44:16 -04:00
}
2025-05-07 07:27:41 -04:00
module.exports = PositionModule;