diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-07-16 18:23:49 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-07-16 18:23:49 +0800 |
commit | 63c4a3a894f3a49a67fcd0daeaeb11ffd8ba1622 (patch) | |
tree | 5b1446f07291c7a466f9863cd607b8718c8fc422 /features/waypoints/index.js | |
parent | bfdd7021153472086b4be445330fc80bcf64155e (diff) | |
download | SoopyV2-63c4a3a894f3a49a67fcd0daeaeb11ffd8ba1622.tar.gz SoopyV2-63c4a3a894f3a49a67fcd0daeaeb11ffd8ba1622.tar.bz2 SoopyV2-63c4a3a894f3a49a67fcd0daeaeb11ffd8ba1622.zip |
+ dungeon map recode start
Diffstat (limited to 'features/waypoints/index.js')
-rw-r--r-- | features/waypoints/index.js | 15 |
1 files changed, 8 insertions, 7 deletions
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, "") |