From 63c4a3a894f3a49a67fcd0daeaeb11ffd8ba1622 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sat, 16 Jul 2022 18:23:49 +0800 Subject: + dungeon map recode start --- features/waypoints/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'features/waypoints/index.js') diff --git a/features/waypoints/index.js b/features/waypoints/index.js index 17cd831..0760354 100644 --- a/features/waypoints/index.js +++ b/features/waypoints/index.js @@ -4,6 +4,7 @@ import { m } from "../../../mappings/mappings"; import Feature from "../../featureClass/class"; import { Waypoint } from "../../utils/renderJavaUtils"; import { drawCoolWaypoint } from "../../utils/renderUtils"; +import { calculateDistanceQuick } from "../../utils/utils"; import SettingBase from "../settings/settingThings/settingBase"; import ToggleSetting from "../settings/settingThings/toggle"; import minewaypoints_socket from "./minewaypoints_socket"; @@ -44,12 +45,6 @@ class Waypoints extends Feature { this.userWaypointsArr = Object.values(this.userWaypoints) this.updateWaypointsHashes() this.waypointsChanged = false - this.lastTp = 0 - this.registerEvent("messageSent", (m) => { - if (m.toLowerCase().startsWith("/warp")) { - this.lastTp = Date.now() - } - }) this.patcherWaypoints = [] @@ -165,7 +160,8 @@ class Waypoints extends Feature { minewaypoints_socket.setLocationHandler = (area, loc) => { this.locations[area || loc[0].area] = loc; } - + let lastLoc = [0, 0, 0] + let lastTp = 0 this.registerEvent("tick", () => { try { if (Scoreboard.getLines().length < 2) return; @@ -179,6 +175,11 @@ class Waypoints extends Feature { minewaypoints_socket.setServer(server, World.getWorld().func_82737_E()) + let loc = [Player.getX(), Player.getY(), Player.getZ()] + if (calculateDistanceQuick(lastLoc, loc) > 25) { + this.lastTp = Date.now() + } + if (Date.now() - this.lastSend > 1000 && Date.now() - this.lastTp > 5000) { Scoreboard.getLines().forEach(line => { line = ChatLib.removeFormatting(line.getName()).replace(/[^0-9A-z]/g, "") -- cgit