From c93163e2a39d3078f565c075d4791b546dee709d Mon Sep 17 00:00:00 2001 From: Smell of curry <75345244+smell-of-curry@users.noreply.github.com> Date: Tue, 30 Aug 2022 16:26:09 -0700 Subject: [PATCH] Update index.js Added watchdog crash protection --- scripts/Smelly Api/vendor/Anti Cheat/src/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/Smelly Api/vendor/Anti Cheat/src/index.js b/scripts/Smelly Api/vendor/Anti Cheat/src/index.js index c3fa29b..11bb380 100644 --- a/scripts/Smelly Api/vendor/Anti Cheat/src/index.js +++ b/scripts/Smelly Api/vendor/Anti Cheat/src/index.js @@ -1,7 +1,7 @@ import "./modules/autoload.js"; import "./moderation/index.js"; import { SA } from "../../../index.js"; -import { world } from "mojang-minecraft"; +import { system, world } from "mojang-minecraft"; import { BLOCK_CONTAINERS, CHECK_SIZE } from "./config.js"; import { BlockInventory } from "./Models/BlockInventory.js"; @@ -16,6 +16,10 @@ export let db_regions = new SA.Utilities.storage.scoreboard("regions"); */ export const CONTAINER_LOCATIONS = {}; +system.events.beforeWatchdogTerminate.subscribe((data) => { + console.warn(`WATCHDOG TRIED TO CRASH GAME REASON: ${data.terminateReason}`); + data.cancel = true; +}); SA.Utilities.time.setTickInterval(() => { for (const player of world.getPlayers()) { @@ -29,7 +33,11 @@ SA.Utilities.time.setTickInterval(() => { CONTAINER_LOCATIONS[JSON.stringify(location)] = new BlockInventory( block.getComponent("inventory").container ); - block.dimension.runCommand(`particle minecraft:dragon_breath_trail ${location.x} ${location.y + 1} ${location.z}`) + block.dimension.runCommand( + `particle minecraft:dragon_breath_trail ${location.x} ${ + location.y + 1 + } ${location.z}` + ); } } -}, 100); \ No newline at end of file +}, 100);