diff --git a/README.md b/README.md index a8f3f93..1421d82 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Rubedo Version 2.6.2-beta +# Rubedo Version 2.6.3-beta Welcome to Rubedo, an anti-cheat designed to protect your world from cheaters. Rubedo is designed to be smarter than cheaters by giving users access to advanced tools to protect their world from hacked items, nuker, crashes, griefing, and so much more. Rubedo makes it possible to protect permissions and manage performance with the click of a button! diff --git a/manifest.json b/manifest.json index c5f74c5..1f4adff 100644 --- a/manifest.json +++ b/manifest.json @@ -5,21 +5,21 @@ "description": "pack.description", "min_engine_version": [1, 19, 50], "uuid": "d98b03cc-38f8-4a82-81c6-5fb7ede55cb8", - "version": [2, 6, 2] + "version": [2, 6, 3] }, "modules": [ { "description": "Data Module", "type": "data", "uuid": "1e866a8b-1807-4689-8329-192a43404d5b", - "version": [2, 6, 2] + "version": [2, 6, 3] }, { "description": "Gametest Module", "language": "javascript", "type": "script", "uuid": "9d7fbe86-68ed-4aac-8fe8-dfe980e671fc", - "version": [2, 6, 2], + "version": [2, 6, 3], "entry": "scripts/index.js" } ], diff --git a/package-lock.json b/package-lock.json index 6b12130..3f7a567 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rubedo", - "version": "2.6.2-beta", + "version": "2.6.3-beta", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "rubedo", - "version": "2.6.2-beta", + "version": "2.6.3-beta", "license": "ISC", "dependencies": { "@minecraft/server": "^1.1.0-beta.preview.1.19.50.24", @@ -3401,7 +3401,7 @@ "dependencies": { "agent-base": "^6.0.2", "debug": "^4.3.3", - "socks": "^2.6.2" + "socks": "^2.6.3" }, "engines": { "node": ">= 10" @@ -6128,7 +6128,7 @@ "requires": { "agent-base": "^6.0.2", "debug": "^4.3.3", - "socks": "^2.6.2" + "socks": "^2.6.3" } }, "spdx-correct": { diff --git a/package.json b/package.json index 88899bb..6729801 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "name": "rubedo", "description": "Welcome to Rubedo, Rubedo is a brand new Anti-cheat designed for Realms, Servers, Worlds and anyone who wants to protect there worlds from Hackers! Rubedo Uses Minecraft's Most advanced functionality so that includes Gametest.", - "version": "2.6.2-beta", + "version": "2.6.3-beta", "main": "index.js", "repository": { "type": "git", diff --git a/scripts/index.js b/scripts/index.js index 4d1982f..72f313f 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -1,4183 +1,4 @@ -// src/index.ts -import { ItemStack as ItemStack5, MinecraftItemTypes as MinecraftItemTypes7 } from "@minecraft/server"; - -// src/lib/Command/index.ts -import { world as world3 } from "@minecraft/server"; - -// src/config/commands.ts -var PREFIX = "-"; - -// src/lib/Command/ArgumentTypes.ts -import { world as world2 } from "@minecraft/server"; - -// src/lib/Database/Database.ts -import { - ItemStack, - MinecraftItemTypes, - system as system2 -} from "@minecraft/server"; - -// src/config/database.ts -import { BlockLocation } from "@minecraft/server"; -var MAX_DATABASE_STRING_SIZE = 32e3; -var ENTITY_IDENTIFIER = "rubedo:database"; -var ENTITY_LOCATION = new BlockLocation(0, -64, 0); -var INVENTORY_SIZE = 128; - -// src/utils.ts -import { - BlockLocation as BlockLocation2, - MinecraftDimensionTypes, - system, - world -} from "@minecraft/server"; - -// src/lib/Form/Models/MessageForm.ts -import { MessageFormData } from "@minecraft/server-ui"; - -// src/config/form.ts -var TIMEOUT_THRESHOLD = 200; - -// src/lib/Form/Models/MessageForm.ts -var MessageForm = class { - constructor(title, body) { - this.title = title; - this.body = body; - this.form = new MessageFormData(); - if (title) - this.form.title(title); - if (body) - this.form.body(body); - this.triedToShow = 0; - } - setButton1(text2, callback) { - this.button1 = { text: text2, callback }; - this.form.button1(text2); - return this; - } - setButton2(text2, callback) { - this.button2 = { text: text2, callback }; - this.form.button2(text2); - return this; - } - show(player) { - this.form.show(player).then((response) => { - if (response.canceled) { - if (response.cancelationReason == "userBusy") { - if (this.triedToShow > TIMEOUT_THRESHOLD) - return player.tell( - `\xA7cForm Timeout: tried to show form, but you were busy (close chat after running command)` - ); - this.triedToShow++; - this.show(player); - } - return; - } - if (response.selection == 1) - this.button1?.callback?.(); - if (response.selection == 0) - this.button2?.callback?.(); - }); - } -}; - -// src/utils.ts -var DIMENSIONS = { - overworld: world.getDimension(MinecraftDimensionTypes.overworld), - nether: world.getDimension(MinecraftDimensionTypes.nether), - theEnd: world.getDimension(MinecraftDimensionTypes.theEnd), - "minecraft:overworld": world.getDimension(MinecraftDimensionTypes.overworld), - "minecraft:nether": world.getDimension(MinecraftDimensionTypes.nether), - "minecraft:the_end": world.getDimension(MinecraftDimensionTypes.theEnd) -}; -function durationToMs(duration) { - const values = duration.split(","); - console.warn(values.length); - let ms = 0; - for (const value of values) { - const length = parseInt(value.match(/\D+|\d+/g)[0]); - const unit = value.match(/\D+|\d+/g)[1]; - if (unit == "y") - ms = ms + 317098e-16 * length; - if (unit == "w") - ms = ms + 6048e5 * length; - if (unit == "d") - ms = ms + 864e5 * length; - if (unit == "h") - ms = ms + 36e5 * length; - if (unit == "m") - ms = ms + 6e4 * length; - if (unit == "s") - ms = ms + 1e3 * length; - if (unit == "ms") - ms = ms + length; - } - return ms; -} -function msToTime(duration) { - return new Date(duration).toString(); -} -function vector3ToBlockLocation(loc) { - return new BlockLocation2( - Math.floor(loc.x), - Math.floor(loc.y), - Math.floor(loc.z) - ); -} -function confirmAction(player, action, onConfirm, onCancel = () => { -}) { - new MessageForm("Confirm To Continue", action).setButton1("Confirm", onConfirm).setButton2("Never Mind", onCancel).show(player); -} -function sleep(tick) { - return new Promise((resolve) => { - let runScheduleId = system.runSchedule(() => { - resolve(); - system.clearRunSchedule(runScheduleId); - }, tick); - }); -} -function LocationEquals(a, b) { - let aLocations = [a.x, a.y, a.z]; - let bLocations = [a.x, a.y, a.z]; - if (a instanceof BlockLocation2 || b instanceof BlockLocation2) { - aLocations = aLocations.map((v) => Math.trunc(v)); - bLocations = bLocations.map((v) => Math.trunc(v)); - } - return aLocations.find((v, i) => bLocations[i] != v) ? false : true; -} -async function awaitWorldLoad() { - if (WORLD_IS_LOADED) - return; - return new Promise((resolve) => { - let s = system.runSchedule(async () => { - try { - await DIMENSIONS.overworld.runCommandAsync(`testfor @a`); - system.clearRunSchedule(s); - setWorldIsLoaded(); - resolve(); - } catch (error) { - } - }, 1); - }); -} -function onWorldLoad(callback) { - if (WORLD_IS_LOADED) - return callback(); - let s = system.runSchedule(async () => { - try { - await DIMENSIONS.overworld.runCommandAsync(`testfor @a`); - system.clearRunSchedule(s); - setWorldIsLoaded(); - callback(); - } catch (error) { - } - }, 1); -} - -// src/lib/Database/utils.ts -function chunkString(str, length) { - return str.match(new RegExp(".{1," + length + "}", "g")); -} - -// src/lib/Database/Database.ts -var Database = class { - constructor(tableName) { - this.tableName = tableName; - this.tableName = tableName; - this.MEMORY = null; - this.QUEUE = []; - system2.runSchedule(() => { - if (this.QUEUE.length == 0) - return; - this.QUEUE.shift()(); - }, 1); - onWorldLoad(async () => { - this.MEMORY = await this.getData(); - }); - } - static createTableEntity(tableName, index) { - const entity = DIMENSIONS.overworld.spawnEntity( - ENTITY_IDENTIFIER, - ENTITY_LOCATION - ); - entity.setDynamicProperty("tableName", tableName); - entity.nameTag = `\xA7aDatabase Table: ${tableName}\xA7r`; - if (index) - entity.setDynamicProperty("index", index); - return entity; - } - static getTableEntities(tableName) { - return DIMENSIONS.overworld.getEntitiesAtBlockLocation(ENTITY_LOCATION).filter( - (e2) => e2.typeId == ENTITY_IDENTIFIER && e2.getDynamicProperty("tableName") == tableName - ); - } - async addQueueTask() { - return new Promise((resolve) => { - this.QUEUE.push(() => { - resolve(); - }); - }); - } - async saveData(data) { - await this.addQueueTask(); - await awaitWorldLoad(); - this.MEMORY = data; - let entities = Database.getTableEntities(this.tableName); - let chunks = chunkString(JSON.stringify(data), MAX_DATABASE_STRING_SIZE); - const entitiesNeeded = Math.ceil(chunks.length / INVENTORY_SIZE) - entities.length; - if (entitiesNeeded > 0) { - for (let i = 0; i < entitiesNeeded; i++) { - entities.push(Database.createTableEntity(this.tableName)); - } - } - for (const [i, entity] of entities.entries()) { - const inventory = entity.getComponent("inventory").container; - for (const [i2, chunk] of chunks.entries()) { - if (!chunk) - continue; - if (i2 > inventory.size - 1) - break; - let item = new ItemStack(MinecraftItemTypes.acaciaBoat); - item.nameTag = chunk; - inventory.setItem(i2, item); - chunks[i2] = null; - } - for (let i2 = chunks.length + 1; i2 < inventory.size; i2++) { - inventory.setItem(i2, AIR); - } - entity.setDynamicProperty("index", i); - entities[i] = null; - if (!chunks.find((v) => v)) - break; - } - entities.filter((e2) => e2).forEach((e2) => e2.triggerEvent("despawn")); - return; - } - async getData() { - await awaitWorldLoad(); - if (this.MEMORY) - return this.MEMORY; - let entities = Database.getTableEntities(this.tableName).sort( - (a, b) => a.getDynamicProperty("index") - b.getDynamicProperty("index") - ); - let stringifiedData = ""; - for (const entity of entities) { - const inventory = entity.getComponent("inventory").container; - for (let i = 0; i < inventory.size; i++) { - const item = inventory.getItem(i); - if (!item) - continue; - stringifiedData = stringifiedData + item.nameTag; - } - } - return stringifiedData == "" ? {} : JSON.parse(stringifiedData); - } - async set(key, value) { - const data = await this.getData(); - data[key] = value; - await this.saveData(data); - return; - } - get(key) { - if (!this.MEMORY) - throw new Error( - "World is not loaded! Consider using `getAsync` instead!" - ); - return this.MEMORY[key]; - } - async getSync(key) { - const data = await this.getData(); - return data[key]; - } - keys() { - if (!this.MEMORY) - throw new Error( - "World is not loaded! Consider using `keysSync` instead!" - ); - return Object.keys(this.MEMORY); - } - async keysSync() { - const data = await this.getData(); - return Object.keys(data); - } - values() { - if (!this.MEMORY) - throw new Error( - "World is not loaded! Consider using `valuesSync` instead!" - ); - return Object.values(this.MEMORY); - } - async valuesSync() { - const data = await this.getData(); - return Object.values(data); - } - has(key) { - if (!this.MEMORY) - throw new Error("World is not loaded! Consider using `hasSync` instead!"); - const keys = this.keys(); - return keys.includes(key); - } - async hasSync(key) { - const keys = await this.keysSync(); - return keys.includes(key); - } - collection() { - if (!this.MEMORY) - throw new Error( - "World is not loaded! Consider using `collectionSync` instead!" - ); - return this.MEMORY; - } - async collectionSync() { - return await this.getData(); - } - async delete(key) { - const data = await this.getData(); - const status = delete data[key]; - await this.saveData(data); - return status; - } - async clear() { - await this.saveData({}); - return; - } -}; - -// src/lib/Database/tables.ts -var TABLES = { - config: new Database("config"), - freezes: new Database("freezes"), - mutes: new Database("mutes"), - bans: new Database("bans"), - regions: new Database("regions"), - roles: new Database("roles"), - tasks: new Database("tasks"), - npcs: new Database("npcs"), - ids: new Database("ids"), - logs: new Database("logs"), - protections: new Database("protections"), - test: new Database("test") -}; - -// src/lib/Command/ArgumentTypes.ts -function fetch(playerName) { - return [...world2.getPlayers()].find((player) => player.name === playerName); -} -var LiteralArgumentType = class { - constructor(name = "literal") { - this.name = name; - this.typeName = "literal"; - this.name = name; - } - matches(value) { - return { - success: this.name == value - }; - } - fail(value) { - return `${value} should be ${this.name}!`; - } -}; -var StringArgumentType = class { - constructor(name = "string") { - this.name = name; - this.typeName = "string"; - this.name = name; - } - matches(value) { - return { - success: value && value != "", - value - }; - } - fail(value) { - return `Value must be of type string!`; - } -}; -var IntegerArgumentType = class { - constructor(name = "integer") { - this.name = name; - this.typeName = "int"; - this.name = name; - } - matches(value) { - return { - success: !isNaN(value), - value: parseInt(value) - }; - } - fail(value) { - return `Value must be valid number!`; - } -}; -var FloatArgumentType = class { - constructor(name = "float") { - this.name = name; - this.typeName = "float"; - this.name = name; - } - matches(value) { - return { - success: Boolean(value?.match(/^\d+\.\d+$/)?.[0]), - value: parseInt(value) - }; - } - fail(value) { - return `Value must be valid float!`; - } -}; -var LocationArgumentType = class { - constructor(name = "location") { - this.name = name; - this.typeName = "location"; - this.name = name; - } - matches(value) { - return { - success: /^([~^]{0,1}(-\d)?(\d*)?(\.(\d+))?)$/.test(value), - value - }; - } - fail(value) { - return `Value needs to be a valid number, value can include: [~,^]`; - } -}; -var BooleanArgumentType = class { - constructor(name = "boolean") { - this.name = name; - this.typeName = "boolean"; - this.name = name; - } - matches(value) { - return { - success: Boolean(value?.match(/^(true|false)$/)?.[0]), - value: value == "true" ? true : false - }; - } - fail(value) { - return `"${value}" can be either "true" or "false"`; - } -}; -var PlayerArgumentType = class { - constructor(name = "player") { - this.name = name; - this.typeName = "Player"; - this.name = name; - } - matches(value) { - return { - success: fetch(value) ? true : false, - value: fetch(value) - }; - } - fail(value) { - return `player: "${value}", is not in this world`; - } -}; -var TargetArgumentType = class { - constructor(name = "target") { - this.name = name; - this.typeName = "Target"; - this.name = name; - } - matches(value) { - return { - success: Boolean(value?.match(/^(@.|"[\s\S]+")$/)?.[0]), - value - }; - } - fail(value) { - return `${value} is not a valid target`; - } -}; -var ArrayArgumentType = class { - constructor(name = "array", types) { - this.name = name; - this.types = types; - this.typeName = "string"; - this.name = name; - this.types = types; - this.typeName = types.join(" | ").replace(/(.{25})..+/, "$1..."); - } - matches(value) { - return { - success: this.types.includes(value), - value - }; - } - fail(value) { - return `"${value}" must be one of these values: ${this.types.join(" | ")}`; - } -}; -var DurationArgumentType = class { - constructor(name) { - this.name = name; - this.typeName = "Duration"; - } - matches(value) { - return { - success: /^(\d+[hdysmw],?)+$/.test(value), - value - }; - } - fail(value) { - return `"${value}" must be a value like "10d" or "3s" the first part is the length second is unit`; - } -}; -var PlayerNameArgumentType = class { - constructor(name = "playerName") { - this.name = name; - this.typeName = "playerName"; - this.name = name; - } - matches(value) { - const player = TABLES.ids.get(value); - return { - success: player ? true : false, - value - }; - } - fail(value) { - return `player: "${value}" has never played this world before! Tip: if the name has spaces in it use quotes around name!`; - } -}; -var ArgumentTypes = { - string: StringArgumentType, - int: IntegerArgumentType, - float: FloatArgumentType, - location: LocationArgumentType, - boolean: BooleanArgumentType, - player: PlayerArgumentType, - target: TargetArgumentType, - array: ArrayArgumentType, - duration: DurationArgumentType, - playerName: PlayerNameArgumentType -}; - -// src/lib/Command/Callback.ts -var CommandCallback = class { - constructor(data) { - this.data = data; - this.sender = data.sender; - } - reply(text2) { - this.sender.tell(text2); - } -}; - -// src/lib/Command/utils.ts -function getChatAugments(message, prefix) { - try { - return message.slice(prefix.length).trim().match(/"[^"]+"|[^\s]+/g).map((e2) => e2.replace(/"(.+)"/, "$1").toString()); - } catch (error) { - return []; - } -} -function commandNotFound(player, command2) { - player.tell({ - rawtext: [ - { - text: `\xA7c` - }, - { - translate: `commands.generic.unknown`, - with: [`${command2}`] - } - ] - }); -} -function noPerm(player, command2) { - player.tell({ - rawtext: [ - { - text: command2.data.invalidPermission ? command2.data.invalidPermission : `\xA7cYou do not have permission to use "${command2.data.name}"` - } - ] - }); -} -function commandSyntaxFail(player, baseCommand, command2, args, i) { - player.tell({ - rawtext: [ - { - text: `\xA7c` - }, - { - translate: `commands.generic.syntax`, - with: [ - `${PREFIX}${baseCommand.data.name} ${args.slice(0, i).join(" ")}`, - args[i] ?? " ", - args.slice(i + 1).join(" ") - ] - } - ] - }); - if (command2.children.length > 1 || !args[i]) { - const types = command2.children.map( - (c) => c.type instanceof LiteralArgumentType ? c.type.name : c.type?.typeName - ); - player.tell( - `\xA7c"${args[i] ?? "undefined"}" is not valid! Argument "${[...new Set(command2.children.map((c) => c.type.name))][0]}" can be typeof: "${types.join('", "')}"` - ); - } else { - player.tell(`\xA7c${command2.children[0]?.type?.fail(args[i])}`); - } -} -function parseLocationArgs([x, y, z], { location, viewVector }) { - if (!x || !y || !x) - return null; - const locations = [location.x, location.y, location.z]; - const viewVectors = [viewVector.x, viewVector.y, viewVector.z]; - const a = [x, y, z].map((arg) => { - const r = parseFloat(arg); - return isNaN(r) ? 0 : r; - }); - const b = [x, y, z].map((arg, index) => { - return arg.includes("~") ? a[index] + locations[index] : arg.includes("^") ? a[index] + viewVectors[index] : a[index]; - }); - return { x: b[0], y: b[1], z: b[2] }; -} -function sendCallback(cmdArgs, args, event, baseCommand) { - const lastArg = args[args.length - 1] ?? baseCommand; - const argsToReturn = []; - for (const [i, arg] of args.entries()) { - if (arg.type.name.endsWith("*")) - continue; - if (arg.type instanceof LocationArgumentType) { - argsToReturn.push( - parseLocationArgs( - [cmdArgs[i], cmdArgs[i + 1], cmdArgs[i + 2]], - event.sender - ) - ); - continue; - } - if (arg.type instanceof LiteralArgumentType) - continue; - argsToReturn.push(arg.type.matches(cmdArgs[i]).value ?? cmdArgs[i]); - } - lastArg.callback(new CommandCallback(event), ...argsToReturn); -} - -// src/lib/Command/index.ts -var COMMANDS = []; -world3.events.beforeChat.subscribe((data) => { - if (!data.message.startsWith(PREFIX)) - return; - data.cancel = true; - const args = getChatAugments(data.message, PREFIX); - const command2 = COMMANDS.find( - (c) => c.depth == 0 && (c.data.name == args[0] || c.data?.aliases?.includes(args[0])) - ); - const event = { - message: data.message, - sendToTargets: data.sendToTargets, - sender: data.sender, - targets: data.targets - }; - if (!command2) - return commandNotFound(data.sender, args[0]); - if (!command2.data?.requires(data.sender)) - return noPerm(event.sender, command2); - args.shift(); - const verifiedCommands = []; - const getArg = (start, i) => { - if (start.children.length > 0) { - const arg = start.children.find((v2) => v2.type.matches(args[i]).success); - if (!arg && !args[i] && start.callback) - return; - if (!arg) - return commandSyntaxFail(event.sender, command2, start, args, i), "fail"; - if (!arg.data?.requires(event.sender)) - return noPerm(event.sender, arg), "fail"; - verifiedCommands.push(arg); - return getArg(arg, i + 1); - } - }; - let v = getArg(command2, 0); - if (v == "fail") - return; - sendCallback(args, verifiedCommands, event, command2); -}); - -// src/lib/Chest GUI/index.ts -import { Player as Player7, system as system5, world as world7 } from "@minecraft/server"; - -// src/config/chest.ts -var GUI_ITEM = "rubedo:gui"; -var ENTITY_INVENTORY = "rubedo:inventory"; - -// src/plugins/Anti-Cheat/utils.ts -import { - world as world4, - Player as Player3, - BlockLocation as BlockLocation4, - MinecraftBlockTypes as MinecraftBlockTypes3, - GameMode, - system as system3 -} from "@minecraft/server"; - -// src/plugins/Anti-Cheat/modules/models/Region.ts -import { BlockLocation as BlockLocation3, MinecraftBlockTypes } from "@minecraft/server"; - -// src/plugins/Anti-Cheat/config/region.ts -var DEFAULT_REGION_PERMISSIONS = { - doorsAndSwitches: true, - openContainers: true, - pvp: false, - allowedEntities: [ - "minecraft:player", - "minecraft:npc", - "minecraft:item", - "rubedo:inventory", - "rubedo:database" - ] -}; -var DOORS_SWITCHES = [ - "minecraft:acacia_door", - "minecraft:acacia_trapdoor", - "minecraft:acacia_button", - "minecraft:birch_door", - "minecraft:birch_trapdoor", - "minecraft:birch_button", - "minecraft:crimson_door", - "minecraft:crimson_trapdoor", - "minecraft:crimson_button", - "minecraft:dark_oak_door", - "minecraft:dark_oak_trapdoor", - "minecraft:dark_oak_button", - "minecraft:jungle_door", - "minecraft:jungle_trapdoor", - "minecraft:jungle_button", - "minecraft:mangrove_door", - "minecraft:mangrove_trapdoor", - "minecraft:mangrove_button", - "minecraft:spruce_door", - "minecraft:spruce_trapdoor", - "minecraft:spruce_button", - "minecraft:warped_door", - "minecraft:warped_trapdoor", - "minecraft:warped_button", - "minecraft:wooden_door", - "minecraft:wooden_button", - "minecraft:trapdoor", - "minecraft:iron_door", - "minecraft:iron_trapdoor", - "minecraft:polished_blackstone_button", - "minecraft:lever" -]; -var BLOCK_CONTAINERS = [ - "minecraft:chest", - "minecraft:ender_chest", - "minecraft:barrel", - "minecraft:trapped_chest", - "minecraft:dispenser", - "minecraft:dropper", - "minecraft:furnace", - "minecraft:blast_furnace", - "minecraft:lit_furnace", - "minecraft:lit_blast_furnace", - "minecraft:hopper", - "minecraft:shulker_box", - "minecraft:undyed_shulker_box", - "minecraft:lit_smoker", - "minecraft:smoker" -]; - -// src/plugins/Anti-Cheat/modules/models/Region.ts -var REGIONS = []; -var REGIONS_HAVE_BEEN_GRABBED = false; -var LOWEST_Y_VALUE = -64; -var HIGHEST_Y_VALUE = 320; -function betweenXYZ(XYZa, XYZb, XYZc) { - return XYZc.every( - (c, i) => c >= Math.min(XYZa[i], XYZb[i]) && c <= Math.max(XYZa[i], XYZb[i]) - ); -} -var Region = class { - static async getAllRegionsSync() { - if (REGIONS_HAVE_BEEN_GRABBED) - return REGIONS; - const regions = (await TABLES.regions.valuesSync()).map( - (region) => new Region( - region.from, - region.to, - region.dimensionId, - region.permissions, - region.key - ) - ); - regions.forEach((r) => { - REGIONS.push(r); - }); - REGIONS_HAVE_BEEN_GRABBED = true; - return regions; - } - static getAllRegions() { - if (REGIONS_HAVE_BEEN_GRABBED) - return REGIONS; - const regions = TABLES.regions.values().map( - (region) => new Region( - region.from, - region.to, - region.dimensionId, - region.permissions, - region.key - ) - ); - regions.forEach((r) => { - REGIONS.push(r); - }); - REGIONS_HAVE_BEEN_GRABBED = true; - return regions; - } - static blockLocationInRegion(blockLocation, dimensionId) { - return this.getAllRegions().find( - (region) => region.dimensionId == dimensionId && betweenXYZ( - [region.from.x, LOWEST_Y_VALUE, region.from.z], - [region.to.x, HIGHEST_Y_VALUE, region.to.z], - [blockLocation.x, blockLocation.y, blockLocation.z] - ) - ); - } - static async blockLocationInRegionSync(blockLocation, dimensionId) { - return (await this.getAllRegionsSync()).find( - (region) => region.dimensionId == dimensionId && betweenXYZ( - [region.from.x, LOWEST_Y_VALUE, region.from.z], - [region.to.x, HIGHEST_Y_VALUE, region.to.z], - [blockLocation.x, blockLocation.y, blockLocation.z] - ) - ); - } - static async removeRegionAtBlockLocation(blockLocation, dimensionId) { - const region = this.blockLocationInRegion(blockLocation, dimensionId); - if (!region) - return false; - return await TABLES.regions.delete(region.key); - } - constructor(from, to, dimensionId, permissions, key) { - this.from = from; - this.to = to; - this.dimensionId = dimensionId; - this.permissions = permissions ?? DEFAULT_REGION_PERMISSIONS; - this.key = key ? key : Date.now().toString(); - if (!key) { - this.update().then(() => { - loadRegionDenys(); - REGIONS.push(this); - }); - } - } - async update() { - return await TABLES.regions.set(this.key, { - key: this.key, - from: this.from, - dimensionId: this.dimensionId, - permissions: this.permissions, - to: this.to - }); - } - async delete() { - const region = TABLES.regions.get(this.key); - const loc1 = new BlockLocation3( - region.from.x, - region.dimensionId == "minecraft:overworld" ? -64 : 0, - region.from.z - ); - const loc2 = new BlockLocation3( - region.to.x, - region.dimensionId == "minecraft:overworld" ? -64 : 0, - region.to.z - ); - for (const blockLocation of loc1.blocksBetween(loc2)) { - DIMENSIONS[region.dimensionId].getBlock(blockLocation)?.setType(MinecraftBlockTypes.bedrock); - } - REGIONS = REGIONS.filter((r) => r.key != this.key); - return TABLES.regions.delete(this.key); - } - entityInRegion(entity) { - return this.dimensionId == entity.dimension.id && betweenXYZ( - [this.from.x, LOWEST_Y_VALUE, this.from.z], - [this.to.x, HIGHEST_Y_VALUE, this.to.z], - [entity.location.x, entity.location.y, entity.location.z] - ); - } - changePermission(key, value) { - this.permissions[key] = value; - this.update(); - } -}; - -// src/plugins/Anti-Cheat/modules/models/Task.ts -var ChangePlayerRoleTask = class { - static getTasks() { - return TABLES.tasks.get("changePlayerRole") ?? []; - } - static getPlayersRoleToSet(playerName) { - const tasks = ChangePlayerRoleTask.getTasks(); - return tasks.find((t) => t.playerName == playerName)?.role; - } - constructor(playerName, role) { - let tasks = ChangePlayerRoleTask.getTasks(); - tasks.push({ playerName, role }); - TABLES.tasks.set("changePlayerRole", tasks); - } -}; - -// src/plugins/Anti-Cheat/config/moderation.ts -import { MinecraftBlockTypes as MinecraftBlockTypes2, MinecraftItemTypes as MinecraftItemTypes2 } from "@minecraft/server"; -var FORBIDDEN_ITEMS = [ - MinecraftItemTypes2.beehive.id, - MinecraftItemTypes2.beeNest.id, - MinecraftItemTypes2.axolotlBucket.id, - MinecraftItemTypes2.codBucket.id, - MinecraftItemTypes2.tadpoleBucket.id, - MinecraftItemTypes2.tropicalFishBucket.id, - MinecraftItemTypes2.salmonBucket.id, - MinecraftItemTypes2.pufferfishBucket.id -]; -var BANNED_ITEMS = [ - MinecraftItemTypes2.allow.id, - MinecraftItemTypes2.barrier.id, - MinecraftItemTypes2.borderBlock.id, - MinecraftItemTypes2.debugStick?.id ?? "minecraft:debug_stick", - MinecraftItemTypes2.deny.id, - MinecraftItemTypes2.jigsaw.id, - MinecraftItemTypes2.lightBlock.id, - MinecraftItemTypes2.commandBlock.id, - MinecraftItemTypes2.repeatingCommandBlock.id, - MinecraftItemTypes2.chainCommandBlock.id, - MinecraftItemTypes2.commandBlockMinecart.id, - MinecraftItemTypes2.structureBlock.id, - MinecraftItemTypes2.structureVoid.id, - MinecraftItemTypes2.bedrock.id, - MinecraftItemTypes2.endPortalFrame.id, - "minecraft:info_update", - "minecraft:info_update2", - "minecraft:reserved3", - "minecraft:reserved4", - "minecraft:reserved6", - "minecraft:movingBlock", - "minecraft:moving_block", - "minecraft:movingblock", - "minecraft:piston_arm_collision", - "minecraft:piston_arm_collision", - "minecraft:pistonarmcollision", - "minecraft:stickyPistonArmCollision", - "minecraft:sticky_piston_arm_collision", - "minecraft:unknown", - "minecraft:glowingobsidian", - "minecraft:invisible_bedrock", - "minecraft:invisiblebedrock", - "minecraft:netherreactor", - "minecraft:portal", - "minecraft:fire", - "minecraft:water", - "minecraft:lava", - "minecraft:flowing_lava", - "minecraft:flowing_water", - "minecraft:soul_fire" -]; -var FORBIDDEN_BLOCKS = [ - MinecraftBlockTypes2.dispenser.id -]; -var BANNED_BLOCKS = [ - MinecraftBlockTypes2.bedrock.id, - MinecraftBlockTypes2.barrier.id, - "minecraft:invisiblebedrock", - "minecraft:movingBlock", - "minecraft:movingblock", - "minecraft:moving_block" -]; -var API_CONTAINERS = [ - MinecraftBlockTypes2.chest.id, - MinecraftBlockTypes2.trappedChest.id -]; -var CONTAINERS = [ - MinecraftItemTypes2.chest.id, - MinecraftItemTypes2.trappedChest.id, - MinecraftItemTypes2.barrel.id, - MinecraftItemTypes2.dispenser.id, - MinecraftItemTypes2.dropper.id, - MinecraftItemTypes2.furnace.id, - "minecraft:lit_furnace", - MinecraftItemTypes2.blastFurnace.id, - "minecraft:lit_blast_furnace", - MinecraftItemTypes2.smoker.id, - "minecraft:lit_smoker", - MinecraftItemTypes2.hopper.id, - MinecraftItemTypes2.shulkerBox.id, - MinecraftItemTypes2.undyedShulkerBox.id -]; -var CHECK_SIZE = { x: 7, y: 7, z: 7 }; - -// src/plugins/Anti-Cheat/config/enchantments.ts -var ENCHANTMENTS = { - aquaAffinity: 1, - baneOfArthropods: 5, - binding: 1, - blastProtection: 4, - channeling: 1, - depthStrider: 3, - efficiency: 5, - featherFalling: 4, - fireAspect: 2, - fireProtection: 4, - flame: 1, - fortune: 3, - frostWalker: 2, - impaling: 5, - infinity: 1, - knockback: 2, - looting: 3, - loyalty: 4, - luckOfTheSea: 3, - lure: 3, - mending: 1, - multishot: 1, - piercing: 4, - power: 5, - projectileProtection: 4, - protection: 4, - punch: 2, - quickCharge: 3, - respiration: 3, - riptide: 3, - sharpness: 5, - silkTouch: 1, - smite: 5, - soulSpeed: 3, - swiftSneak: 4, - thorns: 3, - unbreaking: 3, - vanishing: 1 -}; - -// src/config/app.ts -var VERSION = "2.6.2-beta"; -var APPEAL_LINK = "https://discord.gg/dMa3A5UYKX"; - -// src/plugins/Anti-Cheat/utils.ts -function kick(player, message = [], onFail) { - if (isServerOwner(player)) { - console.warn(`[WARNING]: TRIED TO KICK OWNER`); - player.tell(`You have been tried to kick, but you cant!`); - return onFail?.(); - } - try { - player.runCommandAsync(`kick @s \xA7r${message.join("\n")}`); - player.triggerEvent("kick"); - } catch (error) { - player.triggerEvent("kick"); - if (!/"statusCode":-2147352576/.test(error)) - return; - if (onFail) - onFail(); - } -} -function getRole(player) { - if (player instanceof Player3) { - return TABLES.roles.get(player.name) ?? "member"; - } else { - return TABLES.roles.get(player) ?? "member"; - } -} -async function getRoleSync(player) { - if (player instanceof Player3) { - return await TABLES.roles.getSync(player.name) ?? "member"; - } else { - return await TABLES.roles.getSync(player) ?? "member"; - } -} -function setRole(player, value) { - if (typeof player == "string") { - TABLES.roles.set(player, value); - const inGamePlayer = [...world4.getPlayers()].find((p) => p.name == player); - if (inGamePlayer) { - inGamePlayer.setDynamicProperty("role", value); - } else { - new ChangePlayerRoleTask(player, value); - } - } else { - TABLES.roles.set(player.name, value); - player.setDynamicProperty("role", value); - } -} -function isServerOwner(player) { - return world4.getDynamicProperty("worldsOwner") == player.id; -} -function getServerOwner() { - const id = world4.getDynamicProperty("worldsOwner"); - if (!id || id == "") - return null; - return id; -} -function getServerOwnerName() { - const ownerId = getServerOwner(); - if (!ownerId) - return null; - const ids = TABLES.ids.collection(); - return Object.keys(ids).find((key) => ids[key] === ownerId); -} -function setServerOwner(player) { - if (!player) - return world4.setDynamicProperty("worldsOwner", ""); - world4.setDynamicProperty("worldsOwner", player.id.toString()); -} -function isLockedDown() { - return world4.getDynamicProperty("isLockDown") ?? false; -} -function setLockDown(val) { - world4.setDynamicProperty("isLockDown", val); -} -function loadRegionDenys() { - for (const region of Region.getAllRegions()) { - const loc1 = new BlockLocation4( - region.from.x, - region.dimensionId == "minecraft:overworld" ? -64 : 0, - region.from.z - ); - const loc2 = new BlockLocation4( - region.to.x, - region.dimensionId == "minecraft:overworld" ? -64 : 0, - region.to.z - ); - for (const blockLocation of loc1.blocksBetween(loc2)) { - DIMENSIONS[region.dimensionId].getBlock(blockLocation)?.setType(MinecraftBlockTypes3.deny); - } - } -} -var CALLBACKS = []; -var forEachValidPlayerCalls = 0; -function forEachValidPlayer(callback, delay = 0) { - const key = forEachValidPlayerCalls; - CALLBACKS[key] = { - callback, - delay, - lastCall: 0 - }; - forEachValidPlayerCalls = key + 1; - return key; -} -function clearForEachValidPlayer(key) { - delete CALLBACKS[key]; -} -system3.runSchedule(async () => { - const players = [...world4.getPlayers()]; - for (const [i, player] of players.entries()) { - if (["moderator", "admin"].includes(await getRoleSync(player))) - continue; - for (const CALLBACK of Object.values(CALLBACKS)) { - if (CALLBACK.delay != 0 && system3.currentTick - CALLBACK.lastCall < CALLBACK.delay) - continue; - CALLBACK.callback(player); - if (i == players.length - 1) - CALLBACK.lastCall = system3.currentTick; - } - } -}); -function getConfigId(id) { - switch (id) { - case "spam_config": - return TABLES.config.get("spam_config") ?? { - repeatedMessages: true, - zalgo: true, - violationCount: 0, - permMutePlayer: false - }; - case "cbe_config": - return TABLES.config.get("cbe_config") ?? { - clearItem: true, - violationCount: 0, - banPlayer: false, - canAddEnchantment: false - }; - case "gamemode_config": - return TABLES.config.get("gamemode_config") ?? { - setToSurvival: true, - clearPlayer: true, - violationCount: 0, - banPlayer: false - }; - case "nuker_data": - return TABLES.config.get("nuker_data") ?? { - violationCount: 0, - banPlayer: false - }; - case "banned_items": - return TABLES.config.get("banned_items") ?? BANNED_ITEMS; - case "banned_blocks": - return TABLES.config.get("banned_blocks") ?? BANNED_BLOCKS; - case "enchantments": - return TABLES.config.get("enchantments") ?? ENCHANTMENTS; - case "appealLink": - return TABLES.config.get("appealLink") ?? APPEAL_LINK; - } -} -function setConfigId(key, value) { - TABLES.config.set(key, value); -} -function getMaxEnchantmentLevel(enchantment) { - const MAX_ENCHANTMENTS = getConfigId("enchantments"); - return MAX_ENCHANTMENTS[enchantment.type.id] ?? enchantment.type.maxLevel; -} -function getGamemode(player) { - return Object.values(GameMode).find( - (g) => [...world4.getPlayers({ name: player.name, gameMode: g })].length - ); -} - -// src/lib/Chest GUI/Models/EntityChest.ts -import { world as world6 } from "@minecraft/server"; - -// src/lib/Events/onSlotChange.ts -import { - system as system4 -} from "@minecraft/server"; -var CALLBACKS2 = {}; -var MAPPED_INVENTORIES = {}; -var PREVIOUS_CHANGE = {}; -function getSlotChanges(entity, oldInv, newInv) { - if (oldInv.length != newInv.length) - return []; - const changes = []; - for (let i = 0; i < newInv.length; i++) { - if (oldInv[i]?.item?.amount < newInv[i]?.item?.amount || oldInv[i]?.item?.amount > newInv[i]?.item?.amount && oldInv[i]?.item?.amount != 0) { - const change_data = { - slot: i, - uid: newInv[i].uid, - oldUid: oldInv[i].uid, - item: newInv[i].item, - oldItem: oldInv[i].item, - changeType: "fluctuation" - }; - changes.push(change_data); - PREVIOUS_CHANGE[entity.id] = change_data; - continue; - } - if (newInv[i].uid == oldInv[i].uid) - continue; - if (oldInv[i]?.item && newInv[i]?.item) { - const change_data = { - slot: i, - uid: newInv[i].uid, - oldUid: oldInv[i].uid, - item: newInv[i].item, - oldItem: oldInv[i].item, - changeType: "swap" - }; - changes.push(change_data); - PREVIOUS_CHANGE[entity.id] = change_data; - } else if (!newInv[i]?.item) { - const change_data = { - slot: i, - uid: oldInv[i].uid, - item: oldInv[i].item, - changeType: "delete" - }; - changes.push(change_data); - PREVIOUS_CHANGE[entity.id] = change_data; - } else if (newInv[i]?.item) { - if (PREVIOUS_CHANGE[entity.id]?.changeType == "delete" && PREVIOUS_CHANGE[entity.id]?.uid == newInv[i].uid) { - const change_data = { - slot: i, - uid: newInv[i].uid, - item: newInv[i].item, - changeType: "move" - }; - changes.push(change_data); - PREVIOUS_CHANGE[entity.id] = change_data; - continue; - } else { - const change_data = { - slot: i, - uid: newInv[i].uid, - item: newInv[i].item, - changeType: "put" - }; - changes.push(change_data); - PREVIOUS_CHANGE[entity.id] = change_data; - } - } - } - return changes; -} -function getItemUid(item) { - if (!item) - return ""; - const data = []; - data.push(item.typeId); - data.push(item.nameTag); - data.push(item.data); - data.push(item.getLore().join("")); - return data.join(""); -} -function mapInventory(container) { - const inventory = []; - for (let i = 0; i < container.size; i++) { - let item = container.getItem(i); - inventory[i] = { - uid: getItemUid(item), - item - }; - } - return inventory; -} -system4.runSchedule(() => { - for (const callback of Object.values(CALLBACKS2)) { - for (const entity of DIMENSIONS.overworld.getEntities(callback.entities)) { - const inventory = mapInventory( - entity.getComponent("inventory").container - ); - const changes = getSlotChanges( - entity, - MAPPED_INVENTORIES[entity.id] ?? inventory, - inventory - ); - MAPPED_INVENTORIES[entity.id] = inventory; - if (changes.length == 0) - continue; - if (entity.hasTag("skipCheck")) { - entity.removeTag("skipCheck"); - delete PREVIOUS_CHANGE[entity.id]; - continue; - } - for (const change of changes) { - callback.callback(entity, change); - } - } - } -}, 5); -var onEntityInventorySlotChange = class { - static subscribe(entities, callback) { - const key = Date.now(); - CALLBACKS2[key] = { callback, entities }; - return key; - } - static unsubscribe(key) { - delete CALLBACKS2[key]; - } -}; - -// src/lib/Chest GUI/utils.ts -import { Location as Location2 } from "@minecraft/server"; - -// src/plugins/Anti-Cheat/modules/models/PlayerLog.ts -import { world as world5 } from "@minecraft/server"; -var PlayerLog = class { - constructor() { - this.data = /* @__PURE__ */ new Map(); - this.events = { - playerLeave: world5.events.playerLeave.subscribe( - (data) => this.data.delete(data.playerName) - ) - }; - } - set(player, value) { - this.data.set(player.name, value); - } - get(player) { - return this.data.get(player.name); - } - delete(player) { - this.data.delete(player.name); - } - clear() { - this.data.clear(); - } - playerNames() { - return [...this.data.keys()]; - } - includes(player) { - return this.playerNames().includes(player.name); - } -}; - -// src/lib/Chest GUI/utils.ts -var CHESTGUIS = {}; -var PAGES = {}; -var CHEST_OPEN = new PlayerLog(); -function getHeldItem(player) { - const inventory = player.getComponent("minecraft:inventory").container; - return inventory.getItem(player.selectedSlot); -} -async function clearPlayersPointer(player, ItemToClear) { - try { - const inventory = player.getComponent("minecraft:inventory").container; - let itemsToLoad = []; - for (let i = 0; i < inventory.size; i++) { - const item = inventory.getItem(i); - if (!item) - continue; - if (item?.typeId == ItemToClear?.typeId) { - itemsToLoad.push({ slot: i, item }); - inventory.setItem; - if (i < 9) { - await player.runCommandAsync( - `replaceitem entity @s slot.hotbar ${i} air` - ); - } else { - await player.runCommandAsync( - `replaceitem entity @s slot.inventory ${i - 9} air` - ); - } - } - } - await player.runCommandAsync( - `clear @s ${ItemToClear?.typeId} ${ItemToClear.data} ${ItemToClear.amount}` - ); - for (const item of itemsToLoad) { - inventory.setItem(item.slot, item.item); - } - } catch (error) { - [ - ...player.dimension.getEntities({ - type: "minecraft:item", - location: new Location2( - player.location.x, - player.location.y, - player.location.z - ), - maxDistance: 2, - closest: 1 - }) - ].forEach((e2) => e2.kill()); - } -} -function getItemAtSlot(entity, slot) { - const inventory = entity.getComponent("minecraft:inventory").container; - return inventory.getItem(slot); -} - -// src/lib/Chest GUI/Models/ItemGrabbedCallback.ts -var ItemGrabbedCallback = class { - constructor(gui, slot, change) { - this.gui = gui; - this.slot = slot; - this.change = change; - } - message(text2) { - this.gui.player.tell(text2); - } - getItemAdded() { - if (this.slot.item) - return null; - return this.gui.entity.getComponent("minecraft:inventory").container.getItem(this.change.slot); - } - GiveAction(item = this.slot.item.itemStack) { - this.gui.player.getComponent("minecraft:inventory").container.addItem(item); - } - TakeAction(db = null) { - this.gui.player.getComponent("minecraft:inventory").container.addItem(this.slot.item.itemStack); - this.gui.page.slots[this.change.slot] = null; - if (!db) - return; - db.delete(this.slot.item.components.dbKey); - } - PageAction(page, extras) { - this.gui.setPage(page, extras); - } - CloseAction() { - this.gui.despawn(); - } - SetAction() { - const container = this.gui.entity.getComponent( - "minecraft:inventory" - ).container; - container.setItem(this.change.slot, this.slot.item.itemStack); - } - async FormAction(form) { - this.CloseAction(); - await sleep(5); - return await form.show(this.gui.player); - } -}; - -// src/lib/Chest GUI/Models/EntityChest.ts -var ChestGUI = class { - static spawnEntity(player) { - try { - return player.dimension.spawnEntity( - ENTITY_INVENTORY, - player.headLocation - ); - } catch (error) { - return null; - } - } - constructor(player) { - this.player = player; - this.entity = ChestGUI.spawnEntity(player); - if (this.entity) { - this.hasChestOpen = false; - this.setPage("home"); - } - this.tickEvent = world6.events.tick.subscribe(() => { - if (!this.entity) - return this.despawn(); - if (CHEST_OPEN.get(this.player)) { - if (!this.hasChestOpen) { - this.slotChangeEvent = onEntityInventorySlotChange.subscribe( - { type: ENTITY_INVENTORY }, - (entity, change) => { - if (entity.id != this.entity.id) - return; - this.onSlotChange(change); - } - ); - } - this.hasChestOpen = true; - } else { - try { - this.entity.teleport( - this.player.headLocation, - this.player.dimension, - this.player.rotation.x, - this.player.rotation.y, - true - ); - } catch (error) { - this.despawn(); - } - } - }); - } - setPage(pageId, extras) { - const c = this.entity.getComponent("inventory").container; - for (let i = 0; i < c.size; i++) { - c.setItem(i, AIR); - } - if (!Object.keys(PAGES).includes(pageId)) - throw new Error(`pageId ${pageId} does not exist!`); - const page = PAGES[pageId]; - this.page = page; - page.fillType(this.entity, page, extras); - this.entity.nameTag = `size:54`; - } - onSlotChange(change) { - const slot = this.page.slots[change.slot]; - if (!slot) { - this.entity.getComponent("inventory").container.setItem(change.slot, AIR); - } else if (change.changeType == "delete") { - if (slot.item) - clearPlayersPointer(this.player, change.item); - if (!slot.item && !getItemAtSlot(this.entity, change.slot)) - return; - slot.action(new ItemGrabbedCallback(this, slot, change)); - } - } - despawn() { - try { - this.entity?.triggerEvent("despawn"); - } catch (error) { - } - try { - delete CHESTGUIS[this.player.name]; - } catch (error) { - } - if (this.tickEvent) - world6.events.tick.unsubscribe(this.tickEvent); - if (this.slotChangeEvent) - onEntityInventorySlotChange.unsubscribe(this.slotChangeEvent); - } -}; - -// src/lib/Chest GUI/Models/PageItem.ts -import { - ItemStack as ItemStack4 -} from "@minecraft/server"; -var PageItem = class { - constructor(itemType, components = {}, itemStack) { - this.itemType = itemType; - this.components = components; - this.setItemStack = itemStack; - } - get itemStack() { - if (this.setItemStack) - return this.setItemStack; - const itemStack = new ItemStack4(this.itemType); - if (this.components) { - itemStack.amount = this.components?.amount ?? 1; - itemStack.data = this.components?.data ?? 0; - itemStack.nameTag = this.components?.nameTag; - itemStack.setLore(this.components?.loreList ?? []); - const enchantments = itemStack.getComponent("enchantments").enchantments; - for (const enchantment of this.components?.enchantments ?? []) { - enchantments.addEnchantment(enchantment); - } - itemStack.getComponent("enchantments").enchantments = enchantments; - } - return itemStack; - } -}; - -// src/lib/Chest GUI/Models/FillTypes.ts -function DefaultFill(entity, page, extras) { - const container = entity.getComponent("minecraft:inventory").container; - for (let i = 0; i < container.size; i++) { - const slot = page.slots[i]; - if (!slot || !slot.item) { - container.setItem(i, AIR); - continue; - } - container.setItem(i, slot.item.itemStack); - } -} - -// src/lib/Chest GUI/Models/Page.ts -var Page = class { - constructor(id, fillType = DefaultFill) { - if (Object.keys(PAGES).includes(id)) - throw new Error(`Page: ${id}, Already exists!`); - this.id = id; - this.fillType = fillType; - this.slots = []; - PAGES[id] = this; - } - setSlots(slot, item, action) { - const data = item ? { item, action } : null; - for (const i of slot) { - this.slots[i] = data; - } - return this; - } -}; - -// src/lib/Chest GUI/pages/home.ts -import { MinecraftItemTypes as MinecraftItemTypes3 } from "@minecraft/server"; -var HOME_PAGE = new Page("home").setSlots( - [22], - new PageItem(MinecraftItemTypes3.enderChest, { - nameTag: "\xA7l\xA7bInventory Viewer" - }), - (ctx) => { - ctx.PageAction("moderation:see"); - } -).setSlots( - [54], - new PageItem(MinecraftItemTypes3.barrier, { nameTag: "\xA7cClose GUI" }), - (ctx) => { - ctx.CloseAction(); - } -); - -// src/lib/Chest GUI/index.ts -system5.runSchedule(() => { - for (const player of world7.getPlayers()) { - if (getHeldItem(player)?.typeId != GUI_ITEM) { - if (CHESTGUIS[player.name]) - CHESTGUIS[player.name].despawn(); - continue; - } - if (Object.keys(CHESTGUIS).includes(player?.name)) - continue; - if (getRole(player) != "admin") - continue; - CHESTGUIS[player.name] = new ChestGUI(player); - } -}, 5); -world7.events.beforeDataDrivenEntityTriggerEvent.subscribe((data) => { - if (!(data.entity instanceof Player7)) - return; - if (data.id == "rubedo:has_container_open") { - CHEST_OPEN.set(data.entity, true); - } else if (data.id == "rubedo:dosent_have_container_open") { - CHEST_OPEN.set(data.entity, false); - } -}); -system5.runSchedule(() => { - const validIds = Object.values(CHESTGUIS).map((c) => c.entity.id); - for (const entity of DIMENSIONS.overworld.getEntities({ - type: ENTITY_INVENTORY - })) { - if (validIds.includes(entity.id)) - continue; - entity.triggerEvent("despawn"); - } -}, 100); - -// src/plugins/Anti-Cheat/protections.ts -var PROTECTIONS = {}; - -// src/lang/text.ts -var text = { - "api.name": () => "Smelly API", - "api.error.unknown": () => "An unknown error has occurred.", - "api.database.error.table_name": (a, b) => `The display name ${a} is too long for an objective, it can be at most ${b} characters long`, - "api.utilities.formatter.error.ms": (a) => `${a} is not a string or a number`, - "api.Providers.form.invalidType": (a, b) => `Type ${a} is not a valid type to add a ${b}`, - "modules.protections.cps.clickingToFast": () => `You are clicking to fast! Please click slower!`, - "modules.managers.mute.isMuted": () => `\xA7cYou've been temporarily muted in chat.`, - "modules.commands.ban.reply": (playerName, duration, reason = "") => `\xA7cBanned \xA7f"\xA7a${playerName}\xA7f" \xA7cfor ${duration} Because: "${reason ?? "No reason Provided"}" \xA7aSuccessfully`, - "lockdown.kick.message": () => [ - `\xA7cYou have been kicked!`, - `\xA7aReason: \xA7fServer is currently under LockDown`, - `\xA7fServer will be up soon, Try to join later` - ], - "commands.ban.list.player": (name, reason, expire) => `- "${name}" Because: ${reason}, Expiry ${expire}`, - "commands.freeze.list.player": (name, reason) => `- "${name}" Because: ${reason}`, - "commands.mutes.list.player": (name, reason, expire) => `- "${name}" Because: ${reason}, Expiry: ${expire}`, - "commands.lockdown.confirm": "Are you sure you want to lockdown the server, this will kick all active players and all players who try to join who are not admin" -}; - -// src/lib/Command/Command.ts -var Command = class { - constructor(data, type, depth = 0, parent) { - this.data = data; - this.type = type; - this.depth = depth; - this.parent = parent; - if (!data.requires) - data.requires = (player) => true; - this.data = data; - this.type = type ?? new LiteralArgumentType(this.data.name); - this.children = []; - this.depth = depth; - this.parent = parent; - this.callback = null; - COMMANDS.push(this); - } - argument(type) { - const cmd = new Command( - this.data, - type, - this.depth + 1, - this - ); - this.children.push(cmd); - return cmd; - } - string(name) { - return this.argument(new StringArgumentType(name)); - } - int(name) { - return this.argument(new IntegerArgumentType(name)); - } - array(name, types) { - return this.argument(new ArrayArgumentType(name, types)); - } - boolean(name) { - return this.argument(new BooleanArgumentType(name)); - } - location(name) { - const cmd = this.argument(new LocationArgumentType(name)); - if (!name.endsWith("*")) { - const newArg = cmd.location(name + "_y*").location(name + "_z*"); - return newArg; - } - return cmd; - } - literal(data) { - const cmd = new Command( - data, - new LiteralArgumentType(data.name), - this.depth + 1, - this - ); - this.children.push(cmd); - return cmd; - } - executes(callback) { - this.callback = callback; - return this; - } -}; - -// src/plugins/Anti-Cheat/modules/models/Ban.ts -import { Player as Player8 } from "@minecraft/server"; -function setBan(player, id, duration, reason = "No Reason", by = "Rubedo Auto Mod") { - const data = { - key: id, - playerName: player instanceof Player8 ? player.name : player, - date: Date.now(), - duration: duration ? durationToMs(duration) : null, - expire: duration ? durationToMs(duration) + Date.now() : null, - reason, - by - }; - TABLES.bans.set(id, data); -} -var Ban = class { - constructor(player, duration, reason = "No Reason", by = "Rubedo Auto Mod") { - if (player instanceof Player8) { - setBan(player, player.id, duration, reason, by); - } else { - setBan(player, TABLES.ids.get(player), duration, reason, by); - } - } -}; - -// src/plugins/Anti-Cheat/modules/commands/ban.ts -function ban(ctx, player, duration, reason, by) { - if (TABLES.bans.get(TABLES.ids.get(player))) - return ctx.reply(`\xA7c${player} is already banned`); - ctx.reply(`\xA7aClose chat to confirm`); - confirmAction( - ctx.sender, - `Are you sure you want to ban ${player}, for ${duration ?? "forever"}`, - () => { - new Ban(player, duration, reason, ctx.sender.name); - ctx.reply(text["modules.commands.ban.reply"](player, duration, reason)); - } - ); -} -var root = new Command({ - name: "ban", - description: "Manage bans", - requires: (player) => ["admin", "moderator"].includes(getRole(player)) -}); -root.literal({ - name: "add", - description: "Bans a player" -}).argument(new ArgumentTypes.playerName()).executes((ctx, player) => { - ban(ctx, player, null, null, ctx.sender.name); -}).argument(new ArgumentTypes.duration("duration")).executes((ctx, player, duration) => { - ban(ctx, player, duration, null, ctx.sender.name); -}).string("reason").executes((ctx, player, duration, reason) => { - ban(ctx, player, duration, reason, ctx.sender.name); -}); -root.literal({ - name: "remove", - description: "un-bans a player" -}).argument(new ArgumentTypes.playerName("playerName")).executes((ctx, playerName) => { - const banData = TABLES.bans.values().find((ban2) => ban2.playerName == playerName); - if (!banData) - return ctx.reply(`${playerName} is not banned`); - if (TABLES.bans.delete(banData.key)) { - ctx.reply(`\xA7a${playerName}\xA7r has been Unbanned!`); - } else { - ctx.reply(`\xA7cFailed to un-ban ${playerName}`); - } -}); -root.literal({ - name: "list", - description: "Lists all bans" -}).executes((ctx) => { - const bans = TABLES.bans.values(); - if (bans.length == 0) - return ctx.sender.tell(`\xA7cNo one is banned!`); - ctx.sender.tell(`\xA72--- Showing Bans (${bans.length}) ---`); - for (const ban2 of bans) { - ctx.sender.tell( - text["commands.ban.list.player"]( - ban2.playerName, - ban2.reason, - ban2.expire ? msToTime(ban2.duration) : "Forever" - ) - ); - } -}); - -// src/plugins/Anti-Cheat/modules/commands/database.ts -var root2 = new Command({ - name: "database", - description: "Interacts with SA Database", - aliases: ["db"], - requires: (player) => getRole(player) == "admin" -}); -root2.literal({ - name: "get" -}).string("table").string("key").executes((ctx, table, key) => { - try { - const data = TABLES[table].get(key); - if (data) { - ctx.reply(JSON.stringify(data)); - } else { - ctx.reply(`No data could be found for key ${key}`); - } - } catch (error) { - ctx.reply(error + error.stack); - } -}); -root2.literal({ - name: "set" -}).string("table").string("key").string("value").executes((ctx, table, key, value) => { - try { - TABLES[table].set(key, value); - ctx.reply(`Set Key: "${key}", to value: "${value}" on table: "${table}"`); - } catch (error) { - ctx.reply(error + error.stack); - } -}); -root2.literal({ - name: "clear" -}).string("table").executes((ctx, table) => { - try { - TABLES[table].clear(); - ctx.reply(`Cleared Table ${table}`); - } catch (error) { - ctx.reply(error + error.stack); - } -}); -root2.literal({ - name: "keys", - description: "Returns all keys on a database" -}).string("table").executes((ctx, table) => { - try { - const keys = TABLES[table].keys(); - ctx.reply(`Keys on database: ${table}: ${keys}`); - } catch (error) { - ctx.reply(error + error.stack); - } -}); -root2.literal({ - name: "values", - description: "Returns all values on a database" -}).string("table").executes((ctx, table) => { - try { - const values = TABLES[table].values(); - ctx.reply( - `Values on database: ${table}: ${JSON.stringify(values, null, 2)}` - ); - } catch (error) { - if (error instanceof TypeError) { - ctx.reply(`No values on database ${table}`); - } else { - ctx.reply(error + error.stack); - } - } -}); - -// src/plugins/Anti-Cheat/modules/commands/ecwipe.ts -new Command({ - name: "ecwipe", - description: "Clears a players ender chest", - requires: (player) => getRole(player) == "admin" -}).argument(new ArgumentTypes.player("player")).executes((ctx, player) => { - for (let i = 0; i < 27; i++) { - player.runCommandAsync(`replaceitem entity @s slot.enderchest ${i} air`); - } - ctx.reply(`\xA7aCleared "${player.name}"'s Ender chest!`); -}); - -// src/plugins/Anti-Cheat/modules/models/Freeze.ts -var Freeze = class { - constructor(player, reason = "No Reason") { - const data = { - playerName: player.name, - key: player.id, - reason, - location: { - x: player.location.x, - y: player.location.y, - z: player.location.z, - dimension: player.dimension.id - } - }; - TABLES.freezes.set(player.id, data); - } -}; - -// src/plugins/Anti-Cheat/modules/commands/freeze.ts -var root3 = new Command({ - name: "freeze", - description: "Manage Freezes", - requires: (player) => ["admin", "moderator"].includes(getRole(player)) -}); -root3.literal({ - name: "add", - description: "Freezes a player" -}).argument(new ArgumentTypes.player("player")).string("reason").executes((ctx, player, reason) => { - new Freeze(player, reason); - ctx.reply( - `\xA7cFroze \xA7f"\xA7a${player.name}\xA7f" Because: "${reason}" \xA7aSuccessfully` - ); - ctx.sender.tell( - `\xA7cYou have been frozen by \xA7f"\xA7a${ctx.sender.name}\xA7f" Because: "${reason}"` - ); -}); -root3.literal({ - name: "remove", - description: "unfreezes a player" -}).argument(new ArgumentTypes.playerName("playerName")).executes((ctx, playerName) => { - const freeze = TABLES.freezes.values().find((freeze2) => freeze2.playerName == playerName); - if (!freeze) - return ctx.reply(`${playerName} is not frozen`); - TABLES.freezes.delete(freeze.key); - ctx.reply(`\xA7a${playerName}\xA7r has been UnFrozen!`); -}); -root3.literal({ - name: "list", - description: "Lists all freezes" -}).executes((ctx) => { - const freezes = TABLES.freezes.values(); - if (freezes.length == 0) - return ctx.sender.tell(`\xA7cNo one is frozen!`); - ctx.sender.tell(`\xA72--- Showing Freezes (${freezes.length}) ---`); - for (const freeze of freezes) { - ctx.sender.tell( - text["commands.freeze.list.player"](freeze.playerName, freeze.reason) - ); - } -}); - -// src/plugins/Anti-Cheat/modules/commands/help.ts -var CommandNameArgumentType = class { - constructor(name) { - this.name = name; - this.typeName = "CommandName"; - } - matches(value) { - return { - success: Boolean( - COMMANDS.find((c) => c.depth == 0 && c.data.name == value) - ), - value - }; - } - fail(value) { - return `"${value}" is not a valid command`; - } -}; -function sendCommandType(baseCommand, args, player) { - player.tell( - `${PREFIX}${baseCommand.data.name} ${args.map( - (a) => a.type.typeName == "literal" ? a.data.name : `<${a.type.name}: ${a.type.typeName}>` - ).join(" ")}` - ); -} -function sendArguments(bc, c, args, p) { - if (!c.data?.requires(p)) - return; - if (c.callback) { - sendCommandType(bc, c.depth == 0 ? args : args.concat(c), p); - } - if (c.children.length > 0) { - for (const child of c.children) { - sendArguments(bc, child, c.depth == 0 ? args : args.concat(c), p); - } - } -} -function sendPageHeader(player, p, maxPages) { - player.tell( - `\xA72--- Showing help page ${p} of ${maxPages} (${PREFIX}help ) ---` - ); -} -function getCommands(player) { - return COMMANDS.filter((c) => { - return c.depth == 0 && c.data?.requires(player); - }); -} -function getMaxPages(player) { - const commands = getCommands(player); - if (commands.length == 0) - return 0; - return Math.ceil(commands.length / 5); -} -var root4 = new Command({ - name: "help", - description: "Provides help/list of commands.", - aliases: ["?", "h"] -}).executes((ctx) => { - const maxPages = getMaxPages(ctx.sender); - const commands = getCommands(ctx.sender).slice(1 * 5 - 5, 1 * 5); - sendPageHeader(ctx.sender, 1, maxPages); - for (const cmd of commands) { - sendArguments(cmd, cmd, [], ctx.sender); - } -}); -root4.int("page").executes((ctx, p) => { - const maxPages = getMaxPages(ctx.sender); - if (p > maxPages) - p = maxPages; - const commands = getCommands(ctx.sender).slice(p * 5 - 5, p * 5); - sendPageHeader(ctx.sender, p, maxPages); - for (const cmd of commands) { - sendArguments(cmd, cmd, [], ctx.sender); - } -}); -root4.argument(new CommandNameArgumentType("command")).executes((ctx, command2) => { - const cmd = COMMANDS.filter( - (c) => c.depth == 0 && c.data.name == command2 - )[0]; - ctx.sender.tell( - `\xA7e${cmd.data.name}: ${cmd.data.aliases ? `aliases (${cmd.data.aliases.join(", ")})` : ""}` - ); - ctx.sender.tell(`\xA7e${cmd.data.description}`); - ctx.sender.tell(`Usage:`); - sendArguments(cmd, cmd, [], ctx.sender); -}); - -// src/plugins/Anti-Cheat/modules/commands/lockdown.ts -import { world as world8 } from "@minecraft/server"; -new Command({ - name: "lockdown", - description: "Toggles the servers lockdown, meaning no one can join", - requires: (player) => getRole(player) == "admin" -}).executes((ctx) => { - if (isLockedDown()) { - setLockDown(false); - ctx.sender.tell(`\xA7aUnlocked the server!`); - } else { - ctx.reply(`\xA7aClose chat to confirm lockdown`); - confirmAction(ctx.sender, text["commands.lockdown.confirm"], () => { - setLockDown(true); - for (const player of world8.getPlayers()) { - if (getRole(player) == "admin") - continue; - kick(player, text["lockdown.kick.message"]()); - } - world8.say(`\xA7l\xA7cServer is now LOCKED!`); - }); - } -}); - -// src/plugins/Anti-Cheat/modules/models/Mute.ts -var Mute = class { - static getMuteData(player) { - return TABLES.mutes.get(player.name); - } - constructor(player, duration, reason = "No Reason", by = "Rubedo Auto Mod") { - const msLength = duration ? durationToMs(duration) : null; - const data = { - playerName: player.name, - date: Date.now(), - duration: msLength, - expire: msLength ? msLength + Date.now() : null, - reason, - by - }; - TABLES.mutes.set(player.name, data); - } -}; - -// src/plugins/Anti-Cheat/modules/commands/mute.ts -var root5 = new Command({ - name: "mute", - description: "Manage Mutes", - requires: (player) => ["admin", "moderator"].includes(getRole(player)) -}); -root5.literal({ - name: "add", - description: "Mutes a player" -}).argument(new ArgumentTypes.player("player")).argument(new ArgumentTypes.duration("duration")).string("reason").executes((ctx, player, duration, reason) => { - new Mute(player, duration, reason, ctx.sender.name); - ctx.reply( - `\xA7cMuted \xA7f"\xA7a${player.name}\xA7f" \xA7cfor ${duration} Because: "${reason}" \xA7aSuccessfully` - ); - player.tell( - `\xA7cYou have been muted by \xA7f"${ctx.sender.name}" \xA7cfor ${duration} Because: "${reason}"` - ); -}); -root5.literal({ - name: "remove", - description: "un-mutes a player" -}).argument(new ArgumentTypes.playerName("playerName")).executes((ctx, playerName) => { - const mute = TABLES.mutes.values().find((mute2) => mute2.playerName == playerName); - if (!mute) - return ctx.reply(`${playerName} is not muted!`); - TABLES.mutes.delete(mute.playerName); - try { - ctx.sender.runCommandAsync(`ability "${playerName}" mute false`); - } catch (error) { - } - ctx.reply(`\xA7a${playerName}\xA7r has been UnMuted!`); -}); -root5.literal({ - name: "list", - description: "Lists all freezes" -}).executes((ctx) => { - const mutes = TABLES.mutes.values(); - if (mutes.length == 0) - return ctx.sender.tell(`\xA7cNo one is muted!`); - ctx.sender.tell(`\xA72--- Showing Mutes (${mutes.length}) ---`); - for (const mute of mutes) { - ctx.sender.tell( - text["commands.mutes.list.player"]( - mute.playerName, - mute.reason, - mute.expire ? msToTime(mute.expire) : "Forever" - ) - ); - } -}); - -// src/plugins/Anti-Cheat/modules/commands/npc.ts -import { Location as Location3 } from "@minecraft/server"; - -// src/plugins/Anti-Cheat/modules/models/Npc.ts -var Npc = class { - static isValid(entity) { - if (entity.typeId != "minecraft:npc") - return false; - if (NPC_LOCATIONS.find((l) => LocationEquals(l, entity.location))) - return true; - return TABLES.npcs.keys().find((key) => entity.id == key) ? true : false; - } - constructor(location, dimension) { - NPC_LOCATIONS.push(location); - const entity = dimension.spawnEntity("minecraft:npc", location); - const data = { - dimension: entity.dimension.id, - x: entity.location.x, - y: entity.location.y, - z: entity.location.z - }; - TABLES.npcs.set(entity.id, data); - clearNpcLocations(); - } -}; - -// src/plugins/Anti-Cheat/modules/commands/npc.ts -new Command({ - name: "npc", - description: "Spawns a npc at your coordinates", - requires: (player) => getRole(player) == "admin" -}).executes((ctx) => { - const { x, y, z } = ctx.sender.location; - new Npc(new Location3(x, y, z), ctx.sender.dimension); - ctx.reply(`Spawned a verified npc at your current location`); -}); - -// src/plugins/Anti-Cheat/modules/commands/ping.ts -import { world as world9 } from "@minecraft/server"; -new Command({ - name: "ping", - description: "Returns the current Ticks Per Second of the servers ping" -}).executes((ctx) => { - let pingTick = world9.events.tick.subscribe(({ deltaTime }) => { - ctx.reply(`Pong! Current Ticks Per Second: ${1 / deltaTime}`); - world9.events.tick.unsubscribe(pingTick); - }); -}); - -// src/plugins/Anti-Cheat/modules/commands/region.ts -import { BlockLocation as BlockLocation5 } from "@minecraft/server"; -var command = new Command({ - name: "region", - description: "Create a Region", - requires: (player) => getRole(player) == "admin" -}); -command.literal({ - name: "add", - description: "Adds a new protection region" -}).int("from_x").int("from_z").int("to_x").int("to_z").executes((ctx, from_x, from_z, to_x, to_z) => { - new Region( - { x: from_x, z: from_z }, - { x: to_x, z: to_z }, - ctx.sender.dimension.id - ); - ctx.reply( - `Created Region From ${from_x} -64 ${from_z} ${to_x} 320 ${to_z}` - ); -}); -command.literal({ - name: "remove", - description: "Removes a region at the players current position" -}).executes((ctx) => { - const loc = new BlockLocation5( - ctx.sender.location.x, - ctx.sender.location.y, - ctx.sender.location.z - ); - const r = Region.removeRegionAtBlockLocation(loc, ctx.sender.dimension.id); - if (r) { - ctx.reply(`Removed Region at ${loc.x} ${loc.y} ${loc.z}`); - } else { - ctx.reply(`Failed to find/remove region at ${loc.x} ${loc.y} ${loc.z}`); - } -}); -command.literal({ - name: "removeAll", - description: "Removes all regions" -}).executes((ctx) => { - Region.getAllRegions().forEach((r) => r.delete()); - ctx.reply(`Removed All regions`); -}); -command.literal({ - name: "list", - description: "Lists all regions and positions" -}).executes((ctx) => { - const regions = Region.getAllRegions(); - for (const region of regions) { - ctx.reply( - `Region from ${region.from.x}, ${region.from.z} to ${region.to.x}, ${region.to.z} in dimension ${region.dimensionId}` - ); - } - if (regions.length == 0) - return ctx.reply(`No regions have been made yet`); -}); -var permission = command.literal({ - name: "permission", - description: "Handles permissions for regions" -}); -permission.literal({ - name: "set", - description: "Sets a certain permission on the region the player is currently in to a value" -}).array("key", ["doorsAndSwitches", "openContainers", "pvp"]).boolean("value").executes((ctx, key, value) => { - const region = Region.blockLocationInRegion( - new BlockLocation5( - ctx.sender.location.x, - ctx.sender.location.y, - ctx.sender.location.z - ), - ctx.sender.dimension.id - ); - if (!region) - return ctx.reply(`You are not in a region`); - region.changePermission(key, value); - ctx.reply(`Changed permission ${key} to ${value}`); -}); -permission.literal({ - name: "list", - description: "Lists the permissions for the current region" -}).executes((ctx) => { - const region = Region.blockLocationInRegion( - new BlockLocation5( - ctx.sender.location.x, - ctx.sender.location.y, - ctx.sender.location.z - ), - ctx.sender.dimension.id - ); - if (!region) - return ctx.reply(`You are not in a region`); - ctx.reply( - `Current region permissions ${JSON.stringify(region.permissions)}` - ); -}); -var entityCommands = permission.literal({ - name: "entities", - description: "Holds the subCommands for adding or removing allowedEntities" -}); -entityCommands.literal({ - name: "add", - description: "Adds a entity to the allowed entities list" -}).string("entity").executes((ctx, entity) => { - const region = Region.blockLocationInRegion( - new BlockLocation5( - ctx.sender.location.x, - ctx.sender.location.y, - ctx.sender.location.z - ), - ctx.sender.dimension.id - ); - if (!region) - return ctx.reply(`You are not in a region`); - const currentAllowedEntities = region.permissions.allowedEntities; - currentAllowedEntities.push(entity); - region.changePermission("allowedEntities", currentAllowedEntities); - ctx.reply( - `Added entity ${entity} to the allowed entities of the region your currently standing in` - ); -}); -entityCommands.literal({ - name: "remove", - description: "Removes a entity from the allowed entities in the region" -}).string("entity").executes((ctx, entity) => { - const region = Region.blockLocationInRegion( - new BlockLocation5( - ctx.sender.location.x, - ctx.sender.location.y, - ctx.sender.location.z - ), - ctx.sender.dimension.id - ); - if (!region) - return ctx.reply(`You are not in a region`); - let currentAllowedEntities = region.permissions.allowedEntities; - if (!currentAllowedEntities.includes(entity)) - return ctx.reply( - `The entity ${entity} is not allowed to enter the region` - ); - currentAllowedEntities = currentAllowedEntities.filter((v) => v != entity); - region.changePermission("allowedEntities", currentAllowedEntities); - ctx.reply( - `Removed entity ${entity} to the allowed entities of the region your currently standing in` - ); -}); - -// src/types.ts -var ROLES = /* @__PURE__ */ ((ROLES2) => { - ROLES2[ROLES2["member"] = 0] = "member"; - ROLES2[ROLES2["admin"] = 1] = "admin"; - ROLES2[ROLES2["moderator"] = 2] = "moderator"; - ROLES2[ROLES2["builder"] = 3] = "builder"; - return ROLES2; -})(ROLES || {}); - -// src/plugins/Anti-Cheat/modules/commands/role.ts -var StringIsNumber = (value) => isNaN(Number(value)) === false; -function ToArray(enumme) { - return Object.keys(enumme).filter(StringIsNumber).map((key) => enumme[key]); -} -var root6 = new Command({ - name: "role", - description: "Changes the role for a player", - requires: (player) => getRole(player) == "admin" || isServerOwner(player) -}); -root6.literal({ - name: "set", - description: "Sets the role for a player" -}).argument(new ArgumentTypes.playerName("playerName")).argument(new ArgumentTypes.array("role", ToArray(ROLES))).executes((ctx, playerName, role) => { - setRole(playerName, role); - ctx.reply(`Changed role of ${playerName} to ${role}`); -}); -root6.literal({ - name: "get", - description: "Gets the role of a player" -}).argument(new ArgumentTypes.playerName("playerName")).executes((ctx, playerName) => { - const role = getRole(playerName); - ctx.reply(`${playerName} has role: ${role}`); -}); -var ownerRoot = root6.literal({ - name: "owner", - description: "Manages the owner" -}); -ownerRoot.literal({ - name: "get", - description: "Gets the owner of the world" -}).executes((ctx) => { - const ownerId = getServerOwner(); - const ids = TABLES.ids.collection(); - const ownerName = Object.keys(ids).find((key) => ids[key] === ownerId); - ctx.reply(`\xA7aServer Owner: ${ownerName} (id: ${ownerId})`); -}); -ownerRoot.literal({ - name: "transfer", - description: "Transfers the owner of the world", - requires: (player) => isServerOwner(player) -}).argument(new ArgumentTypes.player()).executes((ctx, player) => { - confirmAction( - ctx.sender, - `Are you sure you want to transfer the server ownership to ${player.name}, this action is not reversible!`, - () => { - setServerOwner(player); - ctx.reply( - `\xA7aSet the server Owner to: ${player.name} (id: ${player.id})` - ); - } - ); - ctx.reply(`\xA7aClose chat to confirm`); -}); -ownerRoot.literal({ - name: "clear", - description: "clear's the owner of the world", - requires: (player) => isServerOwner(player) -}).executes((ctx) => { - confirmAction( - ctx.sender, - "Are you sure you want to clear the server owner, this action is not reversible!", - () => { - setServerOwner(null); - ctx.reply( - `\xA7aCleared the server owner! run "/reload" or reload world to run "/function start" again!` - ); - } - ); - ctx.reply(`\xA7aClose chat to confirm`); -}); - -// src/lib/Form/Models/ActionForm.ts -import { ActionFormData } from "@minecraft/server-ui"; -var ActionForm = class { - constructor(title, body) { - this.title = title; - this.body = body; - this.form = new ActionFormData(); - if (title) - this.form.title(title); - if (body) - this.form.body(body); - this.buttons = []; - this.triedToShow = 0; - } - addButton(text2, iconPath = null, callback) { - this.buttons.push({ - text: text2, - iconPath, - callback - }); - this.form.button(text2, iconPath); - return this; - } - show(player) { - this.form.show(player).then((response) => { - if (response.canceled) { - if (response.cancelationReason == "userBusy") { - if (this.triedToShow > TIMEOUT_THRESHOLD) - return player.tell( - `\xA7cForm Timeout: tried to show form, but you were busy (close chat after running command)` - ); - this.triedToShow++; - this.show(player); - } - return; - } - this.buttons[response.selection].callback?.(); - }); - } -}; - -// src/lib/Form/Models/ModelForm.ts -import { ModalFormData } from "@minecraft/server-ui"; - -// src/lib/Form/Models/FormCallback.ts -var FormCallback = class { - constructor(form, player, callback) { - this.form = form; - this.player = player; - this.callback = callback; - } - error(message) { - new MessageForm("Error", message).setButton1("Return to form", () => { - this.form.show(this.player, this.callback); - }).setButton2("Cancel", null).show(this.player); - } -}; - -// src/lib/Form/Models/ModelForm.ts -var ModalForm = class { - constructor(title) { - this.title = title; - this.form = new ModalFormData(); - if (title) - this.form.title(title); - this.args = []; - this.triedToShow = 0; - } - addDropdown(label, options, defaultValueIndex) { - this.args.push({ type: "dropdown", options }); - this.form.dropdown(label, options, defaultValueIndex); - return this; - } - addSlider(label, minimumValue, maximumValue, valueStep, defaultValue) { - this.args.push({ type: "slider" }); - this.form.slider( - label, - minimumValue, - maximumValue, - valueStep, - defaultValue - ); - return this; - } - addToggle(label, defaultValue) { - this.args.push({ type: "toggle" }); - this.form.toggle(label, defaultValue); - return this; - } - addTextField(label, placeholderText, defaultValue) { - this.args.push({ type: "textField" }); - this.form.textField(label, placeholderText, defaultValue); - return this; - } - show(player, callback) { - this.form.show(player).then((response) => { - if (response.canceled) { - if (response.cancelationReason == "userBusy") { - if (this.triedToShow > TIMEOUT_THRESHOLD) - return player.tell( - `\xA7cForm Timeout: tried to show form, but you were busy (close chat after running command)` - ); - this.triedToShow++; - this.show(player, callback); - } - return; - } - callback( - new FormCallback(this, player, callback), - ...response.formValues.map( - (v, i) => this.args[i].type == "dropdown" ? this.args[i].options[v] : v - ) - ); - }); - } -}; - -// src/plugins/Anti-Cheat/modules/forms/settings.ts -function manageBannedItemsForm(player) { - new ActionForm("Manage Banned Items").addButton("Remove a Banned Item", null, () => { - removeBannedItemForm(player); - }).addButton("Ban an item", null, () => { - addBannedItemForm(player); - }).show(player); -} -function removeBannedItemForm(player) { - new ModalForm("Remove Banned Items").addDropdown("Select item to remove", getConfigId("banned_items")).show(player, (ctx, item) => { - let items = getConfigId("banned_items"); - items = items.filter((p) => p != item); - setConfigId("banned_items", items); - player.tell(`Removed Banned item "${item}"`); - }); -} -function addBannedItemForm(player) { - new ModalForm("Add Banned Item").addTextField("Item Id", "minecraft:string").show(player, (ctx, item) => { - let items = getConfigId("banned_items"); - if (items.includes(item)) - return ctx.error(`\xA7cItem "${item}" is already banned`); - items.push(item); - setConfigId("banned_items", items); - player.tell(`Banned the item "${item}"`); - }); -} -function manageBannedBlocksForm(player) { - new ActionForm("Manage Banned Blocks").addButton("Remove a Banned Block", null, () => { - removeBannedBlockForm(player); - }).addButton("Ban an block", null, () => { - addBannedBlockForm(player); - }).show(player); -} -function removeBannedBlockForm(player) { - new ModalForm("Remove Banned Block").addDropdown("Select block to remove", getConfigId("banned_blocks")).show(player, (ctx, block) => { - let blocks = getConfigId("banned_blocks"); - blocks = blocks.filter((p) => p != block); - setConfigId("banned_blocks", blocks); - player.tell(`Removed Banned block "${block}"`); - }); -} -function addBannedBlockForm(player) { - new ModalForm("Add Banned Block").addTextField("Block Id", "minecraft:barrier").show(player, (ctx, block) => { - let blocks = getConfigId("banned_blocks"); - if (blocks.includes(block)) - return ctx.error(`\xA7cBlock "${block}" is already banned`); - blocks.push(block); - setConfigId("banned_blocks", blocks); - player.tell(`Banned the block "${block}"`); - }); -} -function manageEnchantmentLevelsForm(player) { - new ModalForm("Manage Enchantment Levels").addDropdown("Enchantment to change", Object.keys(ENCHANTMENTS), 0).addTextField("Level (number)", "5").show(player, (ctx, enchantment, levelString) => { - if (isNaN(levelString)) - return ctx.error( - `\xA7c"${levelString}" is not a number, please enter a value like, "3", "9", etc.` - ); - const level = parseInt(levelString); - let enchants = getConfigId("enchantments"); - enchants[enchantment] = level; - setConfigId("enchantments", enchants); - player.tell(`Set max level for ${enchantment} to ${level}`); - }); -} -function manageAppealLinkForm(player) { - new ModalForm("Manage Appeal Link").addTextField("Appeal Link", APPEAL_LINK).show(player, (ctx, link) => { - setConfigId("appealLink", link); - player.tell(`Changed the servers appeal link to ${link}`); - }); -} - -// src/plugins/Anti-Cheat/modules/forms/automod.ts -function showAutoModHomeForm(player) { - const form = new ActionForm("Manage Protections"); - for (const protection6 of Object.values(PROTECTIONS)) { - form.addButton(protection6.name, protection6.iconPath, () => { - showProtectionConfig(protection6, player); - }); - } - form.addButton("Back", "textures/ui/arrow_dark_left_stretch.png", () => { - showHomeForm(player); - }).show(player); -} -function showProtectionConfig(protection6, player) { - const data = protection6.getConfig(); - const form = new ModalForm( - `Manage ${protection6.name} Protection Config` - ).addToggle("Enabled", data["enabled"]); - let keys = []; - for (const [key, value] of Object.entries(protection6.configDefault)) { - keys.push(key); - if (typeof value.defaultValue == "boolean") { - form.addToggle(value.description, data[key]); - } else if (typeof value.defaultValue == "number") { - form.addSlider(value.description, 0, 100, 1, data[key]); - } else { - form.addTextField(value.description, null, data[key]); - } - } - form.show(player, (ctx, enabled, ...keys2) => { - if (enabled != data["enabled"]) { - if (enabled) - protection6.enable(); - if (!enabled) - protection6.disable(); - } - let config = { - enabled - }; - for (const [i, key] of Object.keys(protection6.configDefault).entries()) { - config[key] = keys2[i]; - } - protection6.setConfig(config); - player.tell(`Updated config for ${protection6.name}!`); - }); -} - -// src/plugins/Anti-Cheat/modules/forms/home.ts -function showHomeForm(player) { - new ActionForm("Rubedo Settings").addButton("Auto Mod", "textures/ui/permissions_op_crown.png", () => { - showAutoModHomeForm(player); - }).addButton("Banned items", "textures/blocks/sculk_shrieker_top.png", () => { - manageBannedItemsForm(player); - }).addButton("Banned blocks", "textures/blocks/barrier.png", () => { - manageBannedBlocksForm(player); - }).addButton("Enchantments", "textures/items/book_enchanted.png", () => { - manageEnchantmentLevelsForm(player); - }).addButton("Appeal Link", "textures/ui/Feedback.png", () => { - manageAppealLinkForm(player); - }).show(player); -} - -// src/plugins/Anti-Cheat/modules/commands/settings.ts -new Command({ - name: "settings", - description: "Opens up the settings menu for the player", - requires: (player) => ["admin", "moderator"].includes(getRole(player)) -}).executes((ctx) => { - showHomeForm(ctx.sender); - ctx.sender.tell(`\xA7aForm request sent, close chat to continue!`); -}); - -// src/plugins/Anti-Cheat/modules/commands/vanish.ts -import { world as world10 } from "@minecraft/server"; -function vanish(player, say) { - if (player.hasTag(`spectator`)) { - player.runCommandAsync(`gamemode c`); - player.triggerEvent(`removeSpectator`); - player.removeTag(`spectator`); - if (!say) - return; - world10.say({ - rawtext: [ - { - translate: "multiplayer.player.joined", - with: [`\xA7e${player.name}`] - } - ] - }); - } else { - player.runCommandAsync(`gamemode spectator`); - player.triggerEvent(`addSpectator`); - player.addTag(`spectator`); - if (!say) - return; - world10.say({ - rawtext: [ - { - translate: "multiplayer.player.left", - with: [`\xA7e${player.name}`] - } - ] - }); - } -} -new Command({ - name: "vanish", - description: "Toggles Vanish Mode on the sender", - requires: (player) => getRole(player) == "admin" -}).executes((ctx) => { - vanish(ctx.sender, false); -}).boolean("say").executes((ctx, say) => { - vanish(ctx.sender, say); -}); - -// src/plugins/Anti-Cheat/modules/commands/version.ts -new Command({ - name: "version", - description: "Get Current Version", - aliases: ["v"] -}).executes((ctx) => { - ctx.reply(`Current Rubedo Version: ${VERSION}`); -}); - -// src/plugins/Anti-Cheat/modules/commands/kick.ts -new Command({ - name: "kick", - description: "Kicks a player from the game", - requires: (player) => getRole(player) == "admin" -}).argument(new ArgumentTypes.player()).string("reason").executes((ctx, player, reason) => { - kick(player, [reason]); - ctx.reply(`\xA7aKicked ${player.name} from world`); -}); - -// src/plugins/Anti-Cheat/modules/models/Log.ts -var Log = class { - constructor(data) { - this.data = data; - console.warn(`[LOG]: ${data.message}`); - TABLES.logs.set(Date.now().toString(), data); - } -}; - -// src/plugins/Anti-Cheat/modules/commands/log.ts -function timeDifference(previous) { - var msPerMinute = 60 * 1e3; - var msPerHour = msPerMinute * 60; - var msPerDay = msPerHour * 24; - var msPerMonth = msPerDay * 30; - var msPerYear = msPerDay * 365; - var elapsed = Date.now() - previous; - if (elapsed < msPerMinute) { - return Math.round(elapsed / 1e3) + " seconds ago"; - } else if (elapsed < msPerHour) { - return Math.round(elapsed / msPerMinute) + " minutes ago"; - } else if (elapsed < msPerDay) { - return Math.round(elapsed / msPerHour) + " hours ago"; - } else if (elapsed < msPerMonth) { - return "approximately " + Math.round(elapsed / msPerDay) + " days ago"; - } else if (elapsed < msPerYear) { - return "approximately " + Math.round(elapsed / msPerMonth) + " months ago"; - } else { - return "approximately " + Math.round(elapsed / msPerYear) + " years ago"; - } -} -var root7 = new Command({ - name: "log", - description: "Manages the log command", - requires: (player) => getRole(player) == "admin" -}); -root7.literal({ - name: "add", - description: "Adds a new log" -}).string("message").executes((ctx, message) => { - new Log({ message }); - ctx.reply(`\xA7aAdded new log: ${message}`); -}); -root7.literal({ - name: "getAll", - description: "Gets all logs sorted in descending" -}).int("page").array("order", ["ascending", "descending"]).executes((ctx, page, order) => { - const allLogs = Object.entries(TABLES.logs.collection()).sort( - (a, b) => order == "ascending" ? parseInt(b[0]) - parseInt(a[0]) : parseInt(a[0]) - parseInt(b[0]) - ); - if (allLogs.length == 0) - return ctx.reply(`\xA7cNo Logs have been made!`); - const maxPages = Math.ceil(allLogs.length / 8); - if (page > maxPages) - page = maxPages; - ctx.reply( - `\xA72--- Showing logs page ${page} of ${maxPages} (${PREFIX}log getAll ) ---` - ); - for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) { - ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`); - } -}); -root7.literal({ - name: "getPlayersLogs", - description: "Gets all logs associated with a player" -}).argument(new ArgumentTypes.playerName()).int("page").array("order", ["ascending", "descending"]).executes((ctx, playerName, page, order) => { - const allLogs = Object.entries(TABLES.logs.collection()).filter((v) => v[1].playerName == playerName).sort( - (a, b) => order == "ascending" ? parseInt(b[0]) - parseInt(a[0]) : parseInt(a[0]) - parseInt(b[0]) - ); - if (allLogs.length == 0) - return ctx.reply(`\xA7cNo Logs exists for "${playerName}"!`); - const maxPages = Math.ceil(allLogs.length / 8); - if (page > maxPages) - page = maxPages; - ctx.reply( - `\xA72--- Showing logs for "${playerName}" page ${page} of ${maxPages} ---` - ); - for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) { - ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`); - } -}); -root7.literal({ - name: "getProtectionLogs", - description: "Gets all logs associated with a protection" -}).string("protection").int("page").array("order", ["ascending", "descending"]).executes((ctx, protection6, page, order) => { - const allLogs = Object.entries(TABLES.logs.collection()).filter((v) => v[1].protection == protection6).sort( - (a, b) => order == "ascending" ? parseInt(b[0]) - parseInt(a[0]) : parseInt(a[0]) - parseInt(b[0]) - ); - if (allLogs.length == 0) - return ctx.reply(`\xA7cNo Logs exists for protection: "${protection6}"!`); - const maxPages = Math.ceil(allLogs.length / 8); - if (page > maxPages) - page = maxPages; - ctx.reply( - `\xA72--- Showing logs for Protection: "${protection6}" page ${page} of ${maxPages} ---` - ); - for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) { - ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`); - } -}); -root7.literal({ - name: "clearAll", - description: "Clears all logs" -}).executes((ctx) => { - TABLES.logs.clear(); - ctx.reply(`\xA7aCleared All logs!`); -}); - -// src/plugins/Anti-Cheat/modules/commands/teleport.ts -var root8 = new Command({ - name: "teleport", - description: "Teleports entities (players, mobs, etc.).", - aliases: ["tp"], - requires: (player) => getRole(player) == "admin" -}); -root8.argument(new ArgumentTypes.player()).location("destination").executes((ctx, player, destination) => { - player.addTag("skip-movement-check"); - player.teleport(destination, player.dimension, 0, 0); - ctx.reply( - `Teleported ${player.name} to ${destination.x} ${destination.y} ${destination.z}` - ); -}); - -// src/plugins/Anti-Cheat/modules/managers/ban.ts -forEachValidPlayer((player) => { - try { - const banData = TABLES.bans.get(player.id); - if (!banData) - return; - if (banData.expire && banData.expire < Date.now()) - return TABLES.bans.delete(player.id); - kick( - player, - [ - `\xA7cYou have been banned!`, - `\xA7aReason: \xA7f${banData.reason}`, - `\xA7fExpiry: \xA7b${banData.expire ? msToTime(banData.expire - Date.now()) : "Forever"}`, - `\xA7fAppeal at: \xA7b${getConfigId("appealLink")}` - ], - () => { - console.warn(new Error("Failed to kick player")); - TABLES.bans.delete(player.id); - } - ); - } catch (error) { - console.warn(error + error.stack); - } -}, 20); - -// src/plugins/Anti-Cheat/modules/managers/freeze.ts -import { Location as Location4 } from "@minecraft/server"; -forEachValidPlayer((player) => { - try { - const freezeData = TABLES.freezes.get(player.id); - if (!freezeData) - return player.getComponent("movement").resetToDefaultValue(); - player.getComponent("movement").setCurrent(0); - player.teleport( - new Location4( - freezeData.location.x, - freezeData.location.y, - freezeData.location.z - ), - DIMENSIONS[freezeData.location.dimension], - 0, - 0 - ); - } catch (error) { - } -}, 200); - -// src/lib/Events/beforeChat.ts -import { world as world11 } from "@minecraft/server"; -var CALLBACKS3 = {}; -world11.events.beforeChat.subscribe((data) => { - if (data.message.startsWith(PREFIX)) - return; - for (const callback of Object.values(CALLBACKS3)) { - callback.callback(data); - } -}); -var beforeChat = class { - static subscribe(callback) { - const key = Date.now(); - CALLBACKS3[key] = { callback }; - return key; - } - static unsubscribe(key) { - delete CALLBACKS3[key]; - } -}; - -// src/plugins/Anti-Cheat/modules/managers/mute.ts -beforeChat.subscribe((data) => { - const muteData = Mute.getMuteData(data.sender); - if (!muteData) - return; - if (muteData.expire && muteData.expire < Date.now()) - return TABLES.mutes.delete(data.sender.name); - data.cancel = true; - data.sender.tell(text["modules.managers.mute.isMuted"]()); -}); - -// src/plugins/Anti-Cheat/modules/managers/region.ts -import { BlockLocation as BlockLocation6, system as system6, world as world12 } from "@minecraft/server"; -system6.runSchedule(() => { - loadRegionDenys(); -}, 6e3); -world12.events.beforeItemUseOn.subscribe((data) => { - if (["moderator", "admin"].includes(getRole(data.source))) - return; - const region = Region.blockLocationInRegion( - data.blockLocation, - data.source.dimension.id - ); - if (!region) - return; - const block = data.source.dimension.getBlock(data.blockLocation); - if (DOORS_SWITCHES.includes(block.typeId) && region.permissions.doorsAndSwitches) - return; - if (BLOCK_CONTAINERS.includes(block.typeId) && region.permissions.openContainers) - return; - data.cancel = true; -}); -world12.events.beforeExplosion.subscribe((data) => { - for (let i = 0; i < data.impactedBlocks.length; i++) { - const bL = data.impactedBlocks[i]; - let region = Region.blockLocationInRegion(bL, data.dimension.id); - if (region) - return data.cancel = true; - } -}); -world12.events.entityCreate.subscribe(async ({ entity }) => { - const region = await Region.blockLocationInRegionSync( - new BlockLocation6(entity.location.x, entity.location.y, entity.location.z), - entity.dimension.id - ); - if (!region) - return; - if (region.permissions.allowedEntities.includes(entity.typeId)) - return; - entity.teleport({ x: 0, y: -64, z: 0 }, entity.dimension, 0, 0); - entity.kill(); -}); -system6.runSchedule(async () => { - for (const region of await Region.getAllRegionsSync()) { - for (const entity of DIMENSIONS[region.dimensionId].getEntities({ excludeTypes: region.permissions.allowedEntities })) { - if (!region.entityInRegion(entity)) - continue; - entity.teleport({ x: 0, y: -64, z: 0 }, entity.dimension, 0, 0); - entity.kill(); - } - } -}, 100); -forEachValidPlayer(async (player) => { - for (const region of await Region.getAllRegionsSync()) { - if (region.entityInRegion(player)) { - player.addTag(`inRegion`); - if (!region.permissions.pvp) - player.addTag(`region-protected`); - } else { - player.removeTag(`inRegion`); - player.removeTag(`region-protected`); - } - } -}, 5); - -// src/plugins/Anti-Cheat/modules/events/playerJoin.ts -import { world as world13 } from "@minecraft/server"; -world13.events.playerJoin.subscribe(async ({ player }) => { - await awaitWorldLoad(); - if (isLockedDown() && await getRoleSync(player) != "admin") - return kick(player, text["lockdown.kick.message"]()); - if (Mute.getMuteData(player)) - player.runCommandAsync(`ability @s mute true`); - if (!TABLES.ids.has(player.name)) { - TABLES.ids.set(player.name, player.id); - } else { - player.addTag("old"); - } - const roleToSet = ChangePlayerRoleTask.getPlayersRoleToSet(player.name); - if (roleToSet) - setRole(player, roleToSet); -}); - -// src/plugins/Anti-Cheat/modules/pages/see.ts -import { - Items, - MinecraftItemTypes as MinecraftItemTypes4, - world as world14 -} from "@minecraft/server"; -var FILLABLE_SLOTS = [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44 -]; -var FILLABLE_SLOTS_ENDERCHEST = [ - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 37, - 38, - 39, - 40, - 41, - 42, - 43 -]; -function ViewPlayersFill(entity, page, extras) { - const container = entity.getComponent( - "minecraft:inventory" - ).container; - for (let i = 0; i < container.size; i++) { - const slot = page.slots[i]; - if (!slot || !slot.item) { - container.setItem(i, AIR); - continue; - } - container.setItem(i, slot.item.itemStack); - } - for (const [i, player] of [...world14.getPlayers()].entries()) { - const slot = FILLABLE_SLOTS[i]; - const item = new PageItem(MinecraftItemTypes4.skull, { - nameTag: player.name, - data: 3 - }); - container.setItem(slot, item.itemStack); - page.slots[slot] = { - item, - action: (ctx) => { - ctx.PageAction("moderation:see_inventory", { name: player.name }); - } - }; - } -} -function ViewPlayerInventoryFill(entity, page, extras) { - const container = entity.getComponent("minecraft:inventory").container; - for (let i = 0; i < container.size; i++) { - const slot = page.slots[i]; - if (!slot || !slot.item) { - container.setItem(i, AIR); - continue; - } - container.setItem(i, slot.item.itemStack); - } - const EnderChestItem = new PageItem(MinecraftItemTypes4.enderChest, { - nameTag: `\xA7eView \xA7f${extras?.name}\xA7e Ender Chest -\xA7fNote: \xA7cThis will not grab \xA7lANY NBT!\xA7r` - }); - container.setItem(49, EnderChestItem.itemStack); - page.slots[49] = { - item: EnderChestItem, - action: (ctx) => { - ctx.PageAction("moderation:see_ender_chest", { name: extras.name }); - } - }; - const player = [...world14.getPlayers()].find((p) => p.name == extras.name); - if (!player) { - const gui = Object.values(CHESTGUIS).find((e2) => e2.entity.id == entity.id); - gui.despawn(); - player.tell(`"${extras.name}" Could not be found, Gui Crashed`); - } - const inventory = player.getComponent("inventory").container; - let used_slots = 0; - for (let i = 0; i < inventory.size; i++) { - const item = inventory.getItem(i); - const slot = FILLABLE_SLOTS[used_slots]; - used_slots++; - if (!item) { - container.setItem(slot, AIR); - continue; - } - container.setItem(slot, item); - page.slots[slot] = { - item: new PageItem( - Items.get(item.typeId), - { amount: item.amount, data: item.data }, - item - ), - action: async (ctx) => { - if (i < 9) { - await player.runCommandAsync( - `replaceitem entity @s slot.hotbar ${i} air` - ); - } else { - await player.runCommandAsync( - `replaceitem entity @s slot.inventory ${i - 9} air` - ); - } - ctx.GiveAction(); - page.slots[slot] = { - item: null, - action: (ctx2) => { - inventory.addItem(ctx2.getItemAdded()); - } - }; - } - }; - } -} -async function ViewPlayerEnderChestFill(entity, page, extras) { - const container = entity.getComponent("minecraft:inventory").container; - for (let i = 0; i < container.size; i++) { - const slot = page.slots[i]; - if (!slot || !slot.item) { - container.setItem(i, AIR); - continue; - } - container.setItem(i, slot.item.itemStack); - } - const player = [...world14.getPlayers()].find((p) => p.name == extras?.name); - if (!player) { - const gui = Object.values(CHESTGUIS).find((e2) => e2.entity.id == entity.id); - gui.despawn(); - player.tell(`"${extras.name}" Could not be found, Gui Crashed`); - } - let used_slots = 0; - const ItemTypes = Object.values(MinecraftItemTypes4); - for (const item of ItemTypes) { - try { - await player.runCommandAsync( - `testfor @s[hasitem={item=${item.id},location=slot.enderchest}]` - ); - const ChestGuiItem = new PageItem(item, { - nameTag: "Note: \xA7l\xA7cThis is not the exact item" - }); - const slot = FILLABLE_SLOTS_ENDERCHEST[used_slots]; - container.setItem(slot, ChestGuiItem.itemStack); - page.slots[slot] = { - item: ChestGuiItem, - action: (ctx) => { - ctx.GiveAction(); - page.slots[slot] = null; - } - }; - used_slots++; - } catch (error) { - } - } -} -new Page("moderation:see", ViewPlayersFill).setSlots( - [50], - new PageItem(MinecraftItemTypes4.arrow, { - nameTag: "\xA7fBack" - }), - (ctx) => { - ctx.PageAction("home"); - } -).setSlots( - [48], - new PageItem(MinecraftItemTypes4.barrier, { nameTag: "\xA7cClose GUI" }), - (ctx) => { - ctx.CloseAction(); - } -); -new Page("moderation:see_inventory", ViewPlayerInventoryFill).setSlots( - [50], - new PageItem(MinecraftItemTypes4.arrow, { - nameTag: "\xA7fBack" - }), - (ctx) => { - ctx.PageAction("moderation:see"); - } -).setSlots( - [48], - new PageItem(MinecraftItemTypes4.barrier, { nameTag: "\xA7cClose GUI" }), - (ctx) => { - ctx.CloseAction(); - } -); -new Page("moderation:see_ender_chest", ViewPlayerEnderChestFill).setSlots( - [50], - new PageItem(MinecraftItemTypes4.arrow, { - nameTag: "\xA7fBack" - }), - (ctx) => { - ctx.PageAction("moderation:see"); - } -).setSlots( - [48], - new PageItem(MinecraftItemTypes4.barrier, { nameTag: "\xA7cClose GUI" }), - (ctx) => { - ctx.CloseAction(); - } -); - -// src/plugins/Anti-Cheat/modules/protections/cbe.ts -import { Player as Player12, MinecraftBlockTypes as MinecraftBlockTypes4 } from "@minecraft/server"; - -// src/plugins/Anti-Cheat/modules/models/Protection.ts -import { system as system7, world as world15 } from "@minecraft/server"; -var Protection = class { - constructor(name, description, iconPath) { - this.name = name; - this.description = description; - this.iconPath = iconPath; - this.name = name; - this.description = description; - this.iconPath = iconPath; - this.configDefault = {}; - this.isEnabled = false; - this.events = {}; - this.schedules = []; - this.forEachValidPlayers = []; - PROTECTIONS[this.name] = this; - } - setConfigDefault(data) { - this.configDefault = data; - TABLES.protections.hasSync(this.name).then((v) => { - if (v) - return; - let saveData = { - enabled: true - }; - for (const key of Object.keys(data)) { - saveData[key] = data[key].defaultValue; - } - TABLES.protections.set(this.name, saveData); - }); - return this; - } - getConfig() { - let config = TABLES.protections.get(this.name); - if (!config) - config = { enabled: this.isEnabled }; - return config; - } - async getConfigSync() { - let config = await TABLES.protections.getSync(this.name); - if (!config) - config = { enabled: this.isEnabled }; - return config; - } - async setConfig(data) { - await TABLES.protections.set(this.name, data); - return; - } - triggerChange(enabled) { - if (enabled) { - this.isEnabled = true; - this.onEnableCallback?.(); - for (const [key, value] of Object.entries(this.events)) { - if (value.triggered) - continue; - let callback = world15.events[key].subscribe( - value.callback - ); - value.triggered = true; - value.callback = callback; - } - for (const v of this.forEachValidPlayers) { - if (v.key) - continue; - let key = forEachValidPlayer(v.callback, v.delay); - v.key = key; - } - for (const v of this.schedules) { - if (v.runScheduleId) - continue; - let runScheduleId = system7.runSchedule(v.callback); - v.runScheduleId = runScheduleId; - } - } else { - this.isEnabled = false; - this.onDisableCallback?.(); - for (const [key, value] of Object.entries(this.events)) { - if (!value.triggered) - continue; - world15.events[key].unsubscribe(value.callback); - value.triggered = false; - } - for (const v of this.forEachValidPlayers) { - if (!v.key) - continue; - clearForEachValidPlayer(v.key); - v.key = null; - } - for (const v of this.schedules) { - if (!v.runScheduleId) - continue; - system7.clearRunSchedule(v.runScheduleId); - v.runScheduleId = null; - } - } - } - onEnable(callback) { - this.onEnableCallback = callback; - return this; - } - onDisable(callback) { - this.onDisableCallback = callback; - return this; - } - subscribe(id, callback) { - this.events[id] = { - callback, - triggered: false - }; - return this; - } - runSchedule(callback, tickInterval) { - this.schedules.push({ - callback, - tickInterval, - runScheduleId: null - }); - return this; - } - forEachValidPlayer(callback, delay = 0) { - this.forEachValidPlayers.push({ - callback, - delay, - key: null - }); - return this; - } - enable() { - this.triggerChange(true); - } - disable() { - this.triggerChange(false); - } -}; - -// src/plugins/Anti-Cheat/modules/protections/cbe.ts -var CBE_ENTITIES = ["minecraft:command_block_minecart"]; -var protection = new Protection("cbe", "Stops CBE", "textures/blocks/command_block.png").setConfigDefault({ - entityCreate: { - description: "Adds NPC protection", - defaultValue: true - }, - banSpawnEggs: { - description: "If spawn eggs should be banned", - defaultValue: true - } -}); -protection.subscribe("entityCreate", async ({ entity }) => { - const config = await protection.getConfigSync(); - if (!config.entityCreate) - return; - const kill = () => { - try { - entity.triggerEvent("despawn"); - entity.kill(); - } catch (error) { - entity.kill(); - } - }; - if (CBE_ENTITIES.includes(entity.typeId)) - return kill(); - if (entity.typeId == "minecraft:npc" && !Npc.isValid(entity)) - return kill(); -}); -protection.subscribe("beforeItemUseOn", (data) => { - if (!(data.source instanceof Player12)) - return; - if (["admin", "moderator"].includes(getRole(data.source))) - return; - const config = protection.getConfig(); - if (data.item.typeId.endsWith("spawn_egg")) { - if (!config.banSpawnEggs) - return; - const block = data.source.dimension.getBlock(data.blockLocation); - if (block.typeId == MinecraftBlockTypes4.mobSpawner.id) - return; - data.cancel = true; - data.source.tell(`\xA7c[Rubedo]: You cannot place spawnEggs on the floor!`); - data.source.playSound(`note.bass`); - } else { - if (FORBIDDEN_BLOCKS.includes(data.item.typeId)) { - data.cancel = true; - return; - } - const BANNED_BLOCKS2 = getConfigId("banned_blocks"); - if (!BANNED_BLOCKS2.includes(data.item.typeId)) - return; - data.cancel = true; - new Ban(data.source, null, "Placing Banned Blocks"); - } -}); -protection.enable(); - -// src/plugins/Anti-Cheat/modules/protections/crasher.ts -var DISTANCE = 32e4; -new Protection( - "crasher", - "Protection against type 1 crasher", - "textures/ui/servers.png" -).forEachValidPlayer((player) => { - if (Math.abs(player.location.x) > DISTANCE || Math.abs(player.location.y) > DISTANCE || Math.abs(player.location.z) > DISTANCE) { - new Ban(player, null, "Crasher detected"); - } -}).enable(); - -// src/plugins/Anti-Cheat/modules/protections/gamemode.ts -import { GameMode as GameMode2, world as world16 } from "@minecraft/server"; -var ILLEGAL_GAMEMODE = GameMode2.creative; -var ViolationCount = new PlayerLog(); -var protection2 = new Protection( - "gamemode", - "Blocks illegal gamemode", - "textures/ui/creative_icon.png" -).setConfigDefault({ - clearPlayer: { - description: "Whether to clear players inventory.", - defaultValue: true - }, - setToSurvival: { - description: "If player should be set to survival after being flagged.", - defaultValue: true - }, - banPlayer: { - description: "If player should be banned after violation count is met.", - defaultValue: false - }, - violationCount: { - description: "The amount of violations before ban.", - defaultValue: 0 - } -}); -protection2.runSchedule(async () => { - const config = await protection2.getConfigSync(); - for (const player of world16.getPlayers({ gameMode: ILLEGAL_GAMEMODE })) { - if (["moderator", "admin", "builder"].includes(getRole(player))) - continue; - try { - if (config.setToSurvival) - player.runCommandAsync(`gamemode s`); - if (config.clearPlayer) - player.runCommandAsync(`clear @s`); - } catch (error) { - } - const count = (ViolationCount.get(player) ?? 0) + 1; - ViolationCount.set(player, count); - if (config.banPlayer && count >= config.violationCount) - new Ban(player, null, "Illegal Gamemode"); - } -}, 20); -protection2.enable(); - -// src/lib/Events/beforeBlockBreak.ts -import { - world as world18, - Location as Location5, - system as system9 -} from "@minecraft/server"; - -// src/plugins/Anti-Cheat/modules/managers/containers.ts -import { system as system8, world as world17 } from "@minecraft/server"; - -// src/plugins/Anti-Cheat/modules/models/BlockInventory.ts -var BlockInventory = class { - constructor(inventory) { - this.emptySlotsCount = inventory.emptySlotsCount; - this.size = inventory.size; - this.items = []; - for (let i = 0; i < this.size; i++) { - this.items[i] = inventory.getItem(i); - } - } - load(block) { - for (let i = 0; i < block.size; i++) { - if (!this.items[i]) - continue; - block.setItem(i, this.items[i]); - } - } -}; - -// src/plugins/Anti-Cheat/modules/managers/containers.ts -var CONTAINER_LOCATIONS = {}; -system8.runSchedule(() => { - CONTAINER_LOCATIONS = {}; - for (const player of world17.getPlayers()) { - if (player.dimension.id != "minecraft:overworld") - continue; - const blockLoc = vector3ToBlockLocation(player.location); - const pos1 = blockLoc.offset(CHECK_SIZE.x, CHECK_SIZE.y, CHECK_SIZE.z); - const pos2 = blockLoc.offset(-CHECK_SIZE.x, -CHECK_SIZE.y, -CHECK_SIZE.z); - for (const location of pos1.blocksBetween(pos2)) { - if (location.y < -64) - continue; - const block = player.dimension.getBlock(location); - if (!block) - continue; - if (!API_CONTAINERS.includes(block.typeId)) - continue; - CONTAINER_LOCATIONS[JSON.stringify(location)] = new BlockInventory( - block.getComponent("inventory").container - ); - } - } -}, 100); - -// src/lib/Events/beforeBlockBreak.ts -var CALLBACKS4 = {}; -world18.events.blockBreak.subscribe((data) => { - for (const callback of Object.values(CALLBACKS4)) { - callback.callback( - new BeforeBlockBreakEvent( - data.block, - data.brokenBlockPermutation, - data.dimension, - data.player - ) - ); - } -}); -var beforeBlockBreak = class { - static subscribe(callback) { - const key = Date.now(); - CALLBACKS4[key] = { callback }; - return key; - } - static unsubscribe(key) { - delete CALLBACKS4[key]; - } -}; -var BeforeBlockBreakEvent = class { - constructor(block, brokenBlockPermutation, dimension, player) { - this.block = block; - this.brokenBlockPermutation = brokenBlockPermutation; - this.dimension = dimension; - this.player = player; - this.block = block; - this.brokenBlockPermutation = brokenBlockPermutation; - this.dimension = dimension; - this.player = player; - } - set cancel(value) { - this.dimension.getBlock(this.block.location).setPermutation(this.brokenBlockPermutation.clone()); - if (API_CONTAINERS.includes(this.brokenBlockPermutation.type.id)) { - const OLD_INVENTORY = CONTAINER_LOCATIONS[JSON.stringify(this.block.location)]; - if (OLD_INVENTORY) { - OLD_INVENTORY.load(this.block.getComponent("inventory").container); - } - } - system9.run(() => { - [ - ...this.dimension.getEntities({ - maxDistance: 2, - type: "minecraft:item", - location: new Location5( - this.block.location.x, - this.block.location.y, - this.block.location.z - ) - }) - ].forEach((e2) => e2.kill()); - }); - } -}; - -// src/plugins/Anti-Cheat/modules/protections/nuker.ts -var log = new PlayerLog(); -var IMPOSSIBLE_BREAK_TIME = 15; -var VALID_BLOCK_TAGS = [ - "snow", - "lush_plants_replaceable", - "azalea_log_replaceable", - "minecraft:crop", - "fertilize_area" -]; -var IMPOSSIBLE_BREAKS = [ - "minecraft:water", - "minecraft:flowing_water", - "minecraft:lava", - "minecraft:flowing_lava", - "minecraft:bedrock" -]; -var ViolationCount2 = new PlayerLog(); -var beforeBlockBreakKey = null; -var protection3 = new Protection( - "nuker", - "Blocks block breaking too fast", - "textures/blocks/dirt.png" -).setConfigDefault({ - banPlayer: { - description: "If the player should be banned once violation count is met", - defaultValue: false - }, - violationCount: { - description: "Violations before ban", - defaultValue: 0 - } -}); -protection3.onEnable(async () => { - const config = await protection3.getConfigSync(); - beforeBlockBreakKey = beforeBlockBreak.subscribe((data) => { - if (["moderator", "admin"].includes(getRole(data.player))) - return; - if (data.block.getTags().some((tag) => VALID_BLOCK_TAGS.includes(tag))) - return; - const old = log.get(data.player); - log.set(data.player, Date.now()); - if (!old) - return; - if (!IMPOSSIBLE_BREAKS.includes(data.block.typeId)) { - if (old < Date.now() - IMPOSSIBLE_BREAK_TIME) - return; - const count = (ViolationCount2.get(data.player) ?? 0) + 1; - ViolationCount2.set(data.player, count); - if (config.banPlayer && count >= config.violationCount) - new Ban(data.player, null, "Using Nuker"); - } - data.cancel = true; - }); -}).onDisable(() => { - beforeBlockBreak.unsubscribe(beforeBlockBreakKey); -}); -protection3.enable(); - -// src/plugins/Anti-Cheat/modules/protections/spam.ts -var previousMessage = new PlayerLog(); -var ViolationCount3 = new PlayerLog(); -var protection4 = new Protection("spam", "Blocks spam in chat", "textures/ui/mute_on.png").setConfigDefault({ - permMutePlayer: { - description: "If player should be permanently muted once violation count is met.", - defaultValue: false - }, - violationCount: { - description: "Violation count before permanent mute", - defaultValue: 0 - }, - repeatedMessages: { - description: "Blocks repeated messages", - defaultValue: true - }, - zalgo: { - description: "Blocks zalgo", - defaultValue: true - } -}); -protection4.subscribe("beforeChat", (data) => { - try { - if (data.message.startsWith(PREFIX)) - return; - if (["admin", "moderator"].includes(getRole(data.sender))) - return; - const config = protection4.getConfig(); - const isSpam = () => { - const count = (ViolationCount3.get(data.sender) ?? 0) + 1; - ViolationCount3.set(data.sender, count); - if (config.permMutePlayer && count >= config.violationCount) - new Mute(data.sender, null, "Spamming"); - }; - if (config.repeatedMessages && previousMessage.get(data.sender) == data.message) { - data.cancel = true; - isSpam(); - return data.sender.tell(`\xA7cRepeated message detected!`); - } - if (config.zalgo && /%CC%/g.test(encodeURIComponent(data.message))) { - data.cancel = true; - isSpam(); - return data.sender.tell( - `\xA7cYou message contains some type of zalgo and cannot be sent!` - ); - } - previousMessage.set(data.sender, data.message); - } catch (error) { - console.warn(error + error.stack); - } -}); -protection4.enable(); - -// src/plugins/Anti-Cheat/modules/protections/unobtainable.ts -var ViolationCount4 = new PlayerLog(); -function flag(player, index) { - const inventory = player.getComponent("inventory").container; - const item = inventory.getItem(index); - const data = getConfigId("cbe_config"); - if (data.clearItem) - inventory.setItem(index, AIR); - new Log({ - playerName: player.name, - message: `${player.name} Has obtained a unobtainable item: ${item.typeId}`, - protection: "unobtainable" - }); - if (!data.banPlayer) - return; - const violations2 = (ViolationCount4.get(player) ?? 0) + 1; - ViolationCount4.set(player, violations2); - if (violations2 < data.violationCount) - return; - new Ban(player, null, "Possession of Unobtainable item"); -} -new Protection( - "unobtainable", - "Blocks unobtainable items", - "textures/blocks/end_portal.png" -).forEachValidPlayer((player) => { - const BANNED_ITEMS2 = getConfigId("banned_items"); - const inventory = player.getComponent("inventory").container; - for (let i = 0; i < inventory.size; i++) { - const item = inventory.getItem(i); - if (!item) - continue; - if (BANNED_ITEMS2.includes(item.typeId)) - return flag(player, i); - if (FORBIDDEN_ITEMS.includes(item.typeId)) { - new Log({ - playerName: player.name, - message: `${player.name} Has obtained a Forbidden item: ${item.typeId}`, - protection: "unobtainable" - }); - return inventory.setItem(i, AIR); - } - let enchantments = []; - for (const enchantment of item.getComponent("enchantments").enchantments) { - const MAX_LEVEL = getMaxEnchantmentLevel(enchantment); - if (enchantment.level > MAX_LEVEL) - return flag(player, i); - if (enchantment.level < 1) - return flag(player, i); - if (enchantments.includes(enchantment.type.id)) - return flag(player, i); - enchantments.push(enchantment.type.id); - } - } -}).enable(); - -// src/plugins/Anti-Cheat/modules/protections/nbt.ts -import { - MinecraftBlockTypes as MinecraftBlockTypes5, - MinecraftEntityTypes, - MinecraftItemTypes as MinecraftItemTypes5, - Player as Player14 -} from "@minecraft/server"; -var BLOCKS = [ - MinecraftBlockTypes5.chest.id, - MinecraftBlockTypes5.trappedChest.id, - MinecraftBlockTypes5.barrel.id, - MinecraftBlockTypes5.dispenser.id, - MinecraftBlockTypes5.dropper.id, - MinecraftBlockTypes5.furnace.id, - MinecraftBlockTypes5.litFurnace.id, - MinecraftBlockTypes5.blastFurnace.id, - MinecraftBlockTypes5.litBlastFurnace.id, - MinecraftBlockTypes5.smoker.id, - MinecraftBlockTypes5.litSmoker.id, - MinecraftBlockTypes5.hopper.id, - MinecraftBlockTypes5.beehive.id, - MinecraftBlockTypes5.beeNest.id, - MinecraftBlockTypes5.mobSpawner.id -]; -var CHEST_BOATS = [ - MinecraftItemTypes5.chestBoat.id, - MinecraftItemTypes5.oakChestBoat.id, - MinecraftItemTypes5.birchChestBoat.id, - MinecraftItemTypes5.acaciaChestBoat.id, - MinecraftItemTypes5.jungleChestBoat.id, - MinecraftItemTypes5.spruceChestBoat.id, - MinecraftItemTypes5.darkOakChestBoat.id, - MinecraftItemTypes5.mangroveChestBoat.id -]; -new Protection( - "nbt", - "Blocks illegal nbt on items", - "textures/ui/icon_random.png" -).subscribe("blockPlace", async ({ block }) => { - if (!BLOCKS.includes(block.typeId)) - return; - const permutation = block.permutation; - await block.dimension.runCommandAsync( - `setblock ${block.x} ${block.y} ${block.z} ${block.typeId}` - ); - block.setPermutation(permutation); -}).subscribe("beforeItemUseOn", (data) => { - if (!(data.source instanceof Player14)) - return; - if (!CHEST_BOATS.includes(data.item.typeId)) - return; - data.cancel = true; - data.source.dimension.spawnEntity( - MinecraftEntityTypes.chestBoat.id, - data.blockLocation.above() - ); - if (getGamemode(data.source) == "creative") - return; - data.source.getComponent("inventory").container.setItem(data.source.selectedSlot, AIR); -}).enable(); - -// src/plugins/Anti-Cheat/modules/protections/movement.ts -import { - MinecraftEffectTypes, - MinecraftItemTypes as MinecraftItemTypes6, - Player as Player16 -} from "@minecraft/server"; - -// src/lib/Events/onPlayerMove.ts -import { world as world19 } from "@minecraft/server"; -var CALLBACKS5 = {}; -function vector3Equals(from, to) { - if (from.x != to.x) - return false; - if (from.y != to.y) - return false; - if (from.z != to.z) - return false; - return true; -} -var playerLocation = new PlayerLog(); -world19.events.tick.subscribe((data) => { - const sendCallback2 = (player, data2) => { - for (const callback of Object.values(CALLBACKS5)) { - callback.callback(player, data2); - } - }; - for (const player of world19.getPlayers()) { - const oldLocation = playerLocation.get(player); - if (oldLocation) { - if (vector3Equals(player.location, oldLocation.location)) { - continue; - } - } - playerLocation.set(player, { - location: player.location, - dimension: player.dimension, - tickSet: data.currentTick - }); - if (!oldLocation) - continue; - sendCallback2(player, oldLocation); - } -}); -var onPlayerMove = class { - static subscribe(callback) { - const key = Date.now(); - CALLBACKS5[key] = { callback }; - return key; - } - static unsubscribe(key) { - delete CALLBACKS5[key]; - } - static delete(player) { - playerLocation.delete(player); - } -}; - -// src/plugins/Anti-Cheat/config/movement.ts -var MOVEMENT_DISTANCE_THRESHOLD = 0.8; -var MOVEMENT_CONSTANTS = { - walk: { - velocity: 0.17, - distance: 0.23 - }, - run: { - velocity: 0.19, - distance: 0.35 - } -}; -var SPEED_EFFECT_INCREASE = 0.056; -var ANTI_TP_DISTANCE_THRESHOLD = 10; -var TAGS = ["gliding", "riding"]; - -// src/plugins/Anti-Cheat/modules/protections/movement.ts -var violations = new PlayerLog(); -function distanceBetween(loc1, loc2) { - return Math.hypot(loc2.x - loc1.x, loc2.z - loc1.z); -} -function getSpeedOffset(player) { - const speed = player.getEffect(MinecraftEffectTypes.speed)?.amplifier ?? 0; - return speed * SPEED_EFFECT_INCREASE; -} -function isDistanceFlag(distance, player) { - const speedIntensity = getSpeedOffset(player); - const offset = MOVEMENT_CONSTANTS.run.distance + MOVEMENT_DISTANCE_THRESHOLD; - return distance > speedIntensity + offset; -} -function flag2(player, old) { - const violationCount = (violations.get(player) ?? 0) + 1; - violations.set(player, violationCount); - onPlayerMove.delete(player); - if (violationCount < 3) - return; - player.teleport( - old.location, - old.dimension, - player.rotation.x, - player.rotation.y - ); -} -var onPlayerMoveSubKey = null; -var protection5 = new Protection( - "movement", - "Blocks illegal movements on players", - "textures/ui/move.png" -).setConfigDefault({ - tpCheck: { - description: "If teleports should be flagged", - defaultValue: true - } -}); -protection5.onEnable(async () => { - console.warn(`enabled movement protection`); - const config = await protection5.getConfigSync(); - onPlayerMoveSubKey = onPlayerMove.subscribe((player, old) => { - if (getRole(player) == "admin") - return; - if (player.dimension.id != old.dimension.id) - return; - if (player.getTags().some((tag) => TAGS.includes(tag))) - return; - const distance = distanceBetween(player.location, old.location); - if (player.hasTag(`skip-movement-check`)) - return player.removeTag(`skip-movement-check`); - if (distance > ANTI_TP_DISTANCE_THRESHOLD) { - if (!config.tpCheck) - return; - flag2(player, old); - } else { - if (!isDistanceFlag(distance, player)) - return; - flag2(player, old); - } - }); -}).onDisable(() => { - console.warn(`disabled movement protection`); - onPlayerMove.unsubscribe(onPlayerMoveSubKey); -}); -protection5.subscribe("dataDrivenEntityTriggerEvent", (data) => { - if (!(data.entity instanceof Player16)) - return; - if (data.id != "on_death") - return; - onPlayerMove.delete(data.entity); -}); -protection5.subscribe("projectileHit", ({ projectile, source }) => { - if (projectile.typeId != MinecraftItemTypes6.enderPearl.id) - return; - if (!(source instanceof Player16)) - return; - onPlayerMove.delete(source); -}); -protection5.subscribe("itemCompleteCharge", ({ itemStack, source }) => { - if (itemStack.typeId != MinecraftItemTypes6.chorusFruit.id) - return; - if (!(source instanceof Player16)) - return; - onPlayerMove.delete(source); -}); - -// src/plugins/Anti-Cheat/modules/events/beforeDataDrivenEntityTriggerEvent.ts -import { MinecraftEffectTypes as MinecraftEffectTypes2, Player as Player17, world as world20 } from "@minecraft/server"; -var e = world20.events.beforeDataDrivenEntityTriggerEvent.subscribe((data) => { - if (!(data.entity instanceof Player17)) - return; - if (data.id != "rubedo:becomeAdmin") - return; - data.entity.removeTag("CHECK_PACK"); - const serverOwnerName = getServerOwnerName(); - if (serverOwnerName) { - data.entity.playSound("note.bass"); - data.entity.tell( - `\xA7cFailed to give server owner: "${serverOwnerName}" is already owner!` - ); - return world20.events.beforeDataDrivenEntityTriggerEvent.unsubscribe(e); - } - setRole(data.entity, "admin"); - setServerOwner(data.entity); - data.entity.addEffect(MinecraftEffectTypes2.blindness, 3, 255, true); - data.entity.tell( - `\xA7aYou have now been set as the "owner" of this server. The command "/function start" will not do anything anymore, type "-help" for more information!` - ); -}); - -// src/plugins/Anti-Cheat/modules/events/beforeWatchdogTerminate.ts -import { system as system10 } from "@minecraft/server"; -system10.events.beforeWatchdogTerminate.subscribe((data) => { - data.cancel = true; - console.warn(`WATCHDOG TRIED TO CRASH = ${data.terminateReason}`); -}); - -// src/plugins/Anti-Cheat/modules/events/worldInitialize.ts -import { - DynamicPropertiesDefinition, - EntityTypes, - MinecraftEntityTypes as MinecraftEntityTypes2, - world as world21 -} from "@minecraft/server"; - -// src/config/objectives.ts -var OBJECTIVES = []; - -// src/plugins/Anti-Cheat/modules/events/worldInitialize.ts -world21.events.worldInitialize.subscribe(({ propertyRegistry }) => { - DIMENSIONS.overworld.runCommandAsync( - `tickingarea add ${ENTITY_LOCATION.x} ${ENTITY_LOCATION.y} ${ENTITY_LOCATION.z} ${ENTITY_LOCATION.x} ${ENTITY_LOCATION.y} ${ENTITY_LOCATION.z} db true` - ); - let def = new DynamicPropertiesDefinition(); - def.defineString("tableName", 30); - def.defineNumber("index"); - propertyRegistry.registerEntityTypeDynamicProperties( - def, - EntityTypes.get(ENTITY_IDENTIFIER) - ); - let def2 = new DynamicPropertiesDefinition(); - def2.defineString("role", 30); - propertyRegistry.registerEntityTypeDynamicProperties( - def2, - MinecraftEntityTypes2.player - ); - let def3 = new DynamicPropertiesDefinition(); - def3.defineString("worldsOwner", 100); - def3.defineBoolean("isLockDown"); - propertyRegistry.registerWorldDynamicProperties(def3); - for (const obj of OBJECTIVES) { - world21.scoreboard.addObjective(obj.objective, obj.displayName ?? ""); - } -}); - -// src/plugins/Anti-Cheat/index.ts -var NPC_LOCATIONS = []; -function clearNpcLocations() { - NPC_LOCATIONS = []; -} - -// src/plugins/import.ts -console.warn(`----- Importing Plugins -----`); - -// src/index.ts -console.warn(`---- STARTING RUBEDO ----`); -var AIR = new ItemStack5(MinecraftItemTypes7.stick, 0); -var WORLD_IS_LOADED = false; -function setWorldIsLoaded() { - WORLD_IS_LOADED = true; -} -export { - AIR, - WORLD_IS_LOADED, - setWorldIsLoaded -}; +import{ItemStack as vr,MinecraftItemTypes as Er}from"@minecraft/server";import{world as uo}from"@minecraft/server";var S="-";import{world as lo}from"@minecraft/server";import{ItemStack as so,MinecraftItemTypes as ao,system as co}from"@minecraft/server";import{BlockLocation as ro}from"@minecraft/server";var Rt=32e3,ie="rubedo:database",N=new ro(0,-64,0),Dt=128;import{BlockLocation as Ke,MinecraftDimensionTypes as J,system as Z,world as Q}from"@minecraft/server";import{MessageFormData as io}from"@minecraft/server-ui";var X=class{constructor(e,n){this.title=e,this.body=n,this.form=new io,e&&this.form.title(e),n&&this.form.body(n),this.triedToShow=0}setButton1(e,n){return this.button1={text:e,callback:n},this.form.button1(e),this}setButton2(e,n){return this.button2={text:e,callback:n},this.form.button2(e),this}show(e){this.form.show(e).then(n=>{if(n.canceled){if(n.cancelationReason=="userBusy"){if(this.triedToShow>200)return e.tell("\xA7cForm Timeout: tried to show form, but you were busy (close chat after running command)");this.triedToShow++,this.show(e)}return}n.selection==1&&this.button1?.callback?.(),n.selection==0&&this.button2?.callback?.()})}};var h={overworld:Q.getDimension(J.overworld),nether:Q.getDimension(J.nether),theEnd:Q.getDimension(J.theEnd),"minecraft:overworld":Q.getDimension(J.overworld),"minecraft:nether":Q.getDimension(J.nether),"minecraft:the_end":Q.getDimension(J.theEnd)};function ae(t){let e=t.split(",");console.warn(e.length);let n=0;for(let o of e){let r=parseInt(o.match(/\D+|\d+/g)[0]),i=o.match(/\D+|\d+/g)[1];i=="y"&&(n=n+317098e-16*r),i=="w"&&(n=n+6048e5*r),i=="d"&&(n=n+864e5*r),i=="h"&&(n=n+36e5*r),i=="m"&&(n=n+6e4*r),i=="s"&&(n=n+1e3*r),i=="ms"&&(n=n+r)}return n}function ee(t){return new Date(t).toString()}function Lt(t){return new Ke(Math.floor(t.x),Math.floor(t.y),Math.floor(t.z))}function G(t,e,n,o=()=>{}){new X("Confirm To Continue",e).setButton1("Confirm",n).setButton2("Never Mind",o).show(t)}function _t(t){return new Promise(e=>{let n=Z.runSchedule(()=>{e(),Z.clearRunSchedule(n)},t)})}function Mt(t,e){let n=[t.x,t.y,t.z],o=[t.x,t.y,t.z];return(t instanceof Ke||e instanceof Ke)&&(n=n.map(r=>Math.trunc(r)),o=o.map(r=>Math.trunc(r))),!n.find((r,i)=>o[i]!=r)}async function ce(){if(!Te)return new Promise(t=>{let e=Z.runSchedule(async()=>{try{await h.overworld.runCommandAsync("testfor @a"),Z.clearRunSchedule(e),Ue(),t()}catch{}},1)})}function Ot(t){if(Te)return t();let e=Z.runSchedule(async()=>{try{await h.overworld.runCommandAsync("testfor @a"),Z.clearRunSchedule(e),Ue(),t()}catch{}},1)}function $t(t,e){return t.match(new RegExp(".{1,"+e+"}","g"))}var b=class{constructor(e){this.tableName=e;this.tableName=e,this.MEMORY=null,this.QUEUE=[],co.runSchedule(()=>{this.QUEUE.length!=0&&this.QUEUE.shift()()},1),Ot(async()=>{this.MEMORY=await this.getData()})}static createTableEntity(e,n){let o=h.overworld.spawnEntity(ie,N);return o.setDynamicProperty("tableName",e),o.nameTag=`\xA7aDatabase Table: ${e}\xA7r`,n&&o.setDynamicProperty("index",n),o}static getTableEntities(e){return h.overworld.getEntitiesAtBlockLocation(N).filter(n=>n.typeId==ie&&n.getDynamicProperty("tableName")==e)}async addQueueTask(){return new Promise(e=>{this.QUEUE.push(()=>{e()})})}async saveData(e){await this.addQueueTask(),await ce(),this.MEMORY=e;let n=b.getTableEntities(this.tableName),o=$t(JSON.stringify(e),Rt),r=Math.ceil(o.length/Dt)-n.length;if(r>0)for(let i=0;ic.size-1)break;let g=new so(ao.acaciaBoat);g.nameTag=f,c.setItem(l,g),o[l]=null}for(let l=o.length+1;ll))break}n.filter(i=>i).forEach(i=>i.triggerEvent("despawn"))}async getData(){if(await ce(),this.MEMORY)return this.MEMORY;let e=b.getTableEntities(this.tableName).sort((o,r)=>o.getDynamicProperty("index")-r.getDynamicProperty("index")),n="";for(let o of e){let r=o.getComponent("inventory").container;for(let i=0;ie.name===t)}var O=class{constructor(e="literal"){this.name=e;this.typeName="literal";this.name=e}matches(e){return{success:this.name==e}}fail(e){return`${e} should be ${this.name}!`}},le=class{constructor(e="string"){this.name=e;this.typeName="string";this.name=e}matches(e){return{success:e&&e!="",value:e}}fail(e){return"Value must be of type string!"}},me=class{constructor(e="integer"){this.name=e;this.typeName="int";this.name=e}matches(e){return{success:!isNaN(e),value:parseInt(e)}}fail(e){return"Value must be valid number!"}},Ye=class{constructor(e="float"){this.name=e;this.typeName="float";this.name=e}matches(e){return{success:Boolean(e?.match(/^\d+\.\d+$/)?.[0]),value:parseInt(e)}}fail(e){return"Value must be valid float!"}},H=class{constructor(e="location"){this.name=e;this.typeName="location";this.name=e}matches(e){return{success:/^([~^]{0,1}(-\d)?(\d*)?(\.(\d+))?)$/.test(e),value:e}}fail(e){return"Value needs to be a valid number, value can include: [~,^]"}},ue=class{constructor(e="boolean"){this.name=e;this.typeName="boolean";this.name=e}matches(e){return{success:Boolean(e?.match(/^(true|false)$/)?.[0]),value:e=="true"}}fail(e){return`"${e}" can be either "true" or "false"`}},We=class{constructor(e="player"){this.name=e;this.typeName="Player";this.name=e}matches(e){return{success:!!Ft(e),value:Ft(e)}}fail(e){return`player: "${e}", is not in this world`}},qe=class{constructor(e="target"){this.name=e;this.typeName="Target";this.name=e}matches(e){return{success:Boolean(e?.match(/^(@.|"[\s\S]+")$/)?.[0]),value:e}}fail(e){return`${e} is not a valid target`}},de=class{constructor(e="array",n){this.name=e;this.types=n;this.typeName="string";this.name=e,this.types=n,this.typeName=n.join(" | ").replace(/(.{25})..+/,"$1...")}matches(e){return{success:this.types.includes(e),value:e}}fail(e){return`"${e}" must be one of these values: ${this.types.join(" | ")}`}},Xe=class{constructor(e){this.name=e;this.typeName="Duration"}matches(e){return{success:/^(\d+[hdysmw],?)+$/.test(e),value:e}}fail(e){return`"${e}" must be a value like "10d" or "3s" the first part is the length second is unit`}},Je=class{constructor(e="playerName"){this.name=e;this.typeName="playerName";this.name=e}matches(e){return{success:!!s.ids.get(e),value:e}}fail(e){return`player: "${e}" has never played this world before! Tip: if the name has spaces in it use quotes around name!`}},p={string:le,int:me,float:Ye,location:H,boolean:ue,player:We,target:qe,array:de,duration:Xe,playerName:Je};var Pe=class{constructor(e){this.data=e,this.sender=e.sender}reply(e){this.sender.tell(e)}};function zt(t,e){try{return t.slice(e.length).trim().match(/"[^"]+"|[^\s]+/g).map(n=>n.replace(/"(.+)"/,"$1").toString())}catch{return[]}}function Vt(t,e){t.tell({rawtext:[{text:"\xA7c"},{translate:"commands.generic.unknown",with:[`${e}`]}]})}function Qe(t,e){t.tell({rawtext:[{text:e.data.invalidPermission?e.data.invalidPermission:`\xA7cYou do not have permission to use "${e.data.name}"`}]})}function jt(t,e,n,o,r){if(t.tell({rawtext:[{text:"\xA7c"},{translate:"commands.generic.syntax",with:[`${S}${e.data.name} ${o.slice(0,r).join(" ")}`,o[r]??" ",o.slice(r+1).join(" ")]}]}),n.children.length>1||!o[r]){let i=n.children.map(a=>a.type instanceof O?a.type.name:a.type?.typeName);t.tell(`\xA7c"${o[r]??"undefined"}" is not valid! Argument "${[...new Set(n.children.map(a=>a.type.name))][0]}" can be typeof: "${i.join('", "')}"`)}else t.tell(`\xA7c${n.children[0]?.type?.fail(o[r])}`)}function mo([t,e,n],{location:o,viewVector:r}){if(!t||!e||!t)return null;let i=[o.x,o.y,o.z],a=[r.x,r.y,r.z],c=[t,e,n].map(f=>{let g=parseFloat(f);return isNaN(g)?0:g}),l=[t,e,n].map((f,g)=>f.includes("~")?c[g]+i[g]:f.includes("^")?c[g]+a[g]:c[g]);return{x:l[0],y:l[1],z:l[2]}}function Gt(t,e,n,o){let r=e[e.length-1]??o,i=[];for(let[a,c]of e.entries())if(!c.type.name.endsWith("*")){if(c.type instanceof H){i.push(mo([t[a],t[a+1],t[a+2]],n.sender));continue}c.type instanceof O||i.push(c.type.matches(t[a]).value??t[a])}r.callback(new Pe(n),...i)}var K=[];uo.events.beforeChat.subscribe(t=>{if(!t.message.startsWith(S))return;t.cancel=!0;let e=zt(t.message,S),n=K.find(c=>c.depth==0&&(c.data.name==e[0]||c.data?.aliases?.includes(e[0]))),o={message:t.message,sendToTargets:t.sendToTargets,sender:t.sender,targets:t.targets};if(!n)return Vt(t.sender,e[0]);if(!n.data?.requires(t.sender))return Qe(o.sender,n);e.shift();let r=[],i=(c,l)=>{if(c.children.length>0){let f=c.children.find(g=>g.type.matches(e[l]).success);return!f&&!e[l]&&c.callback?void 0:f?f.data?.requires(o.sender)?(r.push(f),i(f,l+1)):(Qe(o.sender,f),"fail"):(jt(o.sender,n,c,e,l),"fail")}};i(n,0)!="fail"&&Gt(e,r,o,n)});import{Player as vo,system as gn,world as yn}from"@minecraft/server";var Ht="rubedo:gui",fe="rubedo:inventory";import{world as D,Player as nn,BlockLocation as en,MinecraftBlockTypes as po,GameMode as go,system as nt}from"@minecraft/server";import{BlockLocation as Wt,MinecraftBlockTypes as fo}from"@minecraft/server";var Kt={doorsAndSwitches:!0,openContainers:!0,pvp:!1,allowedEntities:["minecraft:player","minecraft:npc","minecraft:item","rubedo:inventory","rubedo:database"]},Ut=["minecraft:acacia_door","minecraft:acacia_trapdoor","minecraft:acacia_button","minecraft:birch_door","minecraft:birch_trapdoor","minecraft:birch_button","minecraft:crimson_door","minecraft:crimson_trapdoor","minecraft:crimson_button","minecraft:dark_oak_door","minecraft:dark_oak_trapdoor","minecraft:dark_oak_button","minecraft:jungle_door","minecraft:jungle_trapdoor","minecraft:jungle_button","minecraft:mangrove_door","minecraft:mangrove_trapdoor","minecraft:mangrove_button","minecraft:spruce_door","minecraft:spruce_trapdoor","minecraft:spruce_button","minecraft:warped_door","minecraft:warped_trapdoor","minecraft:warped_button","minecraft:wooden_door","minecraft:wooden_button","minecraft:trapdoor","minecraft:iron_door","minecraft:iron_trapdoor","minecraft:polished_blackstone_button","minecraft:lever"],Yt=["minecraft:chest","minecraft:ender_chest","minecraft:barrel","minecraft:trapped_chest","minecraft:dispenser","minecraft:dropper","minecraft:furnace","minecraft:blast_furnace","minecraft:lit_furnace","minecraft:lit_blast_furnace","minecraft:hopper","minecraft:shulker_box","minecraft:undyed_shulker_box","minecraft:lit_smoker","minecraft:smoker"];var U=[],Ae=!1,Ze=-64,et=320;function tt(t,e,n){return n.every((o,r)=>o>=Math.min(t[r],e[r])&&o<=Math.max(t[r],e[r]))}var y=class{static async getAllRegionsSync(){if(Ae)return U;let e=(await s.regions.valuesSync()).map(n=>new y(n.from,n.to,n.dimensionId,n.permissions,n.key));return e.forEach(n=>{U.push(n)}),Ae=!0,e}static getAllRegions(){if(Ae)return U;let e=s.regions.values().map(n=>new y(n.from,n.to,n.dimensionId,n.permissions,n.key));return e.forEach(n=>{U.push(n)}),Ae=!0,e}static blockLocationInRegion(e,n){return this.getAllRegions().find(o=>o.dimensionId==n&&tt([o.from.x,Ze,o.from.z],[o.to.x,et,o.to.z],[e.x,e.y,e.z]))}static async blockLocationInRegionSync(e,n){return(await this.getAllRegionsSync()).find(o=>o.dimensionId==n&&tt([o.from.x,Ze,o.from.z],[o.to.x,et,o.to.z],[e.x,e.y,e.z]))}static async removeRegionAtBlockLocation(e,n){let o=this.blockLocationInRegion(e,n);return o?await s.regions.delete(o.key):!1}constructor(e,n,o,r,i){this.from=e,this.to=n,this.dimensionId=o,this.permissions=r??Kt,this.key=i||Date.now().toString(),i||this.update().then(()=>{xe(),U.push(this)})}async update(){return await s.regions.set(this.key,{key:this.key,from:this.from,dimensionId:this.dimensionId,permissions:this.permissions,to:this.to})}async delete(){let e=s.regions.get(this.key),n=new Wt(e.from.x,e.dimensionId=="minecraft:overworld"?-64:0,e.from.z),o=new Wt(e.to.x,e.dimensionId=="minecraft:overworld"?-64:0,e.to.z);for(let r of n.blocksBetween(o))h[e.dimensionId].getBlock(r)?.setType(fo.bedrock);return U=U.filter(r=>r.key!=this.key),s.regions.delete(this.key)}entityInRegion(e){return this.dimensionId==e.dimension.id&&tt([this.from.x,Ze,this.from.z],[this.to.x,et,this.to.z],[e.location.x,e.location.y,e.location.z])}changePermission(e,n){this.permissions[e]=n,this.update()}};var R=class{static getTasks(){return s.tasks.get("changePlayerRole")??[]}static getPlayersRoleToSet(e){return R.getTasks().find(o=>o.playerName==e)?.role}constructor(e,n){let o=R.getTasks();o.push({playerName:e,role:n}),s.tasks.set("changePlayerRole",o)}};import{MinecraftBlockTypes as pe,MinecraftItemTypes as d}from"@minecraft/server";var qt=[d.beehive.id,d.beeNest.id,d.axolotlBucket.id,d.codBucket.id,d.tadpoleBucket.id,d.tropicalFishBucket.id,d.salmonBucket.id,d.pufferfishBucket.id],Xt=[d.allow.id,d.barrier.id,d.borderBlock.id,d.debugStick?.id??"minecraft:debug_stick",d.deny.id,d.jigsaw.id,d.lightBlock.id,d.commandBlock.id,d.repeatingCommandBlock.id,d.chainCommandBlock.id,d.commandBlockMinecart.id,d.structureBlock.id,d.structureVoid.id,d.bedrock.id,d.endPortalFrame.id,"minecraft:info_update","minecraft:info_update2","minecraft:reserved3","minecraft:reserved4","minecraft:reserved6","minecraft:movingBlock","minecraft:moving_block","minecraft:movingblock","minecraft:piston_arm_collision","minecraft:piston_arm_collision","minecraft:pistonarmcollision","minecraft:stickyPistonArmCollision","minecraft:sticky_piston_arm_collision","minecraft:unknown","minecraft:glowingobsidian","minecraft:invisible_bedrock","minecraft:invisiblebedrock","minecraft:netherreactor","minecraft:portal","minecraft:fire","minecraft:water","minecraft:lava","minecraft:flowing_lava","minecraft:flowing_water","minecraft:soul_fire"],Jt=[pe.dispenser.id],Qt=[pe.bedrock.id,pe.barrier.id,"minecraft:invisiblebedrock","minecraft:movingBlock","minecraft:movingblock","minecraft:moving_block"],Ne=[pe.chest.id,pe.trappedChest.id],vi=[d.chest.id,d.trappedChest.id,d.barrel.id,d.dispenser.id,d.dropper.id,d.furnace.id,"minecraft:lit_furnace",d.blastFurnace.id,"minecraft:lit_blast_furnace",d.smoker.id,"minecraft:lit_smoker",d.hopper.id,d.shulkerBox.id,d.undyedShulkerBox.id],Y={x:7,y:7,z:7};var Be={aquaAffinity:1,baneOfArthropods:5,binding:1,blastProtection:4,channeling:1,depthStrider:3,efficiency:5,featherFalling:4,fireAspect:2,fireProtection:4,flame:1,fortune:3,frostWalker:2,impaling:5,infinity:1,knockback:2,looting:3,loyalty:4,luckOfTheSea:3,lure:3,mending:1,multishot:1,piercing:4,power:5,projectileProtection:4,protection:4,punch:2,quickCharge:3,respiration:3,riptide:3,sharpness:5,silkTouch:1,smite:5,soulSpeed:3,swiftSneak:4,thorns:3,unbreaking:3,vanishing:1};var Zt="2.6.3-beta";var Re="https://discord.gg/dMa3A5UYKX";function $(t,e=[],n){if(ge(t))return console.warn("[WARNING]: TRIED TO KICK OWNER"),t.tell("You have been tried to kick, but you cant!"),n?.();try{t.runCommandAsync(`kick @s \xA7r${e.join(` +`)}`),t.triggerEvent("kick")}catch(o){if(t.triggerEvent("kick"),!/"statusCode":-2147352576/.test(o))return;n&&n()}}function m(t){return t instanceof nn?s.roles.get(t.name)??"member":s.roles.get(t)??"member"}async function ot(t){return t instanceof nn?await s.roles.getSync(t.name)??"member":await s.roles.getSync(t)??"member"}function te(t,e){if(typeof t=="string"){s.roles.set(t,e);let n=[...D.getPlayers()].find(o=>o.name==t);n?n.setDynamicProperty("role",e):new R(t,e)}else s.roles.set(t.name,e),t.setDynamicProperty("role",e)}function ge(t){return D.getDynamicProperty("worldsOwner")==t.id}function rt(){let t=D.getDynamicProperty("worldsOwner");return!t||t==""?null:t}function on(){let t=rt();if(!t)return null;let e=s.ids.collection();return Object.keys(e).find(n=>e[n]===t)}function ye(t){if(!t)return D.setDynamicProperty("worldsOwner","");D.setDynamicProperty("worldsOwner",t.id.toString())}function De(){return D.getDynamicProperty("isLockDown")??!1}function it(t){D.setDynamicProperty("isLockDown",t)}function xe(){for(let t of y.getAllRegions()){let e=new en(t.from.x,t.dimensionId=="minecraft:overworld"?-64:0,t.from.z),n=new en(t.to.x,t.dimensionId=="minecraft:overworld"?-64:0,t.to.z);for(let o of e.blocksBetween(n))h[t.dimensionId].getBlock(o)?.setType(po.deny)}}var st=[],tn=0;function F(t,e=0){let n=tn;return st[n]={callback:t,delay:e,lastCall:0},tn=n+1,n}function rn(t){delete st[t]}nt.runSchedule(async()=>{let t=[...D.getPlayers()];for(let[e,n]of t.entries())if(!["moderator","admin"].includes(await ot(n)))for(let o of Object.values(st))o.delay!=0&&nt.currentTick-o.lastCall[...D.getPlayers({name:t.name,gameMode:e})].length)}import{world as dn}from"@minecraft/server";import{system as yo}from"@minecraft/server";var at={},cn={},z={};function ho(t,e,n){if(e.length!=n.length)return[];let o=[];for(let r=0;rn[r]?.item?.amount&&e[r]?.item?.amount!=0){let i={slot:r,uid:n[r].uid,oldUid:e[r].uid,item:n[r].item,oldItem:e[r].item,changeType:"fluctuation"};o.push(i),z[t.id]=i;continue}if(n[r].uid!=e[r].uid)if(e[r]?.item&&n[r]?.item){let i={slot:r,uid:n[r].uid,oldUid:e[r].uid,item:n[r].item,oldItem:e[r].item,changeType:"swap"};o.push(i),z[t.id]=i}else if(n[r]?.item){if(n[r]?.item)if(z[t.id]?.changeType=="delete"&&z[t.id]?.uid==n[r].uid){let i={slot:r,uid:n[r].uid,item:n[r].item,changeType:"move"};o.push(i),z[t.id]=i;continue}else{let i={slot:r,uid:n[r].uid,item:n[r].item,changeType:"put"};o.push(i),z[t.id]=i}}else{let i={slot:r,uid:e[r].uid,item:e[r].item,changeType:"delete"};o.push(i),z[t.id]=i}}return o}function bo(t){if(!t)return"";let e=[];return e.push(t.typeId),e.push(t.nameTag),e.push(t.data),e.push(t.getLore().join("")),e.join("")}function ko(t){let e=[];for(let n=0;n{for(let t of Object.values(at))for(let e of h.overworld.getEntities(t.entities)){let n=ko(e.getComponent("inventory").container),o=ho(e,cn[e.id]??n,n);if(cn[e.id]=n,o.length!=0){if(e.hasTag("skipCheck")){e.removeTag("skipCheck"),delete z[e.id];continue}for(let r of o)t.callback(e,r)}}},5);var he=class{static subscribe(e,n){let o=Date.now();return at[o]={callback:n,entities:e},o}static unsubscribe(e){delete at[e]}};import{Location as wo}from"@minecraft/server";import{world as Io}from"@minecraft/server";var k=class{constructor(){this.data=new Map,this.events={playerLeave:Io.events.playerLeave.subscribe(e=>this.data.delete(e.playerName))}}set(e,n){this.data.set(e.name,n)}get(e){return this.data.get(e.name)}delete(e){this.data.delete(e.name)}clear(){this.data.clear()}playerNames(){return[...this.data.keys()]}includes(e){return this.playerNames().includes(e.name)}};var A={},ne={},be=new k;function ln(t){return t.getComponent("minecraft:inventory").container.getItem(t.selectedSlot)}async function mn(t,e){try{let n=t.getComponent("minecraft:inventory").container,o=[];for(let r=0;ro.kill())}}function un(t,e){return t.getComponent("minecraft:inventory").container.getItem(e)}var Le=class{constructor(e,n,o){this.gui=e,this.slot=n,this.change=o}message(e){this.gui.player.tell(e)}getItemAdded(){return this.slot.item?null:this.gui.entity.getComponent("minecraft:inventory").container.getItem(this.change.slot)}GiveAction(e=this.slot.item.itemStack){this.gui.player.getComponent("minecraft:inventory").container.addItem(e)}TakeAction(e=null){this.gui.player.getComponent("minecraft:inventory").container.addItem(this.slot.item.itemStack),this.gui.page.slots[this.change.slot]=null,e&&e.delete(this.slot.item.components.dbKey)}PageAction(e,n){this.gui.setPage(e,n)}CloseAction(){this.gui.despawn()}SetAction(){this.gui.entity.getComponent("minecraft:inventory").container.setItem(this.change.slot,this.slot.item.itemStack)}async FormAction(e){return this.CloseAction(),await _t(5),await e.show(this.gui.player)}};var oe=class{static spawnEntity(e){try{return e.dimension.spawnEntity(fe,e.headLocation)}catch{return null}}constructor(e){this.player=e,this.entity=oe.spawnEntity(e),this.entity&&(this.hasChestOpen=!1,this.setPage("home")),this.tickEvent=dn.events.tick.subscribe(()=>{if(!this.entity)return this.despawn();if(be.get(this.player))this.hasChestOpen||(this.slotChangeEvent=he.subscribe({type:fe},(n,o)=>{n.id==this.entity.id&&this.onSlotChange(o)})),this.hasChestOpen=!0;else try{this.entity.teleport(this.player.headLocation,this.player.dimension,this.player.rotation.x,this.player.rotation.y,!0)}catch{this.despawn()}})}setPage(e,n){let o=this.entity.getComponent("inventory").container;for(let i=0;i{t.PageAction("moderation:see")}).setSlots([54],new v(pn.barrier,{nameTag:"\xA7cClose GUI"}),t=>{t.CloseAction()});gn.runSchedule(()=>{for(let t of yn.getPlayers()){if(ln(t)?.typeId!=Ht){A[t.name]&&A[t.name].despawn();continue}Object.keys(A).includes(t?.name)||m(t)=="admin"&&(A[t.name]=new oe(t))}},5);yn.events.beforeDataDrivenEntityTriggerEvent.subscribe(t=>{t.entity instanceof vo&&(t.id=="rubedo:has_container_open"?be.set(t.entity,!0):t.id=="rubedo:dosent_have_container_open"&&be.set(t.entity,!1))});gn.runSchedule(()=>{let t=Object.values(A).map(e=>e.entity.id);for(let e of h.overworld.getEntities({type:fe}))t.includes(e.id)||e.triggerEvent("despawn")},100);var _e={};var T={"api.name":()=>"Smelly API","api.error.unknown":()=>"An unknown error has occurred.","api.database.error.table_name":(t,e)=>`The display name ${t} is too long for an objective, it can be at most ${e} characters long`,"api.utilities.formatter.error.ms":t=>`${t} is not a string or a number`,"api.Providers.form.invalidType":(t,e)=>`Type ${t} is not a valid type to add a ${e}`,"modules.protections.cps.clickingToFast":()=>"You are clicking to fast! Please click slower!","modules.managers.mute.isMuted":()=>"\xA7cYou've been temporarily muted in chat.","modules.commands.ban.reply":(t,e,n="")=>`\xA7cBanned \xA7f"\xA7a${t}\xA7f" \xA7cfor ${e} Because: "${n??"No reason Provided"}" \xA7aSuccessfully`,"lockdown.kick.message":()=>["\xA7cYou have been kicked!","\xA7aReason: \xA7fServer is currently under LockDown","\xA7fServer will be up soon, Try to join later"],"commands.ban.list.player":(t,e,n)=>`- "${t}" Because: ${e}, Expiry ${n}`,"commands.freeze.list.player":(t,e)=>`- "${t}" Because: ${e}`,"commands.mutes.list.player":(t,e,n)=>`- "${t}" Because: ${e}, Expiry: ${n}`,"commands.lockdown.confirm":"Are you sure you want to lockdown the server, this will kick all active players and all players who try to join who are not admin"};var u=class{constructor(e,n,o=0,r){this.data=e;this.type=n;this.depth=o;this.parent=r;e.requires||(e.requires=i=>!0),this.data=e,this.type=n??new O(this.data.name),this.children=[],this.depth=o,this.parent=r,this.callback=null,K.push(this)}argument(e){let n=new u(this.data,e,this.depth+1,this);return this.children.push(n),n}string(e){return this.argument(new le(e))}int(e){return this.argument(new me(e))}array(e,n){return this.argument(new de(e,n))}boolean(e){return this.argument(new ue(e))}location(e){let n=this.argument(new H(e));return e.endsWith("*")?n:n.location(e+"_y*").location(e+"_z*")}literal(e){let n=new u(e,new O(e.name),this.depth+1,this);return this.children.push(n),n}executes(e){return this.callback=e,this}};import{Player as bn}from"@minecraft/server";function hn(t,e,n,o="No Reason",r="Rubedo Auto Mod"){let i={key:e,playerName:t instanceof bn?t.name:t,date:Date.now(),duration:n?ae(n):null,expire:n?ae(n)+Date.now():null,reason:o,by:r};s.bans.set(e,i)}var P=class{constructor(e,n,o="No Reason",r="Rubedo Auto Mod"){e instanceof bn?hn(e,e.id,n,o,r):hn(e,s.ids.get(e),n,o,r)}};function ct(t,e,n,o,r){if(s.bans.get(s.ids.get(e)))return t.reply(`\xA7c${e} is already banned`);t.reply("\xA7aClose chat to confirm"),G(t.sender,`Are you sure you want to ban ${e}, for ${n??"forever"}`,()=>{new P(e,n,o,t.sender.name),t.reply(T["modules.commands.ban.reply"](e,n,o))})}var lt=new u({name:"ban",description:"Manage bans",requires:t=>["admin","moderator"].includes(m(t))});lt.literal({name:"add",description:"Bans a player"}).argument(new p.playerName).executes((t,e)=>{ct(t,e,null,null,t.sender.name)}).argument(new p.duration("duration")).executes((t,e,n)=>{ct(t,e,n,null,t.sender.name)}).string("reason").executes((t,e,n,o)=>{ct(t,e,n,o,t.sender.name)});lt.literal({name:"remove",description:"un-bans a player"}).argument(new p.playerName("playerName")).executes((t,e)=>{let n=s.bans.values().find(o=>o.playerName==e);if(!n)return t.reply(`${e} is not banned`);s.bans.delete(n.key)?t.reply(`\xA7a${e}\xA7r has been Unbanned!`):t.reply(`\xA7cFailed to un-ban ${e}`)});lt.literal({name:"list",description:"Lists all bans"}).executes(t=>{let e=s.bans.values();if(e.length==0)return t.sender.tell("\xA7cNo one is banned!");t.sender.tell(`\xA72--- Showing Bans (${e.length}) ---`);for(let n of e)t.sender.tell(T["commands.ban.list.player"](n.playerName,n.reason,n.expire?ee(n.duration):"Forever"))});var ke=new u({name:"database",description:"Interacts with SA Database",aliases:["db"],requires:t=>m(t)=="admin"});ke.literal({name:"get"}).string("table").string("key").executes((t,e,n)=>{try{let o=s[e].get(n);o?t.reply(JSON.stringify(o)):t.reply(`No data could be found for key ${n}`)}catch(o){t.reply(o+o.stack)}});ke.literal({name:"set"}).string("table").string("key").string("value").executes((t,e,n,o)=>{try{s[e].set(n,o),t.reply(`Set Key: "${n}", to value: "${o}" on table: "${e}"`)}catch(r){t.reply(r+r.stack)}});ke.literal({name:"clear"}).string("table").executes((t,e)=>{try{s[e].clear(),t.reply(`Cleared Table ${e}`)}catch(n){t.reply(n+n.stack)}});ke.literal({name:"keys",description:"Returns all keys on a database"}).string("table").executes((t,e)=>{try{let n=s[e].keys();t.reply(`Keys on database: ${e}: ${n}`)}catch(n){t.reply(n+n.stack)}});ke.literal({name:"values",description:"Returns all values on a database"}).string("table").executes((t,e)=>{try{let n=s[e].values();t.reply(`Values on database: ${e}: ${JSON.stringify(n,null,2)}`)}catch(n){n instanceof TypeError?t.reply(`No values on database ${e}`):t.reply(n+n.stack)}});new u({name:"ecwipe",description:"Clears a players ender chest",requires:t=>m(t)=="admin"}).argument(new p.player("player")).executes((t,e)=>{for(let n=0;n<27;n++)e.runCommandAsync(`replaceitem entity @s slot.enderchest ${n} air`);t.reply(`\xA7aCleared "${e.name}"'s Ender chest!`)});var Me=class{constructor(e,n="No Reason"){let o={playerName:e.name,key:e.id,reason:n,location:{x:e.location.x,y:e.location.y,z:e.location.z,dimension:e.dimension.id}};s.freezes.set(e.id,o)}};var mt=new u({name:"freeze",description:"Manage Freezes",requires:t=>["admin","moderator"].includes(m(t))});mt.literal({name:"add",description:"Freezes a player"}).argument(new p.player("player")).string("reason").executes((t,e,n)=>{new Me(e,n),t.reply(`\xA7cFroze \xA7f"\xA7a${e.name}\xA7f" Because: "${n}" \xA7aSuccessfully`),t.sender.tell(`\xA7cYou have been frozen by \xA7f"\xA7a${t.sender.name}\xA7f" Because: "${n}"`)});mt.literal({name:"remove",description:"unfreezes a player"}).argument(new p.playerName("playerName")).executes((t,e)=>{let n=s.freezes.values().find(o=>o.playerName==e);if(!n)return t.reply(`${e} is not frozen`);s.freezes.delete(n.key),t.reply(`\xA7a${e}\xA7r has been UnFrozen!`)});mt.literal({name:"list",description:"Lists all freezes"}).executes(t=>{let e=s.freezes.values();if(e.length==0)return t.sender.tell("\xA7cNo one is frozen!");t.sender.tell(`\xA72--- Showing Freezes (${e.length}) ---`);for(let n of e)t.sender.tell(T["commands.freeze.list.player"](n.playerName,n.reason))});var ut=class{constructor(e){this.name=e;this.typeName="CommandName"}matches(e){return{success:Boolean(K.find(n=>n.depth==0&&n.data.name==e)),value:e}}fail(e){return`"${e}" is not a valid command`}};function Eo(t,e,n){n.tell(`${S}${t.data.name} ${e.map(o=>o.type.typeName=="literal"?o.data.name:`<${o.type.name}: ${o.type.typeName}>`).join(" ")}`)}function Oe(t,e,n,o){if(!!e.data?.requires(o)&&(e.callback&&Eo(t,e.depth==0?n:n.concat(e),o),e.children.length>0))for(let r of e.children)Oe(t,r,e.depth==0?n:n.concat(e),o)}function kn(t,e,n){t.tell(`\xA72--- Showing help page ${e} of ${n} (${S}help ) ---`)}function dt(t){return K.filter(e=>e.depth==0&&e.data?.requires(t))}function In(t){let e=dt(t);return e.length==0?0:Math.ceil(e.length/5)}var wn=new u({name:"help",description:"Provides help/list of commands.",aliases:["?","h"]}).executes(t=>{let e=In(t.sender),n=dt(t.sender).slice(1*5-5,1*5);kn(t.sender,1,e);for(let o of n)Oe(o,o,[],t.sender)});wn.int("page").executes((t,e)=>{let n=In(t.sender);e>n&&(e=n);let o=dt(t.sender).slice(e*5-5,e*5);kn(t.sender,e,n);for(let r of o)Oe(r,r,[],t.sender)});wn.argument(new ut("command")).executes((t,e)=>{let n=K.filter(o=>o.depth==0&&o.data.name==e)[0];t.sender.tell(`\xA7e${n.data.name}: ${n.data.aliases?`aliases (${n.data.aliases.join(", ")})`:""}`),t.sender.tell(`\xA7e${n.data.description}`),t.sender.tell("Usage:"),Oe(n,n,[],t.sender)});import{world as Cn}from"@minecraft/server";new u({name:"lockdown",description:"Toggles the servers lockdown, meaning no one can join",requires:t=>m(t)=="admin"}).executes(t=>{De()?(it(!1),t.sender.tell("\xA7aUnlocked the server!")):(t.reply("\xA7aClose chat to confirm lockdown"),G(t.sender,T["commands.lockdown.confirm"],()=>{it(!0);for(let e of Cn.getPlayers())m(e)!="admin"&&$(e,T["lockdown.kick.message"]());Cn.say("\xA7l\xA7cServer is now LOCKED!")}))});var B=class{static getMuteData(e){return s.mutes.get(e.name)}constructor(e,n,o="No Reason",r="Rubedo Auto Mod"){let i=n?ae(n):null,a={playerName:e.name,date:Date.now(),duration:i,expire:i?i+Date.now():null,reason:o,by:r};s.mutes.set(e.name,a)}};var ft=new u({name:"mute",description:"Manage Mutes",requires:t=>["admin","moderator"].includes(m(t))});ft.literal({name:"add",description:"Mutes a player"}).argument(new p.player("player")).argument(new p.duration("duration")).string("reason").executes((t,e,n,o)=>{new B(e,n,o,t.sender.name),t.reply(`\xA7cMuted \xA7f"\xA7a${e.name}\xA7f" \xA7cfor ${n} Because: "${o}" \xA7aSuccessfully`),e.tell(`\xA7cYou have been muted by \xA7f"${t.sender.name}" \xA7cfor ${n} Because: "${o}"`)});ft.literal({name:"remove",description:"un-mutes a player"}).argument(new p.playerName("playerName")).executes((t,e)=>{let n=s.mutes.values().find(o=>o.playerName==e);if(!n)return t.reply(`${e} is not muted!`);s.mutes.delete(n.playerName);try{t.sender.runCommandAsync(`ability "${e}" mute false`)}catch{}t.reply(`\xA7a${e}\xA7r has been UnMuted!`)});ft.literal({name:"list",description:"Lists all freezes"}).executes(t=>{let e=s.mutes.values();if(e.length==0)return t.sender.tell("\xA7cNo one is muted!");t.sender.tell(`\xA72--- Showing Mutes (${e.length}) ---`);for(let n of e)t.sender.tell(T["commands.mutes.list.player"](n.playerName,n.reason,n.expire?ee(n.expire):"Forever"))});import{Location as So}from"@minecraft/server";var re=class{static isValid(e){return e.typeId!="minecraft:npc"?!1:$e.find(n=>Mt(n,e.location))?!0:!!s.npcs.keys().find(n=>e.id==n)}constructor(e,n){$e.push(e);let o=n.spawnEntity("minecraft:npc",e),r={dimension:o.dimension.id,x:o.location.x,y:o.location.y,z:o.location.z};s.npcs.set(o.id,r),vn()}};new u({name:"npc",description:"Spawns a npc at your coordinates",requires:t=>m(t)=="admin"}).executes(t=>{let{x:e,y:n,z:o}=t.sender.location;new re(new So(e,n,o),t.sender.dimension),t.reply("Spawned a verified npc at your current location")});import{world as En}from"@minecraft/server";new u({name:"ping",description:"Returns the current Ticks Per Second of the servers ping"}).executes(t=>{let e=En.events.tick.subscribe(({deltaTime:n})=>{t.reply(`Pong! Current Ticks Per Second: ${1/n}`),En.events.tick.unsubscribe(e)})});import{BlockLocation as Ie}from"@minecraft/server";var we=new u({name:"region",description:"Create a Region",requires:t=>m(t)=="admin"});we.literal({name:"add",description:"Adds a new protection region"}).int("from_x").int("from_z").int("to_x").int("to_z").executes((t,e,n,o,r)=>{new y({x:e,z:n},{x:o,z:r},t.sender.dimension.id),t.reply(`Created Region From ${e} -64 ${n} ${o} 320 ${r}`)});we.literal({name:"remove",description:"Removes a region at the players current position"}).executes(t=>{let e=new Ie(t.sender.location.x,t.sender.location.y,t.sender.location.z);y.removeRegionAtBlockLocation(e,t.sender.dimension.id)?t.reply(`Removed Region at ${e.x} ${e.y} ${e.z}`):t.reply(`Failed to find/remove region at ${e.x} ${e.y} ${e.z}`)});we.literal({name:"removeAll",description:"Removes all regions"}).executes(t=>{y.getAllRegions().forEach(e=>e.delete()),t.reply("Removed All regions")});we.literal({name:"list",description:"Lists all regions and positions"}).executes(t=>{let e=y.getAllRegions();for(let n of e)t.reply(`Region from ${n.from.x}, ${n.from.z} to ${n.to.x}, ${n.to.z} in dimension ${n.dimensionId}`);if(e.length==0)return t.reply("No regions have been made yet")});var pt=we.literal({name:"permission",description:"Handles permissions for regions"});pt.literal({name:"set",description:"Sets a certain permission on the region the player is currently in to a value"}).array("key",["doorsAndSwitches","openContainers","pvp"]).boolean("value").executes((t,e,n)=>{let o=y.blockLocationInRegion(new Ie(t.sender.location.x,t.sender.location.y,t.sender.location.z),t.sender.dimension.id);if(!o)return t.reply("You are not in a region");o.changePermission(e,n),t.reply(`Changed permission ${e} to ${n}`)});pt.literal({name:"list",description:"Lists the permissions for the current region"}).executes(t=>{let e=y.blockLocationInRegion(new Ie(t.sender.location.x,t.sender.location.y,t.sender.location.z),t.sender.dimension.id);if(!e)return t.reply("You are not in a region");t.reply(`Current region permissions ${JSON.stringify(e.permissions)}`)});var Sn=pt.literal({name:"entities",description:"Holds the subCommands for adding or removing allowedEntities"});Sn.literal({name:"add",description:"Adds a entity to the allowed entities list"}).string("entity").executes((t,e)=>{let n=y.blockLocationInRegion(new Ie(t.sender.location.x,t.sender.location.y,t.sender.location.z),t.sender.dimension.id);if(!n)return t.reply("You are not in a region");let o=n.permissions.allowedEntities;o.push(e),n.changePermission("allowedEntities",o),t.reply(`Added entity ${e} to the allowed entities of the region your currently standing in`)});Sn.literal({name:"remove",description:"Removes a entity from the allowed entities in the region"}).string("entity").executes((t,e)=>{let n=y.blockLocationInRegion(new Ie(t.sender.location.x,t.sender.location.y,t.sender.location.z),t.sender.dimension.id);if(!n)return t.reply("You are not in a region");let o=n.permissions.allowedEntities;if(!o.includes(e))return t.reply(`The entity ${e} is not allowed to enter the region`);o=o.filter(r=>r!=e),n.changePermission("allowedEntities",o),t.reply(`Removed entity ${e} to the allowed entities of the region your currently standing in`)});var gt=(r=>(r[r.member=0]="member",r[r.admin=1]="admin",r[r.moderator=2]="moderator",r[r.builder=3]="builder",r))(gt||{});var To=t=>isNaN(Number(t))===!1;function Po(t){return Object.keys(t).filter(To).map(e=>t[e])}var yt=new u({name:"role",description:"Changes the role for a player",requires:t=>m(t)=="admin"||ge(t)});yt.literal({name:"set",description:"Sets the role for a player"}).argument(new p.playerName("playerName")).argument(new p.array("role",Po(gt))).executes((t,e,n)=>{te(e,n),t.reply(`Changed role of ${e} to ${n}`)});yt.literal({name:"get",description:"Gets the role of a player"}).argument(new p.playerName("playerName")).executes((t,e)=>{let n=m(e);t.reply(`${e} has role: ${n}`)});var ht=yt.literal({name:"owner",description:"Manages the owner"});ht.literal({name:"get",description:"Gets the owner of the world"}).executes(t=>{let e=rt(),n=s.ids.collection(),o=Object.keys(n).find(r=>n[r]===e);t.reply(`\xA7aServer Owner: ${o} (id: ${e})`)});ht.literal({name:"transfer",description:"Transfers the owner of the world",requires:t=>ge(t)}).argument(new p.player).executes((t,e)=>{G(t.sender,`Are you sure you want to transfer the server ownership to ${e.name}, this action is not reversible!`,()=>{ye(e),t.reply(`\xA7aSet the server Owner to: ${e.name} (id: ${e.id})`)}),t.reply("\xA7aClose chat to confirm")});ht.literal({name:"clear",description:"clear's the owner of the world",requires:t=>ge(t)}).executes(t=>{G(t.sender,"Are you sure you want to clear the server owner, this action is not reversible!",()=>{ye(null),t.reply('\xA7aCleared the server owner! run "/reload" or reload world to run "/function start" again!')}),t.reply("\xA7aClose chat to confirm")});import{ActionFormData as Ao}from"@minecraft/server-ui";var L=class{constructor(e,n){this.title=e,this.body=n,this.form=new Ao,e&&this.form.title(e),n&&this.form.body(n),this.buttons=[],this.triedToShow=0}addButton(e,n=null,o){return this.buttons.push({text:e,iconPath:n,callback:o}),this.form.button(e,n),this}show(e){this.form.show(e).then(n=>{if(n.canceled){if(n.cancelationReason=="userBusy"){if(this.triedToShow>200)return e.tell("\xA7cForm Timeout: tried to show form, but you were busy (close chat after running command)");this.triedToShow++,this.show(e)}return}this.buttons[n.selection].callback?.()})}};import{ModalFormData as xo}from"@minecraft/server-ui";var Fe=class{constructor(e,n,o){this.form=e,this.player=n,this.callback=o}error(e){new X("Error",e).setButton1("Return to form",()=>{this.form.show(this.player,this.callback)}).setButton2("Cancel",null).show(this.player)}};var x=class{constructor(e){this.title=e,this.form=new xo,e&&this.form.title(e),this.args=[],this.triedToShow=0}addDropdown(e,n,o){return this.args.push({type:"dropdown",options:n}),this.form.dropdown(e,n,o),this}addSlider(e,n,o,r,i){return this.args.push({type:"slider"}),this.form.slider(e,n,o,r,i),this}addToggle(e,n){return this.args.push({type:"toggle"}),this.form.toggle(e,n),this}addTextField(e,n,o){return this.args.push({type:"textField"}),this.form.textField(e,n,o),this}show(e,n){this.form.show(e).then(o=>{if(o.canceled){if(o.cancelationReason=="userBusy"){if(this.triedToShow>200)return e.tell("\xA7cForm Timeout: tried to show form, but you were busy (close chat after running command)");this.triedToShow++,this.show(e,n)}return}n(new Fe(this,e,n),...o.formValues.map((r,i)=>this.args[i].type=="dropdown"?this.args[i].options[r]:r))})}};function Tn(t){new L("Manage Banned Items").addButton("Remove a Banned Item",null,()=>{No(t)}).addButton("Ban an item",null,()=>{Bo(t)}).show(t)}function No(t){new x("Remove Banned Items").addDropdown("Select item to remove",C("banned_items")).show(t,(e,n)=>{let o=C("banned_items");o=o.filter(r=>r!=n),W("banned_items",o),t.tell(`Removed Banned item "${n}"`)})}function Bo(t){new x("Add Banned Item").addTextField("Item Id","minecraft:string").show(t,(e,n)=>{let o=C("banned_items");if(o.includes(n))return e.error(`\xA7cItem "${n}" is already banned`);o.push(n),W("banned_items",o),t.tell(`Banned the item "${n}"`)})}function Pn(t){new L("Manage Banned Blocks").addButton("Remove a Banned Block",null,()=>{Ro(t)}).addButton("Ban an block",null,()=>{Do(t)}).show(t)}function Ro(t){new x("Remove Banned Block").addDropdown("Select block to remove",C("banned_blocks")).show(t,(e,n)=>{let o=C("banned_blocks");o=o.filter(r=>r!=n),W("banned_blocks",o),t.tell(`Removed Banned block "${n}"`)})}function Do(t){new x("Add Banned Block").addTextField("Block Id","minecraft:barrier").show(t,(e,n)=>{let o=C("banned_blocks");if(o.includes(n))return e.error(`\xA7cBlock "${n}" is already banned`);o.push(n),W("banned_blocks",o),t.tell(`Banned the block "${n}"`)})}function An(t){new x("Manage Enchantment Levels").addDropdown("Enchantment to change",Object.keys(Be),0).addTextField("Level (number)","5").show(t,(e,n,o)=>{if(isNaN(o))return e.error(`\xA7c"${o}" is not a number, please enter a value like, "3", "9", etc.`);let r=parseInt(o),i=C("enchantments");i[n]=r,W("enchantments",i),t.tell(`Set max level for ${n} to ${r}`)})}function xn(t){new x("Manage Appeal Link").addTextField("Appeal Link",Re).show(t,(e,n)=>{W("appealLink",n),t.tell(`Changed the servers appeal link to ${n}`)})}function Nn(t){let e=new L("Manage Protections");for(let n of Object.values(_e))e.addButton(n.name,n.iconPath,()=>{_o(n,t)});e.addButton("Back","textures/ui/arrow_dark_left_stretch.png",()=>{ze(t)}).show(t)}function _o(t,e){let n=t.getConfig(),o=new x(`Manage ${t.name} Protection Config`).addToggle("Enabled",n.enabled),r=[];for(let[i,a]of Object.entries(t.configDefault))r.push(i),typeof a.defaultValue=="boolean"?o.addToggle(a.description,n[i]):typeof a.defaultValue=="number"?o.addSlider(a.description,0,100,1,n[i]):o.addTextField(a.description,null,n[i]);o.show(e,(i,a,...c)=>{a!=n.enabled&&(a&&t.enable(),a||t.disable());let l={enabled:a};for(let[f,g]of Object.keys(t.configDefault).entries())l[g]=c[f];t.setConfig(l),e.tell(`Updated config for ${t.name}!`)})}function ze(t){new L("Rubedo Settings").addButton("Auto Mod","textures/ui/permissions_op_crown.png",()=>{Nn(t)}).addButton("Banned items","textures/blocks/sculk_shrieker_top.png",()=>{Tn(t)}).addButton("Banned blocks","textures/blocks/barrier.png",()=>{Pn(t)}).addButton("Enchantments","textures/items/book_enchanted.png",()=>{An(t)}).addButton("Appeal Link","textures/ui/Feedback.png",()=>{xn(t)}).show(t)}new u({name:"settings",description:"Opens up the settings menu for the player",requires:t=>["admin","moderator"].includes(m(t))}).executes(t=>{ze(t.sender),t.sender.tell("\xA7aForm request sent, close chat to continue!")});import{world as Bn}from"@minecraft/server";function Rn(t,e){if(t.hasTag("spectator")){if(t.runCommandAsync("gamemode c"),t.triggerEvent("removeSpectator"),t.removeTag("spectator"),!e)return;Bn.say({rawtext:[{translate:"multiplayer.player.joined",with:[`\xA7e${t.name}`]}]})}else{if(t.runCommandAsync("gamemode spectator"),t.triggerEvent("addSpectator"),t.addTag("spectator"),!e)return;Bn.say({rawtext:[{translate:"multiplayer.player.left",with:[`\xA7e${t.name}`]}]})}}new u({name:"vanish",description:"Toggles Vanish Mode on the sender",requires:t=>m(t)=="admin"}).executes(t=>{Rn(t.sender,!1)}).boolean("say").executes((t,e)=>{Rn(t.sender,e)});new u({name:"version",description:"Get Current Version",aliases:["v"]}).executes(t=>{t.reply(`Current Rubedo Version: ${Zt}`)});new u({name:"kick",description:"Kicks a player from the game",requires:t=>m(t)=="admin"}).argument(new p.player).string("reason").executes((t,e,n)=>{$(e,[n]),t.reply(`\xA7aKicked ${e.name} from world`)});var q=class{constructor(e){this.data=e,console.warn(`[LOG]: ${e.message}`),s.logs.set(Date.now().toString(),e)}};function bt(t){var e=6e4,n=e*60,o=n*24,r=o*30,i=o*365,a=Date.now()-t;return am(t)=="admin"});Ce.literal({name:"add",description:"Adds a new log"}).string("message").executes((t,e)=>{new q({message:e}),t.reply(`\xA7aAdded new log: ${e}`)});Ce.literal({name:"getAll",description:"Gets all logs sorted in descending"}).int("page").array("order",["ascending","descending"]).executes((t,e,n)=>{let o=Object.entries(s.logs.collection()).sort((i,a)=>n=="ascending"?parseInt(a[0])-parseInt(i[0]):parseInt(i[0])-parseInt(a[0]));if(o.length==0)return t.reply("\xA7cNo Logs have been made!");let r=Math.ceil(o.length/8);e>r&&(e=r),t.reply(`\xA72--- Showing logs page ${e} of ${r} (${S}log getAll ) ---`);for(let[i,a]of o.slice(e*8-8,e*8))t.reply(`${bt(parseInt(i))}: ${a.message}`)});Ce.literal({name:"getPlayersLogs",description:"Gets all logs associated with a player"}).argument(new p.playerName).int("page").array("order",["ascending","descending"]).executes((t,e,n,o)=>{let r=Object.entries(s.logs.collection()).filter(a=>a[1].playerName==e).sort((a,c)=>o=="ascending"?parseInt(c[0])-parseInt(a[0]):parseInt(a[0])-parseInt(c[0]));if(r.length==0)return t.reply(`\xA7cNo Logs exists for "${e}"!`);let i=Math.ceil(r.length/8);n>i&&(n=i),t.reply(`\xA72--- Showing logs for "${e}" page ${n} of ${i} ---`);for(let[a,c]of r.slice(n*8-8,n*8))t.reply(`${bt(parseInt(a))}: ${c.message}`)});Ce.literal({name:"getProtectionLogs",description:"Gets all logs associated with a protection"}).string("protection").int("page").array("order",["ascending","descending"]).executes((t,e,n,o)=>{let r=Object.entries(s.logs.collection()).filter(a=>a[1].protection==e).sort((a,c)=>o=="ascending"?parseInt(c[0])-parseInt(a[0]):parseInt(a[0])-parseInt(c[0]));if(r.length==0)return t.reply(`\xA7cNo Logs exists for protection: "${e}"!`);let i=Math.ceil(r.length/8);n>i&&(n=i),t.reply(`\xA72--- Showing logs for Protection: "${e}" page ${n} of ${i} ---`);for(let[a,c]of r.slice(n*8-8,n*8))t.reply(`${bt(parseInt(a))}: ${c.message}`)});Ce.literal({name:"clearAll",description:"Clears all logs"}).executes(t=>{s.logs.clear(),t.reply("\xA7aCleared All logs!")});var Oo=new u({name:"teleport",description:"Teleports entities (players, mobs, etc.).",aliases:["tp"],requires:t=>m(t)=="admin"});Oo.argument(new p.player).location("destination").executes((t,e,n)=>{e.addTag("skip-movement-check"),e.teleport(n,e.dimension,0,0),t.reply(`Teleported ${e.name} to ${n.x} ${n.y} ${n.z}`)});F(t=>{try{let e=s.bans.get(t.id);if(!e)return;if(e.expire&&e.expire{console.warn(new Error("Failed to kick player")),s.bans.delete(t.id)})}catch(e){console.warn(e+e.stack)}},20);import{Location as $o}from"@minecraft/server";F(t=>{try{let e=s.freezes.get(t.id);if(!e)return t.getComponent("movement").resetToDefaultValue();t.getComponent("movement").setCurrent(0),t.teleport(new $o(e.location.x,e.location.y,e.location.z),h[e.location.dimension],0,0)}catch{}},200);import{world as Fo}from"@minecraft/server";var kt={};Fo.events.beforeChat.subscribe(t=>{if(!t.message.startsWith(S))for(let e of Object.values(kt))e.callback(t)});var Ve=class{static subscribe(e){let n=Date.now();return kt[n]={callback:e},n}static unsubscribe(e){delete kt[e]}};Ve.subscribe(t=>{let e=B.getMuteData(t.sender);if(!!e){if(e.expire&&e.expire{xe()},6e3);It.events.beforeItemUseOn.subscribe(t=>{if(["moderator","admin"].includes(m(t.source)))return;let e=y.blockLocationInRegion(t.blockLocation,t.source.dimension.id);if(!e)return;let n=t.source.dimension.getBlock(t.blockLocation);Ut.includes(n.typeId)&&e.permissions.doorsAndSwitches||Yt.includes(n.typeId)&&e.permissions.openContainers||(t.cancel=!0)});It.events.beforeExplosion.subscribe(t=>{for(let e=0;e{let e=await y.blockLocationInRegionSync(new zo(t.location.x,t.location.y,t.location.z),t.dimension.id);!e||e.permissions.allowedEntities.includes(t.typeId)||(t.teleport({x:0,y:-64,z:0},t.dimension,0,0),t.kill())});Dn.runSchedule(async()=>{for(let t of await y.getAllRegionsSync())for(let e of h[t.dimensionId].getEntities({excludeTypes:t.permissions.allowedEntities}))!t.entityInRegion(e)||(e.teleport({x:0,y:-64,z:0},e.dimension,0,0),e.kill())},100);F(async t=>{for(let e of await y.getAllRegionsSync())e.entityInRegion(t)?(t.addTag("inRegion"),e.permissions.pvp||t.addTag("region-protected")):(t.removeTag("inRegion"),t.removeTag("region-protected"))},5);import{world as Vo}from"@minecraft/server";Vo.events.playerJoin.subscribe(async({player:t})=>{if(await ce(),De()&&await ot(t)!="admin")return $(t,T["lockdown.kick.message"]());B.getMuteData(t)&&t.runCommandAsync("ability @s mute true"),s.ids.has(t.name)?t.addTag("old"):s.ids.set(t.name,t.id);let e=R.getPlayersRoleToSet(t.name);e&&te(t,e)});import{Items as jo,MinecraftItemTypes as _,world as wt}from"@minecraft/server";var Ln=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],Go=[10,11,12,13,14,15,16,19,20,21,22,23,24,25,28,29,30,31,32,33,34,37,38,39,40,41,42,43];function Ho(t,e,n){let o=t.getComponent("minecraft:inventory").container;for(let r=0;r{l.PageAction("moderation:see_inventory",{name:i.name})}}}}function Ko(t,e,n){let o=t.getComponent("minecraft:inventory").container;for(let l=0;l{l.PageAction("moderation:see_ender_chest",{name:n.name})}};let i=[...wt.getPlayers()].find(l=>l.name==n.name);i||(Object.values(A).find(f=>f.entity.id==t.id).despawn(),i.tell(`"${n.name}" Could not be found, Gui Crashed`));let a=i.getComponent("inventory").container,c=0;for(let l=0;l{l<9?await i.runCommandAsync(`replaceitem entity @s slot.hotbar ${l} air`):await i.runCommandAsync(`replaceitem entity @s slot.inventory ${l-9} air`),no.GiveAction(),e.slots[g]={item:null,action:oo=>{a.addItem(oo.getItemAdded())}}}}}}async function Uo(t,e,n){let o=t.getComponent("minecraft:inventory").container;for(let c=0;cc.name==n?.name);r||(Object.values(A).find(l=>l.entity.id==t.id).despawn(),r.tell(`"${n.name}" Could not be found, Gui Crashed`));let i=0,a=Object.values(_);for(let c of a)try{await r.runCommandAsync(`testfor @s[hasitem={item=${c.id},location=slot.enderchest}]`);let l=new v(c,{nameTag:"Note: \xA7l\xA7cThis is not the exact item"}),f=Go[i];o.setItem(f,l.itemStack),e.slots[f]={item:l,action:g=>{g.GiveAction(),e.slots[f]=null}},i++}catch{}}new V("moderation:see",Ho).setSlots([50],new v(_.arrow,{nameTag:"\xA7fBack"}),t=>{t.PageAction("home")}).setSlots([48],new v(_.barrier,{nameTag:"\xA7cClose GUI"}),t=>{t.CloseAction()});new V("moderation:see_inventory",Ko).setSlots([50],new v(_.arrow,{nameTag:"\xA7fBack"}),t=>{t.PageAction("moderation:see")}).setSlots([48],new v(_.barrier,{nameTag:"\xA7cClose GUI"}),t=>{t.CloseAction()});new V("moderation:see_ender_chest",Uo).setSlots([50],new v(_.arrow,{nameTag:"\xA7fBack"}),t=>{t.PageAction("moderation:see")}).setSlots([48],new v(_.barrier,{nameTag:"\xA7cClose GUI"}),t=>{t.CloseAction()});import{Player as Yo,MinecraftBlockTypes as Wo}from"@minecraft/server";import{system as _n,world as Mn}from"@minecraft/server";var I=class{constructor(e,n,o){this.name=e;this.description=n;this.iconPath=o;this.name=e,this.description=n,this.iconPath=o,this.configDefault={},this.isEnabled=!1,this.events={},this.schedules=[],this.forEachValidPlayers=[],_e[this.name]=this}setConfigDefault(e){return this.configDefault=e,s.protections.hasSync(this.name).then(n=>{if(n)return;let o={enabled:!0};for(let r of Object.keys(e))o[r]=e[r].defaultValue;s.protections.set(this.name,o)}),this}getConfig(){let e=s.protections.get(this.name);return e||(e={enabled:this.isEnabled}),e}async getConfigSync(){let e=await s.protections.getSync(this.name);return e||(e={enabled:this.isEnabled}),e}async setConfig(e){await s.protections.set(this.name,e)}triggerChange(e){if(e){this.isEnabled=!0,this.onEnableCallback?.();for(let[n,o]of Object.entries(this.events)){if(o.triggered)continue;let r=Mn.events[n].subscribe(o.callback);o.triggered=!0,o.callback=r}for(let n of this.forEachValidPlayers){if(n.key)continue;let o=F(n.callback,n.delay);n.key=o}for(let n of this.schedules){if(n.runScheduleId)continue;let o=_n.runSchedule(n.callback);n.runScheduleId=o}}else{this.isEnabled=!1,this.onDisableCallback?.();for(let[n,o]of Object.entries(this.events))!o.triggered||(Mn.events[n].unsubscribe(o.callback),o.triggered=!1);for(let n of this.forEachValidPlayers)!n.key||(rn(n.key),n.key=null);for(let n of this.schedules)!n.runScheduleId||(_n.clearRunSchedule(n.runScheduleId),n.runScheduleId=null)}}onEnable(e){return this.onEnableCallback=e,this}onDisable(e){return this.onDisableCallback=e,this}subscribe(e,n){return this.events[e]={callback:n,triggered:!1},this}runSchedule(e,n){return this.schedules.push({callback:e,tickInterval:n,runScheduleId:null}),this}forEachValidPlayer(e,n=0){return this.forEachValidPlayers.push({callback:e,delay:n,key:null}),this}enable(){this.triggerChange(!0)}disable(){this.triggerChange(!1)}};var qo=["minecraft:command_block_minecart"],ve=new I("cbe","Stops CBE","textures/blocks/command_block.png").setConfigDefault({entityCreate:{description:"Adds NPC protection",defaultValue:!0},banSpawnEggs:{description:"If spawn eggs should be banned",defaultValue:!0}});ve.subscribe("entityCreate",async({entity:t})=>{if(!(await ve.getConfigSync()).entityCreate)return;let n=()=>{try{t.triggerEvent("despawn"),t.kill()}catch{t.kill()}};if(qo.includes(t.typeId)||t.typeId=="minecraft:npc"&&!re.isValid(t))return n()});ve.subscribe("beforeItemUseOn",t=>{if(!(t.source instanceof Yo)||["admin","moderator"].includes(m(t.source)))return;let e=ve.getConfig();if(t.item.typeId.endsWith("spawn_egg")){if(!e.banSpawnEggs||t.source.dimension.getBlock(t.blockLocation).typeId==Wo.mobSpawner.id)return;t.cancel=!0,t.source.tell("\xA7c[Rubedo]: You cannot place spawnEggs on the floor!"),t.source.playSound("note.bass")}else{if(Jt.includes(t.item.typeId)){t.cancel=!0;return}if(!C("banned_blocks").includes(t.item.typeId))return;t.cancel=!0,new P(t.source,null,"Placing Banned Blocks")}});ve.enable();var Ct=32e4;new I("crasher","Protection against type 1 crasher","textures/ui/servers.png").forEachValidPlayer(t=>{(Math.abs(t.location.x)>Ct||Math.abs(t.location.y)>Ct||Math.abs(t.location.z)>Ct)&&new P(t,null,"Crasher detected")}).enable();import{GameMode as Xo,world as Jo}from"@minecraft/server";var Qo=Xo.creative,On=new k,vt=new I("gamemode","Blocks illegal gamemode","textures/ui/creative_icon.png").setConfigDefault({clearPlayer:{description:"Whether to clear players inventory.",defaultValue:!0},setToSurvival:{description:"If player should be set to survival after being flagged.",defaultValue:!0},banPlayer:{description:"If player should be banned after violation count is met.",defaultValue:!1},violationCount:{description:"The amount of violations before ban.",defaultValue:0}});vt.runSchedule(async()=>{let t=await vt.getConfigSync();for(let e of Jo.getPlayers({gameMode:Qo})){if(["moderator","admin","builder"].includes(m(e)))continue;try{t.setToSurvival&&e.runCommandAsync("gamemode s"),t.clearPlayer&&e.runCommandAsync("clear @s")}catch{}let n=(On.get(e)??0)+1;On.set(e,n),t.banPlayer&&n>=t.violationCount&&new P(e,null,"Illegal Gamemode")}},20);vt.enable();import{world as tr,Location as nr,system as or}from"@minecraft/server";import{system as Zo,world as er}from"@minecraft/server";var je=class{constructor(e){this.emptySlotsCount=e.emptySlotsCount,this.size=e.size,this.items=[];for(let n=0;n{Ge={};for(let t of er.getPlayers()){if(t.dimension.id!="minecraft:overworld")continue;let e=Lt(t.location),n=e.offset(Y.x,Y.y,Y.z),o=e.offset(-Y.x,-Y.y,-Y.z);for(let r of n.blocksBetween(o)){if(r.y<-64)continue;let i=t.dimension.getBlock(r);!i||!Ne.includes(i.typeId)||(Ge[JSON.stringify(r)]=new je(i.getComponent("inventory").container))}}},100);var Et={};tr.events.blockBreak.subscribe(t=>{for(let e of Object.values(Et))e.callback(new St(t.block,t.brokenBlockPermutation,t.dimension,t.player))});var Ee=class{static subscribe(e){let n=Date.now();return Et[n]={callback:e},n}static unsubscribe(e){delete Et[e]}},St=class{constructor(e,n,o,r){this.block=e;this.brokenBlockPermutation=n;this.dimension=o;this.player=r;this.block=e,this.brokenBlockPermutation=n,this.dimension=o,this.player=r}set cancel(e){if(this.dimension.getBlock(this.block.location).setPermutation(this.brokenBlockPermutation.clone()),Ne.includes(this.brokenBlockPermutation.type.id)){let n=Ge[JSON.stringify(this.block.location)];n&&n.load(this.block.getComponent("inventory").container)}or.run(()=>{[...this.dimension.getEntities({maxDistance:2,type:"minecraft:item",location:new nr(this.block.location.x,this.block.location.y,this.block.location.z)})].forEach(n=>n.kill())})}};var $n=new k,rr=15,ir=["snow","lush_plants_replaceable","azalea_log_replaceable","minecraft:crop","fertilize_area"],sr=["minecraft:water","minecraft:flowing_water","minecraft:lava","minecraft:flowing_lava","minecraft:bedrock"],Fn=new k,zn=null,Tt=new I("nuker","Blocks block breaking too fast","textures/blocks/dirt.png").setConfigDefault({banPlayer:{description:"If the player should be banned once violation count is met",defaultValue:!1},violationCount:{description:"Violations before ban",defaultValue:0}});Tt.onEnable(async()=>{let t=await Tt.getConfigSync();zn=Ee.subscribe(e=>{if(["moderator","admin"].includes(m(e.player))||e.block.getTags().some(o=>ir.includes(o)))return;let n=$n.get(e.player);if($n.set(e.player,Date.now()),!!n){if(!sr.includes(e.block.typeId)){if(n=t.violationCount&&new P(e.player,null,"Using Nuker")}e.cancel=!0}})}).onDisable(()=>{Ee.unsubscribe(zn)});Tt.enable();var Vn=new k,jn=new k,Pt=new I("spam","Blocks spam in chat","textures/ui/mute_on.png").setConfigDefault({permMutePlayer:{description:"If player should be permanently muted once violation count is met.",defaultValue:!1},violationCount:{description:"Violation count before permanent mute",defaultValue:0},repeatedMessages:{description:"Blocks repeated messages",defaultValue:!0},zalgo:{description:"Blocks zalgo",defaultValue:!0}});Pt.subscribe("beforeChat",t=>{try{if(t.message.startsWith(S)||["admin","moderator"].includes(m(t.sender)))return;let e=Pt.getConfig(),n=()=>{let o=(jn.get(t.sender)??0)+1;jn.set(t.sender,o),e.permMutePlayer&&o>=e.violationCount&&new B(t.sender,null,"Spamming")};if(e.repeatedMessages&&Vn.get(t.sender)==t.message)return t.cancel=!0,n(),t.sender.tell("\xA7cRepeated message detected!");if(e.zalgo&&/%CC%/g.test(encodeURIComponent(t.message)))return t.cancel=!0,n(),t.sender.tell("\xA7cYou message contains some type of zalgo and cannot be sent!");Vn.set(t.sender,t.message)}catch(e){console.warn(e+e.stack)}});Pt.enable();var Gn=new k;function He(t,e){let n=t.getComponent("inventory").container,o=n.getItem(e),r=C("cbe_config");if(r.clearItem&&n.setItem(e,w),new q({playerName:t.name,message:`${t.name} Has obtained a unobtainable item: ${o.typeId}`,protection:"unobtainable"}),!r.banPlayer)return;let i=(Gn.get(t)??0)+1;Gn.set(t,i),!(i{let e=C("banned_items"),n=t.getComponent("inventory").container;for(let o=0;oc||a.level<1||i.includes(a.type.id))return He(t,o);i.push(a.type.id)}}}).enable();import{MinecraftBlockTypes as E,MinecraftEntityTypes as ar,MinecraftItemTypes as j,Player as cr}from"@minecraft/server";var lr=[E.chest.id,E.trappedChest.id,E.barrel.id,E.dispenser.id,E.dropper.id,E.furnace.id,E.litFurnace.id,E.blastFurnace.id,E.litBlastFurnace.id,E.smoker.id,E.litSmoker.id,E.hopper.id,E.beehive.id,E.beeNest.id,E.mobSpawner.id],mr=[j.chestBoat.id,j.oakChestBoat.id,j.birchChestBoat.id,j.acaciaChestBoat.id,j.jungleChestBoat.id,j.spruceChestBoat.id,j.darkOakChestBoat.id,j.mangroveChestBoat.id];new I("nbt","Blocks illegal nbt on items","textures/ui/icon_random.png").subscribe("blockPlace",async({block:t})=>{if(!lr.includes(t.typeId))return;let e=t.permutation;await t.dimension.runCommandAsync(`setblock ${t.x} ${t.y} ${t.z} ${t.typeId}`),t.setPermutation(e)}).subscribe("beforeItemUseOn",t=>{t.source instanceof cr&&(!mr.includes(t.item.typeId)||(t.cancel=!0,t.source.dimension.spawnEntity(ar.chestBoat.id,t.blockLocation.above()),an(t.source)!="creative"&&t.source.getComponent("inventory").container.setItem(t.source.selectedSlot,w)))}).enable();import{MinecraftEffectTypes as fr,MinecraftItemTypes as Qn,Player as Nt}from"@minecraft/server";import{world as Hn}from"@minecraft/server";var At={};function ur(t,e){return!(t.x!=e.x||t.y!=e.y||t.z!=e.z)}var xt=new k;Hn.events.tick.subscribe(t=>{let e=(n,o)=>{for(let r of Object.values(At))r.callback(n,o)};for(let n of Hn.getPlayers()){let o=xt.get(n);o&&ur(n.location,o.location)||(xt.set(n,{location:n.location,dimension:n.dimension,tickSet:t.currentTick}),o&&e(n,o))}});var M=class{static subscribe(e){let n=Date.now();return At[n]={callback:e},n}static unsubscribe(e){delete At[e]}static delete(e){xt.delete(e)}};var Kn={walk:{velocity:.17,distance:.23},run:{velocity:.19,distance:.35}},Un=.056,Yn=10,Wn=["gliding","riding"];var qn=new k;function pr(t,e){return Math.hypot(e.x-t.x,e.z-t.z)}function gr(t){return(t.getEffect(fr.speed)?.amplifier??0)*Un}function yr(t,e){let n=gr(e),o=Kn.run.distance+.8;return t>n+o}function Xn(t,e){let n=(qn.get(t)??0)+1;qn.set(t,n),M.delete(t),!(n<3)&&t.teleport(e.location,e.dimension,t.rotation.x,t.rotation.y)}var Jn=null,Se=new I("movement","Blocks illegal movements on players","textures/ui/move.png").setConfigDefault({tpCheck:{description:"If teleports should be flagged",defaultValue:!0}});Se.onEnable(async()=>{console.warn("enabled movement protection");let t=await Se.getConfigSync();Jn=M.subscribe((e,n)=>{if(m(e)=="admin"||e.dimension.id!=n.dimension.id||e.getTags().some(r=>Wn.includes(r)))return;let o=pr(e.location,n.location);if(e.hasTag("skip-movement-check"))return e.removeTag("skip-movement-check");if(o>Yn){if(!t.tpCheck)return;Xn(e,n)}else{if(!yr(o,e))return;Xn(e,n)}})}).onDisable(()=>{console.warn("disabled movement protection"),M.unsubscribe(Jn)});Se.subscribe("dataDrivenEntityTriggerEvent",t=>{t.entity instanceof Nt&&t.id=="on_death"&&M.delete(t.entity)});Se.subscribe("projectileHit",({projectile:t,source:e})=>{t.typeId==Qn.enderPearl.id&&e instanceof Nt&&M.delete(e)});Se.subscribe("itemCompleteCharge",({itemStack:t,source:e})=>{t.typeId==Qn.chorusFruit.id&&e instanceof Nt&&M.delete(e)});import{MinecraftEffectTypes as hr,Player as br,world as Zn}from"@minecraft/server";var kr=Zn.events.beforeDataDrivenEntityTriggerEvent.subscribe(t=>{if(!(t.entity instanceof br)||t.id!="rubedo:becomeAdmin")return;t.entity.removeTag("CHECK_PACK");let e=on();if(e)return t.entity.playSound("note.bass"),t.entity.tell(`\xA7cFailed to give server owner: "${e}" is already owner!`),Zn.events.beforeDataDrivenEntityTriggerEvent.unsubscribe(kr);te(t.entity,"admin"),ye(t.entity),t.entity.addEffect(hr.blindness,3,255,!0),t.entity.tell('\xA7aYou have now been set as the "owner" of this server. The command "/function start" will not do anything anymore, type "-help" for more information!')});import{system as Ir}from"@minecraft/server";Ir.events.beforeWatchdogTerminate.subscribe(t=>{t.cancel=!0,console.warn(`WATCHDOG TRIED TO CRASH = ${t.terminateReason}`)});import{DynamicPropertiesDefinition as Bt,EntityTypes as wr,MinecraftEntityTypes as Cr,world as to}from"@minecraft/server";var eo=[];to.events.worldInitialize.subscribe(({propertyRegistry:t})=>{h.overworld.runCommandAsync(`tickingarea add ${N.x} ${N.y} ${N.z} ${N.x} ${N.y} ${N.z} db true`);let e=new Bt;e.defineString("tableName",30),e.defineNumber("index"),t.registerEntityTypeDynamicProperties(e,wr.get(ie));let n=new Bt;n.defineString("role",30),t.registerEntityTypeDynamicProperties(n,Cr.player);let o=new Bt;o.defineString("worldsOwner",100),o.defineBoolean("isLockDown"),t.registerWorldDynamicProperties(o);for(let r of eo)to.scoreboard.addObjective(r.objective,r.displayName??"")});var $e=[];function vn(){$e=[]}console.warn("----- Importing Plugins -----");console.warn("---- STARTING RUBEDO ----");var w=new vr(Er.stick,0),Te=!1;function Ue(){Te=!0}export{w as AIR,Te as WORLD_IS_LOADED,Ue as setWorldIsLoaded}; //# sourceMappingURL=index.js.map diff --git a/scripts/index.js.map b/scripts/index.js.map index 2a9b6cf..a1072af 100644 --- a/scripts/index.js.map +++ b/scripts/index.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../src/index.ts", "../src/lib/Command/index.ts", "../src/config/commands.ts", "../src/lib/Command/ArgumentTypes.ts", "../src/lib/Database/Database.ts", "../src/config/database.ts", "../src/utils.ts", "../src/lib/Form/Models/MessageForm.ts", "../src/config/form.ts", "../src/lib/Database/utils.ts", "../src/lib/Database/tables.ts", "../src/lib/Command/Callback.ts", "../src/lib/Command/utils.ts", "../src/lib/Chest GUI/index.ts", "../src/config/chest.ts", "../src/plugins/Anti-Cheat/utils.ts", "../src/plugins/Anti-Cheat/modules/models/Region.ts", "../src/plugins/Anti-Cheat/config/region.ts", "../src/plugins/Anti-Cheat/modules/models/Task.ts", "../src/plugins/Anti-Cheat/config/moderation.ts", "../src/plugins/Anti-Cheat/config/enchantments.ts", "../src/config/app.ts", "../src/lib/Chest GUI/Models/EntityChest.ts", "../src/lib/Events/onSlotChange.ts", "../src/lib/Chest GUI/utils.ts", "../src/plugins/Anti-Cheat/modules/models/PlayerLog.ts", "../src/lib/Chest GUI/Models/ItemGrabbedCallback.ts", "../src/lib/Chest GUI/Models/PageItem.ts", "../src/lib/Chest GUI/Models/FillTypes.ts", "../src/lib/Chest GUI/Models/Page.ts", "../src/lib/Chest GUI/pages/home.ts", "../src/plugins/Anti-Cheat/protections.ts", "../src/lang/text.ts", "../src/lib/Command/Command.ts", "../src/plugins/Anti-Cheat/modules/models/Ban.ts", "../src/plugins/Anti-Cheat/modules/commands/ban.ts", "../src/plugins/Anti-Cheat/modules/commands/database.ts", "../src/plugins/Anti-Cheat/modules/commands/ecwipe.ts", "../src/plugins/Anti-Cheat/modules/models/Freeze.ts", "../src/plugins/Anti-Cheat/modules/commands/freeze.ts", "../src/plugins/Anti-Cheat/modules/commands/help.ts", "../src/plugins/Anti-Cheat/modules/commands/lockdown.ts", "../src/plugins/Anti-Cheat/modules/models/Mute.ts", "../src/plugins/Anti-Cheat/modules/commands/mute.ts", "../src/plugins/Anti-Cheat/modules/commands/npc.ts", "../src/plugins/Anti-Cheat/modules/models/Npc.ts", "../src/plugins/Anti-Cheat/modules/commands/ping.ts", "../src/plugins/Anti-Cheat/modules/commands/region.ts", "../src/types.ts", "../src/plugins/Anti-Cheat/modules/commands/role.ts", "../src/lib/Form/Models/ActionForm.ts", "../src/lib/Form/Models/ModelForm.ts", "../src/lib/Form/Models/FormCallback.ts", "../src/plugins/Anti-Cheat/modules/forms/settings.ts", "../src/plugins/Anti-Cheat/modules/forms/automod.ts", "../src/plugins/Anti-Cheat/modules/forms/home.ts", "../src/plugins/Anti-Cheat/modules/commands/settings.ts", "../src/plugins/Anti-Cheat/modules/commands/vanish.ts", "../src/plugins/Anti-Cheat/modules/commands/version.ts", "../src/plugins/Anti-Cheat/modules/commands/kick.ts", "../src/plugins/Anti-Cheat/modules/models/Log.ts", "../src/plugins/Anti-Cheat/modules/commands/log.ts", "../src/plugins/Anti-Cheat/modules/commands/teleport.ts", "../src/plugins/Anti-Cheat/modules/managers/ban.ts", "../src/plugins/Anti-Cheat/modules/managers/freeze.ts", "../src/lib/Events/beforeChat.ts", "../src/plugins/Anti-Cheat/modules/managers/mute.ts", "../src/plugins/Anti-Cheat/modules/managers/region.ts", "../src/plugins/Anti-Cheat/modules/events/playerJoin.ts", "../src/plugins/Anti-Cheat/modules/pages/see.ts", "../src/plugins/Anti-Cheat/modules/protections/cbe.ts", "../src/plugins/Anti-Cheat/modules/models/Protection.ts", "../src/plugins/Anti-Cheat/modules/protections/crasher.ts", "../src/plugins/Anti-Cheat/modules/protections/gamemode.ts", "../src/lib/Events/beforeBlockBreak.ts", "../src/plugins/Anti-Cheat/modules/managers/containers.ts", "../src/plugins/Anti-Cheat/modules/models/BlockInventory.ts", "../src/plugins/Anti-Cheat/modules/protections/nuker.ts", "../src/plugins/Anti-Cheat/modules/protections/spam.ts", "../src/plugins/Anti-Cheat/modules/protections/unobtainable.ts", "../src/plugins/Anti-Cheat/modules/protections/nbt.ts", "../src/plugins/Anti-Cheat/modules/protections/movement.ts", "../src/lib/Events/onPlayerMove.ts", "../src/plugins/Anti-Cheat/config/movement.ts", "../src/plugins/Anti-Cheat/modules/events/beforeDataDrivenEntityTriggerEvent.ts", "../src/plugins/Anti-Cheat/modules/events/beforeWatchdogTerminate.ts", "../src/plugins/Anti-Cheat/modules/events/worldInitialize.ts", "../src/config/objectives.ts", "../src/plugins/Anti-Cheat/index.ts", "../src/plugins/import.ts"], - "sourcesContent": ["console.warn(`---- STARTING RUBEDO ----`);\nimport { ItemStack, MinecraftItemTypes } from \"@minecraft/server\";\nimport \"./lib/Command/index\";\nimport \"./lib/Chest GUI/index\";\nimport \"./plugins/import\";\n\n/**\n * This is air as a item,\n */\nexport const AIR = new ItemStack(MinecraftItemTypes.stick, 0);\n\n/**\n * If the world is loaded or not\n */\nexport let WORLD_IS_LOADED = false;\n\n/**\n * Sets the world to loaded\n */\nexport function setWorldIsLoaded() {\n WORLD_IS_LOADED = true;\n}\n", "import { BeforeChatEvent, world } from \"@minecraft/server\";\r\nimport { PREFIX } from \"../../config/commands\";\r\nimport type { Command } from \"./Command\";\r\nimport {\r\n commandNotFound,\r\n commandSyntaxFail,\r\n getChatAugments,\r\n noPerm,\r\n sendCallback,\r\n} from \"./utils\";\r\n\r\n/**\r\n * An array of all active commands\r\n */\r\nexport const COMMANDS: Command[] = [];\r\n\r\nworld.events.beforeChat.subscribe((data) => {\r\n if (!data.message.startsWith(PREFIX)) return; // This is not a command\r\n data.cancel = true;\r\n const args = getChatAugments(data.message, PREFIX);\r\n const command = COMMANDS.find(\r\n (c) =>\r\n c.depth == 0 &&\r\n (c.data.name == args[0] || c.data?.aliases?.includes(args[0]))\r\n );\r\n const event = {\r\n message: data.message,\r\n sendToTargets: data.sendToTargets,\r\n sender: data.sender,\r\n targets: data.targets,\r\n } as BeforeChatEvent;\r\n if (!command) return commandNotFound(data.sender, args[0]);\r\n if (!command.data?.requires(data.sender))\r\n return noPerm(event.sender, command);\r\n args.shift(); // Remove first command so we can look at args\r\n // Check Args/SubCommands for errors\r\n const verifiedCommands: Command[] = [];\r\n const getArg = (start: Command, i: number): string => {\r\n if (start.children.length > 0) {\r\n const arg = start.children.find((v) => v.type.matches(args[i]).success);\r\n if (!arg && !args[i] && start.callback) return;\r\n if (!arg)\r\n return commandSyntaxFail(event.sender, command, start, args, i), \"fail\";\r\n if (!arg.data?.requires(event.sender))\r\n return noPerm(event.sender, arg), \"fail\";\r\n verifiedCommands.push(arg);\r\n return getArg(arg, i + 1);\r\n }\r\n };\r\n let v = getArg(command, 0);\r\n if (v == \"fail\") return;\r\n sendCallback(args, verifiedCommands, event, command);\r\n});\r\n", "/*\n|--------------------------------------------------------------------------\n| Command Prefix\n|--------------------------------------------------------------------------\n|\n| This is the prefix of the commands that are send in chat\n| changing this changes what people have to type in before using\n| a command for instance: -help. (-) is the command prefix.\n|\n*/\nexport const PREFIX = \"-\";\n", "import { Player, world } from \"@minecraft/server\";\r\nimport { TABLES } from \"../Database/tables\";\r\n\r\n/**\r\n * Fetch an online players data\r\n */\r\nexport function fetch(playerName: string): Player | null {\r\n return [...world.getPlayers()].find((player) => player.name === playerName);\r\n}\r\n\r\nexport interface IArgumentReturnData {\r\n /**\r\n * If this argument matches the value\r\n */\r\n success: boolean;\r\n /**\r\n * The parsed value that should be passed in command callback\r\n * if there is no return type this will be null\r\n */\r\n value?: T;\r\n}\r\n\r\nexport abstract class IArgumentType {\r\n /**\r\n * The return type\r\n */\r\n type: any;\r\n /**\r\n * The name that the help for this command will see\r\n * @example \"string\"\r\n * @example \"Location\"\r\n * @example \"int\"\r\n * @example \"number\"\r\n * @example \"UnitType\"\r\n */\r\n typeName: string;\r\n /**\r\n * The name this argument is\r\n */\r\n name: string = \"name\";\r\n /**\r\n * Checks if a value matches this argument type, also\r\n * returns the corresponding type\r\n */\r\n matches(value: string): IArgumentReturnData {\r\n return { success: true };\r\n }\r\n /**\r\n * the fail message that should be sent if player fails to meet the matches criteria\r\n * @param value value that was sent\r\n * @returns what would happen if you didn't enter the right value\r\n */\r\n fail(value: string): string {\r\n return `Value must be of type string!`;\r\n }\r\n constructor(name: string = \"any\") {}\r\n}\r\n\r\nexport class LiteralArgumentType implements IArgumentType {\r\n type: null;\r\n typeName = \"literal\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: this.name == value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `${value} should be ${this.name}!`;\r\n }\r\n constructor(public name: string = \"literal\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class StringArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"string\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: value && value != \"\",\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value must be of type string!`;\r\n }\r\n constructor(public name: string = \"string\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class IntegerArgumentType implements IArgumentType {\r\n type: number;\r\n typeName = \"int\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: !isNaN(value as any),\r\n value: parseInt(value),\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value must be valid number!`;\r\n }\r\n constructor(public name: string = \"integer\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class FloatArgumentType implements IArgumentType {\r\n type: number;\r\n typeName = \"float\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: Boolean(value?.match(/^\\d+\\.\\d+$/)?.[0]),\r\n value: parseInt(value),\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value must be valid float!`;\r\n }\r\n constructor(public name: string = \"float\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class LocationArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"location\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: /^([~^]{0,1}(-\\d)?(\\d*)?(\\.(\\d+))?)$/.test(value),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value needs to be a valid number, value can include: [~,^]`;\r\n }\r\n constructor(public name: string = \"location\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class BooleanArgumentType implements IArgumentType {\r\n type: boolean;\r\n typeName = \"boolean\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: Boolean(value?.match(/^(true|false)$/)?.[0]),\r\n value: value == \"true\" ? true : false,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `\"${value}\" can be either \"true\" or \"false\"`;\r\n }\r\n constructor(public name: string = \"boolean\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class PlayerArgumentType implements IArgumentType {\r\n type: Player;\r\n typeName = \"Player\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: fetch(value) ? true : false,\r\n value: fetch(value),\r\n };\r\n }\r\n fail(value: string): string {\r\n return `player: \"${value}\", is not in this world`;\r\n }\r\n constructor(public name: string = \"player\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class TargetArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"Target\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: Boolean(value?.match(/^(@.|\"[\\s\\S]+\")$/)?.[0]),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `${value} is not a valid target`;\r\n }\r\n constructor(public name: string = \"target\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class ArrayArgumentType>\r\n implements IArgumentType\r\n{\r\n type: T[number];\r\n typeName = \"string\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: this.types.includes(value),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `\"${value}\" must be one of these values: ${this.types.join(\" | \")}`;\r\n }\r\n constructor(public name: string = \"array\", public types: T) {\r\n this.name = name;\r\n this.types = types;\r\n\r\n this.typeName = types.join(\" | \").replace(/(.{25})..+/, \"$1...\");\r\n }\r\n}\r\n\r\nexport class DurationArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"Duration\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: /^(\\d+[hdysmw],?)+$/.test(value),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `\"${value}\" must be a value like \"10d\" or \"3s\" the first part is the length second is unit`;\r\n }\r\n constructor(public name: string) {}\r\n}\r\n\r\nexport class PlayerNameArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"playerName\";\r\n matches(value: string): IArgumentReturnData {\r\n const player = TABLES.ids.get(value);\r\n return {\r\n success: player ? true : false,\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `player: \"${value}\" has never played this world before! Tip: if the name has spaces in it use quotes around name!`;\r\n }\r\n constructor(public name: string = \"playerName\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport const ArgumentTypes = {\r\n string: StringArgumentType,\r\n int: IntegerArgumentType,\r\n float: FloatArgumentType,\r\n location: LocationArgumentType,\r\n boolean: BooleanArgumentType,\r\n player: PlayerArgumentType,\r\n target: TargetArgumentType,\r\n array: ArrayArgumentType,\r\n duration: DurationArgumentType,\r\n playerName: PlayerNameArgumentType,\r\n};\r\n", "import {\n Entity,\n ItemStack,\n MinecraftItemTypes,\n system,\n} from \"@minecraft/server\";\nimport { AIR } from \"../../index.js\";\nimport {\n ENTITY_IDENTIFIER,\n ENTITY_LOCATION,\n INVENTORY_SIZE,\n MAX_DATABASE_STRING_SIZE,\n} from \"../../config/database\";\nimport { awaitWorldLoad, DIMENSIONS, onWorldLoad } from \"../../utils\";\nimport { chunkString } from \"./utils\";\n\nexport class Database {\n /**\n * Creates a table entity that is used for data storage\n * @param tableName\n * @param index if not specified no index will be set\n * @returns\n */\n static createTableEntity(tableName: string, index?: number): Entity {\n const entity = DIMENSIONS.overworld.spawnEntity(\n ENTITY_IDENTIFIER,\n ENTITY_LOCATION\n );\n entity.setDynamicProperty(\"tableName\", tableName);\n entity.nameTag = `\u00A7aDatabase Table: ${tableName}\u00A7r`;\n if (index) entity.setDynamicProperty(\"index\", index);\n return entity;\n }\n\n /**\n * Gets all table Entities associated with this tableName\n * @param tableName\n * @returns\n */\n static getTableEntities(tableName: string): Entity[] {\n return DIMENSIONS.overworld\n .getEntitiesAtBlockLocation(ENTITY_LOCATION)\n .filter(\n (e) =>\n e.typeId == ENTITY_IDENTIFIER &&\n e.getDynamicProperty(\"tableName\") == tableName\n );\n }\n\n /**\n * Data saved in memory\n */\n private MEMORY: { [key in Key]: Value } | null;\n\n /**\n * List of queued tasks on this table\n */\n private QUEUE: Array<() => void>;\n\n constructor(public tableName: string) {\n this.tableName = tableName;\n this.MEMORY = null;\n this.QUEUE = [];\n system.runSchedule(() => {\n if (this.QUEUE.length == 0) return;\n this.QUEUE.shift()(); // removes queue item and runs it\n }, 1);\n onWorldLoad(async () => {\n this.MEMORY = await this.getData();\n });\n }\n\n /**\n * Adds a queue task to be awaited\n * @returns once its this items time to run in queue\n */\n private async addQueueTask(): Promise {\n return new Promise((resolve) => {\n this.QUEUE.push(() => {\n resolve();\n });\n });\n }\n\n /**\n * Saves data into this database\n * @param data\n * @returns once data is saved\n */\n private async saveData(data: { [key in Key]: Value }): Promise {\n await this.addQueueTask();\n await awaitWorldLoad(); // Await till world is loaded\n this.MEMORY = data; // set memory\n let entities = Database.getTableEntities(this.tableName);\n /**\n * The split chunks of the stringified data, This is done because we can\n * only store {@link MAX_DATABASE_STRING_SIZE} chars in a single nameTag\n */\n let chunks = chunkString(JSON.stringify(data), MAX_DATABASE_STRING_SIZE);\n /**\n * The amount of entities that is needed to store {@link chunks} data\n */\n const entitiesNeeded =\n Math.ceil(chunks.length / INVENTORY_SIZE) - entities.length;\n if (entitiesNeeded > 0) {\n for (let i = 0; i < entitiesNeeded; i++) {\n entities.push(Database.createTableEntity(this.tableName));\n }\n }\n for (const [i, entity] of entities.entries()) {\n const inventory = entity.getComponent(\"inventory\").container;\n for (const [i, chunk] of chunks.entries()) {\n if (!chunk) continue;\n if (i > inventory.size - 1) break; // Exit because it has maxed items\n let item = new ItemStack(MinecraftItemTypes.acaciaBoat);\n item.nameTag = chunk;\n inventory.setItem(i, item);\n chunks[i] = null; // Delete chunk because its been set.\n }\n // Set all unUsed slots to air\n for (let i = chunks.length + 1; i < inventory.size; i++) {\n inventory.setItem(i, AIR);\n }\n entity.setDynamicProperty(\"index\", i);\n entities[i] = null; // Set this entity to null because its maxed out!\n // If all chunks have been saved no need to go to next entity\n if (!chunks.find((v) => v)) break;\n }\n // Check for unUsed entities and despawn them\n entities.filter((e) => e).forEach((e) => e.triggerEvent(\"despawn\"));\n return;\n }\n\n /**\n * Grabs all data from this table\n * @returns\n */\n private async getData(): Promise<{ [key in Key]: Value }> {\n await awaitWorldLoad(); // Await till world is loaded\n if (this.MEMORY) return this.MEMORY;\n let entities = Database.getTableEntities(this.tableName).sort(\n (a, b) =>\n (a.getDynamicProperty(\"index\") as number) -\n (b.getDynamicProperty(\"index\") as number)\n );\n let stringifiedData: string = \"\";\n for (const entity of entities) {\n const inventory = entity.getComponent(\"inventory\").container;\n for (let i = 0; i < inventory.size; i++) {\n const item = inventory.getItem(i);\n if (!item) continue;\n stringifiedData = stringifiedData + item.nameTag;\n }\n }\n return stringifiedData == \"\" ? {} : JSON.parse(stringifiedData);\n }\n\n /**\n * Sets a key to a value in this table\n * @param key\n * @param value\n */\n async set(key: Key, value: Value): Promise {\n const data = await this.getData();\n data[key] = value;\n await this.saveData(data);\n return;\n }\n\n /**\n * Gets a value from this table\n * @param key\n * @returns the keys corresponding key\n */\n get(key: Key): Value {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `getAsync` instead!\"\n );\n return this.MEMORY[key];\n }\n\n /**\n * Gets a value async from this table, this should be used on calls from like\n * entityCreate, system.runSchedule or things that could be before database entities spawn\n * @param key\n * @returns\n */\n async getSync(key: Key): Promise {\n const data = await this.getData();\n return data[key];\n }\n\n /**\n * Get all the keys in the table\n * @returns\n */\n keys(): Key[] {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `keysSync` instead!\"\n );\n return Object.keys(this.MEMORY) as Key[];\n }\n\n /**\n * Get all the keys in the table async, this should be used on world load\n * @returns\n */\n async keysSync(): Promise {\n const data = await this.getData();\n return Object.keys(data) as Key[];\n }\n\n /**\n * Get all the values in the table\n * @returns\n */\n values(): Value[] {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `valuesSync` instead!\"\n );\n return Object.values(this.MEMORY) as Value[];\n }\n\n /**\n * Get all the values in the table async, this should be used on world load\n * @returns\n */\n async valuesSync(): Promise {\n const data = await this.getData();\n return Object.values(data) as Value[];\n }\n\n /**\n * Check if the key exists in the table\n * @param key the key to test\n * @returns\n */\n has(key: Key): boolean {\n if (!this.MEMORY)\n throw new Error(\"World is not loaded! Consider using `hasSync` instead!\");\n const keys = this.keys();\n return keys.includes(key);\n }\n\n /**\n * Check if the key exists in the table async, this should be used on worldLoad\n * @param key the key to test\n * @returns\n */\n async hasSync(key: Key): Promise {\n const keys = await this.keysSync();\n return keys.includes(key);\n }\n\n /**\n * Gets all the keys and values\n * @returns\n */\n collection(): { [key in Key]: Value } {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `collectionSync` instead!\"\n );\n return this.MEMORY;\n }\n\n /**\n * Gets all the keys and values async, this should be used for grabbingCollection on world load\n * @returns\n */\n async collectionSync(): Promise<{ [key in Key]: Value }> {\n return await this.getData();\n }\n\n /**\n * Delete the key from the table\n * @param key the key to delete\n * @returns\n */\n async delete(key: Key): Promise {\n const data = await this.getData();\n const status = delete data[key];\n await this.saveData(data);\n return status;\n }\n\n /**\n * Clear everything in the table\n */\n async clear(): Promise {\n await this.saveData({} as { [key in Key]: Value });\n return;\n }\n}\n", "import { BlockLocation } from \"@minecraft/server\";\n\n/*\n|--------------------------------------------------------------------------\n| Max Database string size\n|--------------------------------------------------------------------------\n|\n| Here is the max database save size meaning when a save gets made\n| it tests the size of that save and splits up the save depending on this\n| Size. It's related to Minecraft's 32k bit limit.\n|\n*/\nexport const MAX_DATABASE_STRING_SIZE = 32000;\n\n/*\n|--------------------------------------------------------------------------\n| Entity Id\n|--------------------------------------------------------------------------\n|\n| This is the entity id of the database this is what stores the information\n| of the database on its nameTag\n|\n*/\nexport const ENTITY_IDENTIFIER = \"rubedo:database\";\n\n/*\n|--------------------------------------------------------------------------\n| Entity Spawn Location\n|--------------------------------------------------------------------------\n|\n| This is the spawn location of the database entities there will be\n| Multiple entities at this location for each chunk\n|\n*/\nexport const ENTITY_LOCATION = new BlockLocation(0, -64, 0);\n\n/*\n|--------------------------------------------------------------------------\n| Entity's INVENTORY_SIZE\n|--------------------------------------------------------------------------\n|\n| The max amount of items this entity can store in its inventory\n|\n*/\nexport const INVENTORY_SIZE = 128;\n", "import {\r\n BlockLocation,\r\n Entity,\r\n Location,\r\n MinecraftDimensionTypes,\r\n Player,\r\n system,\r\n Vector3,\r\n world,\r\n} from \"@minecraft/server\";\r\nimport { setWorldIsLoaded, WORLD_IS_LOADED } from \"./index.js\";\r\nimport { TABLES } from \"./lib/Database/tables\";\r\nimport { MessageForm } from \"./lib/Form/Models/MessageForm\";\r\nimport { durationSegment, durationSegmentType } from \"./types\";\r\n\r\n/**\r\n * This is to reduce lag when grabbing dimensions keep them set and pre-defined\r\n */\r\nexport const DIMENSIONS = {\r\n overworld: world.getDimension(MinecraftDimensionTypes.overworld),\r\n nether: world.getDimension(MinecraftDimensionTypes.nether),\r\n theEnd: world.getDimension(MinecraftDimensionTypes.theEnd),\r\n \"minecraft:overworld\": world.getDimension(MinecraftDimensionTypes.overworld),\r\n \"minecraft:nether\": world.getDimension(MinecraftDimensionTypes.nether),\r\n \"minecraft:the_end\": world.getDimension(MinecraftDimensionTypes.theEnd),\r\n};\r\n\r\n/**\r\n * Get score of an entity\r\n * @example getScore(Entity, 'Money');\r\n */\r\nexport function getScore(entity: Entity, objective: string): number {\r\n try {\r\n return world.scoreboard.getObjective(objective).getScore(entity.scoreboard);\r\n } catch (error) {\r\n return 0;\r\n }\r\n}\r\n\r\n/**\r\n * grabs the score of a entity off of nameTag\r\n * @param name Entity's name\r\n * @param objective objective to get\r\n * @returns the score of the entity\r\n */\r\nexport async function getScoreByName(\r\n name: string,\r\n objective: string\r\n): Promise {\r\n try {\r\n const command = await DIMENSIONS.overworld.runCommandAsync(\r\n `scoreboard players test \"${name}\" \"${objective}\" * *`\r\n );\r\n return parseInt(String(command.statusMessage?.split(\" \")[1]), 10);\r\n } catch (error) {\r\n return 0;\r\n }\r\n}\r\n\r\n/**\r\n * sets the score of a name\r\n * @example setScore(\"Smell of curry\", 'Money');\r\n */\r\nexport function setScore(\r\n entityName: string,\r\n objective: string,\r\n value: Number\r\n): void {\r\n try {\r\n DIMENSIONS.overworld.runCommandAsync(\r\n `scoreboard players set \"${entityName}\" ${objective} ${value}`\r\n );\r\n } catch (error) {\r\n console.warn(error + error.stack);\r\n }\r\n}\r\n\r\n/**\r\n * Gets a players id based on a saved database values\r\n * @param playerName playerName to get\r\n */\r\nexport function getId(playerName: string): string | null {\r\n return TABLES.ids.get(playerName);\r\n}\r\n\r\n/**\r\n * Duration converter\r\n * @param duration time to convert\r\n * @example ```\r\n * durationToMs(\"10s\")\r\n * durationToMs(\"10d,2y\")\r\n * durationToMs(\"5m\")\r\n * durationToMs(\"23ms,10s\")\r\n * ```\r\n */\r\nexport function durationToMs(duration: string): number {\r\n /**\r\n * This holds the different duration values this duration can have\r\n * @example `[\"10d\", \"20s\", \"2h\"]`\r\n * @example `[\"2h\"]`\r\n */\r\n const values: durationSegment[] = duration.split(\",\") as durationSegment[];\r\n console.warn(values.length);\r\n let ms = 0;\r\n for (const value of values) {\r\n const length = parseInt(value.match(/\\D+|\\d+/g)[0]);\r\n const unit = value.match(/\\D+|\\d+/g)[1] as durationSegmentType;\r\n if (unit == \"y\") ms = ms + 3.17098e-11 * length;\r\n if (unit == \"w\") ms = ms + 6.048e8 * length;\r\n if (unit == \"d\") ms = ms + 8.64e7 * length;\r\n if (unit == \"h\") ms = ms + 3.6e6 * length;\r\n if (unit == \"m\") ms = ms + 60000 * length;\r\n if (unit == \"s\") ms = ms + 1000 * length;\r\n if (unit == \"ms\") ms = ms + length;\r\n }\r\n return ms;\r\n}\r\n\r\n/**\r\n * Converts a date stored in ms to a Date string\r\n * @param duration milliseconds to convert\r\n * @returns Date as a string\r\n */\r\nexport function msToTime(duration: number) {\r\n return new Date(duration).toString();\r\n}\r\n\r\n/**\r\n * Converts a location to a block location\r\n */\r\nexport function vector3ToBlockLocation(loc: Vector3): BlockLocation {\r\n return new BlockLocation(\r\n Math.floor(loc.x),\r\n Math.floor(loc.y),\r\n Math.floor(loc.z)\r\n );\r\n}\r\n\r\n/**\r\n * Sends a confirmation message to a player to confirm a action\r\n * @param action action message to confirm\r\n * @param onConfirm callback to run when a player confirms the action\r\n * @param onCancel callback to run when a player cancels the action, this can be null\r\n * @example ```\r\n * confirmAction(\"Ban Smell of curry\", () => {\r\n * new Ban(\"Smell of curry\")\r\n * })\r\n * ```\r\n */\r\nexport function confirmAction(\r\n player: Player,\r\n action: string,\r\n onConfirm: () => void,\r\n onCancel: () => void = () => {}\r\n) {\r\n new MessageForm(\"Confirm To Continue\", action)\r\n .setButton1(\"Confirm\", onConfirm)\r\n .setButton2(\"Never Mind\", onCancel)\r\n .show(player);\r\n}\r\n\r\n/**\r\n * Sleeps your code\r\n * @param {number} tick time in ticks you want the return to occur\r\n * @returns {Promise}\r\n */\r\nexport function sleep(tick: number): Promise {\r\n return new Promise((resolve) => {\r\n let runScheduleId = system.runSchedule(() => {\r\n resolve();\r\n system.clearRunSchedule(runScheduleId);\r\n }, tick);\r\n });\r\n}\r\n\r\n/**\r\n * Checks if a location equals another location\r\n * @param a first location\r\n * @param b location to test against first\r\n * @returns {boolean} if they locations are the same\r\n */\r\nexport function LocationEquals(\r\n a: Vector3 | Location | BlockLocation,\r\n b: Vector3 | Location | BlockLocation\r\n): boolean {\r\n let aLocations = [a.x, a.y, a.z];\r\n let bLocations = [a.x, a.y, a.z];\r\n if (a instanceof BlockLocation || b instanceof BlockLocation) {\r\n aLocations = aLocations.map((v) => Math.trunc(v));\r\n bLocations = bLocations.map((v) => Math.trunc(v));\r\n }\r\n return aLocations.find((v, i) => bLocations[i] != v) ? false : true;\r\n}\r\n\r\n/**\r\n * Awaits till work load\r\n * @returns\r\n */\r\nexport async function awaitWorldLoad(): Promise {\r\n if (WORLD_IS_LOADED) return;\r\n return new Promise((resolve) => {\r\n let s = system.runSchedule(async () => {\r\n try {\r\n await DIMENSIONS.overworld.runCommandAsync(`testfor @a`);\r\n system.clearRunSchedule(s);\r\n setWorldIsLoaded();\r\n resolve();\r\n } catch (error) {}\r\n }, 1);\r\n });\r\n}\r\n\r\n/**\r\n * Sends a callback once world is loaded\r\n * @param callback\r\n */\r\nexport function onWorldLoad(callback: () => void) {\r\n if (WORLD_IS_LOADED) return callback();\r\n let s = system.runSchedule(async () => {\r\n try {\r\n await DIMENSIONS.overworld.runCommandAsync(`testfor @a`);\r\n system.clearRunSchedule(s);\r\n setWorldIsLoaded();\r\n callback();\r\n } catch (error) {}\r\n }, 1);\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { MessageFormData } from \"@minecraft/server-ui\";\r\nimport { TIMEOUT_THRESHOLD } from \"../../../config/form\";\r\nimport type { ButtonCallback, IMessageFormButton } from \"../types\";\r\n\r\nexport class MessageForm {\r\n /**\r\n * the title that this form should have\r\n */\r\n title?: string;\r\n /**\r\n * extra text that should be displayed in the form\r\n */\r\n body?: string;\r\n /**\r\n * The default minecraft form this form is based on\r\n */\r\n private form: MessageFormData;\r\n /**\r\n * the first button of the dialog.\r\n */\r\n private button1: IMessageFormButton;\r\n /**\r\n * the second button of the dialog.\r\n */\r\n private button2: IMessageFormButton;\r\n /**\r\n * The amount of times it takes to show this form in ms\r\n * if this value goes above 200 it will time out\r\n */\r\n private triedToShow: number;\r\n\r\n /**\r\n * Creates a new form to be shown to a player\r\n * @param title the title that this form should have\r\n * @param body extra text that should be displayed in the form\r\n */\r\n constructor(title?: string, body?: string) {\r\n this.title = title;\r\n this.body = body;\r\n this.form = new MessageFormData();\r\n\r\n if (title) this.form.title(title);\r\n if (body) this.form.body(body);\r\n\r\n this.triedToShow = 0;\r\n }\r\n\r\n /**\r\n * Method that sets the text for the first button of the dialog.\r\n * @param text text to show on this button\r\n * @param callback what happens when this button is clicked\r\n * @example ```\r\n * setButton1(\"settings\", () => {})\r\n * ```\r\n */\r\n setButton1(text: string, callback?: ButtonCallback): MessageForm {\r\n this.button1 = { text: text, callback: callback };\r\n this.form.button1(text);\r\n return this;\r\n }\r\n\r\n /**\r\n * Method that sets the text for the second button of the dialog.\r\n * @param text text to show on this button\r\n * @param callback what happens when this button is clicked\r\n * @example ```\r\n * setButton2(\"settings\", () => {})\r\n * ```\r\n */\r\n setButton2(text: string, callback?: ButtonCallback): MessageForm {\r\n this.button2 = { text: text, callback: callback };\r\n this.form.button2(text);\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows this form to the player\r\n * @param player player to show to\r\n */\r\n show(player: Player): void {\r\n this.form.show(player).then((response) => {\r\n if (response.canceled) {\r\n if (response.cancelationReason == \"userBusy\") {\r\n // check time and reshow form\r\n if (this.triedToShow > TIMEOUT_THRESHOLD)\r\n return player.tell(\r\n `\u00A7cForm Timeout: tried to show form, but you were busy (close chat after running command)`\r\n );\r\n this.triedToShow++;\r\n this.show(player);\r\n }\r\n return;\r\n }\r\n if (response.selection == 1) this.button1?.callback?.();\r\n if (response.selection == 0) this.button2?.callback?.();\r\n });\r\n }\r\n}\r\n", "/**\r\n * If a form tries to show for longer than this value\r\n * the form will stop trying to show. this is used for a timeout\r\n * because if someone tries to open a form but doesn't close chat\r\n */\r\nexport const TIMEOUT_THRESHOLD = 200;\r\n", "/**\n * Splits a string into chunk sizes\n */\nexport function chunkString(str: string, length: number): string[] {\n return str.match(new RegExp(\".{1,\" + length + \"}\", \"g\"));\n}\n", "import type {\r\n IRegionDB,\r\n IMuteData,\r\n IBanData,\r\n IFreezeData,\r\n INpcLocation,\r\n LogData,\r\n IProtectionsConfig,\r\n} from \"../../types\";\r\nimport type { ROLES } from \"../../types\";\r\nimport { Database } from \"../../lib/Database/Database\";\r\n\r\n/**\r\n * All the Database tables that are created\r\n */\r\nexport const TABLES = {\r\n config: new Database(\"config\"),\r\n freezes: new Database(\"freezes\"),\r\n mutes: new Database(\"mutes\"),\r\n bans: new Database(\"bans\"),\r\n regions: new Database(\"regions\"),\r\n roles: new Database(\"roles\"),\r\n tasks: new Database(\"tasks\"),\r\n npcs: new Database(\"npcs\"),\r\n ids: new Database(\"ids\"),\r\n logs: new Database(\"logs\"),\r\n protections: new Database(\"protections\"),\r\n test: new Database(\"test\"),\r\n};\r\n", "import { BeforeChatEvent, Player } from \"@minecraft/server\";\r\n\r\nexport class CommandCallback {\r\n data: BeforeChatEvent;\r\n sender: Player;\r\n\r\n /**\r\n * Returns a commands callback\r\n * @param data chat data that was used\r\n */\r\n constructor(data: BeforeChatEvent) {\r\n this.data = data;\r\n this.sender = data.sender;\r\n }\r\n /**\r\n * Replies to the sender of a command callback\r\n * @param text Message or a lang code\r\n * @example ctx.reply('Hello World!');\r\n */\r\n reply(text: string) {\r\n this.sender.tell(text);\r\n }\r\n}\r\n", "import { BeforeChatEvent, Player, Vector, Vector3 } from \"@minecraft/server\";\nimport { PREFIX } from \"../../config/commands\";\nimport { LiteralArgumentType, LocationArgumentType } from \"./ArgumentTypes\";\nimport { CommandCallback } from \"./Callback\";\nimport type { Command } from \"./Command\";\n\n/**\n * Returns a Before chat events augments\n * @example this.getChatAugments(BeforeChatEvent)\n */\nexport function getChatAugments(\n message: string,\n prefix: string\n): Array {\n try {\n return message\n .slice(prefix.length)\n .trim()\n .match(/\"[^\"]+\"|[^\\s]+/g)\n .map((e) => e.replace(/\"(.+)\"/, \"$1\").toString());\n } catch (error) {\n return [];\n }\n}\n\n/**\n * Sends a command not found message to a player\n * @param player player to send message to\n */\nexport function commandNotFound(player: Player, command: string) {\n player.tell({\n rawtext: [\n {\n text: `\u00A7c`,\n },\n {\n translate: `commands.generic.unknown`,\n with: [`${command}`],\n },\n ],\n });\n}\n\n/**\n * Sends a command not found message to a player\n * @param player player to send message to\n */\nexport function noPerm(player: Player, command: Command) {\n player.tell({\n rawtext: [\n {\n text: command.data.invalidPermission\n ? command.data.invalidPermission\n : `\u00A7cYou do not have permission to use \"${command.data.name}\"`,\n },\n ],\n });\n}\n\n/**\n * Sends a syntax failure message to player\n * @param player\n * @param command\n * @param args\n * @param i\n */\nexport function commandSyntaxFail(\n player: Player,\n baseCommand: Command,\n command: Command,\n args: string[],\n i: number\n) {\n player.tell({\n rawtext: [\n {\n text: `\u00A7c`,\n },\n {\n translate: `commands.generic.syntax`,\n with: [\n `${PREFIX}${baseCommand.data.name} ${args.slice(0, i).join(\" \")}`,\n args[i] ?? \" \",\n args.slice(i + 1).join(\" \"),\n ],\n },\n ],\n });\n if (command.children.length > 1 || !args[i]) {\n // this type could be many things\n const types = command.children.map((c) =>\n c.type instanceof LiteralArgumentType ? c.type.name : c.type?.typeName\n );\n player.tell(\n `\u00A7c\"${args[i] ?? \"undefined\"}\" is not valid! Argument \"${\n [...new Set(command.children.map((c) => c.type.name))][0]\n }\" can be typeof: \"${types.join('\", \"')}\"`\n );\n } else {\n // this type is only 1 thing\n player.tell(`\u00A7c${command.children[0]?.type?.fail(args[i])}`);\n }\n}\n\n/**\n * Returns a location of the inputted argument\n * @example parseLocationArgs([\"~1\", \"3\", \"^7\"], { location: [1,2,3] , viewVector: [1,2,3] })\n */\nexport function parseLocationArgs(\n [x, y, z]: [x: string, y: string, z: string],\n { location, viewVector }: { location: Vector3; viewVector: Vector }\n): Vector3 {\n if (!x || !y || !x) return null;\n const locations = [location.x, location.y, location.z];\n const viewVectors = [viewVector.x, viewVector.y, viewVector.z];\n const a = [x, y, z].map((arg) => {\n const r = parseFloat(arg);\n return isNaN(r) ? 0 : r;\n });\n const b = [x, y, z].map((arg, index) => {\n return arg.includes(\"~\")\n ? a[index] + locations[index]\n : arg.includes(\"^\")\n ? a[index] + viewVectors[index]\n : a[index];\n });\n return { x: b[0], y: b[1], z: b[2] };\n}\n\n/**\n * Sends a callback back to the command\n * @param cmdArgs the args that the command used\n * @param args args to use\n */\nexport function sendCallback(\n cmdArgs: string[],\n args: Command[],\n event: BeforeChatEvent,\n baseCommand: Command\n) {\n const lastArg = args[args.length - 1] ?? baseCommand;\n const argsToReturn: any[] = [];\n for (const [i, arg] of args.entries()) {\n if (arg.type.name.endsWith(\"*\")) continue;\n if (arg.type instanceof LocationArgumentType) {\n argsToReturn.push(\n parseLocationArgs(\n [cmdArgs[i], cmdArgs[i + 1], cmdArgs[i + 2]],\n event.sender\n )\n );\n continue;\n }\n if (arg.type instanceof LiteralArgumentType) continue;\n argsToReturn.push(arg.type.matches(cmdArgs[i]).value ?? cmdArgs[i]);\n }\n lastArg.callback(new CommandCallback(event), ...argsToReturn);\n}\n", "import { Player, system, world } from \"@minecraft/server\";\r\nimport { ENTITY_INVENTORY, GUI_ITEM } from \"../../config/chest\";\r\nimport { getRole } from \"../../plugins/Anti-Cheat/utils.js\";\r\nimport { ChestGUI } from \"./Models/EntityChest\";\r\nimport { CHESTGUIS, CHEST_OPEN, getHeldItem } from \"./utils.js\";\r\nimport \"./pages/home\";\r\nimport { DIMENSIONS } from \"../../utils.js\";\r\n\r\nsystem.runSchedule(() => {\r\n for (const player of world.getPlayers()) {\r\n /**\r\n * Loop through all players, check if player has a chest gui\r\n * if not create them one\r\n * Once all players are checked verify there are no false entities\r\n */\r\n if (getHeldItem(player)?.typeId != GUI_ITEM) {\r\n if (CHESTGUIS[player.name]) CHESTGUIS[player.name].despawn();\r\n continue;\r\n }\r\n // Player has a item Held we need to verify that they have a gui\r\n if (Object.keys(CHESTGUIS).includes(player?.name)) continue;\r\n // Player does not have a chest gui spawn them in one\r\n if (getRole(player) != \"admin\") continue;\r\n CHESTGUIS[player.name] = new ChestGUI(player);\r\n }\r\n}, 5);\r\n\r\nworld.events.beforeDataDrivenEntityTriggerEvent.subscribe((data) => {\r\n if (!(data.entity instanceof Player)) return;\r\n if (data.id == \"rubedo:has_container_open\") {\r\n CHEST_OPEN.set(data.entity, true);\r\n } else if (data.id == \"rubedo:dosent_have_container_open\") {\r\n CHEST_OPEN.set(data.entity, false);\r\n }\r\n});\r\n\r\n/**\r\n * This system will detect false entities and kill them to\r\n * reduce lag and eliminate broken/left players/entities\r\n */\r\nsystem.runSchedule(() => {\r\n const validIds = Object.values(CHESTGUIS).map((c) => c.entity.id);\r\n for (const entity of DIMENSIONS.overworld.getEntities({\r\n type: ENTITY_INVENTORY,\r\n })) {\r\n if (validIds.includes(entity.id)) continue;\r\n // This entity is not valid so we despawn it\r\n entity.triggerEvent(\"despawn\");\r\n }\r\n}, 100);\r\n", "/*\n|--------------------------------------------------------------------------\n| Gui item\n|--------------------------------------------------------------------------\n|\n| This is the GUI item that is used to open up the gui\n| this is set to the identifier of item.json and is used to find the item\n| in the gui template\n|\n*/\nexport const GUI_ITEM = \"rubedo:gui\";\n\n/*\n|--------------------------------------------------------------------------\n| Entity Inventory\n|--------------------------------------------------------------------------\n|\n| The id of the entity inventory\n| this is found in the entities file\n| this will be updated if inventory entity is changed\n|\n*/\nexport const ENTITY_INVENTORY = \"rubedo:inventory\";\n\n/*\n|--------------------------------------------------------------------------\n| Default Static Page id\n|--------------------------------------------------------------------------\n|\n| This is the default static page id of what is open by default\n| when you click on the gui, this can be changed but it probably shouldn't\n| because static pages will need to be changed\n|\n*/\nexport const DEFAULT_STATIC_PAGE_ID = \"home\";\n", "import {\n world,\n Player,\n BlockLocation,\n MinecraftBlockTypes,\n Enchantment,\n GameMode,\n system,\n} from \"@minecraft/server\";\nimport type { ConfigType, ROLES } from \"../../types\";\nimport { TABLES } from \"../../lib/Database/tables\";\nimport { Region } from \"./modules/models/Region.js\";\nimport { ChangePlayerRoleTask } from \"./modules/models/Task\";\nimport type { IplayerTickRegister } from \"../../types\";\nimport { BANNED_BLOCKS, BANNED_ITEMS } from \"./config/moderation\";\nimport { ENCHANTMENTS } from \"./config/enchantments\";\nimport { APPEAL_LINK } from \"../../config/app\";\nimport { DIMENSIONS } from \"../../utils.js\";\n\n/**\n * Kicks a player\n * @param player player who should be kicked\n * @param message the message that should be show to player\n * @param onFail this needs to be used for loops to unregister\n */\nexport function kick(\n player: Player,\n message: Array = [],\n onFail?: () => void\n): void {\n if (isServerOwner(player)) {\n console.warn(`[WARNING]: TRIED TO KICK OWNER`);\n player.tell(`You have been tried to kick, but you cant!`);\n return onFail?.();\n }\n try {\n player.runCommandAsync(`kick @s \u00A7r${message.join(\"\\n\")}`);\n player.triggerEvent(\"kick\");\n } catch (error) {\n player.triggerEvent(\"kick\");\n if (!/\"statusCode\":-2147352576/.test(error)) return;\n // This function just tried to kick the owner\n if (onFail) onFail();\n }\n}\n\n/**\n * Gets the role of this player\n * @param player player to get role from\n * @example getRole(\"Smell of curry\")\n */\nexport function getRole(player: Player | string): keyof typeof ROLES {\n if (player instanceof Player) {\n return TABLES.roles.get(player.name) ?? \"member\";\n } else {\n return TABLES.roles.get(player) ?? \"member\";\n }\n}\n\n/**\n * Gets the role of this player sync, should be used in world load\n * @param player player to get role from\n * @example getRoleSync(\"Smell of curry\")\n */\nexport async function getRoleSync(\n player: Player | string\n): Promise {\n if (player instanceof Player) {\n return (await TABLES.roles.getSync(player.name)) ?? \"member\";\n } else {\n return (await TABLES.roles.getSync(player)) ?? \"member\";\n }\n}\n\n/**\n * Sets the role of this player\n * @example setRole(\"Smell of curry\", \"admin\")\n */\nexport function setRole(\n player: Player | string,\n value: keyof typeof ROLES\n): void {\n if (typeof player == \"string\") {\n // we need to create a task that will update the role for\n // that player when they join\n // also we need to set there db_role back\n TABLES.roles.set(player, value);\n /**\n * If the player is in the game just set it now\n * if they are not in the game we will need to create a task\n * to set there role when they join\n */\n const inGamePlayer = [...world.getPlayers()].find((p) => p.name == player);\n if (inGamePlayer) {\n inGamePlayer.setDynamicProperty(\"role\", value);\n } else {\n new ChangePlayerRoleTask(player, value);\n }\n } else {\n // just change both of them no need for task\n TABLES.roles.set(player.name, value);\n player.setDynamicProperty(\"role\", value);\n }\n}\n\n/**\n * Checks if a player is the owner of this world that was set using `/function`\n * @param player player to test\n * @returns if player is owner\n */\nexport function isServerOwner(player: Player): boolean {\n return world.getDynamicProperty(\"worldsOwner\") == player.id;\n}\n\n/**\n * Gets the server owner\n * @returns server owners id\n */\nexport function getServerOwner(): string | null {\n const id = world.getDynamicProperty(\"worldsOwner\") as string;\n if (!id || id == \"\") return null;\n return id;\n}\n\n/**\n * Gets the server owners name\n * @returns server owners name\n */\nexport function getServerOwnerName(): string | null {\n const ownerId = getServerOwner();\n if (!ownerId) return null;\n const ids = TABLES.ids.collection();\n return Object.keys(ids).find((key) => ids[key] === ownerId);\n}\n\n/**\n * Sets the server owner\n * @param player player to set the server owner too\n */\nexport function setServerOwner(player: Player) {\n if (!player) return world.setDynamicProperty(\"worldsOwner\", \"\");\n world.setDynamicProperty(\"worldsOwner\", player.id.toString());\n}\n\n/**\n * Checks if the server is locked down\n */\nexport function isLockedDown(): boolean {\n return (world.getDynamicProperty(\"isLockDown\") ?? false) as boolean;\n}\n\n/**\n * Sets the server's lock down status\n * @param val if the server is locked down or not\n */\nexport function setLockDown(val: boolean) {\n world.setDynamicProperty(\"isLockDown\", val);\n}\n\n/**\n * Sets Deny blocks at bottom of region every 5 mins\n */\nexport function loadRegionDenys() {\n for (const region of Region.getAllRegions()) {\n const loc1 = new BlockLocation(\n region.from.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.from.z\n );\n const loc2 = new BlockLocation(\n region.to.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.to.z\n );\n for (const blockLocation of loc1.blocksBetween(loc2)) {\n DIMENSIONS[region.dimensionId as keyof typeof DIMENSIONS]\n .getBlock(blockLocation)\n ?.setType(MinecraftBlockTypes.deny);\n }\n }\n}\n\n/**\n * Stores all the callbacks in an array\n */\nconst CALLBACKS: { [key: number]: IplayerTickRegister } = [];\n\n/**\n * Records the amount of times the forEachValidPlayer function is called\n * used to generate keys for callback\n */\nlet forEachValidPlayerCalls = 0;\n\n/**\n * Sends a callback for each player\n * @returns the key to disable this callback\n */\nexport function forEachValidPlayer(\n callback: (player: Player) => void,\n delay = 0\n): number {\n const key = forEachValidPlayerCalls;\n CALLBACKS[key] = {\n callback: callback,\n delay: delay,\n lastCall: 0,\n };\n forEachValidPlayerCalls = key + 1;\n return key;\n}\n\n/**\n * Sends a callback for each player\n * @returns the key to disable this callback\n */\nexport function clearForEachValidPlayer(key: number) {\n delete CALLBACKS[key];\n}\n\nsystem.runSchedule(async () => {\n const players = [...world.getPlayers()];\n for (const [i, player] of players.entries()) {\n if ([\"moderator\", \"admin\"].includes(await getRoleSync(player))) continue;\n for (const CALLBACK of Object.values(CALLBACKS)) {\n if (\n CALLBACK.delay != 0 &&\n system.currentTick - CALLBACK.lastCall < CALLBACK.delay\n )\n continue;\n CALLBACK.callback(player);\n if (i == players.length - 1) CALLBACK.lastCall = system.currentTick;\n }\n }\n});\n\n/**\n * Grabs config data from the database\n * @param id id to grab\n */\nexport function getConfigId(id: T): ConfigType[T] {\n switch (id) {\n case \"spam_config\":\n return (\n TABLES.config.get(\"spam_config\") ?? {\n repeatedMessages: true,\n zalgo: true,\n violationCount: 0,\n permMutePlayer: false,\n }\n );\n\n case \"cbe_config\":\n return (\n TABLES.config.get(\"cbe_config\") ?? {\n clearItem: true,\n violationCount: 0,\n banPlayer: false,\n canAddEnchantment: false,\n }\n );\n\n case \"gamemode_config\":\n return (\n TABLES.config.get(\"gamemode_config\") ?? {\n setToSurvival: true,\n clearPlayer: true,\n violationCount: 0,\n banPlayer: false,\n }\n );\n\n case \"nuker_data\":\n return (\n TABLES.config.get(\"nuker_data\") ?? {\n violationCount: 0,\n banPlayer: false,\n }\n );\n case \"banned_items\":\n return TABLES.config.get(\"banned_items\") ?? BANNED_ITEMS;\n case \"banned_blocks\":\n return TABLES.config.get(\"banned_blocks\") ?? BANNED_BLOCKS;\n case \"enchantments\":\n return TABLES.config.get(\"enchantments\") ?? ENCHANTMENTS;\n case \"appealLink\":\n return TABLES.config.get(\"appealLink\") ?? APPEAL_LINK;\n }\n}\n\n/**\n * Sets a config id\n * @param key key to set\n * @param value value to set key to\n */\nexport function setConfigId(\n key: T,\n value: ConfigType[T]\n) {\n TABLES.config.set(key, value);\n}\n\n/**\n * Gets the max level of a enchantment\n * @param enchantment enchantment to get\n * @returns max level\n * @example ```\n * getMaxLevel(MinecraftEnchantmentTypes.sharpness): 5\n * ```\n */\nexport function getMaxEnchantmentLevel(enchantment: Enchantment): number {\n const MAX_ENCHANTMENTS = getConfigId(\"enchantments\");\n return (\n MAX_ENCHANTMENTS[enchantment.type.id as keyof typeof ENCHANTMENTS] ??\n enchantment.type.maxLevel\n );\n}\n\n/**\n * Gets the Gamemode of a player\n * @param {Player} player player to get\n * @returns {keyof typeof GameMode}\n * @example if (getGamemode(player) == \"creative\") return;\n */\nexport function getGamemode(player: Player): keyof typeof GameMode {\n return Object.values(GameMode).find(\n (g) => [...world.getPlayers({ name: player.name, gameMode: g })].length\n );\n}\n", "import { BlockLocation, Entity, MinecraftBlockTypes } from \"@minecraft/server\";\nimport { DEFAULT_REGION_PERMISSIONS } from \"../../config/region\";\nimport { TABLES } from \"../../../../lib/Database/tables\";\nimport type { IRegionCords, IRegionPermissions } from \"../../../../types\";\nimport { loadRegionDenys } from \"../../utils.js\";\nimport { DIMENSIONS } from \"../../../../utils\";\n\n/**\n * Holds all regions in memory so its not grabbing them so much\n */\nexport let REGIONS: Array = [];\n\n/**\n * If the regions have been grabbed if not it will grab them and set this to true\n */\nlet REGIONS_HAVE_BEEN_GRABBED: boolean = false;\n\n/**\n * The Lowest Y value in minecraft\n */\nconst LOWEST_Y_VALUE: number = -64;\n\n/**\n * The HIGHEST Y value in minecraft\n */\nconst HIGHEST_Y_VALUE: number = 320;\n\n/**\n * Compare a array of numbers with 2 arrays\n * @param XYZa The first set of numbers\n * @param XYZb The second set of numbers\n * @param XYZc The set of numbers that should between the first and second set of numbers\n * @example betweenXYZ([1, 0, 1], [22, 81, 10], [19, 40, 6]));\n */\nfunction betweenXYZ(\n XYZa: [number, number, number],\n XYZb: [number, number, number],\n XYZc: [number, number, number]\n): boolean {\n return XYZc.every(\n (c, i) => c >= Math.min(XYZa[i], XYZb[i]) && c <= Math.max(XYZa[i], XYZb[i])\n );\n}\n\nexport class Region {\n dimensionId: string;\n from: IRegionCords;\n to: IRegionCords;\n key: string;\n permissions: IRegionPermissions;\n /**\n * Gets all regions\n */\n static async getAllRegionsSync(): Promise> {\n if (REGIONS_HAVE_BEEN_GRABBED) return REGIONS;\n const regions = (await TABLES.regions.valuesSync()).map(\n (region) =>\n new Region(\n region.from,\n region.to,\n region.dimensionId,\n region.permissions,\n region.key\n )\n );\n regions.forEach((r) => {\n REGIONS.push(r);\n });\n REGIONS_HAVE_BEEN_GRABBED = true;\n return regions;\n }\n\n static getAllRegions(): Array {\n if (REGIONS_HAVE_BEEN_GRABBED) return REGIONS;\n const regions = TABLES.regions\n .values()\n .map(\n (region) =>\n new Region(\n region.from,\n region.to,\n region.dimensionId,\n region.permissions,\n region.key\n )\n );\n regions.forEach((r) => {\n REGIONS.push(r);\n });\n REGIONS_HAVE_BEEN_GRABBED = true;\n return regions;\n }\n\n /**\n * Checks if a block location is in region\n */\n static blockLocationInRegion(\n blockLocation: BlockLocation,\n dimensionId: string\n ): Region | undefined {\n return this.getAllRegions().find(\n (region) =>\n region.dimensionId == dimensionId &&\n betweenXYZ(\n [region.from.x, LOWEST_Y_VALUE, region.from.z],\n [region.to.x, HIGHEST_Y_VALUE, region.to.z],\n [blockLocation.x, blockLocation.y, blockLocation.z]\n )\n );\n }\n\n /**\n * Checks if a block location is in region\n */\n static async blockLocationInRegionSync(\n blockLocation: BlockLocation,\n dimensionId: string\n ): Promise {\n return (await this.getAllRegionsSync()).find(\n (region) =>\n region.dimensionId == dimensionId &&\n betweenXYZ(\n [region.from.x, LOWEST_Y_VALUE, region.from.z],\n [region.to.x, HIGHEST_Y_VALUE, region.to.z],\n [blockLocation.x, blockLocation.y, blockLocation.z]\n )\n );\n }\n\n /**\n * Removes a region at a block Location\n * @param dimensionId the id of this dimension\n * @returns if the region was removed or not\n */\n static async removeRegionAtBlockLocation(\n blockLocation: BlockLocation,\n dimensionId: string\n ): Promise {\n const region = this.blockLocationInRegion(blockLocation, dimensionId);\n if (!region) return false;\n return await TABLES.regions.delete(region.key);\n }\n /**\n * Creates a new Region to store in db\n */\n constructor(\n from: IRegionCords,\n to: IRegionCords,\n dimensionId: string,\n permissions?: IRegionPermissions,\n key?: string\n ) {\n this.from = from;\n this.to = to;\n this.dimensionId = dimensionId;\n this.permissions = permissions ?? DEFAULT_REGION_PERMISSIONS;\n this.key = key ? key : Date.now().toString();\n\n if (!key) {\n this.update().then(() => {\n loadRegionDenys();\n REGIONS.push(this);\n });\n }\n }\n\n /**\n * Updates this region in the database\n */\n async update(): Promise {\n return await TABLES.regions.set(this.key, {\n key: this.key,\n from: this.from,\n dimensionId: this.dimensionId,\n permissions: this.permissions,\n to: this.to,\n });\n }\n\n /**\n * removes this region\n * @returns if the region was removed successfully\n */\n async delete(): Promise {\n const region = TABLES.regions.get(this.key);\n const loc1 = new BlockLocation(\n region.from.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.from.z\n );\n const loc2 = new BlockLocation(\n region.to.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.to.z\n );\n for (const blockLocation of loc1.blocksBetween(loc2)) {\n DIMENSIONS[region.dimensionId as keyof typeof DIMENSIONS]\n .getBlock(blockLocation)\n ?.setType(MinecraftBlockTypes.bedrock);\n }\n REGIONS = REGIONS.filter((r) => r.key != this.key);\n return TABLES.regions.delete(this.key);\n }\n\n /**\n * Checks if a player is in this region\n * @returns if a entity is in this region or not\n */\n entityInRegion(entity: Entity): Boolean {\n return (\n this.dimensionId == entity.dimension.id &&\n betweenXYZ(\n [this.from.x, LOWEST_Y_VALUE, this.from.z],\n [this.to.x, HIGHEST_Y_VALUE, this.to.z],\n [entity.location.x, entity.location.y, entity.location.z]\n )\n );\n }\n\n /**\n * Changes a permission to on or off\n */\n changePermission(\n key: T,\n value: IRegionPermissions[T]\n ): void {\n this.permissions[key] = value;\n this.update();\n }\n}\n", "/**\n * The default permissions for all regions made\n */\nexport const DEFAULT_REGION_PERMISSIONS = {\n /**\n * If players in this region can use doors, trapdoors, and switches like buttons and levers\n */\n doorsAndSwitches: true,\n /**\n * If players in this region can open containers, this is like chests, furnaces, hoppers, etc\n */\n openContainers: true,\n /**\n * If the players in this region can fight each other\n */\n pvp: false,\n /**\n * the entities allowed in this region\n */\n allowedEntities: [\n \"minecraft:player\",\n \"minecraft:npc\",\n \"minecraft:item\",\n \"rubedo:inventory\",\n \"rubedo:database\",\n ],\n};\n\n/**\n * All doors and switches in minecraft\n */\nexport const DOORS_SWITCHES = [\n \"minecraft:acacia_door\",\n \"minecraft:acacia_trapdoor\",\n \"minecraft:acacia_button\",\n \"minecraft:birch_door\",\n \"minecraft:birch_trapdoor\",\n \"minecraft:birch_button\",\n \"minecraft:crimson_door\",\n \"minecraft:crimson_trapdoor\",\n \"minecraft:crimson_button\",\n \"minecraft:dark_oak_door\",\n \"minecraft:dark_oak_trapdoor\",\n \"minecraft:dark_oak_button\",\n \"minecraft:jungle_door\",\n \"minecraft:jungle_trapdoor\",\n \"minecraft:jungle_button\",\n \"minecraft:mangrove_door\",\n \"minecraft:mangrove_trapdoor\",\n \"minecraft:mangrove_button\",\n \"minecraft:spruce_door\",\n \"minecraft:spruce_trapdoor\",\n \"minecraft:spruce_button\",\n \"minecraft:warped_door\",\n \"minecraft:warped_trapdoor\",\n \"minecraft:warped_button\",\n \"minecraft:wooden_door\",\n \"minecraft:wooden_button\",\n \"minecraft:trapdoor\",\n \"minecraft:iron_door\",\n \"minecraft:iron_trapdoor\",\n \"minecraft:polished_blackstone_button\",\n \"minecraft:lever\",\n];\n\n/**\n * A List of all containers a item could be in\n */\nexport const BLOCK_CONTAINERS = [\n \"minecraft:chest\",\n \"minecraft:ender_chest\",\n \"minecraft:barrel\",\n \"minecraft:trapped_chest\",\n \"minecraft:dispenser\",\n \"minecraft:dropper\",\n \"minecraft:furnace\",\n \"minecraft:blast_furnace\",\n \"minecraft:lit_furnace\",\n \"minecraft:lit_blast_furnace\",\n \"minecraft:hopper\",\n \"minecraft:shulker_box\",\n \"minecraft:undyed_shulker_box\",\n \"minecraft:lit_smoker\",\n \"minecraft:smoker\",\n];\n", "import type { ROLES } from \"../../../../types\";\r\nimport { TABLES } from \"../../../../lib/Database/tables\";\r\nimport type { IChangePlayerRoleData } from \"../../../../types\";\r\n\r\nexport class ChangePlayerRoleTask {\r\n /**\r\n * The name of the player\r\n */\r\n playerName: string;\r\n /**\r\n * The role that the player should be set to\r\n */\r\n role: keyof typeof ROLES;\r\n\r\n /**\r\n * gets all tasks that are present\r\n * @returns all tasks\r\n */\r\n static getTasks(): Array {\r\n return TABLES.tasks.get(\"changePlayerRole\") ?? [];\r\n }\r\n\r\n /**\r\n * Gets the role this player needs to be set to\r\n * @param playerName name\r\n */\r\n static getPlayersRoleToSet(playerName: string): keyof typeof ROLES | null {\r\n const tasks = ChangePlayerRoleTask.getTasks();\r\n return tasks.find((t) => t.playerName == playerName)?.role;\r\n }\r\n\r\n constructor(playerName: string, role: keyof typeof ROLES) {\r\n let tasks = ChangePlayerRoleTask.getTasks();\r\n tasks.push({ playerName: playerName, role: role });\r\n TABLES.tasks.set(\"changePlayerRole\", tasks);\r\n }\r\n}\r\n", "import { MinecraftBlockTypes, MinecraftItemTypes } from \"@minecraft/server\";\n\n/**\n * Items that simply get removed from inventory but will not ban\n */\nexport const FORBIDDEN_ITEMS = [\n // Common CBE Items\n MinecraftItemTypes.beehive.id,\n MinecraftItemTypes.beeNest.id,\n MinecraftItemTypes.axolotlBucket.id,\n MinecraftItemTypes.codBucket.id,\n MinecraftItemTypes.tadpoleBucket.id,\n MinecraftItemTypes.tropicalFishBucket.id,\n MinecraftItemTypes.salmonBucket.id,\n MinecraftItemTypes.pufferfishBucket.id,\n];\n\n/**\n * List of items that if you hold you will be automatically banned\n */\nexport const BANNED_ITEMS = [\n // Op Only Items\n MinecraftItemTypes.allow.id,\n MinecraftItemTypes.barrier.id,\n MinecraftItemTypes.borderBlock.id,\n MinecraftItemTypes.debugStick?.id ?? \"minecraft:debug_stick\",\n MinecraftItemTypes.deny.id,\n MinecraftItemTypes.jigsaw.id,\n MinecraftItemTypes.lightBlock.id,\n MinecraftItemTypes.commandBlock.id,\n MinecraftItemTypes.repeatingCommandBlock.id,\n MinecraftItemTypes.chainCommandBlock.id,\n MinecraftItemTypes.commandBlockMinecart.id,\n MinecraftItemTypes.structureBlock.id,\n MinecraftItemTypes.structureVoid.id,\n\n // Not Normal Items\n MinecraftItemTypes.bedrock.id,\n MinecraftItemTypes.endPortalFrame.id,\n\n // Server Movement Blocks\n \"minecraft:info_update\",\n \"minecraft:info_update2\",\n \"minecraft:reserved3\",\n \"minecraft:reserved4\",\n \"minecraft:reserved6\",\n \"minecraft:movingBlock\",\n \"minecraft:moving_block\",\n \"minecraft:movingblock\",\n \"minecraft:piston_arm_collision\",\n \"minecraft:piston_arm_collision\",\n \"minecraft:pistonarmcollision\",\n \"minecraft:stickyPistonArmCollision\",\n \"minecraft:sticky_piston_arm_collision\",\n \"minecraft:unknown\",\n\n // Common Hacked Items\n \"minecraft:glowingobsidian\",\n \"minecraft:invisible_bedrock\",\n \"minecraft:invisiblebedrock\",\n \"minecraft:netherreactor\",\n \"minecraft:portal\",\n \"minecraft:fire\",\n \"minecraft:water\",\n \"minecraft:lava\",\n \"minecraft:flowing_lava\",\n \"minecraft:flowing_water\",\n \"minecraft:soul_fire\",\n];\n\n/**\n * Blocks in this list are forbidden from being placed but will not ban the placer\n */\nexport const FORBIDDEN_BLOCKS = [\n // Common CBE Blocks\n MinecraftBlockTypes.dispenser.id,\n];\n\n/**\n * List of blocks that cannot be placed down\n */\nexport const BANNED_BLOCKS = [\n // Should Not be Placed\n MinecraftBlockTypes.bedrock.id,\n MinecraftBlockTypes.barrier.id,\n \"minecraft:invisiblebedrock\",\n \"minecraft:movingBlock\",\n \"minecraft:movingblock\",\n \"minecraft:moving_block\",\n];\n\n/**\n * The currently supported block containers by script api\n */\nexport const API_CONTAINERS = [\n MinecraftBlockTypes.chest.id,\n MinecraftBlockTypes.trappedChest.id,\n];\n\n/**\n * A List of containers\n */\nexport const CONTAINERS = [\n MinecraftItemTypes.chest.id,\n MinecraftItemTypes.trappedChest.id,\n MinecraftItemTypes.barrel.id,\n MinecraftItemTypes.dispenser.id,\n MinecraftItemTypes.dropper.id,\n MinecraftItemTypes.furnace.id,\n \"minecraft:lit_furnace\",\n MinecraftItemTypes.blastFurnace.id,\n \"minecraft:lit_blast_furnace\",\n MinecraftItemTypes.smoker.id,\n \"minecraft:lit_smoker\",\n MinecraftItemTypes.hopper.id,\n MinecraftItemTypes.shulkerBox.id,\n MinecraftItemTypes.undyedShulkerBox.id,\n];\n\n/**\n * The block size to check for blockContainers\n */\nexport const CHECK_SIZE = { x: 7, y: 7, z: 7 };\n", "/*\n|--------------------------------------------------------------------------\n| Enchantments\n|--------------------------------------------------------------------------\n|\n| This is the default enchantments that can be added to items\n| each enchantment is set to its desired max level this can be changed here\n| or in game using -config enchantments set \"enchantment\" value\n|\n*/\nexport const ENCHANTMENTS = {\n aquaAffinity: 1,\n baneOfArthropods: 5,\n binding: 1,\n blastProtection: 4,\n channeling: 1,\n depthStrider: 3,\n efficiency: 5,\n featherFalling: 4,\n fireAspect: 2,\n fireProtection: 4,\n flame: 1,\n fortune: 3,\n frostWalker: 2,\n impaling: 5,\n infinity: 1,\n knockback: 2,\n looting: 3,\n loyalty: 4,\n luckOfTheSea: 3,\n lure: 3,\n mending: 1,\n multishot: 1,\n piercing: 4,\n power: 5,\n projectileProtection: 4,\n protection: 4,\n punch: 2,\n quickCharge: 3,\n respiration: 3,\n riptide: 3,\n sharpness: 5,\n silkTouch: 1,\n smite: 5,\n soulSpeed: 3,\n swiftSneak: 4,\n thorns: 3,\n unbreaking: 3,\n vanishing: 1,\n};\n", "/*\r\n|--------------------------------------------------------------------------\r\n| Version\r\n|--------------------------------------------------------------------------\r\n|\r\n| This is the version of rubedo recommended to NOT CHANGE could cause bugs.\r\n|\r\n*/\r\nexport const VERSION = \"2.6.2-beta\";\r\n\r\n/*\r\n|--------------------------------------------------------------------------\r\n| Game Version\r\n|--------------------------------------------------------------------------\r\n|\r\n| This is the version of minecraft that this version of rubedo\r\n| was made for its a simple constant to tell creators what version\r\n| this gametest api is supposed to work perfectly for.\r\n|\r\n*/\r\nexport const GAME_VERSION = \"1.19.50\";\r\n\r\n/*\r\n|--------------------------------------------------------------------------\r\n| Appeal Link\r\n|--------------------------------------------------------------------------\r\n|\r\n| This is the appeal link that gets showed when someone gets banned\r\n| this link pops up at the bottom of the ban message to show\r\n| where they can appeal there ban.\r\n|\r\n*/\r\nexport const APPEAL_LINK = \"https://discord.gg/dMa3A5UYKX\";\r\n", "import { Entity, Player, world } from \"@minecraft/server\";\r\nimport { AIR } from \"../../../index.js\";\r\nimport { ENTITY_INVENTORY } from \"../../../config/chest\";\r\nimport {\r\n ISlotChangeReturn,\r\n onEntityInventorySlotChange,\r\n} from \"../../Events/onSlotChange\";\r\nimport {\r\n CHESTGUIS,\r\n CHEST_OPEN,\r\n clearPlayersPointer,\r\n getItemAtSlot,\r\n PAGES,\r\n} from \"../utils.js\";\r\nimport { ItemGrabbedCallback } from \"./ItemGrabbedCallback\";\r\nimport { ISlot, Page } from \"./Page.js\";\r\n\r\nexport class ChestGUI {\r\n /**\r\n * The connected player to this gui\r\n */\r\n player: Player;\r\n /**\r\n * The entity that this chest gui is associated to\r\n */\r\n entity: Entity;\r\n /**\r\n * The event that is registered on this gui\r\n */\r\n tickEvent: any;\r\n\r\n /**\r\n * The page that this gui is currently viewing\r\n */\r\n page: Page;\r\n\r\n /**\r\n * The event that is used to test for changes in inventory\r\n */\r\n slotChangeEvent: number;\r\n\r\n /**\r\n * if the player has a chest open\r\n */\r\n hasChestOpen: boolean;\r\n\r\n /**\r\n * Spawns a entity to be attached to the player\r\n * @param player player this entity will be attached to\r\n */\r\n static spawnEntity(player: Player): Entity {\r\n try {\r\n return player.dimension.spawnEntity(\r\n ENTITY_INVENTORY,\r\n player.headLocation\r\n );\r\n } catch (error) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Links a new chest gui to a player\r\n * @param player player to link\r\n */\r\n constructor(player: Player) {\r\n this.player = player;\r\n this.entity = ChestGUI.spawnEntity(player);\r\n if (this.entity) {\r\n this.hasChestOpen = false;\r\n this.setPage(\"home\");\r\n }\r\n this.tickEvent = world.events.tick.subscribe(() => {\r\n if (!this.entity) return this.despawn();\r\n if (CHEST_OPEN.get(this.player)) {\r\n if (!this.hasChestOpen) {\r\n // Player has this inventory open run checks for changes\r\n this.slotChangeEvent = onEntityInventorySlotChange.subscribe(\r\n { type: ENTITY_INVENTORY },\r\n (entity, change) => {\r\n if (entity.id != this.entity.id) return;\r\n this.onSlotChange(change);\r\n }\r\n );\r\n }\r\n this.hasChestOpen = true;\r\n } else {\r\n // Player does not have inventory open but item is held\r\n try {\r\n this.entity.teleport(\r\n this.player.headLocation,\r\n this.player.dimension,\r\n this.player.rotation.x,\r\n this.player.rotation.y,\r\n true\r\n );\r\n } catch (error) {\r\n this.despawn();\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Sets this gui to a page of items\r\n * @param pageId page to set this gui too\r\n */\r\n setPage(pageId: string, extras?: any) {\r\n const c = this.entity.getComponent(\"inventory\").container;\r\n for (let i = 0; i < c.size; i++) {\r\n c.setItem(i, AIR);\r\n }\r\n if (!Object.keys(PAGES).includes(pageId))\r\n throw new Error(`pageId ${pageId} does not exist!`);\r\n const page = PAGES[pageId];\r\n this.page = page;\r\n\r\n page.fillType(this.entity, page, extras);\r\n this.entity.nameTag = `size:54`;\r\n }\r\n\r\n /**\r\n * This runs when a slot gets changed in the chest inventory\r\n */\r\n onSlotChange(change: ISlotChangeReturn) {\r\n /**\r\n * The guiItem that was changed\r\n */\r\n const slot: ISlot = this.page.slots[change.slot];\r\n\r\n if (!slot) {\r\n // item was added to page that is not a valid slot so set that slot back to air\r\n this.entity.getComponent(\"inventory\").container.setItem(change.slot, AIR);\r\n } else if (change.changeType == \"delete\") {\r\n // item was taken from this page\r\n if (slot.item) clearPlayersPointer(this.player, change.item);\r\n /**\r\n * if the slot has a item that returns when something is grabbed, this checks\r\n * if there is a item put into the slot to return, if not it will not send a\r\n * callback by returning before\r\n */\r\n if (!slot.item && !getItemAtSlot(this.entity, change.slot)) return;\r\n slot.action(new ItemGrabbedCallback(this, slot, change));\r\n }\r\n }\r\n\r\n /**\r\n * Deletes this gui and despawn its entity\r\n */\r\n despawn() {\r\n try {\r\n this.entity?.triggerEvent(\"despawn\");\r\n } catch (error) {}\r\n try {\r\n delete CHESTGUIS[this.player.name];\r\n } catch (error) {}\r\n if (this.tickEvent) world.events.tick.unsubscribe(this.tickEvent);\r\n if (this.slotChangeEvent)\r\n onEntityInventorySlotChange.unsubscribe(this.slotChangeEvent);\r\n }\r\n}\r\n", "import {\r\n Entity,\r\n EntityQueryOptions,\r\n ItemStack,\r\n PlayerInventoryComponentContainer,\r\n system,\r\n} from \"@minecraft/server\";\r\nimport { DIMENSIONS } from \"../../utils.js\";\r\n\r\ntype onSlotChangeCallback = (entity: Entity, change: ISlotChangeReturn) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: onSlotChangeCallback;\r\n entities: EntityQueryOptions;\r\n };\r\n} = {};\r\n\r\nconst MAPPED_INVENTORIES: { [key: string]: Array } = {};\r\nexport const PREVIOUS_CHANGE: { [key: string]: ISlotChangeReturn } = {};\r\n\r\nexport interface ISlotChangeReturn {\r\n /**\r\n * Slot that changed\r\n */\r\n slot: number;\r\n /**\r\n * The uid of this item\r\n */\r\n uid: string;\r\n /**\r\n * The old uid of this item\r\n */\r\n oldUid?: string;\r\n /**\r\n * the item that was grabbed / put\r\n */\r\n item: ItemStack;\r\n /**\r\n * The old itemStack that was in this slot\r\n */\r\n oldItem?: ItemStack;\r\n /**\r\n * How the inventory has changed\r\n */\r\n changeType: \"delete\" | \"put\" | \"swap\" | \"fluctuation\" | \"move\";\r\n}\r\n\r\ninterface IMappedInventoryItem {\r\n /**\r\n * a unique id for a itemStack\r\n */\r\n uid: string;\r\n /**\r\n * the item\r\n */\r\n item: ItemStack;\r\n}\r\n\r\n/**\r\n * Finds and returns a slot change in a inventory\r\n */\r\nfunction getSlotChanges(\r\n entity: Entity,\r\n oldInv: Array,\r\n newInv: Array\r\n): Array {\r\n if (oldInv.length != newInv.length) return [];\r\n const changes: Array = [];\r\n for (let i = 0; i < newInv.length; i++) {\r\n if (\r\n oldInv[i]?.item?.amount < newInv[i]?.item?.amount ||\r\n (oldInv[i]?.item?.amount > newInv[i]?.item?.amount &&\r\n oldInv[i]?.item?.amount != 0)\r\n ) {\r\n // Checks if the item is the same but checks if the amount has changed\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n oldUid: oldInv[i].uid,\r\n item: newInv[i].item,\r\n oldItem: oldInv[i].item,\r\n changeType: \"fluctuation\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n continue;\r\n }\r\n if (newInv[i].uid == oldInv[i].uid) continue; // no change\r\n if (oldInv[i]?.item && newInv[i]?.item) {\r\n // Checks if there was a new item but a new slot was not taken up\r\n // Meaning that the item got used like using a bucket on a cow\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n oldUid: oldInv[i].uid,\r\n item: newInv[i].item,\r\n oldItem: oldInv[i].item,\r\n changeType: \"swap\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n } else if (!newInv[i]?.item) {\r\n // There is no more item in this slot\r\n // Meaning the item has been moved across slots or been thrown out\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: oldInv[i].uid,\r\n item: oldInv[i].item,\r\n changeType: \"delete\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n } else if (newInv[i]?.item) {\r\n // New item has been added in this slot\r\n if (\r\n PREVIOUS_CHANGE[entity.id]?.changeType == \"delete\" &&\r\n PREVIOUS_CHANGE[entity.id]?.uid == newInv[i].uid\r\n ) {\r\n // item has been moved across slots\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n item: newInv[i].item,\r\n changeType: \"move\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n continue;\r\n } else {\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n item: newInv[i].item,\r\n changeType: \"put\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n }\r\n }\r\n }\r\n return changes;\r\n}\r\n\r\n/**\r\n * Converts a itemStack to a unique id\r\n * @param {ItemStack} item\r\n * @returns {string}\r\n */\r\nexport function getItemUid(item: ItemStack): string {\r\n if (!item) return \"\";\r\n const data = [];\r\n data.push(item.typeId);\r\n data.push(item.nameTag);\r\n data.push(item.data);\r\n data.push(item.getLore().join(\"\"));\r\n return data.join(\"\");\r\n}\r\n\r\n/**\r\n * Gets an entity's inventory but with mapped data\r\n */\r\nfunction mapInventory(\r\n container: PlayerInventoryComponentContainer\r\n): Array {\r\n const inventory = [];\r\n\r\n for (let i = 0; i < container.size; i++) {\r\n let item = container.getItem(i);\r\n inventory[i] = {\r\n uid: getItemUid(item),\r\n item: item,\r\n };\r\n }\r\n return inventory;\r\n}\r\n\r\nsystem.runSchedule(() => {\r\n for (const callback of Object.values(CALLBACKS)) {\r\n for (const entity of DIMENSIONS.overworld.getEntities(callback.entities)) {\r\n const inventory = mapInventory(\r\n entity.getComponent(\"inventory\").container\r\n );\r\n const changes = getSlotChanges(\r\n entity,\r\n MAPPED_INVENTORIES[entity.id] ?? inventory,\r\n inventory\r\n );\r\n MAPPED_INVENTORIES[entity.id] = inventory;\r\n if (changes.length == 0) continue;\r\n if (entity.hasTag(\"skipCheck\")) {\r\n entity.removeTag(\"skipCheck\");\r\n delete PREVIOUS_CHANGE[entity.id];\r\n continue;\r\n }\r\n for (const change of changes) {\r\n callback.callback(entity, change);\r\n }\r\n }\r\n }\r\n}, 5);\r\n\r\nexport class onEntityInventorySlotChange {\r\n /**\r\n * Subscribes to a callback to get notified when a entities inventory changes\r\n * @param callback what to be called when one of these entities inventory's changes\r\n * @param entities the entity's to grab from\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(\r\n entities: EntityQueryOptions,\r\n callback: onSlotChangeCallback\r\n ): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback, entities: entities };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n}\r\n", "import { Entity, ItemStack, Location, Player } from \"@minecraft/server\";\r\nimport { PlayerLog } from \"../../plugins/Anti-Cheat/modules/models/PlayerLog\";\r\nimport type { ChestGUI } from \"./Models/EntityChest\";\r\nimport type { Page } from \"./Models/Page\";\r\n\r\n/**\r\n * This will link a players name to a chest gui instance\r\n */\r\nexport const CHESTGUIS: { [key: string]: ChestGUI } = {};\r\n\r\n/**\r\n * This will link a players name to a chest gui instance\r\n */\r\nexport const PAGES: { [key: string]: Page } = {};\r\n\r\n/**\r\n * This will keep track if a player has a chest open\r\n */\r\nexport const CHEST_OPEN = new PlayerLog();\r\n\r\n/**\r\n * Gets a players held item\r\n */\r\nexport function getHeldItem(player: Player): ItemStack {\r\n const inventory = player.getComponent(\"minecraft:inventory\").container;\r\n return inventory.getItem(player.selectedSlot);\r\n}\r\n\r\n/**\r\n * Clears the player of a item in there pointer slot\r\n */\r\nexport async function clearPlayersPointer(\r\n player: Player,\r\n ItemToClear: ItemStack\r\n) {\r\n try {\r\n const inventory = player.getComponent(\"minecraft:inventory\").container;\r\n let itemsToLoad = [];\r\n for (let i = 0; i < inventory.size; i++) {\r\n const item = inventory.getItem(i);\r\n if (!item) continue;\r\n if (item?.typeId == ItemToClear?.typeId) {\r\n itemsToLoad.push({ slot: i, item: item });\r\n inventory.setItem;\r\n if (i < 9) {\r\n await player.runCommandAsync(\r\n `replaceitem entity @s slot.hotbar ${i} air`\r\n );\r\n } else {\r\n await player.runCommandAsync(\r\n `replaceitem entity @s slot.inventory ${i - 9} air`\r\n );\r\n }\r\n }\r\n }\r\n await player.runCommandAsync(\r\n `clear @s ${ItemToClear?.typeId} ${ItemToClear.data} ${ItemToClear.amount}`\r\n );\r\n for (const item of itemsToLoad) {\r\n inventory.setItem(item.slot, item.item);\r\n }\r\n } catch (error) {\r\n // the item couldn't be cleared that means\r\n // they now have a item witch is really BAD\r\n [\r\n ...player.dimension.getEntities({\r\n type: \"minecraft:item\",\r\n location: new Location(\r\n player.location.x,\r\n player.location.y,\r\n player.location.z\r\n ),\r\n maxDistance: 2,\r\n closest: 1,\r\n }),\r\n ].forEach((e) => e.kill());\r\n }\r\n}\r\n\r\n/**\r\n * Gets an item at slot\r\n */\r\nexport function getItemAtSlot(entity: Entity, slot: number): ItemStack | null {\r\n const inventory = entity.getComponent(\"minecraft:inventory\").container;\r\n return inventory.getItem(slot);\r\n}\r\n", "import { Player, world } from \"@minecraft/server\";\n\nexport class PlayerLog {\n data: Map;\n events: Object;\n\n constructor() {\n this.data = new Map();\n this.events = {\n playerLeave: world.events.playerLeave.subscribe((data) =>\n this.data.delete(data.playerName)\n ),\n };\n }\n\n /**\n * Logs a player to a value\n */\n set(player: Player, value: T): void {\n this.data.set(player.name, value);\n }\n\n /**\n * Gets a players value\n */\n get(player: Player): T | undefined {\n return this.data.get(player.name);\n }\n\n /**\n * Deletes a player from log\n */\n delete(player: Player) {\n this.data.delete(player.name);\n }\n\n /**\n * Clears this Player log\n */\n clear() {\n this.data.clear();\n }\n\n /**\n * Gets all the players in the log\n */\n playerNames(): Array {\n return [...this.data.keys()];\n }\n\n /**\n * Checks to see if a player is in this list\n * @param player player to check\n * @returns\n */\n includes(player: Player): boolean {\n return this.playerNames().includes(player.name);\n }\n}\n", "import {\n ActionFormData,\n MessageFormData,\n ModalFormData,\n ActionFormResponse,\n ModalFormResponse,\n MessageFormResponse,\n} from \"@minecraft/server-ui\";\nimport { ChestGUI } from \"./EntityChest\";\nimport { ItemStack } from \"@minecraft/server\";\nimport { ItemDatabase } from \"../database/Item\";\nimport type { ISlot } from \"./Page\";\nimport type { ISlotChangeReturn } from \"../../Events/onSlotChange\";\nimport { sleep } from \"../../../utils\";\n\ntype FormActionReturn = T extends ActionFormData\n ? Promise\n : T extends ModalFormData\n ? Promise\n : Promise;\n\nexport class ItemGrabbedCallback {\n gui: ChestGUI;\n slot: ISlot;\n change: ISlotChangeReturn;\n /**\n * New Callback\n */\n constructor(gui: ChestGUI, slot: ISlot, change: ISlotChangeReturn) {\n this.gui = gui;\n this.slot = slot;\n this.change = change;\n }\n\n /**\n * Messages to the owner of this gui\n * @example ctx.reply('Hello World!');\n */\n message(text: string) {\n this.gui.player.tell(text);\n }\n\n /**\n * Gets the item added\n */\n getItemAdded(): ItemStack | null {\n if (this.slot.item) return null;\n return this.gui.entity\n .getComponent(\"minecraft:inventory\")\n .container.getItem(this.change.slot);\n }\n\n /**\n * Gives the player the item the grabbed\n */\n GiveAction(item: ItemStack = this.slot.item.itemStack) {\n this.gui.player.getComponent(\"minecraft:inventory\").container.addItem(item);\n }\n\n /**\n * Gives the player the item that was grabbed also removes this item from the gui + db\n * @param db the item database to remove this item from\n */\n TakeAction(db: ItemDatabase = null) {\n this.gui.player\n .getComponent(\"minecraft:inventory\")\n .container.addItem(this.slot.item.itemStack);\n this.gui.page.slots[this.change.slot] = null;\n if (!db) return;\n db.delete(this.slot.item.components.dbKey);\n }\n\n /**\n * Changes the page of the chestGui when this item is grabbed\n * @param page page to send to\n * @param extras stuff to be passed onto the page\n */\n PageAction(page: string, extras?: any) {\n this.gui.setPage(page, extras);\n }\n\n /**\n * Closes the chest GUI when this item is grabbed\n */\n CloseAction() {\n this.gui.despawn();\n }\n\n /**\n * Sets the item back\n */\n SetAction() {\n const container = this.gui.entity.getComponent(\n \"minecraft:inventory\"\n ).container;\n container.setItem(this.change.slot, this.slot.item.itemStack);\n }\n\n /**\n * Opens a form to the player\n * @param {ActionFormData | ModalFormData | MessageFormData} form form to load\n * @returns {Promise}\n */\n async FormAction(\n form: T\n ): Promise> {\n this.CloseAction();\n await sleep(5);\n // @ts-ignore\n return await form.show(this.gui.player);\n }\n}\n", "import {\r\n Enchantment,\r\n EnchantmentList,\r\n ItemStack,\r\n ItemType,\r\n} from \"@minecraft/server\";\r\n\r\ninterface IPageItemComponents {\r\n /**\r\n * Number of the items in the stack. Valid values range between 0 and 64.\r\n */\r\n amount?: number;\r\n /**\r\n * A data value used to configure alternate states of the item.\r\n */\r\n data?: number;\r\n /**\r\n * Given name of this stack of items.\r\n */\r\n nameTag?: string;\r\n /**\r\n * a secondary display string - for an ItemStack.\r\n */\r\n loreList?: string[];\r\n /**\r\n * a collection of the enchantments on this item\r\n */\r\n enchantments?: Enchantment[];\r\n /**\r\n * A key that could be on this item, meaning its connect to database\r\n */\r\n dbKey?: string;\r\n}\r\n\r\nexport class PageItem {\r\n /**\r\n * The item type this item has\r\n */\r\n itemType: ItemType;\r\n /**\r\n * The components that this item\r\n * this stores information such as data, enchantments etc\r\n */\r\n components: IPageItemComponents;\r\n\r\n /**\r\n * The itemStack that was set at item creation\r\n */\r\n setItemStack: ItemStack | null;\r\n\r\n constructor(\r\n itemType: ItemType,\r\n components: IPageItemComponents = {},\r\n itemStack?: ItemStack\r\n ) {\r\n this.itemType = itemType;\r\n this.components = components;\r\n this.setItemStack = itemStack;\r\n }\r\n /**\r\n * gets itemStack that this PageItem is associated with\r\n */\r\n get itemStack(): ItemStack {\r\n if (this.setItemStack) return this.setItemStack;\r\n const itemStack = new ItemStack(this.itemType);\r\n if (this.components) {\r\n itemStack.amount = this.components?.amount ?? 1;\r\n itemStack.data = this.components?.data ?? 0;\r\n itemStack.nameTag = this.components?.nameTag;\r\n itemStack.setLore(this.components?.loreList ?? []);\r\n const enchantments: EnchantmentList =\r\n itemStack.getComponent(\"enchantments\").enchantments;\r\n for (const enchantment of this.components?.enchantments ?? []) {\r\n enchantments.addEnchantment(enchantment);\r\n }\r\n itemStack.getComponent(\"enchantments\").enchantments = enchantments;\r\n }\r\n return itemStack;\r\n }\r\n}\r\n", "import { Entity } from \"@minecraft/server\";\nimport { AIR } from \"../../../index.js\";\nimport { Page } from \"./Page.js\";\n\nexport type FillTypeCallback = (\n entity: Entity,\n page: Page,\n extras: any\n) => void;\n\n/**\n * Fills a entity with desired items\n */\nexport function DefaultFill(entity: Entity, page: Page, extras: any) {\n const container = entity.getComponent(\"minecraft:inventory\").container;\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n}\n", "import { PAGES } from \"../utils.js\";\r\nimport { DefaultFill, FillTypeCallback } from \"./FillTypes\";\r\nimport { ItemGrabbedCallback } from \"./ItemGrabbedCallback.js\";\r\nimport type { PageItem } from \"./PageItem\";\r\n\r\nexport interface ISlot {\r\n /**\r\n * The item that should be in this slot\r\n */\r\n item: PageItem;\r\n /**\r\n * What happens when there is a change in this slot\r\n */\r\n action: (ctx: ItemGrabbedCallback) => void;\r\n}\r\n\r\nexport class Page {\r\n /**\r\n * The id this page has\r\n */\r\n id: string;\r\n /**\r\n * How this page fills, these can be custom or kept default\r\n */\r\n fillType: FillTypeCallback;\r\n\r\n /**\r\n * The slots in this gui\r\n */\r\n slots: ISlot[];\r\n\r\n constructor(id: string, fillType: FillTypeCallback = DefaultFill) {\r\n if (Object.keys(PAGES).includes(id))\r\n throw new Error(`Page: ${id}, Already exists!`);\r\n this.id = id;\r\n this.fillType = fillType;\r\n this.slots = [];\r\n PAGES[id] = this;\r\n }\r\n\r\n /**\r\n * Sets slots in this page\r\n */\r\n setSlots(\r\n slot: Array,\r\n item: PageItem,\r\n action: (ctx: ItemGrabbedCallback) => void\r\n ): Page {\r\n const data = item ? { item: item, action: action } : null;\r\n for (const i of slot) {\r\n this.slots[i] = data;\r\n }\r\n return this;\r\n }\r\n}\r\n", "import { PageItem } from \"../Models/PageItem.js\";\r\nimport { Page } from \"../Models/Page.js\";\r\nimport { MinecraftItemTypes } from \"@minecraft/server\";\r\n\r\n/**\r\n * The Home page of this GUI this is the most important because\r\n * when the GUI is opened it will open up here, any plugin can\r\n * change this but this is the default screen\r\n */\r\nexport let HOME_PAGE = new Page(\"home\")\r\n .setSlots(\r\n [22],\r\n new PageItem(MinecraftItemTypes.enderChest, {\r\n nameTag: \"\u00A7l\u00A7bInventory Viewer\",\r\n }),\r\n (ctx) => {\r\n ctx.PageAction(\"moderation:see\");\r\n }\r\n )\r\n .setSlots(\r\n [54],\r\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\r\n (ctx) => {\r\n ctx.CloseAction();\r\n }\r\n );\r\n", "import type { Protection } from \"./modules/models/Protection\";\r\n\r\n/**\r\n * All protections in this anti-cheat\r\n */\r\nexport const PROTECTIONS: { [key: string]: Protection } = {};\r\n", "export const text = {\n \"api.name\": () => \"Smelly API\",\n \"api.error.unknown\": () => \"An unknown error has occurred.\",\n \"api.database.error.table_name\": (a: string, b: number) =>\n `The display name ${a} is too long for an objective, it can be at most ${b} characters long`,\n \"api.utilities.formatter.error.ms\": (a: string) =>\n `${a} is not a string or a number`,\n \"api.Providers.form.invalidType\": (a: string, b: string) =>\n `Type ${a} is not a valid type to add a ${b}`,\n \"modules.protections.cps.clickingToFast\": () =>\n `You are clicking to fast! Please click slower!`,\n \"modules.managers.mute.isMuted\": () =>\n `\u00A7cYou've been temporarily muted in chat.`,\n \"modules.commands.ban.reply\": (\n playerName: string,\n duration: string,\n reason: string = \"\"\n ) =>\n `\u00A7cBanned \u00A7f\"\u00A7a${playerName}\u00A7f\" \u00A7cfor ${duration} Because: \"${\n reason ?? \"No reason Provided\"\n }\" \u00A7aSuccessfully`,\n \"lockdown.kick.message\": () => [\n `\u00A7cYou have been kicked!`,\n `\u00A7aReason: \u00A7fServer is currently under LockDown`,\n `\u00A7fServer will be up soon, Try to join later`,\n ],\n \"commands.ban.list.player\": (name: string, reason: string, expire: string) =>\n `- \"${name}\" Because: ${reason}, Expiry ${expire}`,\n \"commands.freeze.list.player\": (name: string, reason: string) =>\n `- \"${name}\" Because: ${reason}`,\n \"commands.mutes.list.player\": (\n name: string,\n reason: string,\n expire: string\n ) => `- \"${name}\" Because: ${reason}, Expiry: ${expire}`,\n \"commands.lockdown.confirm\":\n \"Are you sure you want to lockdown the server, this will kick all active players and all players who try to join who are not admin\",\n};\n", "import { Location, Player } from \"@minecraft/server\";\r\nimport {\r\n LiteralArgumentType,\r\n IArgumentType,\r\n LocationArgumentType,\r\n StringArgumentType,\r\n IntegerArgumentType,\r\n ArrayArgumentType,\r\n BooleanArgumentType,\r\n} from \"./ArgumentTypes.js\";\r\nimport { CommandCallback } from \"./Callback.js\";\r\nimport { COMMANDS } from \"./index.js\";\r\nimport type { AppendArgument, ICommandData, ArgReturn } from \"./types\";\r\nexport { ArgumentTypes } from \"./ArgumentTypes\";\r\n\r\nexport class Command<\r\n Callback extends Function = (ctx: CommandCallback) => void\r\n> {\r\n /**\r\n * The Arguments on this command\r\n */\r\n children: Command[];\r\n\r\n /**\r\n * Function to run when this command is called\r\n */\r\n callback: Callback;\r\n\r\n constructor(\r\n public data: ICommandData,\r\n public type?: IArgumentType,\r\n public depth: number = 0,\r\n public parent?: Command\r\n ) {\r\n if (!data.requires) data.requires = (player: Player) => true;\r\n this.data = data;\r\n this.type = type ?? new LiteralArgumentType(this.data.name);\r\n this.children = [];\r\n this.depth = depth;\r\n this.parent = parent;\r\n this.callback = null;\r\n\r\n COMMANDS.push(this);\r\n }\r\n\r\n /**\r\n * Adds a ranch to this command of your own type\r\n * @param type a special type to be added\r\n * @returns new branch to this command\r\n */\r\n argument(type: T): ArgReturn {\r\n const cmd = new Command>(\r\n this.data,\r\n type,\r\n this.depth + 1,\r\n this\r\n );\r\n this.children.push(cmd);\r\n return cmd;\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n string(name: string): ArgReturn {\r\n return this.argument(new StringArgumentType(name));\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n int(name: string): ArgReturn {\r\n return this.argument(new IntegerArgumentType(name));\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n array>(\r\n name: string,\r\n types: T\r\n ): ArgReturn {\r\n return this.argument(new ArrayArgumentType(name, types));\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n boolean(name: string): ArgReturn {\r\n return this.argument(new BooleanArgumentType(name));\r\n }\r\n\r\n /**\r\n * Adds a argument to this command to add 3 parameters with location types and to return a Location\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n location(name: string): ArgReturn {\r\n const cmd = this.argument(new LocationArgumentType(name));\r\n if (!name.endsWith(\"*\")) {\r\n const newArg = cmd.location(name + \"_y*\").location(name + \"_z*\");\r\n //@ts-ignore\r\n return newArg;\r\n }\r\n //@ts-ignore\r\n return cmd;\r\n }\r\n\r\n /**\r\n * Adds a subCommand to this argument\r\n * @param name name this literal should have\r\n * @returns new branch to this command\r\n */\r\n literal(data: ICommandData): Command {\r\n const cmd = new Command(\r\n data,\r\n new LiteralArgumentType(data.name),\r\n this.depth + 1,\r\n this\r\n );\r\n this.children.push(cmd);\r\n return cmd;\r\n }\r\n\r\n /**\r\n * Registers this command and its appending arguments\r\n * @param callback what to run when this command gets called\r\n */\r\n executes(callback: Callback): Command {\r\n this.callback = callback;\r\n return this;\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport type { IBanData } from \"../../../../types.js\";\nimport { durationToMs } from \"../../../../utils.js\";\n\nfunction setBan(\n player: string | Player,\n id: string,\n duration?: string,\n reason: string = \"No Reason\",\n by: string = \"Rubedo Auto Mod\"\n) {\n const data: IBanData = {\n key: id,\n playerName: player instanceof Player ? player.name : player,\n date: Date.now(),\n duration: duration ? durationToMs(duration) : null,\n expire: duration ? durationToMs(duration) + Date.now() : null,\n reason: reason,\n by: by,\n };\n TABLES.bans.set(id, data);\n}\n\nexport class Ban {\n /**\n * Ban a player for a set length\n */\n constructor(\n player: string | Player,\n duration?: string,\n reason: string = \"No Reason\",\n by: string = \"Rubedo Auto Mod\"\n ) {\n if (player instanceof Player) {\n setBan(player, player.id, duration, reason, by);\n } else {\n setBan(player, TABLES.ids.get(player), duration, reason, by);\n }\n }\n}\n", "import { text } from \"../../../../lang/text.js\";\nimport type { CommandCallback } from \"../../../../lib/Command/Callback.js\";\nimport { Command, ArgumentTypes } from \"../../../../lib/Command/Command.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { confirmAction, msToTime } from \"../../../../utils.js\";\nimport { getRole } from \"../../utils.js\";\nimport { Ban } from \"../models/Ban.js\";\n\nfunction ban(\n ctx: CommandCallback,\n player: string,\n duration: string,\n reason: string,\n by: string\n) {\n if (TABLES.bans.get(TABLES.ids.get(player)))\n return ctx.reply(`\u00A7c${player} is already banned`);\n ctx.reply(`\u00A7aClose chat to confirm`);\n confirmAction(\n ctx.sender,\n `Are you sure you want to ban ${player}, for ${duration ?? \"forever\"}`,\n () => {\n new Ban(player, duration, reason, ctx.sender.name);\n ctx.reply(text[\"modules.commands.ban.reply\"](player, duration, reason));\n }\n );\n}\n\nconst root = new Command({\n name: \"ban\",\n description: \"Manage bans\",\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\n});\n\nroot\n .literal({\n name: \"add\",\n description: \"Bans a player\",\n })\n .argument(new ArgumentTypes.playerName())\n .executes((ctx, player) => {\n ban(ctx, player, null, null, ctx.sender.name);\n })\n .argument(new ArgumentTypes.duration(\"duration\"))\n .executes((ctx, player, duration) => {\n ban(ctx, player, duration, null, ctx.sender.name);\n })\n .string(\"reason\")\n .executes((ctx, player, duration, reason) => {\n ban(ctx, player, duration, reason, ctx.sender.name);\n });\n\nroot\n .literal({\n name: \"remove\",\n description: \"un-bans a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const banData = TABLES.bans\n .values()\n .find((ban) => ban.playerName == playerName);\n if (!banData) return ctx.reply(`${playerName} is not banned`);\n if (TABLES.bans.delete(banData.key)) {\n ctx.reply(`\u00A7a${playerName}\u00A7r has been Unbanned!`);\n } else {\n ctx.reply(`\u00A7cFailed to un-ban ${playerName}`);\n }\n });\n\nroot\n .literal({\n name: \"list\",\n description: \"Lists all bans\",\n })\n .executes((ctx) => {\n const bans = TABLES.bans.values();\n if (bans.length == 0) return ctx.sender.tell(`\u00A7cNo one is banned!`);\n ctx.sender.tell(`\u00A72--- Showing Bans (${bans.length}) ---`);\n for (const ban of bans) {\n ctx.sender.tell(\n text[\"commands.ban.list.player\"](\n ban.playerName,\n ban.reason,\n ban.expire ? msToTime(ban.duration) : \"Forever\"\n )\n );\n }\n });\n", "import { Command } from \"../../../../lib/Command/Command\";\nimport { TABLES } from \"../../../../lib/Database/tables\";\nimport { getRole } from \"../../utils\";\n\nconst root = new Command({\n name: \"database\",\n description: \"Interacts with SA Database\",\n aliases: [\"db\"],\n requires: (player) => getRole(player) == \"admin\",\n});\n\nroot\n .literal({\n name: \"get\",\n })\n .string(\"table\")\n .string(\"key\")\n .executes((ctx, table, key) => {\n try {\n const data = TABLES[table as keyof typeof TABLES].get(key);\n if (data) {\n ctx.reply(JSON.stringify(data));\n } else {\n ctx.reply(`No data could be found for key ${key}`);\n }\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"set\",\n })\n .string(\"table\")\n .string(\"key\")\n .string(\"value\")\n .executes((ctx, table, key, value) => {\n try {\n TABLES[table as keyof typeof TABLES].set(key, value);\n ctx.reply(`Set Key: \"${key}\", to value: \"${value}\" on table: \"${table}\"`);\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"clear\",\n })\n .string(\"table\")\n .executes((ctx, table) => {\n try {\n TABLES[table as keyof typeof TABLES].clear();\n ctx.reply(`Cleared Table ${table}`);\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"keys\",\n description: \"Returns all keys on a database\",\n })\n .string(\"table\")\n .executes((ctx, table) => {\n try {\n const keys = TABLES[table as keyof typeof TABLES].keys();\n ctx.reply(`Keys on database: ${table}: ${keys}`);\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"values\",\n description: \"Returns all values on a database\",\n })\n .string(\"table\")\n .executes((ctx, table) => {\n try {\n const values = TABLES[table as keyof typeof TABLES].values();\n ctx.reply(\n `Values on database: ${table}: ${JSON.stringify(values, null, 2)}`\n );\n } catch (error) {\n // likely occurs when table is empty\n if (error instanceof TypeError) {\n ctx.reply(`No values on database ${table}`);\n } else {\n ctx.reply(error + error.stack);\n }\n }\n });\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command.js\";\nimport { getRole } from \"../../utils.js\";\n\nnew Command({\n name: \"ecwipe\",\n description: \"Clears a players ender chest\",\n requires: (player) => getRole(player) == \"admin\",\n})\n .argument(new ArgumentTypes.player(\"player\"))\n .executes((ctx, player) => {\n for (let i = 0; i < 27; i++) {\n player.runCommandAsync(`replaceitem entity @s slot.enderchest ${i} air`);\n }\n ctx.reply(`\u00A7aCleared \"${player.name}\"'s Ender chest!`);\n });\n", "import { Player } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport type { IFreezeData } from \"../../../../types.js\";\n\nexport class Freeze {\n /**\n * Freeze a player\n */\n constructor(player: Player, reason: string = \"No Reason\") {\n const data: IFreezeData = {\n playerName: player.name,\n key: player.id,\n reason: reason,\n location: {\n x: player.location.x,\n y: player.location.y,\n z: player.location.z,\n dimension: player.dimension.id,\n },\n };\n TABLES.freezes.set(player.id, data);\n }\n}\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command.js\";\nimport { Freeze } from \"../models/Freeze.js\";\nimport { getRole } from \"../../utils.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { text } from \"../../../../lang/text.js\";\n\nconst root = new Command({\n name: \"freeze\",\n description: \"Manage Freezes\",\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\n});\n\nroot\n .literal({\n name: \"add\",\n description: \"Freezes a player\",\n })\n .argument(new ArgumentTypes.player(\"player\"))\n .string(\"reason\")\n .executes((ctx, player, reason) => {\n new Freeze(player, reason);\n ctx.reply(\n `\u00A7cFroze \u00A7f\"\u00A7a${player.name}\u00A7f\" Because: \"${reason}\" \u00A7aSuccessfully`\n );\n ctx.sender.tell(\n `\u00A7cYou have been frozen by \u00A7f\"\u00A7a${ctx.sender.name}\u00A7f\" Because: \"${reason}\"`\n );\n });\n\nroot\n .literal({\n name: \"remove\",\n description: \"unfreezes a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const freeze = TABLES.freezes\n .values()\n .find((freeze) => freeze.playerName == playerName);\n if (!freeze) return ctx.reply(`${playerName} is not frozen`);\n\n TABLES.freezes.delete(freeze.key);\n\n ctx.reply(`\u00A7a${playerName}\u00A7r has been UnFrozen!`);\n });\n\nroot\n .literal({\n name: \"list\",\n description: \"Lists all freezes\",\n })\n .executes((ctx) => {\n const freezes = TABLES.freezes.values();\n if (freezes.length == 0) return ctx.sender.tell(`\u00A7cNo one is frozen!`);\n ctx.sender.tell(`\u00A72--- Showing Freezes (${freezes.length}) ---`);\n for (const freeze of freezes) {\n ctx.sender.tell(\n text[\"commands.freeze.list.player\"](freeze.playerName, freeze.reason)\n );\n }\n });\n", "import { Player } from \"@minecraft/server\";\nimport { PREFIX } from \"../../../../config/commands.js\";\nimport {\n IArgumentReturnData,\n IArgumentType,\n} from \"../../../../lib/Command/ArgumentTypes.js\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { COMMANDS } from \"../../../../lib/Command/index.js\";\n\nclass CommandNameArgumentType implements IArgumentType {\n type: string;\n typeName = \"CommandName\";\n matches(value: string): IArgumentReturnData {\n return {\n success: Boolean(\n COMMANDS.find((c) => c.depth == 0 && c.data.name == value)\n ),\n value: value,\n };\n }\n fail(value: string): string {\n return `\"${value}\" is not a valid command`;\n }\n constructor(public name: string) {}\n}\n\n/**\n * Sends text in chat relation to the args in the command to player\n */\nfunction sendCommandType(\n baseCommand: Command,\n args: Command[],\n player: Player\n) {\n player.tell(\n `${PREFIX}${baseCommand.data.name} ${args\n .map((a) =>\n a.type.typeName == \"literal\"\n ? a.data.name\n : `<${a.type.name}: ${a.type.typeName}>`\n )\n .join(\" \")}`\n );\n}\n\nfunction sendArguments(bc: Command, c: Command, args: Command[], p: Player) {\n if (!c.data?.requires(p)) return;\n if (c.callback) {\n // command has a callback\n sendCommandType(bc, c.depth == 0 ? args : args.concat(c), p);\n }\n if (c.children.length > 0) {\n // cmd has arguments\n for (const child of c.children) {\n sendArguments(bc, child, c.depth == 0 ? args : args.concat(c), p);\n }\n }\n}\n\nfunction sendPageHeader(player: Player, p: number, maxPages: number) {\n player.tell(\n `\u00A72--- Showing help page ${p} of ${maxPages} (${PREFIX}help ) ---`\n );\n}\n\nfunction getCommands(player: Player): Command[] {\n return COMMANDS.filter((c) => {\n return c.depth == 0 && c.data?.requires(player);\n });\n}\n\nfunction getMaxPages(player: Player): number {\n const commands = getCommands(player);\n if (commands.length == 0) return 0;\n return Math.ceil(commands.length / 5);\n}\n\nconst root = new Command({\n name: \"help\",\n description: \"Provides help/list of commands.\",\n aliases: [\"?\", \"h\"],\n}).executes((ctx) => {\n // show page 1\n const maxPages = getMaxPages(ctx.sender);\n const commands = getCommands(ctx.sender).slice(1 * 5 - 5, 1 * 5);\n sendPageHeader(ctx.sender, 1, maxPages);\n for (const cmd of commands) {\n sendArguments(cmd, cmd, [], ctx.sender);\n }\n});\n\nroot.int(\"page\").executes((ctx, p) => {\n // shows page\n const maxPages = getMaxPages(ctx.sender);\n if (p > maxPages) p = maxPages;\n const commands = getCommands(ctx.sender).slice(p * 5 - 5, p * 5);\n sendPageHeader(ctx.sender, p, maxPages);\n for (const cmd of commands) {\n sendArguments(cmd, cmd, [], ctx.sender);\n }\n});\n\nroot\n .argument(new CommandNameArgumentType(\"command\"))\n .executes((ctx, command) => {\n // shows command\n const cmd = COMMANDS.filter(\n (c) => c.depth == 0 && c.data.name == command\n )[0];\n ctx.sender.tell(\n `\u00A7e${cmd.data.name}: ${\n cmd.data.aliases ? `aliases (${cmd.data.aliases.join(\", \")})` : \"\"\n }`\n );\n ctx.sender.tell(`\u00A7e${cmd.data.description}`);\n ctx.sender.tell(`Usage:`);\n sendArguments(cmd, cmd, [], ctx.sender);\n });\n", "import { world } from \"@minecraft/server\";\r\nimport { text } from \"../../../../lang/text.js\";\r\nimport { Command } from \"../../../../lib/Command/Command.js\";\r\nimport { confirmAction } from \"../../../../utils.js\";\r\nimport { getRole, isLockedDown, kick, setLockDown } from \"../../utils.js\";\r\n\r\nnew Command({\r\n name: \"lockdown\",\r\n description: \"Toggles the servers lockdown, meaning no one can join\",\r\n requires: (player) => getRole(player) == \"admin\",\r\n}).executes((ctx) => {\r\n if (isLockedDown()) {\r\n setLockDown(false);\r\n ctx.sender.tell(`\u00A7aUnlocked the server!`);\r\n } else {\r\n ctx.reply(`\u00A7aClose chat to confirm lockdown`);\r\n confirmAction(ctx.sender, text[\"commands.lockdown.confirm\"], () => {\r\n setLockDown(true);\r\n for (const player of world.getPlayers()) {\r\n if (getRole(player) == \"admin\") continue;\r\n kick(player, text[\"lockdown.kick.message\"]());\r\n }\r\n world.say(`\u00A7l\u00A7cServer is now LOCKED!`);\r\n });\r\n }\r\n});\r\n", "import { Player } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport type { IMuteData } from \"../../../../types.js\";\nimport { durationToMs } from \"../../../../utils.js\";\n\nexport class Mute {\n length: number;\n /**\n * Gets the mute data for this player\n */\n static getMuteData(player: Player): IMuteData {\n return TABLES.mutes.get(player.name);\n }\n /**\n * Mutes a player for a length\n */\n constructor(\n player: Player,\n duration?: string,\n reason: string = \"No Reason\",\n by: string = \"Rubedo Auto Mod\"\n ) {\n const msLength = duration ? durationToMs(duration) : null;\n const data: IMuteData = {\n playerName: player.name,\n date: Date.now(),\n duration: msLength,\n expire: msLength ? msLength + Date.now() : null,\n reason: reason,\n by: by,\n };\n TABLES.mutes.set(player.name, data);\n }\n}\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command.js\";\nimport { Mute } from \"../models/Mute.js\";\nimport { getRole } from \"../../utils.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { text } from \"../../../../lang/text.js\";\nimport { msToTime } from \"../../../../utils.js\";\n\nconst root = new Command({\n name: \"mute\",\n description: \"Manage Mutes\",\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\n});\n\nroot\n .literal({\n name: \"add\",\n description: \"Mutes a player\",\n })\n .argument(new ArgumentTypes.player(\"player\"))\n .argument(new ArgumentTypes.duration(\"duration\"))\n .string(\"reason\")\n .executes((ctx, player, duration, reason) => {\n new Mute(player, duration, reason, ctx.sender.name);\n ctx.reply(\n `\u00A7cMuted \u00A7f\"\u00A7a${player.name}\u00A7f\" \u00A7cfor ${duration} Because: \"${reason}\" \u00A7aSuccessfully`\n );\n player.tell(\n `\u00A7cYou have been muted by \u00A7f\"${ctx.sender.name}\" \u00A7cfor ${duration} Because: \"${reason}\"`\n );\n });\n\nroot\n .literal({\n name: \"remove\",\n description: \"un-mutes a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const mute = TABLES.mutes\n .values()\n .find((mute) => mute.playerName == playerName);\n if (!mute) return ctx.reply(`${playerName} is not muted!`);\n\n TABLES.mutes.delete(mute.playerName);\n try {\n ctx.sender.runCommandAsync(`ability \"${playerName}\" mute false`);\n } catch (error) {}\n ctx.reply(`\u00A7a${playerName}\u00A7r has been UnMuted!`);\n });\n\nroot\n .literal({\n name: \"list\",\n description: \"Lists all freezes\",\n })\n .executes((ctx) => {\n const mutes = TABLES.mutes.values();\n if (mutes.length == 0) return ctx.sender.tell(`\u00A7cNo one is muted!`);\n ctx.sender.tell(`\u00A72--- Showing Mutes (${mutes.length}) ---`);\n for (const mute of mutes) {\n ctx.sender.tell(\n text[\"commands.mutes.list.player\"](\n mute.playerName,\n mute.reason,\n mute.expire ? msToTime(mute.expire) : \"Forever\"\n )\n );\n }\n });\n", "import { Location } from \"@minecraft/server\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { getRole } from \"../../utils.js\";\nimport { Npc } from \"../models/Npc.js\";\n\nnew Command({\n name: \"npc\",\n description: \"Spawns a npc at your coordinates\",\n requires: (player) => getRole(player) == \"admin\",\n}).executes((ctx) => {\n const { x, y, z } = ctx.sender.location;\n new Npc(new Location(x, y, z), ctx.sender.dimension);\n ctx.reply(`Spawned a verified npc at your current location`);\n});\n", "import { Dimension, Entity, Location } from \"@minecraft/server\";\r\nimport { clearNpcLocations, NPC_LOCATIONS } from \"../../index.js\";\r\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\r\nimport type { INpcLocation } from \"../../../../types.js\";\r\nimport { LocationEquals } from \"../../../../utils.js\";\r\n\r\nexport class Npc {\r\n /**\r\n * Checks if a entity is a valid npc\r\n * @param entity npc\r\n */\r\n static isValid(entity: Entity): boolean {\r\n if (entity.typeId != \"minecraft:npc\") return false;\r\n if (NPC_LOCATIONS.find((l) => LocationEquals(l, entity.location)))\r\n return true;\r\n return TABLES.npcs.keys().find((key) => entity.id == key) ? true : false;\r\n }\r\n /**\r\n * Adds a new verified npc to the world\r\n */\r\n constructor(location: Location, dimension: Dimension) {\r\n NPC_LOCATIONS.push(location);\r\n const entity = dimension.spawnEntity(\"minecraft:npc\", location);\r\n\r\n const data: INpcLocation = {\r\n dimension: entity.dimension.id,\r\n x: entity.location.x,\r\n y: entity.location.y,\r\n z: entity.location.z,\r\n };\r\n TABLES.npcs.set(entity.id, data);\r\n clearNpcLocations();\r\n }\r\n}\r\n", "import { Command } from \"../../../../lib/Command/Command.js\";\nimport { world } from \"@minecraft/server\";\n\nnew Command({\n name: \"ping\",\n description: \"Returns the current Ticks Per Second of the servers ping\",\n}).executes((ctx) => {\n let pingTick = world.events.tick.subscribe(({ deltaTime }) => {\n ctx.reply(`Pong! Current Ticks Per Second: ${1 / deltaTime}`);\n world.events.tick.unsubscribe(pingTick);\n });\n});\n", "import { BlockLocation } from \"@minecraft/server\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { Region } from \"../models/Region.js\";\nimport { getRole } from \"../../utils.js\";\n\nconst command = new Command({\n name: \"region\",\n description: \"Create a Region\",\n requires: (player) => getRole(player) == \"admin\",\n});\n\ncommand\n .literal({\n name: \"add\",\n description: \"Adds a new protection region\",\n })\n .int(\"from_x\")\n .int(\"from_z\")\n .int(\"to_x\")\n .int(\"to_z\")\n .executes((ctx, from_x, from_z, to_x, to_z) => {\n new Region(\n { x: from_x, z: from_z },\n { x: to_x, z: to_z },\n ctx.sender.dimension.id\n );\n ctx.reply(\n `Created Region From ${from_x} -64 ${from_z} ${to_x} 320 ${to_z}`\n );\n });\n\ncommand\n .literal({\n name: \"remove\",\n description: \"Removes a region at the players current position\",\n })\n .executes((ctx) => {\n const loc = new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n );\n const r = Region.removeRegionAtBlockLocation(loc, ctx.sender.dimension.id);\n if (r) {\n ctx.reply(`Removed Region at ${loc.x} ${loc.y} ${loc.z}`);\n } else {\n ctx.reply(`Failed to find/remove region at ${loc.x} ${loc.y} ${loc.z}`);\n }\n });\n\ncommand\n .literal({\n name: \"removeAll\",\n description: \"Removes all regions\",\n })\n .executes((ctx) => {\n Region.getAllRegions().forEach((r) => r.delete());\n ctx.reply(`Removed All regions`);\n });\n\ncommand\n .literal({\n name: \"list\",\n description: \"Lists all regions and positions\",\n })\n .executes((ctx) => {\n const regions = Region.getAllRegions();\n for (const region of regions) {\n ctx.reply(\n `Region from ${region.from.x}, ${region.from.z} to ${region.to.x}, ${region.to.z} in dimension ${region.dimensionId}`\n );\n }\n if (regions.length == 0) return ctx.reply(`No regions have been made yet`);\n });\n\nconst permission = command.literal({\n name: \"permission\",\n description: \"Handles permissions for regions\",\n});\n\npermission\n .literal({\n name: \"set\",\n description:\n \"Sets a certain permission on the region the player is currently in to a value\",\n })\n .array(\"key\", [\"doorsAndSwitches\", \"openContainers\", \"pvp\"] as const)\n .boolean(\"value\")\n .executes((ctx, key, value) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n region.changePermission(key, value);\n ctx.reply(`Changed permission ${key} to ${value}`);\n });\n\npermission\n .literal({\n name: \"list\",\n description: \"Lists the permissions for the current region\",\n })\n .executes((ctx) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n ctx.reply(\n `Current region permissions ${JSON.stringify(region.permissions)}`\n );\n });\n\nconst entityCommands = permission.literal({\n name: \"entities\",\n description: \"Holds the subCommands for adding or removing allowedEntities\",\n});\n\nentityCommands\n .literal({\n name: \"add\",\n description: \"Adds a entity to the allowed entities list\",\n })\n .string(\"entity\")\n .executes((ctx, entity) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n const currentAllowedEntities = region.permissions.allowedEntities;\n currentAllowedEntities.push(entity);\n region.changePermission(\"allowedEntities\", currentAllowedEntities);\n ctx.reply(\n `Added entity ${entity} to the allowed entities of the region your currently standing in`\n );\n });\n\nentityCommands\n .literal({\n name: \"remove\",\n description: \"Removes a entity from the allowed entities in the region\",\n })\n .string(\"entity\")\n .executes((ctx, entity) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n let currentAllowedEntities = region.permissions.allowedEntities;\n if (!currentAllowedEntities.includes(entity))\n return ctx.reply(\n `The entity ${entity} is not allowed to enter the region`\n );\n currentAllowedEntities = currentAllowedEntities.filter((v) => v != entity);\n region.changePermission(\"allowedEntities\", currentAllowedEntities);\n ctx.reply(\n `Removed entity ${entity} to the allowed entities of the region your currently standing in`\n );\n });\n", "import { Events, ItemStack, Player } from \"@minecraft/server\";\r\nimport type { APPEAL_LINK } from \"./config/app\";\r\nimport type { ENCHANTMENTS } from \"./plugins/Anti-Cheat/config/enchantments\";\r\nimport type {\r\n BANNED_BLOCKS,\r\n BANNED_ITEMS,\r\n} from \"./plugins/Anti-Cheat/config/moderation\";\r\nimport type { BlockInventory } from \"./plugins/Anti-Cheat/modules/models/BlockInventory\";\r\n\r\n/**\r\n * The roles that are in this server\r\n */\r\nexport enum ROLES {\r\n member,\r\n admin,\r\n moderator,\r\n builder,\r\n}\r\n\r\nexport interface IMsOptions {\r\n compactDuration?: string;\r\n fullDuration?: string;\r\n avoidDuration?: Array;\r\n}\r\n\r\nexport interface IplayerTickRegister {\r\n /**\r\n * callback to send\r\n */\r\n callback: (player: Player) => void;\r\n /**\r\n * delay in ticks\r\n */\r\n delay: number;\r\n /**\r\n * the last tick it sent a callback\r\n */\r\n lastCall: number;\r\n}\r\n\r\nexport interface ISlotChangeReturn {\r\n /**\r\n * Slot that changed\r\n */\r\n slot: number;\r\n /**\r\n * the item that was grabbed / put\r\n */\r\n item: ItemStack;\r\n}\r\n\r\nexport interface IEvents {\r\n [key: string]: any;\r\n}\r\n\r\nexport interface IContainerLocation {\r\n [key: string]: BlockInventory;\r\n}\r\n\r\nexport interface IBanData {\r\n /**\r\n * The unique id of this ban\r\n */\r\n key: string;\r\n /**\r\n * The playersName of who was banned\r\n * @example \"Smell of curry\"\r\n */\r\n playerName: string;\r\n /**\r\n * The date in MS when this player was banned\r\n */\r\n date: number;\r\n /**\r\n * The duration in ms that this ban will be for\r\n * if null player is banned forever\r\n */\r\n duration?: number;\r\n /**\r\n * When this ban will expire, if null it will never expire meaning player is banned forever\r\n */\r\n expire?: number;\r\n /**\r\n * The reason for why this player was banned\r\n * @example \"Hacking\"\r\n */\r\n reason?: string;\r\n /**\r\n * Who banned this player\r\n * @example \"Smell of curry\"\r\n * @example \"Rubedo Anti Cheat\"\r\n */\r\n by?: string;\r\n}\r\n\r\nexport interface IFreezeData {\r\n /**\r\n * Players name of who was banned\r\n */\r\n playerName: string;\r\n /**\r\n * Unique id of this freeze instance\r\n */\r\n key: string;\r\n /**\r\n * The reason for this freeze\r\n */\r\n reason?: string;\r\n /**\r\n * The location of this freeze\r\n */\r\n location: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n dimension: string;\r\n };\r\n}\r\n\r\nexport interface IMuteData {\r\n /**\r\n * Players name of who is muted\r\n * @example \"Smell of curry\"\r\n */\r\n playerName: string;\r\n /**\r\n * The date this player got muted\r\n */\r\n date: number;\r\n /**\r\n * The duration of this mute in ms\r\n * if null player is muted forever\r\n */\r\n duration?: number;\r\n /**\r\n * When this players mute will expire in ms\r\n * if null this mute will never expire\r\n */\r\n expire?: number;\r\n /**\r\n * Why this player is muted\r\n * @example \"Spamming\"\r\n */\r\n reason?: string;\r\n /**\r\n * Who muted this player\r\n * @example \"Smell of curry\"\r\n * @example \"Rubedo Anti Cheat\"\r\n */\r\n by?: string;\r\n}\r\n\r\nexport interface INpcLocation {\r\n dimension: string;\r\n x: number;\r\n y: number;\r\n z: number;\r\n}\r\n\r\nexport interface IRegionDB {\r\n dimensionId: string;\r\n from: IRegionCords;\r\n to: IRegionCords;\r\n key: string;\r\n permissions: IRegionPermissions;\r\n}\r\n\r\nexport interface IRegionCords {\r\n x: number;\r\n z: number;\r\n}\r\n\r\nexport interface IRegionPermissions {\r\n /**\r\n * if the player can use chests, default: true\r\n */\r\n doorsAndSwitches: Boolean;\r\n /**\r\n * if the player can use doors, default: true\r\n */\r\n openContainers: Boolean;\r\n /**\r\n * if players can fight, default: false\r\n */\r\n pvp: Boolean;\r\n /**\r\n * the entities allowed in this region\r\n */\r\n allowedEntities: Array;\r\n}\r\n\r\nexport interface IChangePlayerRoleData {\r\n /**\r\n * The name of the player\r\n */\r\n playerName: string;\r\n /**\r\n * The role that the player should be set to\r\n */\r\n role: keyof typeof ROLES;\r\n}\r\n\r\nexport type durationSegmentType = \"y\" | \"w\" | \"d\" | \"h\" | \"m\" | \"s\" | \"ms\";\r\nexport type durationSegment = `${number}${durationSegmentType}`;\r\n\r\nexport type ConfigIds =\r\n | \"spam_config\"\r\n | \"cbe_config\"\r\n | \"gamemode_config\"\r\n | \"nuker_data\"\r\n | \"banned_items\"\r\n | \"banned_blocks\";\r\n\r\nexport type ConfigType = {\r\n spam_config: {\r\n /**\r\n * @default true\r\n */\r\n repeatedMessages: boolean;\r\n /**\r\n * @default true\r\n */\r\n zalgo: boolean;\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n permMutePlayer: boolean;\r\n };\r\n cbe_config: {\r\n /**\r\n * @default true\r\n */\r\n clearItem: boolean;\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n banPlayer: boolean;\r\n /**\r\n * @default false\r\n */\r\n canAddEnchantment: boolean;\r\n };\r\n gamemode_config: {\r\n /**\r\n * @default true\r\n */\r\n setToSurvival: boolean;\r\n /**\r\n * @default true\r\n */\r\n clearPlayer: boolean;\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n banPlayer: boolean;\r\n };\r\n nuker_data: {\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n banPlayer: boolean;\r\n };\r\n /**\r\n * {@link BANNED_ITEMS}\r\n */\r\n banned_items: string[];\r\n /**\r\n * {@link BANNED_BLOCKS}\r\n */\r\n banned_blocks: string[];\r\n /**\r\n * {@link ENCHANTMENTS}\r\n */\r\n enchantments: {\r\n [Property in keyof typeof ENCHANTMENTS]: number;\r\n };\r\n /**\r\n * {@link APPEAL_LINK}\r\n */\r\n appealLink: string;\r\n};\r\n\r\nexport interface LogData {\r\n /**\r\n * An optional playerName who is associated with this log\r\n * @example \"Smell of curry\"\r\n */\r\n playerName?: string;\r\n /**\r\n * The message for this log\r\n * @example \"Smell of curry is bad\"\r\n */\r\n message: string;\r\n /**\r\n * An optional property to list what protection this was from\r\n */\r\n protection?: string;\r\n}\r\n\r\nexport type EventsReturnType = (\r\n arg: Parameters[0]>[0]\r\n) => void;\r\n\r\nexport type IProtectionsConfig = {\r\n [key: string]: boolean | string | number;\r\n /**\r\n * If this protection is enabled\r\n */\r\n enabled: boolean\r\n};\r\n", "import { ROLES } from \"../../../../types\";\nimport { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\nimport {\n getRole,\n getServerOwner,\n isServerOwner,\n setRole,\n setServerOwner,\n} from \"../../utils.js\";\nimport { TABLES } from \"../../../../lib/Database/tables\";\nimport { confirmAction } from \"../../../../utils\";\n\n// Helper\nconst StringIsNumber = (value: any) => isNaN(Number(value)) === false;\n\n// Turn enum into array\nfunction ToArray(enumme: any) {\n return (\n Object.keys(enumme)\n // @ts-ignore\n .filter(StringIsNumber)\n .map((key) => enumme[key])\n );\n}\n\nconst root = new Command({\n name: \"role\",\n description: \"Changes the role for a player\",\n requires: (player) => getRole(player) == \"admin\" || isServerOwner(player),\n});\n\nroot\n .literal({\n name: \"set\",\n description: \"Sets the role for a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .argument(new ArgumentTypes.array(\"role\", ToArray(ROLES) as string[]))\n .executes((ctx, playerName, role) => {\n setRole(playerName, role as keyof typeof ROLES);\n ctx.reply(`Changed role of ${playerName} to ${role}`);\n });\n\nroot\n .literal({\n name: \"get\",\n description: \"Gets the role of a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const role = getRole(playerName);\n ctx.reply(`${playerName} has role: ${role}`);\n });\n\nconst ownerRoot = root.literal({\n name: \"owner\",\n description: \"Manages the owner\",\n});\n\nownerRoot\n .literal({\n name: \"get\",\n description: \"Gets the owner of the world\",\n })\n .executes((ctx) => {\n const ownerId = getServerOwner();\n const ids = TABLES.ids.collection();\n const ownerName = Object.keys(ids).find((key) => ids[key] === ownerId);\n ctx.reply(`\u00A7aServer Owner: ${ownerName} (id: ${ownerId})`);\n });\n\nownerRoot\n .literal({\n name: \"transfer\",\n description: \"Transfers the owner of the world\",\n requires: (player) => isServerOwner(player),\n })\n .argument(new ArgumentTypes.player())\n .executes((ctx, player) => {\n confirmAction(\n ctx.sender,\n `Are you sure you want to transfer the server ownership to ${player.name}, this action is not reversible!`,\n () => {\n setServerOwner(player);\n ctx.reply(\n `\u00A7aSet the server Owner to: ${player.name} (id: ${player.id})`\n );\n }\n );\n ctx.reply(`\u00A7aClose chat to confirm`);\n });\n\nownerRoot\n .literal({\n name: \"clear\",\n description: \"clear's the owner of the world\",\n requires: (player) => isServerOwner(player),\n })\n .executes((ctx) => {\n confirmAction(\n ctx.sender,\n \"Are you sure you want to clear the server owner, this action is not reversible!\",\n () => {\n setServerOwner(null);\n ctx.reply(\n `\u00A7aCleared the server owner! run \"/reload\" or reload world to run \"/function start\" again!`\n );\n }\n );\n ctx.reply(`\u00A7aClose chat to confirm`);\n });\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionFormData } from \"@minecraft/server-ui\";\r\nimport { TIMEOUT_THRESHOLD } from \"../../../config/form\";\r\nimport type { ButtonCallback, IActionFormButton } from \"../types\";\r\n\r\nexport class ActionForm {\r\n /**\r\n * the title that this form should have\r\n */\r\n title?: string;\r\n /**\r\n * extra text that should be displayed in the form\r\n */\r\n body?: string;\r\n /**\r\n * The buttons this form has\r\n */\r\n private buttons: IActionFormButton[];\r\n\r\n /**\r\n * The default minecraft form this form is based on\r\n */\r\n private form: ActionFormData;\r\n\r\n /**\r\n * The amount of times it takes to show this form in ms\r\n * if this value goes above 200 it will time out\r\n */\r\n private triedToShow: number;\r\n\r\n /**\r\n * Creates a new form to be shown to a player\r\n * @param title the title that this form should have\r\n * @param body extra text that should be displayed in the form\r\n */\r\n constructor(title?: string, body?: string) {\r\n this.title = title;\r\n this.body = body;\r\n this.form = new ActionFormData();\r\n\r\n if (title) this.form.title(title);\r\n if (body) this.form.body(body);\r\n\r\n this.buttons = [];\r\n\r\n this.triedToShow = 0;\r\n }\r\n\r\n /**\r\n * Adds a button to this form\r\n * @param text text to show on this button\r\n * @param iconPath the path this button shows\r\n * @param callback what happens when this button is clicked\r\n * @example ```\r\n * addButton(\"settings\", \"textures/items/sum\")\r\n * ```\r\n */\r\n addButton(\r\n text: string,\r\n iconPath: string = null,\r\n callback: ButtonCallback\r\n ): ActionForm {\r\n this.buttons.push({\r\n text: text,\r\n iconPath: iconPath,\r\n callback: callback,\r\n });\r\n this.form.button(text, iconPath);\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows this form to the player\r\n * @param player player to show to\r\n */\r\n show(player: Player): void {\r\n this.form.show(player).then((response) => {\r\n if (response.canceled) {\r\n if (response.cancelationReason == \"userBusy\") {\r\n // check time and reshow form\r\n if (this.triedToShow > TIMEOUT_THRESHOLD)\r\n return player.tell(\r\n `\u00A7cForm Timeout: tried to show form, but you were busy (close chat after running command)`\r\n );\r\n this.triedToShow++;\r\n this.show(player);\r\n }\r\n return;\r\n }\r\n this.buttons[response.selection].callback?.();\r\n });\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ModalFormData } from \"@minecraft/server-ui\";\r\nimport { TIMEOUT_THRESHOLD } from \"../../../config/form\";\r\nimport type { AppendFormField, IModalFormArg, Range } from \"../types\";\r\nimport { FormCallback } from \"./FormCallback\";\r\n\r\nexport class ModalForm void> {\r\n /**\r\n * the title that this form should have\r\n */\r\n title?: string;\r\n\r\n /**\r\n * The default minecraft form this form is based on\r\n */\r\n private form: ModalFormData;\r\n\r\n /**\r\n * The arguments this form has\r\n */\r\n private args: IModalFormArg[];\r\n\r\n /**\r\n * The amount of times it takes to show this form in ms\r\n * if this value goes above 200 it will time out\r\n */\r\n private triedToShow: number;\r\n\r\n /**\r\n * Creates a new form to be shown to a player\r\n * @param title the title that this form should have\r\n */\r\n constructor(title?: string) {\r\n this.title = title;\r\n this.form = new ModalFormData();\r\n\r\n if (title) this.form.title(title);\r\n\r\n this.args = [];\r\n\r\n this.triedToShow = 0;\r\n }\r\n\r\n /**\r\n * Adds a dropdown to this form\r\n * @param label label to show on dropdown\r\n * @param options the available options for this dropdown\r\n * @param defaultValueIndex the default value index\r\n * @returns this\r\n */\r\n addDropdown>(\r\n label: string,\r\n options: T,\r\n defaultValueIndex?: number\r\n ): ModalForm> {\r\n // @ts-ignore\r\n this.args.push({ type: \"dropdown\", options: options });\r\n // @ts-ignore\r\n this.form.dropdown(label, options, defaultValueIndex);\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a slider to this form\r\n * @param label label to be shown on this slider\r\n * @param minimumValue the smallest value this can be\r\n * @param maximumValue the maximum value this can be\r\n * @param valueStep how this slider increments\r\n * @param defaultValue the default value in slider\r\n * @returns this\r\n */\r\n addSlider(\r\n label: string,\r\n minimumValue: T,\r\n maximumValue: U,\r\n valueStep: number,\r\n defaultValue?: number\r\n ): ModalForm>> {\r\n this.args.push({ type: \"slider\" });\r\n this.form.slider(\r\n label,\r\n minimumValue,\r\n maximumValue,\r\n valueStep,\r\n defaultValue\r\n );\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a toggle to this form\r\n * @param label the name of this toggle\r\n * @param defaultValue the default toggle value could be true or false\r\n * @returns\r\n */\r\n addToggle(\r\n label: string,\r\n defaultValue?: boolean\r\n ): ModalForm> {\r\n this.args.push({ type: \"toggle\" });\r\n this.form.toggle(label, defaultValue);\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a text field to this form\r\n * @param label label for this textField\r\n * @param placeholderText the text that shows on this field\r\n * @param defaultValue the default value that this field has\r\n */\r\n addTextField(\r\n label: string,\r\n placeholderText: string,\r\n defaultValue?: string\r\n ): ModalForm> {\r\n this.args.push({ type: \"textField\" });\r\n this.form.textField(label, placeholderText, defaultValue);\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows this form to a player\r\n * @param player player to show to\r\n * @param callback sends a callback when this form is submitted\r\n */\r\n show(player: Player, callback: Callback): void {\r\n this.form.show(player).then((response) => { \r\n if (response.canceled) {\r\n if (response.cancelationReason == \"userBusy\") {\r\n // check time and reshow form\r\n if (this.triedToShow > TIMEOUT_THRESHOLD)\r\n return player.tell(\r\n `\u00A7cForm Timeout: tried to show form, but you were busy (close chat after running command)`\r\n );\r\n this.triedToShow++;\r\n this.show(player, callback);\r\n }\r\n return;\r\n }\r\n callback(\r\n new FormCallback(this, player, callback),\r\n ...response.formValues.map((v, i) =>\r\n this.args[i].type == \"dropdown\" ? this.args[i].options[v] : v\r\n )\r\n );\r\n });\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionForm } from \"./ActionForm\";\r\nimport { MessageForm } from \"./MessageForm\";\r\nimport { ModalForm } from \"./ModelForm\";\r\n\r\nexport class FormCallback {\r\n /**\r\n * form that was used in this call\r\n */\r\n private form: ActionForm | MessageForm | ModalForm;\r\n /**\r\n * player that this form used\r\n */\r\n private player: Player;\r\n\r\n /**\r\n * the function that was called\r\n */\r\n private callback: () => void;\r\n\r\n /**\r\n * Creates a new form callback instance that can be used by\r\n * buttons, and args to run various functions\r\n * @param form form that is used in this call\r\n */\r\n constructor(\r\n form: ActionForm | MessageForm | ModalForm,\r\n player: Player,\r\n callback: any\r\n ) {\r\n this.form = form;\r\n this.player = player;\r\n this.callback = callback;\r\n }\r\n\r\n /**\r\n * Reshow the form and shows the user a error message\r\n * @param message error message to show\r\n */\r\n error(message: string) {\r\n new MessageForm(\"Error\", message)\r\n .setButton1(\"Return to form\", () => {\r\n this.form.show(this.player, this.callback);\r\n })\r\n .setButton2(\"Cancel\", null)\r\n .show(this.player);\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { APPEAL_LINK } from \"../../../../config/app\";\r\nimport { ENCHANTMENTS } from \"../../config/enchantments\";\r\nimport { ActionForm } from \"../../../../lib/Form/Models/ActionForm\";\r\nimport { ModalForm } from \"../../../../lib/Form/Models/ModelForm\";\r\nimport { getConfigId, setConfigId } from \"../../utils\";\r\n\r\nexport function manageBannedItemsForm(player: Player) {\r\n new ActionForm(\"Manage Banned Items\")\r\n .addButton(\"Remove a Banned Item\", null, () => {\r\n removeBannedItemForm(player);\r\n })\r\n .addButton(\"Ban an item\", null, () => {\r\n addBannedItemForm(player);\r\n })\r\n .show(player);\r\n}\r\nexport function removeBannedItemForm(player: Player) {\r\n new ModalForm(\"Remove Banned Items\")\r\n .addDropdown(\"Select item to remove\", getConfigId(\"banned_items\"))\r\n .show(player, (ctx, item) => {\r\n let items = getConfigId(\"banned_items\");\r\n items = items.filter((p) => p != item);\r\n setConfigId(\"banned_items\", items);\r\n player.tell(`Removed Banned item \"${item}\"`);\r\n });\r\n}\r\n\r\nexport function addBannedItemForm(player: Player) {\r\n new ModalForm(\"Add Banned Item\")\r\n .addTextField(\"Item Id\", \"minecraft:string\")\r\n .show(player, (ctx, item) => {\r\n let items = getConfigId(\"banned_items\");\r\n if (items.includes(item))\r\n return ctx.error(`\u00A7cItem \"${item}\" is already banned`);\r\n items.push(item);\r\n setConfigId(\"banned_items\", items);\r\n player.tell(`Banned the item \"${item}\"`);\r\n });\r\n}\r\n\r\nexport function manageBannedBlocksForm(player: Player) {\r\n new ActionForm(\"Manage Banned Blocks\")\r\n .addButton(\"Remove a Banned Block\", null, () => {\r\n removeBannedBlockForm(player);\r\n })\r\n .addButton(\"Ban an block\", null, () => {\r\n addBannedBlockForm(player);\r\n })\r\n .show(player);\r\n}\r\n\r\nexport function removeBannedBlockForm(player: Player) {\r\n new ModalForm(\"Remove Banned Block\")\r\n .addDropdown(\"Select block to remove\", getConfigId(\"banned_blocks\"))\r\n .show(player, (ctx, block) => {\r\n let blocks = getConfigId(\"banned_blocks\");\r\n blocks = blocks.filter((p) => p != block);\r\n setConfigId(\"banned_blocks\", blocks);\r\n player.tell(`Removed Banned block \"${block}\"`);\r\n });\r\n}\r\n\r\nexport function addBannedBlockForm(player: Player) {\r\n new ModalForm(\"Add Banned Block\")\r\n .addTextField(\"Block Id\", \"minecraft:barrier\")\r\n .show(player, (ctx, block) => {\r\n let blocks = getConfigId(\"banned_blocks\");\r\n if (blocks.includes(block))\r\n return ctx.error(`\u00A7cBlock \"${block}\" is already banned`);\r\n blocks.push(block);\r\n setConfigId(\"banned_blocks\", blocks);\r\n player.tell(`Banned the block \"${block}\"`);\r\n });\r\n}\r\n\r\nexport function manageEnchantmentLevelsForm(player: Player) {\r\n new ModalForm(\"Manage Enchantment Levels\")\r\n .addDropdown(\"Enchantment to change\", Object.keys(ENCHANTMENTS), 0)\r\n .addTextField(\"Level (number)\", \"5\")\r\n .show(player, (ctx, enchantment, levelString) => {\r\n if (isNaN(levelString as any))\r\n return ctx.error(\r\n `\u00A7c\"${levelString}\" is not a number, please enter a value like, \"3\", \"9\", etc.`\r\n );\r\n const level = parseInt(levelString);\r\n let enchants = getConfigId(\"enchantments\");\r\n enchants[enchantment as keyof typeof ENCHANTMENTS] = level;\r\n setConfigId(\"enchantments\", enchants);\r\n player.tell(`Set max level for ${enchantment} to ${level}`);\r\n });\r\n}\r\n\r\nexport function manageAppealLinkForm(player: Player) {\r\n new ModalForm(\"Manage Appeal Link\")\r\n .addTextField(\"Appeal Link\", APPEAL_LINK)\r\n .show(player, (ctx, link) => {\r\n setConfigId(\"appealLink\", link);\r\n player.tell(`Changed the servers appeal link to ${link}`);\r\n });\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionForm } from \"../../../../lib/Form/Models/ActionForm\";\r\nimport { ModalForm } from \"../../../../lib/Form/Models/ModelForm\";\r\nimport { IProtectionsConfig } from \"../../../../types\";\r\nimport { PROTECTIONS } from \"../../protections\";\r\nimport { Protection } from \"../models/Protection\";\r\nimport { showHomeForm } from \"./home\";\r\n\r\nexport function showAutoModHomeForm(player: Player) {\r\n const form = new ActionForm(\"Manage Protections\");\r\n\r\n for (const protection of Object.values(PROTECTIONS)) {\r\n form.addButton(protection.name, protection.iconPath, () => {\r\n showProtectionConfig(protection, player);\r\n });\r\n }\r\n form\r\n .addButton(\"Back\", \"textures/ui/arrow_dark_left_stretch.png\", () => {\r\n showHomeForm(player);\r\n })\r\n .show(player);\r\n}\r\n\r\nexport function showProtectionConfig(protection: Protection, player: Player) {\r\n const data = protection.getConfig();\r\n const form = new ModalForm(\r\n `Manage ${protection.name} Protection Config`\r\n ).addToggle(\"Enabled\", data[\"enabled\"]);\r\n let keys: string[] = [];\r\n for (const [key, value] of Object.entries(protection.configDefault)) {\r\n keys.push(key);\r\n if (typeof value.defaultValue == \"boolean\") {\r\n form.addToggle(value.description, data[key] as boolean);\r\n } else if (typeof value.defaultValue == \"number\") {\r\n form.addSlider(value.description, 0, 100, 1, data[key] as number);\r\n } else {\r\n form.addTextField(value.description, null, data[key] as string);\r\n }\r\n }\r\n form.show(player, (ctx, enabled, ...keys) => {\r\n if (enabled != data[\"enabled\"]) {\r\n if (enabled) protection.enable();\r\n if (!enabled) protection.disable();\r\n }\r\n let config: IProtectionsConfig = {\r\n enabled: enabled,\r\n };\r\n for (const [i, key] of Object.keys(protection.configDefault).entries()) {\r\n config[key] = keys[i];\r\n }\r\n protection.setConfig(config);\r\n player.tell(`Updated config for ${protection.name}!`);\r\n });\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionForm } from \"../../../../lib/Form/Models/ActionForm\";\r\nimport * as settings from \"./settings\";\r\nimport * as automod from \"./automod\";\r\n\r\nexport function showHomeForm(player: Player) {\r\n new ActionForm(\"Rubedo Settings\")\r\n .addButton(\"Auto Mod\", \"textures/ui/permissions_op_crown.png\", () => {\r\n automod.showAutoModHomeForm(player);\r\n })\r\n .addButton(\"Banned items\", \"textures/blocks/sculk_shrieker_top.png\", () => {\r\n settings.manageBannedItemsForm(player);\r\n })\r\n .addButton(\"Banned blocks\", \"textures/blocks/barrier.png\", () => {\r\n settings.manageBannedBlocksForm(player);\r\n })\r\n .addButton(\"Enchantments\", \"textures/items/book_enchanted.png\", () => {\r\n settings.manageEnchantmentLevelsForm(player);\r\n })\r\n .addButton(\"Appeal Link\", \"textures/ui/Feedback.png\", () => {\r\n settings.manageAppealLinkForm(player);\r\n })\r\n .show(player);\r\n}\r\n", "import { Command } from \"../../../../lib/Command/Command.js\";\r\nimport { getRole } from \"../../utils.js\";\r\nimport { showHomeForm } from \"../forms/home.js\";\r\n\r\nnew Command({\r\n name: \"settings\",\r\n description: \"Opens up the settings menu for the player\",\r\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\r\n}).executes((ctx) => {\r\n showHomeForm(ctx.sender);\r\n ctx.sender.tell(`\u00A7aForm request sent, close chat to continue!`);\r\n});\r\n", "import { Player, world } from \"@minecraft/server\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { getRole } from \"../../utils.js\";\n\nfunction vanish(player: Player, say: boolean) {\n if (player.hasTag(`spectator`)) {\n player.runCommandAsync(`gamemode c`);\n player.triggerEvent(`removeSpectator`);\n player.removeTag(`spectator`);\n if (!say) return;\n world.say({\n rawtext: [\n {\n translate: \"multiplayer.player.joined\",\n with: [`\u00A7e${player.name}`],\n },\n ],\n });\n } else {\n player.runCommandAsync(`gamemode spectator`);\n player.triggerEvent(`addSpectator`);\n player.addTag(`spectator`);\n if (!say) return;\n world.say({\n rawtext: [\n {\n translate: \"multiplayer.player.left\",\n with: [`\u00A7e${player.name}`],\n },\n ],\n });\n }\n}\n\nnew Command({\n name: \"vanish\",\n description: \"Toggles Vanish Mode on the sender\",\n requires: (player) => getRole(player) == \"admin\",\n})\n .executes((ctx) => {\n vanish(ctx.sender, false);\n })\n .boolean(\"say\")\n .executes((ctx, say) => {\n vanish(ctx.sender, say);\n });\n", "import { Command } from \"../../../../lib/Command/Command.js\";\nimport { VERSION } from \"../../../../config/app\";\n\nnew Command({\n name: \"version\",\n description: \"Get Current Version\",\n aliases: [\"v\"],\n}).executes((ctx) => {\n ctx.reply(`Current Rubedo Version: ${VERSION}`);\n});\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\r\nimport { getRole, kick } from \"../../utils\";\r\n\r\nnew Command({\r\n name: \"kick\",\r\n description: \"Kicks a player from the game\",\r\n requires: (player) => getRole(player) == \"admin\",\r\n})\r\n .argument(new ArgumentTypes.player())\r\n .string(\"reason\")\r\n .executes((ctx, player, reason) => {\r\n kick(player, [reason]);\r\n ctx.reply(`\u00A7aKicked ${player.name} from world`);\r\n });\r\n", "import { TABLES } from \"../../../../lib/Database/tables\";\r\nimport type { LogData } from \"../../../../types\";\r\n\r\nexport class Log {\r\n /**\r\n * The data on this Log\r\n */\r\n data: LogData;\r\n constructor(data: LogData) {\r\n this.data = data;\r\n console.warn(`[LOG]: ${data.message}`);\r\n TABLES.logs.set(Date.now().toString(), data);\r\n }\r\n}\r\n", "import { PREFIX } from \"../../../../config/commands\";\r\nimport { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\r\nimport { TABLES } from \"../../../../lib/Database/tables\";\r\nimport { getRole } from \"../../utils\";\r\nimport { Log } from \"../models/Log\";\r\n\r\nfunction timeDifference(previous: number) {\r\n var msPerMinute = 60 * 1000;\r\n var msPerHour = msPerMinute * 60;\r\n var msPerDay = msPerHour * 24;\r\n var msPerMonth = msPerDay * 30;\r\n var msPerYear = msPerDay * 365;\r\n\r\n var elapsed = Date.now() - previous;\r\n\r\n if (elapsed < msPerMinute) {\r\n return Math.round(elapsed / 1000) + \" seconds ago\";\r\n } else if (elapsed < msPerHour) {\r\n return Math.round(elapsed / msPerMinute) + \" minutes ago\";\r\n } else if (elapsed < msPerDay) {\r\n return Math.round(elapsed / msPerHour) + \" hours ago\";\r\n } else if (elapsed < msPerMonth) {\r\n return \"approximately \" + Math.round(elapsed / msPerDay) + \" days ago\";\r\n } else if (elapsed < msPerYear) {\r\n return \"approximately \" + Math.round(elapsed / msPerMonth) + \" months ago\";\r\n } else {\r\n return \"approximately \" + Math.round(elapsed / msPerYear) + \" years ago\";\r\n }\r\n}\r\n\r\nconst root = new Command({\r\n name: \"log\",\r\n description: \"Manages the log command\",\r\n requires: (player) => getRole(player) == \"admin\",\r\n});\r\n\r\nroot\r\n .literal({\r\n name: \"add\",\r\n description: \"Adds a new log\",\r\n })\r\n .string(\"message\")\r\n .executes((ctx, message) => {\r\n new Log({ message: message });\r\n ctx.reply(`\u00A7aAdded new log: ${message}`);\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"getAll\",\r\n description: \"Gets all logs sorted in descending\",\r\n })\r\n .int(\"page\")\r\n .array(\"order\", [\"ascending\", \"descending\"] as const)\r\n .executes((ctx, page, order) => {\r\n const allLogs = Object.entries(TABLES.logs.collection()).sort((a, b) =>\r\n order == \"ascending\"\r\n ? parseInt(b[0]) - parseInt(a[0])\r\n : parseInt(a[0]) - parseInt(b[0])\r\n );\r\n if (allLogs.length == 0) return ctx.reply(`\u00A7cNo Logs have been made!`);\r\n const maxPages = Math.ceil(allLogs.length / 8);\r\n if (page > maxPages) page = maxPages;\r\n ctx.reply(\r\n `\u00A72--- Showing logs page ${page} of ${maxPages} (${PREFIX}log getAll ) ---`\r\n );\r\n\r\n for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) {\r\n ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`);\r\n }\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"getPlayersLogs\",\r\n description: \"Gets all logs associated with a player\",\r\n })\r\n .argument(new ArgumentTypes.playerName())\r\n .int(\"page\")\r\n .array(\"order\", [\"ascending\", \"descending\"] as const)\r\n .executes((ctx, playerName, page, order) => {\r\n const allLogs = Object.entries(TABLES.logs.collection())\r\n .filter((v) => v[1].playerName == playerName)\r\n .sort((a, b) =>\r\n order == \"ascending\"\r\n ? parseInt(b[0]) - parseInt(a[0])\r\n : parseInt(a[0]) - parseInt(b[0])\r\n );\r\n if (allLogs.length == 0)\r\n return ctx.reply(`\u00A7cNo Logs exists for \"${playerName}\"!`);\r\n const maxPages = Math.ceil(allLogs.length / 8);\r\n if (page > maxPages) page = maxPages;\r\n ctx.reply(\r\n `\u00A72--- Showing logs for \"${playerName}\" page ${page} of ${maxPages} ---`\r\n );\r\n\r\n for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) {\r\n ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`);\r\n }\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"getProtectionLogs\",\r\n description: \"Gets all logs associated with a protection\",\r\n })\r\n .string(\"protection\")\r\n .int(\"page\")\r\n .array(\"order\", [\"ascending\", \"descending\"] as const)\r\n .executes((ctx, protection, page, order) => {\r\n const allLogs = Object.entries(TABLES.logs.collection())\r\n .filter((v) => v[1].protection == protection)\r\n .sort((a, b) =>\r\n order == \"ascending\"\r\n ? parseInt(b[0]) - parseInt(a[0])\r\n : parseInt(a[0]) - parseInt(b[0])\r\n );\r\n if (allLogs.length == 0)\r\n return ctx.reply(`\u00A7cNo Logs exists for protection: \"${protection}\"!`);\r\n const maxPages = Math.ceil(allLogs.length / 8);\r\n if (page > maxPages) page = maxPages;\r\n ctx.reply(\r\n `\u00A72--- Showing logs for Protection: \"${protection}\" page ${page} of ${maxPages} ---`\r\n );\r\n\r\n for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) {\r\n ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`);\r\n }\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"clearAll\",\r\n description: \"Clears all logs\",\r\n })\r\n .executes((ctx) => {\r\n TABLES.logs.clear();\r\n ctx.reply(`\u00A7aCleared All logs!`);\r\n });\r\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\r\nimport { getRole } from \"../../utils\";\r\n\r\nconst root = new Command({\r\n name: \"teleport\",\r\n description: \"Teleports entities (players, mobs, etc.).\",\r\n aliases: [\"tp\"],\r\n requires: (player) => getRole(player) == \"admin\",\r\n});\r\n\r\nroot\r\n .argument(new ArgumentTypes.player())\r\n .location(\"destination\")\r\n .executes((ctx, player, destination) => {\r\n player.addTag(\"skip-movement-check\");\r\n player.teleport(destination, player.dimension, 0, 0);\r\n ctx.reply(\r\n `Teleported ${player.name} to ${destination.x} ${destination.y} ${destination.z}`\r\n );\r\n });\r\n", "import { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { msToTime } from \"../../../../utils.js\";\nimport { kick, forEachValidPlayer, getConfigId } from \"../../utils.js\";\n\nforEachValidPlayer((player) => {\n try {\n const banData = TABLES.bans.get(player.id);\n if (!banData) return;\n if (banData.expire && banData.expire < Date.now())\n return TABLES.bans.delete(player.id);\n kick(\n player,\n [\n `\u00A7cYou have been banned!`,\n `\u00A7aReason: \u00A7f${banData.reason}`,\n `\u00A7fExpiry: \u00A7b${\n banData.expire ? msToTime(banData.expire - Date.now()) : \"Forever\"\n }`,\n `\u00A7fAppeal at: \u00A7b${getConfigId(\"appealLink\")}`,\n ],\n () => {\n console.warn(new Error(\"Failed to kick player\"));\n TABLES.bans.delete(player.id);\n }\n );\n } catch (error) {\n console.warn(error + error.stack);\n }\n}, 20);\n", "import { Location } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { DIMENSIONS } from \"../../../../utils.js\";\nimport { forEachValidPlayer } from \"../../utils.js\";\n\nforEachValidPlayer((player) => {\n try {\n const freezeData = TABLES.freezes.get(player.id);\n\n if (!freezeData)\n return player.getComponent(\"movement\").resetToDefaultValue();\n player.getComponent(\"movement\").setCurrent(0);\n\n player.teleport(\n new Location(\n freezeData.location.x,\n freezeData.location.y,\n freezeData.location.z\n ),\n DIMENSIONS[freezeData.location.dimension as keyof typeof DIMENSIONS],\n 0,\n 0\n );\n } catch (error) {}\n}, 200);\n", "import { world, BeforeChatEvent } from \"@minecraft/server\";\r\nimport { PREFIX } from \"../../config/commands\";\r\n\r\ntype beforeChatCallback = (arg: BeforeChatEvent) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: beforeChatCallback;\r\n };\r\n} = {};\r\n\r\nworld.events.beforeChat.subscribe((data) => {\r\n if (data.message.startsWith(PREFIX)) return; // This is a command\r\n for (const callback of Object.values(CALLBACKS)) {\r\n callback.callback(data);\r\n }\r\n});\r\n\r\nexport class beforeChat {\r\n /**\r\n * Subscribes to a callback to get notified when a chat is sent that is not a command\r\n * @param callback what to be called when one of these entity's inventory changes\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(callback: beforeChatCallback): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n}\r\n", "import { Mute } from \"../models/Mute.js\";\nimport { text } from \"../../../../lang/text.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { beforeChat } from \"../../../../lib/Events/beforeChat.js\";\n\nbeforeChat.subscribe((data) => {\n const muteData = Mute.getMuteData(data.sender);\n if (!muteData) return;\n if (muteData.expire && muteData.expire < Date.now())\n return TABLES.mutes.delete(data.sender.name);\n data.cancel = true;\n data.sender.tell(text[\"modules.managers.mute.isMuted\"]());\n});\n", "import { BlockLocation, Player, system, world } from \"@minecraft/server\";\nimport { Region } from \"../models/Region.js\";\nimport { forEachValidPlayer, getRole, loadRegionDenys } from \"../../utils.js\";\nimport { BLOCK_CONTAINERS, DOORS_SWITCHES } from \"../../config/region.js\";\nimport { DIMENSIONS } from \"../../../../utils.js\";\n\n/**\n * Sets Deny blocks at bottom of region every 5 mins\n */\nsystem.runSchedule(() => {\n loadRegionDenys();\n}, 6000);\n\n/**\n * Permissions for region\n */\nworld.events.beforeItemUseOn.subscribe((data) => {\n if ([\"moderator\", \"admin\"].includes(getRole(data.source as Player))) return;\n const region = Region.blockLocationInRegion(\n data.blockLocation,\n data.source.dimension.id\n );\n if (!region) return;\n const block = data.source.dimension.getBlock(data.blockLocation);\n if (\n DOORS_SWITCHES.includes(block.typeId) &&\n region.permissions.doorsAndSwitches\n )\n return;\n if (\n BLOCK_CONTAINERS.includes(block.typeId) &&\n region.permissions.openContainers\n )\n return;\n data.cancel = true;\n});\n\nworld.events.beforeExplosion.subscribe((data) => {\n for (let i = 0; i < data.impactedBlocks.length; i++) {\n const bL = data.impactedBlocks[i];\n let region = Region.blockLocationInRegion(bL, data.dimension.id);\n if (region) return (data.cancel = true);\n }\n});\n\nworld.events.entityCreate.subscribe(async ({ entity }) => {\n const region = await Region.blockLocationInRegionSync(\n new BlockLocation(entity.location.x, entity.location.y, entity.location.z),\n entity.dimension.id\n );\n if (!region) return;\n if (region.permissions.allowedEntities.includes(entity.typeId)) return;\n entity.teleport({ x: 0, y: -64, z: 0 }, entity.dimension, 0, 0);\n entity.kill();\n});\n\nsystem.runSchedule(async () => {\n for (const region of await Region.getAllRegionsSync()) {\n for (const entity of DIMENSIONS[\n region.dimensionId as keyof typeof DIMENSIONS\n ].getEntities({ excludeTypes: region.permissions.allowedEntities })) {\n if (!region.entityInRegion(entity)) continue;\n entity.teleport({ x: 0, y: -64, z: 0 }, entity.dimension, 0, 0);\n entity.kill();\n }\n }\n}, 100);\n\n/**\n * Gives player a tag if they are in a region\n */\nforEachValidPlayer(async (player) => {\n for (const region of await Region.getAllRegionsSync()) {\n if (region.entityInRegion(player)) {\n player.addTag(`inRegion`);\n if (!region.permissions.pvp) player.addTag(`region-protected`);\n } else {\n player.removeTag(`inRegion`);\n player.removeTag(`region-protected`);\n }\n }\n}, 5);\n", "import { world } from \"@minecraft/server\";\r\nimport { text } from \"../../../../lang/text\";\r\nimport { TABLES } from \"../../../../lib/Database/tables\";\r\nimport { awaitWorldLoad } from \"../../../../utils.js\";\r\nimport { getRoleSync, isLockedDown, kick, setRole } from \"../../utils\";\r\nimport { Mute } from \"../models/Mute\";\r\nimport { ChangePlayerRoleTask } from \"../models/Task\";\r\n\r\nworld.events.playerJoin.subscribe(async ({ player }) => {\r\n await awaitWorldLoad();\r\n if (isLockedDown() && (await getRoleSync(player)) != \"admin\")\r\n return kick(player, text[\"lockdown.kick.message\"]());\r\n // --\r\n if (Mute.getMuteData(player)) player.runCommandAsync(`ability @s mute true`);\r\n if (!TABLES.ids.has(player.name)) {\r\n // Player is new!\r\n TABLES.ids.set(player.name, player.id);\r\n } else {\r\n player.addTag(\"old\");\r\n }\r\n /**\r\n * This is a role that was tried to push when the player was offline\r\n * so were setting it now because the player just joined\r\n */\r\n const roleToSet = ChangePlayerRoleTask.getPlayersRoleToSet(player.name);\r\n if (roleToSet) setRole(player, roleToSet);\r\n});\r\n", "import {\n Entity,\n InventoryComponentContainer,\n Items,\n MinecraftItemTypes,\n world,\n} from \"@minecraft/server\";\nimport { AIR } from \"../../../../index.js\";\nimport { PageItem } from \"../../../../lib/Chest GUI/Models/PageItem\";\nimport { Page } from \"../../../../lib/Chest GUI/Models/Page\";\nimport { CHESTGUIS } from \"../../../../lib/Chest GUI/utils.js\";\nimport { ItemType } from \"@minecraft/server\";\n\n/**\n * The possible fillable slots where items can be put\n * this is for inventory fill\n */\nconst FILLABLE_SLOTS = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\n 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,\n 41, 42, 43, 44,\n];\n\n/**\n * The possible fillable slots where items can be put\n * this is for inventory fill\n */\nconst FILLABLE_SLOTS_ENDERCHEST = [\n 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32,\n 33, 34, 37, 38, 39, 40, 41, 42, 43,\n];\n\n/**\n * Fills the chest Screen with the desired kit\n */\nexport function ViewPlayersFill(entity: Entity, page: Page, extras: any) {\n const container: InventoryComponentContainer = entity.getComponent(\n \"minecraft:inventory\"\n ).container;\n\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n for (const [i, player] of [...world.getPlayers()].entries()) {\n const slot = FILLABLE_SLOTS[i];\n const item = new PageItem(MinecraftItemTypes.skull, {\n nameTag: player.name,\n data: 3,\n });\n container.setItem(slot, item.itemStack);\n page.slots[slot] = {\n item: item,\n action: (ctx) => {\n ctx.PageAction(\"moderation:see_inventory\", { name: player.name });\n },\n };\n }\n}\n\n/**\n * Fills the chest Screen with the desired kit\n */\nexport function ViewPlayerInventoryFill(\n entity: Entity,\n page: Page,\n extras: any\n) {\n const container = entity.getComponent(\"minecraft:inventory\").container;\n\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n const EnderChestItem = new PageItem(MinecraftItemTypes.enderChest, {\n nameTag: `\u00A7eView \u00A7f${extras?.name}\u00A7e Ender Chest\\n\u00A7fNote: \u00A7cThis will not grab \u00A7lANY NBT!\u00A7r`,\n });\n container.setItem(49, EnderChestItem.itemStack);\n page.slots[49] = {\n item: EnderChestItem,\n action: (ctx) => {\n ctx.PageAction(\"moderation:see_ender_chest\", { name: extras.name });\n },\n };\n const player = [...world.getPlayers()].find((p) => p.name == extras.name);\n if (!player) {\n const gui = Object.values(CHESTGUIS).find((e) => e.entity.id == entity.id);\n gui.despawn();\n player.tell(`\"${extras.name}\" Could not be found, Gui Crashed`);\n }\n const inventory = player.getComponent(\"inventory\").container;\n /**\n * the value of how many slots have been taken\n */\n let used_slots = 0;\n for (let i = 0; i < inventory.size; i++) {\n const item = inventory.getItem(i);\n const slot = FILLABLE_SLOTS[used_slots];\n used_slots++;\n if (!item) {\n container.setItem(slot, AIR);\n continue;\n }\n container.setItem(slot, item);\n page.slots[slot] = {\n item: new PageItem(\n Items.get(item.typeId),\n { amount: item.amount, data: item.data },\n item\n ),\n action: async (ctx) => {\n if (i < 9) {\n await player.runCommandAsync(\n `replaceitem entity @s slot.hotbar ${i} air`\n );\n } else {\n await player.runCommandAsync(\n `replaceitem entity @s slot.inventory ${i - 9} air`\n );\n }\n ctx.GiveAction();\n page.slots[slot] = {\n item: null,\n action: (ctx) => {\n inventory.addItem(ctx.getItemAdded());\n },\n };\n },\n };\n }\n}\n\n/**\n * Fills the chest Screen with the desired kit\n */\nexport async function ViewPlayerEnderChestFill(\n entity: Entity,\n page: Page,\n extras: any\n) {\n const container = entity.getComponent(\"minecraft:inventory\").container;\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n const player = [...world.getPlayers()].find((p) => p.name == extras?.name);\n if (!player) {\n const gui = Object.values(CHESTGUIS).find((e) => e.entity.id == entity.id);\n gui.despawn();\n player.tell(`\"${extras.name}\" Could not be found, Gui Crashed`);\n }\n /**\n * the value of how many slots have been taken\n */\n let used_slots = 0;\n const ItemTypes: ItemType[] = Object.values(MinecraftItemTypes);\n for (const item of ItemTypes) {\n try {\n await player.runCommandAsync(\n `testfor @s[hasitem={item=${item.id},location=slot.enderchest}]`\n );\n const ChestGuiItem = new PageItem(item, {\n nameTag: \"Note: \u00A7l\u00A7cThis is not the exact item\",\n });\n const slot = FILLABLE_SLOTS_ENDERCHEST[used_slots];\n container.setItem(slot, ChestGuiItem.itemStack);\n page.slots[slot] = {\n item: ChestGuiItem,\n action: (ctx) => {\n ctx.GiveAction();\n page.slots[slot] = null;\n },\n };\n used_slots++;\n } catch (error) {}\n }\n}\n\nnew Page(\"moderation:see\", ViewPlayersFill)\n .setSlots(\n [50],\n new PageItem(MinecraftItemTypes.arrow, {\n nameTag: \"\u00A7fBack\",\n }),\n (ctx) => {\n ctx.PageAction(\"home\");\n }\n )\n .setSlots(\n [48],\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\n (ctx) => {\n ctx.CloseAction();\n }\n );\n\nnew Page(\"moderation:see_inventory\", ViewPlayerInventoryFill)\n .setSlots(\n [50],\n new PageItem(MinecraftItemTypes.arrow, {\n nameTag: \"\u00A7fBack\",\n }),\n (ctx) => {\n ctx.PageAction(\"moderation:see\");\n }\n )\n .setSlots(\n [48],\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\n (ctx) => {\n ctx.CloseAction();\n }\n );\n\nnew Page(\"moderation:see_ender_chest\", ViewPlayerEnderChestFill)\n .setSlots(\n [50],\n new PageItem(MinecraftItemTypes.arrow, {\n nameTag: \"\u00A7fBack\",\n }),\n (ctx) => {\n ctx.PageAction(\"moderation:see\");\n }\n )\n .setSlots(\n [48],\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\n (ctx) => {\n ctx.CloseAction();\n }\n );\n", "import { Player, MinecraftBlockTypes } from \"@minecraft/server\";\nimport { FORBIDDEN_BLOCKS } from \"../../config/moderation\";\nimport { Npc } from \"../models/Npc\";\nimport { getConfigId, getRole } from \"../../utils\";\nimport { Ban } from \"../models/Ban\";\nimport { Protection } from \"../models/Protection\";\n\n/**\n * Entities that are not allowed to spawn because they can be used by CBE\n */\nconst CBE_ENTITIES = [\"minecraft:command_block_minecart\"];\n\nconst protection = new Protection<{\n entityCreate: boolean;\n banSpawnEggs: boolean;\n}>(\"cbe\", \"Stops CBE\", \"textures/blocks/command_block.png\").setConfigDefault({\n entityCreate: {\n description: \"Adds NPC protection\",\n defaultValue: true,\n },\n banSpawnEggs: {\n description: \"If spawn eggs should be banned\",\n defaultValue: true,\n },\n});\n\nprotection.subscribe(\"entityCreate\", async ({ entity }) => {\n const config = await protection.getConfigSync();\n if (!config.entityCreate) return;\n const kill = () => {\n try {\n entity.triggerEvent(\"despawn\");\n entity.kill();\n } catch (error) {\n entity.kill();\n }\n };\n if (CBE_ENTITIES.includes(entity.typeId)) return kill();\n if (entity.typeId == \"minecraft:npc\" && !Npc.isValid(entity)) return kill();\n});\n\nprotection.subscribe(\"beforeItemUseOn\", (data) => {\n if (!(data.source instanceof Player)) return;\n if ([\"admin\", \"moderator\"].includes(getRole(data.source))) return;\n const config = protection.getConfig();\n\n if (data.item.typeId.endsWith(\"spawn_egg\")) {\n if (!config.banSpawnEggs) return;\n const block = data.source.dimension.getBlock(data.blockLocation);\n if (block.typeId == MinecraftBlockTypes.mobSpawner.id) return;\n // Cancel use so players cant use spawnEggs on floor\n data.cancel = true;\n data.source.tell(`\u00A7c[Rubedo]: You cannot place spawnEggs on the floor!`);\n data.source.playSound(`note.bass`);\n } else {\n if (FORBIDDEN_BLOCKS.includes(data.item.typeId)) {\n data.cancel = true;\n return;\n }\n const BANNED_BLOCKS = getConfigId(\"banned_blocks\");\n if (!BANNED_BLOCKS.includes(data.item.typeId)) return;\n data.cancel = true;\n new Ban(data.source, null, \"Placing Banned Blocks\");\n }\n});\n\nprotection.enable();\n", "import { Events, Player, system, world } from \"@minecraft/server\";\r\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\r\nimport { EventsReturnType, IProtectionsConfig } from \"../../../../types.js\";\r\nimport { PROTECTIONS } from \"../../protections.js\";\r\nimport { clearForEachValidPlayer, forEachValidPlayer } from \"../../utils.js\";\r\n\r\n/**\r\n * A protection instance\r\n */\r\nexport class Protection {\r\n /**\r\n * Events that this is subscribed to\r\n */\r\n private events: {\r\n -readonly [Key in keyof Events]+?: {\r\n /**\r\n * Callback this event is to run.\r\n */\r\n callback: ReturnType;\r\n /**\r\n * If this has been triggered on world.events\r\n */\r\n triggered: boolean;\r\n };\r\n };\r\n\r\n /**\r\n * List of events that this protection is scheduled\r\n */\r\n private schedules: {\r\n /**\r\n * Callback to run\r\n */\r\n callback: () => void;\r\n /**\r\n * Delay in ticks\r\n */\r\n tickInterval: number;\r\n /**\r\n * If null, this event hasn't been registered by {@link system.runSchedule}\r\n * if {@link number}, the event has been registered and this key can be used to {@link system.clearRunSchedule}\r\n */\r\n runScheduleId: number | null;\r\n }[];\r\n\r\n /**\r\n * A list of forEachValidPlayers keys used to unsubscribe\r\n */\r\n private forEachValidPlayers: {\r\n /**\r\n * Callback to run\r\n * @param player\r\n * @returns\r\n */\r\n callback: (player: Player) => void;\r\n /**\r\n * Delay in ticks\r\n */\r\n delay: number;\r\n /**\r\n * If null, this event hasn't been registered by {@link forEachValidPlayers}\r\n * if {@link number}, the event has been registered and this key can be used to unsubscribe\r\n */\r\n key: number | null;\r\n }[];\r\n\r\n /**\r\n * Callback to run on enable\r\n */\r\n private onEnableCallback: () => void | undefined;\r\n\r\n /**\r\n * Callback to run on disable\r\n */\r\n private onDisableCallback: () => void | undefined;\r\n\r\n /**\r\n * If this protection is enabled\r\n */\r\n private isEnabled: boolean;\r\n\r\n /**\r\n * The default config object\r\n */\r\n configDefault: {\r\n [key: string]: {\r\n description: string;\r\n defaultValue: string | boolean | number;\r\n };\r\n };\r\n\r\n /**\r\n * Creates a new protection module\r\n */\r\n constructor(\r\n public name: string,\r\n public description: string,\r\n public iconPath: string\r\n ) {\r\n this.name = name;\r\n this.description = description;\r\n this.iconPath = iconPath;\r\n this.configDefault = {};\r\n this.isEnabled = false;\r\n // ---- events\r\n this.events = {};\r\n this.schedules = [];\r\n this.forEachValidPlayers = [];\r\n // Save protection\r\n PROTECTIONS[this.name] = this;\r\n }\r\n\r\n /**\r\n * Sets the config to a typed object\r\n * @param data typed object\r\n * @returns\r\n */\r\n setConfigDefault(data: {\r\n [key: string]: {\r\n description: string;\r\n defaultValue: string | boolean | number;\r\n };\r\n }): Protection {\r\n this.configDefault = data;\r\n TABLES.protections.hasSync(this.name).then((v) => {\r\n if (v) return;\r\n let saveData: IProtectionsConfig = {\r\n enabled: true,\r\n };\r\n for (const key of Object.keys(data)) {\r\n saveData[key] = data[key as keyof typeof data].defaultValue;\r\n }\r\n TABLES.protections.set(this.name, saveData);\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the config data\r\n * @returns Config\r\n */\r\n getConfig(): Config {\r\n let config = TABLES.protections.get(this.name);\r\n if (!config) config = { enabled: this.isEnabled };\r\n return config as Config;\r\n }\r\n\r\n /**\r\n * Gets the config data sync, should be used for worldLoad calls\r\n * @returns Config\r\n */\r\n async getConfigSync(): Promise {\r\n let config = await TABLES.protections.getSync(this.name);\r\n if (!config) config = { enabled: this.isEnabled };\r\n return config as Config;\r\n }\r\n\r\n async setConfig(data: Config) {\r\n await TABLES.protections.set(this.name, data as IProtectionsConfig);\r\n return;\r\n }\r\n\r\n /**\r\n * Triggers a change to a activate this module or not.\r\n * @param enabled if this protection is enabled or not\r\n */\r\n private triggerChange(enabled: boolean) {\r\n if (enabled) {\r\n this.isEnabled = true;\r\n // Enable this protection\r\n this.onEnableCallback?.();\r\n for (const [key, value] of Object.entries(this.events)) {\r\n if (value.triggered) continue;\r\n let callback = world.events[key as keyof Events].subscribe(\r\n // @ts-ignore\r\n value.callback\r\n );\r\n value.triggered = true;\r\n value.callback = callback;\r\n }\r\n for (const v of this.forEachValidPlayers) {\r\n if (v.key) continue;\r\n let key = forEachValidPlayer(v.callback, v.delay);\r\n v.key = key;\r\n }\r\n for (const v of this.schedules) {\r\n if (v.runScheduleId) continue;\r\n let runScheduleId = system.runSchedule(v.callback);\r\n v.runScheduleId = runScheduleId;\r\n }\r\n } else {\r\n this.isEnabled = false;\r\n // Disable this protection\r\n this.onDisableCallback?.();\r\n for (const [key, value] of Object.entries(this.events)) {\r\n if (!value.triggered) continue;\r\n // @ts-ignore\r\n world.events[key as keyof Events].unsubscribe(value.callback);\r\n value.triggered = false;\r\n }\r\n for (const v of this.forEachValidPlayers) {\r\n if (!v.key) continue;\r\n clearForEachValidPlayer(v.key);\r\n v.key = null;\r\n }\r\n for (const v of this.schedules) {\r\n if (!v.runScheduleId) continue;\r\n system.clearRunSchedule(v.runScheduleId);\r\n v.runScheduleId = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Runs a callback once this protection is activated\r\n * @param callback function to run\r\n */\r\n onEnable(callback: () => void): Protection {\r\n this.onEnableCallback = callback;\r\n return this;\r\n }\r\n\r\n /**\r\n * Runs a callback once this protection is disabled\r\n * @param callback function to run\r\n */\r\n onDisable(callback: () => void): Protection {\r\n this.onDisableCallback = callback;\r\n return this;\r\n }\r\n\r\n /**\r\n * Subscribes to a worldEvent\r\n * @param id event id to subscribe\r\n * @param callback what to run on event callback\r\n * @returns this\r\n */\r\n subscribe(\r\n id: T,\r\n callback: EventsReturnType\r\n ): Protection {\r\n this.events[id] = {\r\n callback: callback,\r\n triggered: false,\r\n };\r\n return this;\r\n }\r\n\r\n /**\r\n * Schedules a callback to be run every x number of ticks\r\n * @param callback callback\r\n * @param tickInterval ticks\r\n */\r\n runSchedule(callback: () => void, tickInterval?: number): Protection {\r\n this.schedules.push({\r\n callback: callback,\r\n tickInterval: tickInterval,\r\n runScheduleId: null,\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Callback for each valid players\r\n * @param callback\r\n * @param delay\r\n */\r\n forEachValidPlayer(\r\n callback: (player: Player) => void,\r\n delay: number = 0\r\n ): Protection {\r\n this.forEachValidPlayers.push({\r\n callback: callback,\r\n delay: delay,\r\n key: null,\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Enables this protection\r\n */\r\n enable() {\r\n this.triggerChange(true);\r\n }\r\n\r\n /**\r\n * Disables this protection\r\n */\r\n disable() {\r\n this.triggerChange(false);\r\n }\r\n}\r\n", "import { Ban } from \"../models/Ban.js\";\nimport { Protection } from \"../models/Protection.js\";\n\n/**\n * Minecraft Bedrock Anti Crasher\n * @license MIT\n * @author Smell of curry\n * @version 1.0.0\n * --------------------------------------------------------------------------\n * This anti crasher works by testing if a player has reached a location\n * Horion's crasher teleports the player to 30 Million so we just test for\n * That location and if they are there we kick the player (USES: player.json)\n * --------------------------------------------------------------------------\n */\n\n/**\n * This is the distance where if you go past it will ban you\n */\nconst DISTANCE = 320000;\n\nnew Protection(\n \"crasher\",\n \"Protection against type 1 crasher\",\n \"textures/ui/servers.png\"\n).forEachValidPlayer((player) => {\n if (\n Math.abs(player.location.x) > DISTANCE ||\n Math.abs(player.location.y) > DISTANCE ||\n Math.abs(player.location.z) > DISTANCE\n ) {\n new Ban(player, null, \"Crasher detected\");\n }\n}).enable()\n", "import { GameMode, world } from \"@minecraft/server\";\nimport { getRole } from \"../../utils.js\";\nimport { Ban } from \"../models/Ban.js\";\nimport { Protection } from \"../models/Protection.js\";\nimport { PlayerLog } from \"../models/PlayerLog.js\";\n\n/**\n * The gamemode that you cannot be in unless you have staff tag\n */\nconst ILLEGAL_GAMEMODE = GameMode.creative;\n\n/**\n * Stores per world load violation data for players\n */\nconst ViolationCount = new PlayerLog();\n\nconst protection = new Protection<{\n clearPlayer: boolean;\n setToSurvival: boolean;\n banPlayer: boolean;\n violationCount: number;\n}>(\n \"gamemode\",\n \"Blocks illegal gamemode\",\n \"textures/ui/creative_icon.png\"\n).setConfigDefault({\n clearPlayer: {\n description: \"Whether to clear players inventory.\",\n defaultValue: true,\n },\n setToSurvival: {\n description: \"If player should be set to survival after being flagged.\",\n defaultValue: true,\n },\n banPlayer: {\n description: \"If player should be banned after violation count is met.\",\n defaultValue: false,\n },\n violationCount: {\n description: \"The amount of violations before ban.\",\n defaultValue: 0,\n },\n});\n\nprotection.runSchedule(async () => {\n const config = await protection.getConfigSync();\n for (const player of world.getPlayers({ gameMode: ILLEGAL_GAMEMODE })) {\n if ([\"moderator\", \"admin\", \"builder\"].includes(getRole(player))) continue;\n try {\n if (config.setToSurvival) player.runCommandAsync(`gamemode s`);\n if (config.clearPlayer) player.runCommandAsync(`clear @s`);\n } catch (error) {}\n const count = (ViolationCount.get(player) ?? 0) + 1;\n ViolationCount.set(player, count);\n if (config.banPlayer && count >= config.violationCount)\n new Ban(player, null, \"Illegal Gamemode\");\n }\n}, 20);\n\nprotection.enable();\n", "import {\r\n world,\r\n Location,\r\n Block,\r\n BlockPermutation,\r\n Dimension,\r\n Player,\r\n system,\r\n} from \"@minecraft/server\";\r\nimport { API_CONTAINERS } from \"../../plugins/Anti-Cheat/config/moderation\";\r\nimport { CONTAINER_LOCATIONS } from \"../../plugins/Anti-Cheat/modules/managers/containers.js\";\r\n\r\ntype beforeBlockBreakCallback = (arg0: BeforeBlockBreakEvent) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: beforeBlockBreakCallback;\r\n };\r\n} = {};\r\n\r\nworld.events.blockBreak.subscribe((data) => {\r\n for (const callback of Object.values(CALLBACKS)) {\r\n callback.callback(\r\n new BeforeBlockBreakEvent(\r\n data.block,\r\n data.brokenBlockPermutation,\r\n data.dimension,\r\n data.player\r\n )\r\n );\r\n }\r\n});\r\n\r\nexport class beforeBlockBreak {\r\n /**\r\n * Subscribes to a callback to get notified when a chat is sent that is not a command\r\n * @param callback what to be called when one of these entities inventory's changes\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(callback: beforeBlockBreakCallback): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n}\r\n\r\nclass BeforeBlockBreakEvent {\r\n /**\r\n * Contains information regarding an event before a player breaks a block.\r\n * @param block Block broken in this event. Note that because this event fires right after a block is broken, the block you will receive will likely be of type 'minecraft:air'. See the .brokenBlockPermutation property for information on this block before it was broken.\r\n * @param brokenBlockPermutation Returns permutation information about this block before it was broken.\r\n * @param dimension Dimension that contains the block that has been broken in this event.\r\n * @param player Player that broke the block for this event.\r\n */\r\n constructor(\r\n public block: Block,\r\n public brokenBlockPermutation: BlockPermutation,\r\n public dimension: Dimension,\r\n public player: Player\r\n ) {\r\n this.block = block;\r\n this.brokenBlockPermutation = brokenBlockPermutation;\r\n this.dimension = dimension;\r\n this.player = player;\r\n }\r\n\r\n set cancel(value: boolean) {\r\n // setting block back\r\n this.dimension\r\n .getBlock(this.block.location)\r\n .setPermutation(this.brokenBlockPermutation.clone());\r\n // setting chest inventory back\r\n if (API_CONTAINERS.includes(this.brokenBlockPermutation.type.id)) {\r\n const OLD_INVENTORY =\r\n CONTAINER_LOCATIONS[JSON.stringify(this.block.location)];\r\n if (OLD_INVENTORY) {\r\n OLD_INVENTORY.load(this.block.getComponent(\"inventory\").container);\r\n }\r\n }\r\n // killing dropped items\r\n system.run(() => {\r\n [\r\n ...this.dimension.getEntities({\r\n maxDistance: 2,\r\n type: \"minecraft:item\",\r\n location: new Location(\r\n this.block.location.x,\r\n this.block.location.y,\r\n this.block.location.z\r\n ),\r\n }),\r\n ].forEach((e) => e.kill());\r\n })\r\n }\r\n}\r\n", "import { system, world } from \"@minecraft/server\";\r\nimport { API_CONTAINERS, CHECK_SIZE } from \"../../config/moderation\";\r\nimport { IContainerLocation } from \"../../../../types\";\r\nimport { vector3ToBlockLocation } from \"../../../../utils.js\";\r\nimport { BlockInventory } from \"../models/BlockInventory\";\r\n\r\n/**\r\n * storage of all container locations in the world\r\n */\r\nexport let CONTAINER_LOCATIONS: IContainerLocation = {};\r\n\r\nsystem.runSchedule(() => {\r\n CONTAINER_LOCATIONS = {};\r\n for (const player of world.getPlayers()) {\r\n if (player.dimension.id != \"minecraft:overworld\") continue;\r\n const blockLoc = vector3ToBlockLocation(player.location);\r\n const pos1 = blockLoc.offset(CHECK_SIZE.x, CHECK_SIZE.y, CHECK_SIZE.z);\r\n const pos2 = blockLoc.offset(-CHECK_SIZE.x, -CHECK_SIZE.y, -CHECK_SIZE.z);\r\n\r\n for (const location of pos1.blocksBetween(pos2)) {\r\n if (location.y < -64) continue;\r\n const block = player.dimension.getBlock(location);\r\n if (!block) continue;\r\n if (!API_CONTAINERS.includes(block.typeId)) continue;\r\n CONTAINER_LOCATIONS[JSON.stringify(location)] = new BlockInventory(\r\n block.getComponent(\"inventory\").container\r\n );\r\n }\r\n }\r\n}, 100);\r\n", "import { BlockInventoryComponentContainer, ItemStack } from \"@minecraft/server\";\n\nexport class BlockInventory {\n emptySlotsCount: number;\n size: number;\n items: Array;\n /**\n * Coverts a blockInventoryComponentContainer and saves it\n * @param {BlockInventoryComponentContainer} inventory\n */\n constructor(inventory: BlockInventoryComponentContainer) {\n this.emptySlotsCount = inventory.emptySlotsCount;\n this.size = inventory.size;\n this.items = [];\n for (let i = 0; i < this.size; i++) {\n this.items[i] = inventory.getItem(i);\n }\n }\n\n /**\n * Loads this inventory onto a BlockInventoryComponentContainer\n * @param {BlockInventoryComponentContainer} block block to load on\n */\n load(block: BlockInventoryComponentContainer) {\n for (let i = 0; i < block.size; i++) {\n if (!this.items[i]) continue;\n block.setItem(i, this.items[i]);\n }\n }\n}\n", "import { PlayerLog } from \"../models/PlayerLog.js\";\nimport { getRole } from \"../../utils.js\";\nimport { Ban } from \"../models/Ban.js\";\nimport { beforeBlockBreak } from \"../../../../lib/Events/beforeBlockBreak.js\";\nimport { Protection } from \"../models/Protection.js\";\n\n/**\n * The log of the players break times\n */\nconst log = new PlayerLog();\n\n/**\n * if a block is broken faster than this time it is considered hacking\n */\nconst IMPOSSIBLE_BREAK_TIME = 15;\n\n/**\n * When breaking vegetation blocks it could cause a false trigger\n * so when a block gets broken and it has one of the block tags\n * it gets skipped and doesn't count in the nuker event\n *\n * @link https://wiki.bedrock.dev/blocks/block-tags.html\n */\nconst VALID_BLOCK_TAGS = [\n \"snow\",\n \"lush_plants_replaceable\",\n \"azalea_log_replaceable\",\n \"minecraft:crop\",\n \"fertilize_area\",\n];\n\n/**\n * A list of all the blocks that are impossible to break unless you have hacks\n */\nconst IMPOSSIBLE_BREAKS = [\n \"minecraft:water\",\n \"minecraft:flowing_water\",\n \"minecraft:lava\",\n \"minecraft:flowing_lava\",\n \"minecraft:bedrock\",\n];\n\n/**\n * Stores per world load violation data for players\n */\nconst ViolationCount = new PlayerLog();\n\nlet beforeBlockBreakKey: number = null;\n\nconst protection = new Protection<{\n banPlayer: boolean;\n violationCount: number;\n}>(\n \"nuker\",\n \"Blocks block breaking too fast\",\n \"textures/blocks/dirt.png\"\n).setConfigDefault({\n banPlayer: {\n description: \"If the player should be banned once violation count is met\",\n defaultValue: false,\n },\n violationCount: {\n description: \"Violations before ban\",\n defaultValue: 0,\n },\n});\n\nprotection\n .onEnable(async () => {\n const config = await protection.getConfigSync();\n beforeBlockBreakKey = beforeBlockBreak.subscribe((data) => {\n if ([\"moderator\", \"admin\"].includes(getRole(data.player))) return;\n if (data.block.getTags().some((tag) => VALID_BLOCK_TAGS.includes(tag)))\n return;\n const old = log.get(data.player);\n log.set(data.player, Date.now());\n if (!old) return;\n\n // If block is impossible to break skip check, reduces lag.\n if (!IMPOSSIBLE_BREAKS.includes(data.block.typeId)) {\n if (old < Date.now() - IMPOSSIBLE_BREAK_TIME) return;\n const count = (ViolationCount.get(data.player) ?? 0) + 1;\n ViolationCount.set(data.player, count);\n if (config.banPlayer && count >= config.violationCount)\n new Ban(data.player, null, \"Using Nuker\");\n }\n\n data.cancel = true;\n });\n })\n .onDisable(() => {\n beforeBlockBreak.unsubscribe(beforeBlockBreakKey);\n });\n\nprotection.enable();\n", "import { PREFIX } from \"../../../../config/commands\";\r\nimport { getRole } from \"../../utils\";\r\nimport { Mute } from \"../models/Mute\";\r\nimport { PlayerLog } from \"../models/PlayerLog\";\r\nimport { Protection } from \"../models/Protection\";\r\n\r\nconst previousMessage = new PlayerLog();\r\n\r\n/**\r\n * Stores per world load violation data for players\r\n */\r\nconst ViolationCount = new PlayerLog();\r\n\r\nconst protection = new Protection<{\r\n permMutePlayer: boolean;\r\n violationCount: number;\r\n repeatedMessages: boolean;\r\n zalgo: boolean;\r\n}>(\"spam\", \"Blocks spam in chat\", \"textures/ui/mute_on.png\").setConfigDefault({\r\n permMutePlayer: {\r\n description:\r\n \"If player should be permanently muted once violation count is met.\",\r\n defaultValue: false,\r\n },\r\n violationCount: {\r\n description: \"Violation count before permanent mute\",\r\n defaultValue: 0,\r\n },\r\n repeatedMessages: {\r\n description: \"Blocks repeated messages\",\r\n defaultValue: true,\r\n },\r\n zalgo: {\r\n description: \"Blocks zalgo\",\r\n defaultValue: true,\r\n },\r\n});\r\n\r\nprotection.subscribe(\"beforeChat\", (data) => {\r\n try {\r\n if (data.message.startsWith(PREFIX)) return;\r\n if ([\"admin\", \"moderator\"].includes(getRole(data.sender))) return;\r\n const config = protection.getConfig();\r\n const isSpam = () => {\r\n const count = (ViolationCount.get(data.sender) ?? 0) + 1;\r\n ViolationCount.set(data.sender, count);\r\n if (config.permMutePlayer && count >= config.violationCount)\r\n new Mute(data.sender, null, \"Spamming\");\r\n };\r\n if (\r\n config.repeatedMessages &&\r\n previousMessage.get(data.sender) == data.message\r\n ) {\r\n data.cancel = true;\r\n isSpam();\r\n return data.sender.tell(`\u00A7cRepeated message detected!`);\r\n }\r\n if (config.zalgo && /%CC%/g.test(encodeURIComponent(data.message))) {\r\n data.cancel = true;\r\n isSpam();\r\n return data.sender.tell(\r\n `\u00A7cYou message contains some type of zalgo and cannot be sent!`\r\n );\r\n }\r\n previousMessage.set(data.sender, data.message);\r\n } catch (error) {\r\n console.warn(error + error.stack);\r\n }\r\n});\r\n\r\nprotection.enable();\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { FORBIDDEN_ITEMS } from \"../../config/moderation.js\";\r\nimport { AIR } from \"../../../../index.js\";\r\nimport { getConfigId, getMaxEnchantmentLevel } from \"../../utils\";\r\nimport { Ban } from \"../models/Ban.js\";\r\nimport { Log } from \"../models/Log.js\";\r\nimport { PlayerLog } from \"../models/PlayerLog.js\";\r\nimport { Protection } from \"../models/Protection.js\";\r\n\r\n/**\r\n * Stores violation count for player\r\n */\r\nconst ViolationCount = new PlayerLog();\r\n\r\n/**\r\n * Flags a player for a item they should not have\r\n * @param player player to flag\r\n * @param index the index of this item in the players inventory\r\n */\r\nfunction flag(player: Player, index: number) {\r\n const inventory = player.getComponent(\"inventory\").container;\r\n const item = inventory.getItem(index);\r\n const data = getConfigId(\"cbe_config\");\r\n // Clear Item\r\n if (data.clearItem) inventory.setItem(index, AIR);\r\n // Log action\r\n new Log({\r\n playerName: player.name,\r\n message: `${player.name} Has obtained a unobtainable item: ${item.typeId}`,\r\n protection: \"unobtainable\",\r\n });\r\n // Violation\r\n if (!data.banPlayer) return;\r\n const violations = (ViolationCount.get(player) ?? 0) + 1;\r\n ViolationCount.set(player, violations);\r\n if (violations < data.violationCount) return;\r\n new Ban(player, null, \"Possession of Unobtainable item\");\r\n}\r\n\r\nnew Protection(\r\n \"unobtainable\",\r\n \"Blocks unobtainable items\",\r\n \"textures/blocks/end_portal.png\"\r\n)\r\n .forEachValidPlayer((player) => {\r\n const BANNED_ITEMS = getConfigId(\"banned_items\");\r\n\r\n const inventory = player.getComponent(\"inventory\").container;\r\n for (let i = 0; i < inventory.size; i++) {\r\n const item = inventory.getItem(i);\r\n if (!item) continue;\r\n if (BANNED_ITEMS.includes(item.typeId)) return flag(player, i);\r\n if (FORBIDDEN_ITEMS.includes(item.typeId)) {\r\n // Log action\r\n new Log({\r\n playerName: player.name,\r\n message: `${player.name} Has obtained a Forbidden item: ${item.typeId}`,\r\n protection: \"unobtainable\",\r\n });\r\n return inventory.setItem(i, AIR);\r\n }\r\n // Player is allowed to have this itemType\r\n /**\r\n * List of all enchantments that are valid on this item\r\n */\r\n let enchantments: string[] = [];\r\n for (const enchantment of item.getComponent(\"enchantments\")\r\n .enchantments) {\r\n const MAX_LEVEL = getMaxEnchantmentLevel(enchantment);\r\n if (enchantment.level > MAX_LEVEL) return flag(player, i);\r\n if (enchantment.level < 1) return flag(player, i);\r\n if (enchantments.includes(enchantment.type.id)) return flag(player, i);\r\n // Enchantment Is valid\r\n enchantments.push(enchantment.type.id);\r\n }\r\n }\r\n })\r\n .enable();\r\n", "import {\r\n MinecraftBlockTypes,\r\n MinecraftEntityTypes,\r\n MinecraftItemTypes,\r\n Player,\r\n} from \"@minecraft/server\";\r\nimport { AIR } from \"../../../../index.js\";\r\nimport { getGamemode } from \"../../utils.js\";\r\nimport { Protection } from \"../models/Protection.js\";\r\n\r\n/**\r\n * List of blocks to test\r\n */\r\nconst BLOCKS = [\r\n MinecraftBlockTypes.chest.id,\r\n MinecraftBlockTypes.trappedChest.id,\r\n MinecraftBlockTypes.barrel.id,\r\n MinecraftBlockTypes.dispenser.id,\r\n MinecraftBlockTypes.dropper.id,\r\n MinecraftBlockTypes.furnace.id,\r\n MinecraftBlockTypes.litFurnace.id,\r\n MinecraftBlockTypes.blastFurnace.id,\r\n MinecraftBlockTypes.litBlastFurnace.id,\r\n MinecraftBlockTypes.smoker.id,\r\n MinecraftBlockTypes.litSmoker.id,\r\n MinecraftBlockTypes.hopper.id,\r\n MinecraftBlockTypes.beehive.id,\r\n MinecraftBlockTypes.beeNest.id,\r\n MinecraftBlockTypes.mobSpawner.id,\r\n];\r\n\r\n/**\r\n * List of items to test\r\n */\r\nconst CHEST_BOATS = [\r\n MinecraftItemTypes.chestBoat.id,\r\n MinecraftItemTypes.oakChestBoat.id,\r\n MinecraftItemTypes.birchChestBoat.id,\r\n MinecraftItemTypes.acaciaChestBoat.id,\r\n MinecraftItemTypes.jungleChestBoat.id,\r\n MinecraftItemTypes.spruceChestBoat.id,\r\n MinecraftItemTypes.darkOakChestBoat.id,\r\n MinecraftItemTypes.mangroveChestBoat.id,\r\n];\r\n\r\nnew Protection(\r\n \"nbt\",\r\n \"Blocks illegal nbt on items\",\r\n \"textures/ui/icon_random.png\"\r\n)\r\n .subscribe(\"blockPlace\", async ({ block }) => {\r\n if (!BLOCKS.includes(block.typeId)) return;\r\n const permutation = block.permutation;\r\n await block.dimension.runCommandAsync(\r\n `setblock ${block.x} ${block.y} ${block.z} ${block.typeId}`\r\n );\r\n block.setPermutation(permutation);\r\n })\r\n .subscribe(\"beforeItemUseOn\", (data) => {\r\n if (!(data.source instanceof Player)) return;\r\n if (!CHEST_BOATS.includes(data.item.typeId)) return;\r\n data.cancel = true;\r\n data.source.dimension.spawnEntity(\r\n MinecraftEntityTypes.chestBoat.id,\r\n data.blockLocation.above()\r\n );\r\n if (getGamemode(data.source) == \"creative\") return;\r\n data.source\r\n .getComponent(\"inventory\")\r\n .container.setItem(data.source.selectedSlot, AIR);\r\n })\r\n .enable();\r\n", "import {\r\n MinecraftEffectTypes,\r\n MinecraftItemTypes,\r\n Player,\r\n Vector3,\r\n} from \"@minecraft/server\";\r\nimport {\r\n ILocationLog,\r\n onPlayerMove,\r\n} from \"../../../../lib/Events/onPlayerMove\";\r\nimport {\r\n ANTI_TP_DISTANCE_THRESHOLD,\r\n MOVEMENT_CONSTANTS,\r\n MOVEMENT_DISTANCE_THRESHOLD,\r\n SPEED_EFFECT_INCREASE,\r\n TAGS,\r\n} from \"../../config/movement\";\r\nimport { getRole } from \"../../utils\";\r\nimport { PlayerLog } from \"../models/PlayerLog\";\r\nimport { Protection } from \"../models/Protection\";\r\n\r\nconst violations = new PlayerLog();\r\n\r\n/**\r\n * Calculates the distance from loc1 to loc2\r\n * @param {Location} loc1 location 1\r\n * @param {Location} loc2 location 2\r\n * @returns {number}\r\n */\r\nfunction distanceBetween(loc1: Vector3, loc2: Vector3): number {\r\n return Math.hypot(loc2.x - loc1.x, loc2.z - loc1.z);\r\n}\r\n\r\n/**\r\n * Gets the speed offset based on a players SpeedEffect\r\n * @param player player to get\r\n */\r\nfunction getSpeedOffset(player: Player): number {\r\n const speed = player.getEffect(MinecraftEffectTypes.speed)?.amplifier ?? 0;\r\n return speed * SPEED_EFFECT_INCREASE;\r\n}\r\n\r\n/**\r\n * Checks if a distance traveled is big enough to be flagged\r\n * @param distance distance the player has traveled\r\n * @returns if this distance is bad\r\n */\r\nfunction isDistanceFlag(distance: number, player: Player): boolean {\r\n const speedIntensity = getSpeedOffset(player);\r\n const offset = MOVEMENT_CONSTANTS.run.distance + MOVEMENT_DISTANCE_THRESHOLD;\r\n return distance > speedIntensity + offset;\r\n}\r\n\r\nfunction flag(player: Player, old: ILocationLog) {\r\n const violationCount = (violations.get(player) ?? 0) + 1;\r\n violations.set(player, violationCount);\r\n onPlayerMove.delete(player); // Reset Players old location\r\n if (violationCount < 3) return;\r\n player.teleport(\r\n old.location,\r\n old.dimension,\r\n player.rotation.x,\r\n player.rotation.y\r\n );\r\n}\r\n\r\n/**\r\n * The key used to unsubscribe from this event\r\n */\r\nlet onPlayerMoveSubKey: number = null;\r\n\r\nconst protection = new Protection<{\r\n tpCheck: boolean;\r\n}>(\r\n \"movement\",\r\n \"Blocks illegal movements on players\",\r\n \"textures/ui/move.png\"\r\n).setConfigDefault({\r\n tpCheck: {\r\n description: \"If teleports should be flagged\",\r\n defaultValue: true,\r\n },\r\n});\r\n\r\nprotection\r\n .onEnable(async () => {\r\n console.warn(`enabled movement protection`)\r\n const config = await protection.getConfigSync();\r\n onPlayerMoveSubKey = onPlayerMove.subscribe((player, old) => {\r\n if (getRole(player) == \"admin\") return;\r\n if (player.dimension.id != old.dimension.id) return;\r\n if (player.getTags().some((tag) => TAGS.includes(tag))) return;\r\n const distance = distanceBetween(player.location, old.location);\r\n if (player.hasTag(`skip-movement-check`))\r\n return player.removeTag(`skip-movement-check`);\r\n if (distance > ANTI_TP_DISTANCE_THRESHOLD) {\r\n if (!config.tpCheck) return;\r\n // Anti Tp.\r\n flag(player, old);\r\n } else {\r\n // Anti speed/jet pack\r\n if (!isDistanceFlag(distance, player)) return;\r\n // Flagged\r\n flag(player, old);\r\n }\r\n });\r\n })\r\n .onDisable(() => {\r\n console.warn(`disabled movement protection`);\r\n onPlayerMove.unsubscribe(onPlayerMoveSubKey);\r\n });\r\n\r\nprotection.subscribe(\"dataDrivenEntityTriggerEvent\", (data) => {\r\n if (!(data.entity instanceof Player)) return;\r\n if (data.id != \"on_death\") return;\r\n onPlayerMove.delete(data.entity); // Reset Players old location\r\n});\r\n\r\nprotection.subscribe(\"projectileHit\", ({ projectile, source }) => {\r\n if (projectile.typeId != MinecraftItemTypes.enderPearl.id) return;\r\n if (!(source instanceof Player)) return;\r\n onPlayerMove.delete(source); // Reset Players old location\r\n});\r\n\r\nprotection.subscribe(\"itemCompleteCharge\", ({ itemStack, source }) => {\r\n if (itemStack.typeId != MinecraftItemTypes.chorusFruit.id) return;\r\n if (!(source instanceof Player)) return;\r\n onPlayerMove.delete(source); // Reset Players old location\r\n});", "import { Dimension, Player, Vector3, world } from \"@minecraft/server\";\r\nimport { PlayerLog } from \"../../plugins/Anti-Cheat/modules/models/PlayerLog\";\r\n\r\ntype onPlayerMoveCallback = (player: Player, data: ILocationLog) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: onPlayerMoveCallback;\r\n };\r\n} = {};\r\n\r\nexport interface ILocationLog {\r\n /**\r\n * The Location this is\r\n */\r\n location: Vector3;\r\n /**\r\n * The dimension this location was in\r\n */\r\n dimension: Dimension;\r\n /**\r\n * The world tick this location log was set on\r\n */\r\n tickSet: number;\r\n}\r\n\r\n/**\r\n * Checks if two vectors are the same\r\n * @param from first vector\r\n * @param to second vector\r\n */\r\nfunction vector3Equals(from: Vector3, to: Vector3): boolean {\r\n if (from.x != to.x) return false;\r\n if (from.y != to.y) return false;\r\n if (from.z != to.z) return false;\r\n return true;\r\n}\r\n\r\n/**\r\n * Stores Last Previous grounded location\r\n */\r\nexport const playerLocation = new PlayerLog();\r\n\r\nworld.events.tick.subscribe((data) => {\r\n const sendCallback = (player: Player, data: ILocationLog) => {\r\n for (const callback of Object.values(CALLBACKS)) {\r\n callback.callback(player, data);\r\n }\r\n };\r\n for (const player of world.getPlayers()) {\r\n const oldLocation = playerLocation.get(player);\r\n if (oldLocation) {\r\n if (vector3Equals(player.location, oldLocation.location)) {\r\n continue;\r\n }\r\n }\r\n playerLocation.set(player, {\r\n location: player.location,\r\n dimension: player.dimension,\r\n tickSet: data.currentTick,\r\n });\r\n if (!oldLocation) continue;\r\n sendCallback(player, oldLocation);\r\n }\r\n});\r\n\r\nexport class onPlayerMove {\r\n /**\r\n * Subscribes to a callback to get notified when a player moves\r\n * @param callback what to be called when one of these entity's inventory changes\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(callback: onPlayerMoveCallback): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n /**\r\n * Clears a players location\r\n * @param player player to clear\r\n */\r\n static delete(player: Player): void {\r\n playerLocation.delete(player);\r\n }\r\n}\r\n", "/**\r\n * The leeway that the distances can be off before it flags\r\n */\r\nexport const MOVEMENT_DISTANCE_THRESHOLD = 0.80;\r\n\r\n/**\r\n * Constant of speeds when players are moving\r\n */\r\nexport const MOVEMENT_CONSTANTS = {\r\n walk: {\r\n velocity: 0.17 as const,\r\n distance: 0.23 as const,\r\n },\r\n run: {\r\n velocity: 0.19 as const,\r\n distance: 0.35 as const,\r\n },\r\n};\r\n\r\n/**\r\n * The distance increase per speed effect increase\r\n */\r\nexport const SPEED_EFFECT_INCREASE = 0.056;\r\n\r\n/**\r\n * if the distance is over this amount the system will automatically flag tp\r\n */\r\nexport const ANTI_TP_DISTANCE_THRESHOLD = 10;\r\n\r\n/**\r\n * If your \r\n */\r\nexport const TAGS = [\"gliding\", \"riding\"];\r\n", "import { MinecraftEffectTypes, Player, world } from \"@minecraft/server\";\r\nimport { getServerOwnerName, setRole, setServerOwner } from \"../../utils\";\r\n\r\nlet e = world.events.beforeDataDrivenEntityTriggerEvent.subscribe((data) => {\r\n if (!(data.entity instanceof Player)) return;\r\n if (data.id != \"rubedo:becomeAdmin\") return;\r\n // Rubedo is now verified to be at the top\r\n data.entity.removeTag(\"CHECK_PACK\");\r\n const serverOwnerName = getServerOwnerName();\r\n if (serverOwnerName) {\r\n data.entity.playSound(\"note.bass\");\r\n data.entity.tell(\r\n `\u00A7cFailed to give server owner: \"${serverOwnerName}\" is already owner!`\r\n );\r\n return world.events.beforeDataDrivenEntityTriggerEvent.unsubscribe(e);\r\n }\r\n setRole(data.entity, \"admin\");\r\n setServerOwner(data.entity);\r\n data.entity.addEffect(MinecraftEffectTypes.blindness, 3, 255, true);\r\n data.entity.tell(\r\n `\u00A7aYou have now been set as the \"owner\" of this server. The command \"/function start\" will not do anything anymore, type \"-help\" for more information!`\r\n );\r\n});\r\n", "import { system } from \"@minecraft/server\";\r\n\r\nsystem.events.beforeWatchdogTerminate.subscribe((data) => {\r\n data.cancel = true;\r\n console.warn(`WATCHDOG TRIED TO CRASH = ${data.terminateReason}`);\r\n});\r\n", "import {\r\n DynamicPropertiesDefinition,\r\n EntityTypes,\r\n MinecraftEntityTypes,\r\n world,\r\n} from \"@minecraft/server\";\r\nimport {\r\n ENTITY_IDENTIFIER,\r\n ENTITY_LOCATION,\r\n} from \"../../../../config/database\";\r\nimport { OBJECTIVES } from \"../../../../config/objectives\";\r\nimport { DIMENSIONS } from \"../../../../utils.js\";\r\n\r\nworld.events.worldInitialize.subscribe(({ propertyRegistry }) => {\r\n /**\r\n * Loads Ticking Area\r\n */\r\n DIMENSIONS.overworld.runCommandAsync(\r\n `tickingarea add ${ENTITY_LOCATION.x} ${ENTITY_LOCATION.y} ${ENTITY_LOCATION.z} ${ENTITY_LOCATION.x} ${ENTITY_LOCATION.y} ${ENTITY_LOCATION.z} db true`\r\n );\r\n\r\n let def = new DynamicPropertiesDefinition();\r\n def.defineString(\"tableName\", 30);\r\n def.defineNumber(\"index\");\r\n propertyRegistry.registerEntityTypeDynamicProperties(\r\n def,\r\n EntityTypes.get(ENTITY_IDENTIFIER)\r\n );\r\n\r\n let def2 = new DynamicPropertiesDefinition();\r\n def2.defineString(\"role\", 30);\r\n propertyRegistry.registerEntityTypeDynamicProperties(\r\n def2,\r\n MinecraftEntityTypes.player\r\n );\r\n\r\n let def3 = new DynamicPropertiesDefinition();\r\n def3.defineString(\"worldsOwner\", 100);\r\n def3.defineBoolean(\"isLockDown\");\r\n propertyRegistry.registerWorldDynamicProperties(def3);\r\n\r\n for (const obj of OBJECTIVES) {\r\n world.scoreboard.addObjective(obj.objective, obj.displayName ?? \"\");\r\n }\r\n});\r\n", "/*\n|--------------------------------------------------------------------------\n| Objectives\n|--------------------------------------------------------------------------\n|\n| This is a list of all objectives this pack uses\n| please add any objective to this list so it can be added at world creation\n| make sure to add them before sending pack to others and new worlds.\n|\n*/\ninterface IObjective {\n objective: string;\n displayName?: string;\n}\n\nexport const OBJECTIVES: Array = [];\n", "import { Location } from \"@minecraft/server\";\r\nimport \"./protections\";\r\nimport \"./modules/commands/import\";\r\nimport \"./modules/managers/import\";\r\nimport \"./modules/pages/import\";\r\nimport \"./modules/protections/import\";\r\nimport \"./modules/events/import\";\r\n\r\n/**\r\n * Stores npc locations that are verified to allow NPC's to spawn in\r\n */\r\nexport let NPC_LOCATIONS: Array = [];\r\n\r\nexport function clearNpcLocations() {\r\n NPC_LOCATIONS = [];\r\n}\r\n", "console.warn(`----- Importing Plugins -----`);\r\n\r\nimport \"./Anti-Cheat/index\";\r\n//import \"./ChatRanks/index\";\r\n//import \"./GlobalBans/index\";\r\n"], - "mappings": ";AACA,SAAS,aAA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", "MinecraftItemTypes", "world", "world", "system", "BlockLocation", "text", "BlockLocation", "system", "e", "i", "world", "text", "e", "command", "world", "command", "v", "Player", "system", "world", "world", "Player", "BlockLocation", "MinecraftBlockTypes", "system", "BlockLocation", "BlockLocation", "MinecraftBlockTypes", "MinecraftItemTypes", "Player", "world", "BlockLocation", "MinecraftBlockTypes", "system", "world", "system", "CALLBACKS", "system", "Location", "world", "Location", "e", "text", "world", "ItemStack", "MinecraftItemTypes", "system", "world", "Player", "Player", "Player", "ban", "root", "root", "freeze", "root", "command", "world", "world", "root", "mute", "Location", "Location", "world", "BlockLocation", "BlockLocation", "ROLES", "root", "text", "protection", "keys", "world", "world", "root", "protection", "root", "Location", "Location", "world", "CALLBACKS", "world", "BlockLocation", "system", "world", "system", "world", "BlockLocation", "world", "world", "MinecraftItemTypes", "world", "world", "MinecraftItemTypes", "e", "ctx", "Player", "MinecraftBlockTypes", "system", "world", "world", "system", "Player", "MinecraftBlockTypes", "BANNED_BLOCKS", "GameMode", "world", "GameMode", "protection", "world", "world", "Location", "system", "system", "world", "system", "world", "CALLBACKS", "world", "system", "Location", "e", "ViolationCount", "protection", "ViolationCount", "protection", "ViolationCount", "violations", "BANNED_ITEMS", "MinecraftBlockTypes", "MinecraftItemTypes", "Player", "MinecraftBlockTypes", "MinecraftItemTypes", "Player", "MinecraftItemTypes", "Player", "world", "CALLBACKS", "world", "sendCallback", "data", "flag", "protection", "Player", "MinecraftItemTypes", "MinecraftEffectTypes", "Player", "world", "world", "Player", "MinecraftEffectTypes", "system", "MinecraftEntityTypes", "world", "world", "MinecraftEntityTypes", "ItemStack", "MinecraftItemTypes"] + "sources": ["../src/index.ts", "../src/lib/Command/index.ts", "../src/config/commands.ts", "../src/lib/Command/ArgumentTypes.ts", "../src/lib/Database/Database.ts", "../src/config/database.ts", "../src/utils.ts", "../src/lib/Form/Models/MessageForm.ts", "../src/lib/Database/utils.ts", "../src/lib/Database/tables.ts", "../src/lib/Command/Callback.ts", "../src/lib/Command/utils.ts", "../src/lib/Chest GUI/index.ts", "../src/config/chest.ts", "../src/plugins/Anti-Cheat/utils.ts", "../src/plugins/Anti-Cheat/modules/models/Region.ts", "../src/plugins/Anti-Cheat/config/region.ts", "../src/plugins/Anti-Cheat/modules/models/Task.ts", "../src/plugins/Anti-Cheat/config/moderation.ts", "../src/plugins/Anti-Cheat/config/enchantments.ts", "../src/config/app.ts", "../src/lib/Chest GUI/Models/EntityChest.ts", "../src/lib/Events/onSlotChange.ts", "../src/lib/Chest GUI/utils.ts", "../src/plugins/Anti-Cheat/modules/models/PlayerLog.ts", "../src/lib/Chest GUI/Models/ItemGrabbedCallback.ts", "../src/lib/Chest GUI/Models/PageItem.ts", "../src/lib/Chest GUI/Models/FillTypes.ts", "../src/lib/Chest GUI/Models/Page.ts", "../src/lib/Chest GUI/pages/home.ts", "../src/plugins/Anti-Cheat/protections.ts", "../src/lang/text.ts", "../src/lib/Command/Command.ts", "../src/plugins/Anti-Cheat/modules/models/Ban.ts", "../src/plugins/Anti-Cheat/modules/commands/ban.ts", "../src/plugins/Anti-Cheat/modules/commands/database.ts", "../src/plugins/Anti-Cheat/modules/commands/ecwipe.ts", "../src/plugins/Anti-Cheat/modules/models/Freeze.ts", "../src/plugins/Anti-Cheat/modules/commands/freeze.ts", "../src/plugins/Anti-Cheat/modules/commands/help.ts", "../src/plugins/Anti-Cheat/modules/commands/lockdown.ts", "../src/plugins/Anti-Cheat/modules/models/Mute.ts", "../src/plugins/Anti-Cheat/modules/commands/mute.ts", "../src/plugins/Anti-Cheat/modules/commands/npc.ts", "../src/plugins/Anti-Cheat/modules/models/Npc.ts", "../src/plugins/Anti-Cheat/modules/commands/ping.ts", "../src/plugins/Anti-Cheat/modules/commands/region.ts", "../src/types.ts", "../src/plugins/Anti-Cheat/modules/commands/role.ts", "../src/lib/Form/Models/ActionForm.ts", "../src/lib/Form/Models/ModelForm.ts", "../src/lib/Form/Models/FormCallback.ts", "../src/plugins/Anti-Cheat/modules/forms/settings.ts", "../src/plugins/Anti-Cheat/modules/forms/automod.ts", "../src/plugins/Anti-Cheat/modules/forms/home.ts", "../src/plugins/Anti-Cheat/modules/commands/settings.ts", "../src/plugins/Anti-Cheat/modules/commands/vanish.ts", "../src/plugins/Anti-Cheat/modules/commands/version.ts", "../src/plugins/Anti-Cheat/modules/commands/kick.ts", "../src/plugins/Anti-Cheat/modules/models/Log.ts", "../src/plugins/Anti-Cheat/modules/commands/log.ts", "../src/plugins/Anti-Cheat/modules/commands/teleport.ts", "../src/plugins/Anti-Cheat/modules/managers/ban.ts", "../src/plugins/Anti-Cheat/modules/managers/freeze.ts", "../src/lib/Events/beforeChat.ts", "../src/plugins/Anti-Cheat/modules/managers/mute.ts", "../src/plugins/Anti-Cheat/modules/managers/region.ts", "../src/plugins/Anti-Cheat/modules/events/playerJoin.ts", "../src/plugins/Anti-Cheat/modules/pages/see.ts", "../src/plugins/Anti-Cheat/modules/protections/cbe.ts", "../src/plugins/Anti-Cheat/modules/models/Protection.ts", "../src/plugins/Anti-Cheat/modules/protections/crasher.ts", "../src/plugins/Anti-Cheat/modules/protections/gamemode.ts", "../src/lib/Events/beforeBlockBreak.ts", "../src/plugins/Anti-Cheat/modules/managers/containers.ts", "../src/plugins/Anti-Cheat/modules/models/BlockInventory.ts", "../src/plugins/Anti-Cheat/modules/protections/nuker.ts", "../src/plugins/Anti-Cheat/modules/protections/spam.ts", "../src/plugins/Anti-Cheat/modules/protections/unobtainable.ts", "../src/plugins/Anti-Cheat/modules/protections/nbt.ts", "../src/plugins/Anti-Cheat/modules/protections/movement.ts", "../src/lib/Events/onPlayerMove.ts", "../src/plugins/Anti-Cheat/config/movement.ts", "../src/plugins/Anti-Cheat/modules/events/beforeDataDrivenEntityTriggerEvent.ts", "../src/plugins/Anti-Cheat/modules/events/beforeWatchdogTerminate.ts", "../src/plugins/Anti-Cheat/modules/events/worldInitialize.ts", "../src/config/objectives.ts", "../src/plugins/Anti-Cheat/index.ts", "../src/plugins/import.ts"], + "sourcesContent": ["console.warn(`---- STARTING RUBEDO ----`);\nimport { ItemStack, MinecraftItemTypes } from \"@minecraft/server\";\nimport \"./lib/Command/index\";\nimport \"./lib/Chest GUI/index\";\nimport \"./plugins/import\";\n\n/**\n * This is air as a item,\n */\nexport const AIR = new ItemStack(MinecraftItemTypes.stick, 0);\n\n/**\n * If the world is loaded or not\n */\nexport let WORLD_IS_LOADED = false;\n\n/**\n * Sets the world to loaded\n */\nexport function setWorldIsLoaded() {\n WORLD_IS_LOADED = true;\n}\n", "import { BeforeChatEvent, world } from \"@minecraft/server\";\r\nimport { PREFIX } from \"../../config/commands\";\r\nimport type { Command } from \"./Command\";\r\nimport {\r\n commandNotFound,\r\n commandSyntaxFail,\r\n getChatAugments,\r\n noPerm,\r\n sendCallback,\r\n} from \"./utils\";\r\n\r\n/**\r\n * An array of all active commands\r\n */\r\nexport const COMMANDS: Command[] = [];\r\n\r\nworld.events.beforeChat.subscribe((data) => {\r\n if (!data.message.startsWith(PREFIX)) return; // This is not a command\r\n data.cancel = true;\r\n const args = getChatAugments(data.message, PREFIX);\r\n const command = COMMANDS.find(\r\n (c) =>\r\n c.depth == 0 &&\r\n (c.data.name == args[0] || c.data?.aliases?.includes(args[0]))\r\n );\r\n const event = {\r\n message: data.message,\r\n sendToTargets: data.sendToTargets,\r\n sender: data.sender,\r\n targets: data.targets,\r\n } as BeforeChatEvent;\r\n if (!command) return commandNotFound(data.sender, args[0]);\r\n if (!command.data?.requires(data.sender))\r\n return noPerm(event.sender, command);\r\n args.shift(); // Remove first command so we can look at args\r\n // Check Args/SubCommands for errors\r\n const verifiedCommands: Command[] = [];\r\n const getArg = (start: Command, i: number): string => {\r\n if (start.children.length > 0) {\r\n const arg = start.children.find((v) => v.type.matches(args[i]).success);\r\n if (!arg && !args[i] && start.callback) return;\r\n if (!arg)\r\n return commandSyntaxFail(event.sender, command, start, args, i), \"fail\";\r\n if (!arg.data?.requires(event.sender))\r\n return noPerm(event.sender, arg), \"fail\";\r\n verifiedCommands.push(arg);\r\n return getArg(arg, i + 1);\r\n }\r\n };\r\n let v = getArg(command, 0);\r\n if (v == \"fail\") return;\r\n sendCallback(args, verifiedCommands, event, command);\r\n});\r\n", "/*\n|--------------------------------------------------------------------------\n| Command Prefix\n|--------------------------------------------------------------------------\n|\n| This is the prefix of the commands that are send in chat\n| changing this changes what people have to type in before using\n| a command for instance: -help. (-) is the command prefix.\n|\n*/\nexport const PREFIX = \"-\";\n", "import { Player, world } from \"@minecraft/server\";\r\nimport { TABLES } from \"../Database/tables\";\r\n\r\n/**\r\n * Fetch an online players data\r\n */\r\nexport function fetch(playerName: string): Player | null {\r\n return [...world.getPlayers()].find((player) => player.name === playerName);\r\n}\r\n\r\nexport interface IArgumentReturnData {\r\n /**\r\n * If this argument matches the value\r\n */\r\n success: boolean;\r\n /**\r\n * The parsed value that should be passed in command callback\r\n * if there is no return type this will be null\r\n */\r\n value?: T;\r\n}\r\n\r\nexport abstract class IArgumentType {\r\n /**\r\n * The return type\r\n */\r\n type: any;\r\n /**\r\n * The name that the help for this command will see\r\n * @example \"string\"\r\n * @example \"Location\"\r\n * @example \"int\"\r\n * @example \"number\"\r\n * @example \"UnitType\"\r\n */\r\n typeName: string;\r\n /**\r\n * The name this argument is\r\n */\r\n name: string = \"name\";\r\n /**\r\n * Checks if a value matches this argument type, also\r\n * returns the corresponding type\r\n */\r\n matches(value: string): IArgumentReturnData {\r\n return { success: true };\r\n }\r\n /**\r\n * the fail message that should be sent if player fails to meet the matches criteria\r\n * @param value value that was sent\r\n * @returns what would happen if you didn't enter the right value\r\n */\r\n fail(value: string): string {\r\n return `Value must be of type string!`;\r\n }\r\n constructor(name: string = \"any\") {}\r\n}\r\n\r\nexport class LiteralArgumentType implements IArgumentType {\r\n type: null;\r\n typeName = \"literal\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: this.name == value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `${value} should be ${this.name}!`;\r\n }\r\n constructor(public name: string = \"literal\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class StringArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"string\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: value && value != \"\",\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value must be of type string!`;\r\n }\r\n constructor(public name: string = \"string\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class IntegerArgumentType implements IArgumentType {\r\n type: number;\r\n typeName = \"int\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: !isNaN(value as any),\r\n value: parseInt(value),\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value must be valid number!`;\r\n }\r\n constructor(public name: string = \"integer\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class FloatArgumentType implements IArgumentType {\r\n type: number;\r\n typeName = \"float\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: Boolean(value?.match(/^\\d+\\.\\d+$/)?.[0]),\r\n value: parseInt(value),\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value must be valid float!`;\r\n }\r\n constructor(public name: string = \"float\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class LocationArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"location\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: /^([~^]{0,1}(-\\d)?(\\d*)?(\\.(\\d+))?)$/.test(value),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `Value needs to be a valid number, value can include: [~,^]`;\r\n }\r\n constructor(public name: string = \"location\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class BooleanArgumentType implements IArgumentType {\r\n type: boolean;\r\n typeName = \"boolean\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: Boolean(value?.match(/^(true|false)$/)?.[0]),\r\n value: value == \"true\" ? true : false,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `\"${value}\" can be either \"true\" or \"false\"`;\r\n }\r\n constructor(public name: string = \"boolean\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class PlayerArgumentType implements IArgumentType {\r\n type: Player;\r\n typeName = \"Player\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: fetch(value) ? true : false,\r\n value: fetch(value),\r\n };\r\n }\r\n fail(value: string): string {\r\n return `player: \"${value}\", is not in this world`;\r\n }\r\n constructor(public name: string = \"player\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class TargetArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"Target\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: Boolean(value?.match(/^(@.|\"[\\s\\S]+\")$/)?.[0]),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `${value} is not a valid target`;\r\n }\r\n constructor(public name: string = \"target\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport class ArrayArgumentType>\r\n implements IArgumentType\r\n{\r\n type: T[number];\r\n typeName = \"string\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: this.types.includes(value),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `\"${value}\" must be one of these values: ${this.types.join(\" | \")}`;\r\n }\r\n constructor(public name: string = \"array\", public types: T) {\r\n this.name = name;\r\n this.types = types;\r\n\r\n this.typeName = types.join(\" | \").replace(/(.{25})..+/, \"$1...\");\r\n }\r\n}\r\n\r\nexport class DurationArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"Duration\";\r\n matches(value: string): IArgumentReturnData {\r\n return {\r\n success: /^(\\d+[hdysmw],?)+$/.test(value),\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `\"${value}\" must be a value like \"10d\" or \"3s\" the first part is the length second is unit`;\r\n }\r\n constructor(public name: string) {}\r\n}\r\n\r\nexport class PlayerNameArgumentType implements IArgumentType {\r\n type: string;\r\n typeName = \"playerName\";\r\n matches(value: string): IArgumentReturnData {\r\n const player = TABLES.ids.get(value);\r\n return {\r\n success: player ? true : false,\r\n value: value,\r\n };\r\n }\r\n fail(value: string): string {\r\n return `player: \"${value}\" has never played this world before! Tip: if the name has spaces in it use quotes around name!`;\r\n }\r\n constructor(public name: string = \"playerName\") {\r\n this.name = name;\r\n }\r\n}\r\n\r\nexport const ArgumentTypes = {\r\n string: StringArgumentType,\r\n int: IntegerArgumentType,\r\n float: FloatArgumentType,\r\n location: LocationArgumentType,\r\n boolean: BooleanArgumentType,\r\n player: PlayerArgumentType,\r\n target: TargetArgumentType,\r\n array: ArrayArgumentType,\r\n duration: DurationArgumentType,\r\n playerName: PlayerNameArgumentType,\r\n};\r\n", "import {\n Entity,\n ItemStack,\n MinecraftItemTypes,\n system,\n} from \"@minecraft/server\";\nimport { AIR } from \"../../index.js\";\nimport {\n ENTITY_IDENTIFIER,\n ENTITY_LOCATION,\n INVENTORY_SIZE,\n MAX_DATABASE_STRING_SIZE,\n} from \"../../config/database\";\nimport { awaitWorldLoad, DIMENSIONS, onWorldLoad } from \"../../utils\";\nimport { chunkString } from \"./utils\";\n\nexport class Database {\n /**\n * Creates a table entity that is used for data storage\n * @param tableName\n * @param index if not specified no index will be set\n * @returns\n */\n static createTableEntity(tableName: string, index?: number): Entity {\n const entity = DIMENSIONS.overworld.spawnEntity(\n ENTITY_IDENTIFIER,\n ENTITY_LOCATION\n );\n entity.setDynamicProperty(\"tableName\", tableName);\n entity.nameTag = `\u00A7aDatabase Table: ${tableName}\u00A7r`;\n if (index) entity.setDynamicProperty(\"index\", index);\n return entity;\n }\n\n /**\n * Gets all table Entities associated with this tableName\n * @param tableName\n * @returns\n */\n static getTableEntities(tableName: string): Entity[] {\n return DIMENSIONS.overworld\n .getEntitiesAtBlockLocation(ENTITY_LOCATION)\n .filter(\n (e) =>\n e.typeId == ENTITY_IDENTIFIER &&\n e.getDynamicProperty(\"tableName\") == tableName\n );\n }\n\n /**\n * Data saved in memory\n */\n private MEMORY: { [key in Key]: Value } | null;\n\n /**\n * List of queued tasks on this table\n */\n private QUEUE: Array<() => void>;\n\n constructor(public tableName: string) {\n this.tableName = tableName;\n this.MEMORY = null;\n this.QUEUE = [];\n system.runSchedule(() => {\n if (this.QUEUE.length == 0) return;\n this.QUEUE.shift()(); // removes queue item and runs it\n }, 1);\n onWorldLoad(async () => {\n this.MEMORY = await this.getData();\n });\n }\n\n /**\n * Adds a queue task to be awaited\n * @returns once its this items time to run in queue\n */\n private async addQueueTask(): Promise {\n return new Promise((resolve) => {\n this.QUEUE.push(() => {\n resolve();\n });\n });\n }\n\n /**\n * Saves data into this database\n * @param data\n * @returns once data is saved\n */\n private async saveData(data: { [key in Key]: Value }): Promise {\n await this.addQueueTask();\n await awaitWorldLoad(); // Await till world is loaded\n this.MEMORY = data; // set memory\n let entities = Database.getTableEntities(this.tableName);\n /**\n * The split chunks of the stringified data, This is done because we can\n * only store {@link MAX_DATABASE_STRING_SIZE} chars in a single nameTag\n */\n let chunks = chunkString(JSON.stringify(data), MAX_DATABASE_STRING_SIZE);\n /**\n * The amount of entities that is needed to store {@link chunks} data\n */\n const entitiesNeeded =\n Math.ceil(chunks.length / INVENTORY_SIZE) - entities.length;\n if (entitiesNeeded > 0) {\n for (let i = 0; i < entitiesNeeded; i++) {\n entities.push(Database.createTableEntity(this.tableName));\n }\n }\n for (const [i, entity] of entities.entries()) {\n const inventory = entity.getComponent(\"inventory\").container;\n for (const [i, chunk] of chunks.entries()) {\n if (!chunk) continue;\n if (i > inventory.size - 1) break; // Exit because it has maxed items\n let item = new ItemStack(MinecraftItemTypes.acaciaBoat);\n item.nameTag = chunk;\n inventory.setItem(i, item);\n chunks[i] = null; // Delete chunk because its been set.\n }\n // Set all unUsed slots to air\n for (let i = chunks.length + 1; i < inventory.size; i++) {\n inventory.setItem(i, AIR);\n }\n entity.setDynamicProperty(\"index\", i);\n entities[i] = null; // Set this entity to null because its maxed out!\n // If all chunks have been saved no need to go to next entity\n if (!chunks.find((v) => v)) break;\n }\n // Check for unUsed entities and despawn them\n entities.filter((e) => e).forEach((e) => e.triggerEvent(\"despawn\"));\n return;\n }\n\n /**\n * Grabs all data from this table\n * @returns\n */\n private async getData(): Promise<{ [key in Key]: Value }> {\n await awaitWorldLoad(); // Await till world is loaded\n if (this.MEMORY) return this.MEMORY;\n let entities = Database.getTableEntities(this.tableName).sort(\n (a, b) =>\n (a.getDynamicProperty(\"index\") as number) -\n (b.getDynamicProperty(\"index\") as number)\n );\n let stringifiedData: string = \"\";\n for (const entity of entities) {\n const inventory = entity.getComponent(\"inventory\").container;\n for (let i = 0; i < inventory.size; i++) {\n const item = inventory.getItem(i);\n if (!item) continue;\n stringifiedData = stringifiedData + item.nameTag;\n }\n }\n return stringifiedData == \"\" ? {} : JSON.parse(stringifiedData);\n }\n\n /**\n * Sets a key to a value in this table\n * @param key\n * @param value\n */\n async set(key: Key, value: Value): Promise {\n const data = await this.getData();\n data[key] = value;\n await this.saveData(data);\n return;\n }\n\n /**\n * Gets a value from this table\n * @param key\n * @returns the keys corresponding key\n */\n get(key: Key): Value {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `getAsync` instead!\"\n );\n return this.MEMORY[key];\n }\n\n /**\n * Gets a value async from this table, this should be used on calls from like\n * entityCreate, system.runSchedule or things that could be before database entities spawn\n * @param key\n * @returns\n */\n async getSync(key: Key): Promise {\n const data = await this.getData();\n return data[key];\n }\n\n /**\n * Get all the keys in the table\n * @returns\n */\n keys(): Key[] {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `keysSync` instead!\"\n );\n return Object.keys(this.MEMORY) as Key[];\n }\n\n /**\n * Get all the keys in the table async, this should be used on world load\n * @returns\n */\n async keysSync(): Promise {\n const data = await this.getData();\n return Object.keys(data) as Key[];\n }\n\n /**\n * Get all the values in the table\n * @returns\n */\n values(): Value[] {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `valuesSync` instead!\"\n );\n return Object.values(this.MEMORY) as Value[];\n }\n\n /**\n * Get all the values in the table async, this should be used on world load\n * @returns\n */\n async valuesSync(): Promise {\n const data = await this.getData();\n return Object.values(data) as Value[];\n }\n\n /**\n * Check if the key exists in the table\n * @param key the key to test\n * @returns\n */\n has(key: Key): boolean {\n if (!this.MEMORY)\n throw new Error(\"World is not loaded! Consider using `hasSync` instead!\");\n const keys = this.keys();\n return keys.includes(key);\n }\n\n /**\n * Check if the key exists in the table async, this should be used on worldLoad\n * @param key the key to test\n * @returns\n */\n async hasSync(key: Key): Promise {\n const keys = await this.keysSync();\n return keys.includes(key);\n }\n\n /**\n * Gets all the keys and values\n * @returns\n */\n collection(): { [key in Key]: Value } {\n if (!this.MEMORY)\n throw new Error(\n \"World is not loaded! Consider using `collectionSync` instead!\"\n );\n return this.MEMORY;\n }\n\n /**\n * Gets all the keys and values async, this should be used for grabbingCollection on world load\n * @returns\n */\n async collectionSync(): Promise<{ [key in Key]: Value }> {\n return await this.getData();\n }\n\n /**\n * Delete the key from the table\n * @param key the key to delete\n * @returns\n */\n async delete(key: Key): Promise {\n const data = await this.getData();\n const status = delete data[key];\n await this.saveData(data);\n return status;\n }\n\n /**\n * Clear everything in the table\n */\n async clear(): Promise {\n await this.saveData({} as { [key in Key]: Value });\n return;\n }\n}\n", "import { BlockLocation } from \"@minecraft/server\";\n\n/*\n|--------------------------------------------------------------------------\n| Max Database string size\n|--------------------------------------------------------------------------\n|\n| Here is the max database save size meaning when a save gets made\n| it tests the size of that save and splits up the save depending on this\n| Size. It's related to Minecraft's 32k bit limit.\n|\n*/\nexport const MAX_DATABASE_STRING_SIZE = 32000;\n\n/*\n|--------------------------------------------------------------------------\n| Entity Id\n|--------------------------------------------------------------------------\n|\n| This is the entity id of the database this is what stores the information\n| of the database on its nameTag\n|\n*/\nexport const ENTITY_IDENTIFIER = \"rubedo:database\";\n\n/*\n|--------------------------------------------------------------------------\n| Entity Spawn Location\n|--------------------------------------------------------------------------\n|\n| This is the spawn location of the database entities there will be\n| Multiple entities at this location for each chunk\n|\n*/\nexport const ENTITY_LOCATION = new BlockLocation(0, -64, 0);\n\n/*\n|--------------------------------------------------------------------------\n| Entity's INVENTORY_SIZE\n|--------------------------------------------------------------------------\n|\n| The max amount of items this entity can store in its inventory\n|\n*/\nexport const INVENTORY_SIZE = 128;\n", "import {\r\n BlockLocation,\r\n Entity,\r\n Location,\r\n MinecraftDimensionTypes,\r\n Player,\r\n system,\r\n Vector3,\r\n world,\r\n} from \"@minecraft/server\";\r\nimport { setWorldIsLoaded, WORLD_IS_LOADED } from \"./index.js\";\r\nimport { TABLES } from \"./lib/Database/tables\";\r\nimport { MessageForm } from \"./lib/Form/Models/MessageForm\";\r\nimport { durationSegment, durationSegmentType } from \"./types\";\r\n\r\n/**\r\n * This is to reduce lag when grabbing dimensions keep them set and pre-defined\r\n */\r\nexport const DIMENSIONS = {\r\n overworld: world.getDimension(MinecraftDimensionTypes.overworld),\r\n nether: world.getDimension(MinecraftDimensionTypes.nether),\r\n theEnd: world.getDimension(MinecraftDimensionTypes.theEnd),\r\n \"minecraft:overworld\": world.getDimension(MinecraftDimensionTypes.overworld),\r\n \"minecraft:nether\": world.getDimension(MinecraftDimensionTypes.nether),\r\n \"minecraft:the_end\": world.getDimension(MinecraftDimensionTypes.theEnd),\r\n};\r\n\r\n/**\r\n * Get score of an entity\r\n * @example getScore(Entity, 'Money');\r\n */\r\nexport function getScore(entity: Entity, objective: string): number {\r\n try {\r\n return world.scoreboard.getObjective(objective).getScore(entity.scoreboard);\r\n } catch (error) {\r\n return 0;\r\n }\r\n}\r\n\r\n/**\r\n * grabs the score of a entity off of nameTag\r\n * @param name Entity's name\r\n * @param objective objective to get\r\n * @returns the score of the entity\r\n */\r\nexport async function getScoreByName(\r\n name: string,\r\n objective: string\r\n): Promise {\r\n try {\r\n const command = await DIMENSIONS.overworld.runCommandAsync(\r\n `scoreboard players test \"${name}\" \"${objective}\" * *`\r\n );\r\n return parseInt(String(command.statusMessage?.split(\" \")[1]), 10);\r\n } catch (error) {\r\n return 0;\r\n }\r\n}\r\n\r\n/**\r\n * sets the score of a name\r\n * @example setScore(\"Smell of curry\", 'Money');\r\n */\r\nexport function setScore(\r\n entityName: string,\r\n objective: string,\r\n value: Number\r\n): void {\r\n try {\r\n DIMENSIONS.overworld.runCommandAsync(\r\n `scoreboard players set \"${entityName}\" ${objective} ${value}`\r\n );\r\n } catch (error) {\r\n console.warn(error + error.stack);\r\n }\r\n}\r\n\r\n/**\r\n * Gets a players id based on a saved database values\r\n * @param playerName playerName to get\r\n */\r\nexport function getId(playerName: string): string | null {\r\n return TABLES.ids.get(playerName);\r\n}\r\n\r\n/**\r\n * Duration converter\r\n * @param duration time to convert\r\n * @example ```\r\n * durationToMs(\"10s\")\r\n * durationToMs(\"10d,2y\")\r\n * durationToMs(\"5m\")\r\n * durationToMs(\"23ms,10s\")\r\n * ```\r\n */\r\nexport function durationToMs(duration: string): number {\r\n /**\r\n * This holds the different duration values this duration can have\r\n * @example `[\"10d\", \"20s\", \"2h\"]`\r\n * @example `[\"2h\"]`\r\n */\r\n const values: durationSegment[] = duration.split(\",\") as durationSegment[];\r\n console.warn(values.length);\r\n let ms = 0;\r\n for (const value of values) {\r\n const length = parseInt(value.match(/\\D+|\\d+/g)[0]);\r\n const unit = value.match(/\\D+|\\d+/g)[1] as durationSegmentType;\r\n if (unit == \"y\") ms = ms + 3.17098e-11 * length;\r\n if (unit == \"w\") ms = ms + 6.048e8 * length;\r\n if (unit == \"d\") ms = ms + 8.64e7 * length;\r\n if (unit == \"h\") ms = ms + 3.6e6 * length;\r\n if (unit == \"m\") ms = ms + 60000 * length;\r\n if (unit == \"s\") ms = ms + 1000 * length;\r\n if (unit == \"ms\") ms = ms + length;\r\n }\r\n return ms;\r\n}\r\n\r\n/**\r\n * Converts a date stored in ms to a Date string\r\n * @param duration milliseconds to convert\r\n * @returns Date as a string\r\n */\r\nexport function msToTime(duration: number) {\r\n return new Date(duration).toString();\r\n}\r\n\r\n/**\r\n * Converts a location to a block location\r\n */\r\nexport function vector3ToBlockLocation(loc: Vector3): BlockLocation {\r\n return new BlockLocation(\r\n Math.floor(loc.x),\r\n Math.floor(loc.y),\r\n Math.floor(loc.z)\r\n );\r\n}\r\n\r\n/**\r\n * Sends a confirmation message to a player to confirm a action\r\n * @param action action message to confirm\r\n * @param onConfirm callback to run when a player confirms the action\r\n * @param onCancel callback to run when a player cancels the action, this can be null\r\n * @example ```\r\n * confirmAction(\"Ban Smell of curry\", () => {\r\n * new Ban(\"Smell of curry\")\r\n * })\r\n * ```\r\n */\r\nexport function confirmAction(\r\n player: Player,\r\n action: string,\r\n onConfirm: () => void,\r\n onCancel: () => void = () => {}\r\n) {\r\n new MessageForm(\"Confirm To Continue\", action)\r\n .setButton1(\"Confirm\", onConfirm)\r\n .setButton2(\"Never Mind\", onCancel)\r\n .show(player);\r\n}\r\n\r\n/**\r\n * Sleeps your code\r\n * @param {number} tick time in ticks you want the return to occur\r\n * @returns {Promise}\r\n */\r\nexport function sleep(tick: number): Promise {\r\n return new Promise((resolve) => {\r\n let runScheduleId = system.runSchedule(() => {\r\n resolve();\r\n system.clearRunSchedule(runScheduleId);\r\n }, tick);\r\n });\r\n}\r\n\r\n/**\r\n * Checks if a location equals another location\r\n * @param a first location\r\n * @param b location to test against first\r\n * @returns {boolean} if they locations are the same\r\n */\r\nexport function LocationEquals(\r\n a: Vector3 | Location | BlockLocation,\r\n b: Vector3 | Location | BlockLocation\r\n): boolean {\r\n let aLocations = [a.x, a.y, a.z];\r\n let bLocations = [a.x, a.y, a.z];\r\n if (a instanceof BlockLocation || b instanceof BlockLocation) {\r\n aLocations = aLocations.map((v) => Math.trunc(v));\r\n bLocations = bLocations.map((v) => Math.trunc(v));\r\n }\r\n return aLocations.find((v, i) => bLocations[i] != v) ? false : true;\r\n}\r\n\r\n/**\r\n * Awaits till work load\r\n * @returns\r\n */\r\nexport async function awaitWorldLoad(): Promise {\r\n if (WORLD_IS_LOADED) return;\r\n return new Promise((resolve) => {\r\n let s = system.runSchedule(async () => {\r\n try {\r\n await DIMENSIONS.overworld.runCommandAsync(`testfor @a`);\r\n system.clearRunSchedule(s);\r\n setWorldIsLoaded();\r\n resolve();\r\n } catch (error) {}\r\n }, 1);\r\n });\r\n}\r\n\r\n/**\r\n * Sends a callback once world is loaded\r\n * @param callback\r\n */\r\nexport function onWorldLoad(callback: () => void) {\r\n if (WORLD_IS_LOADED) return callback();\r\n let s = system.runSchedule(async () => {\r\n try {\r\n await DIMENSIONS.overworld.runCommandAsync(`testfor @a`);\r\n system.clearRunSchedule(s);\r\n setWorldIsLoaded();\r\n callback();\r\n } catch (error) {}\r\n }, 1);\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { MessageFormData } from \"@minecraft/server-ui\";\r\nimport { TIMEOUT_THRESHOLD } from \"../../../config/form\";\r\nimport type { ButtonCallback, IMessageFormButton } from \"../types\";\r\n\r\nexport class MessageForm {\r\n /**\r\n * the title that this form should have\r\n */\r\n title?: string;\r\n /**\r\n * extra text that should be displayed in the form\r\n */\r\n body?: string;\r\n /**\r\n * The default minecraft form this form is based on\r\n */\r\n private form: MessageFormData;\r\n /**\r\n * the first button of the dialog.\r\n */\r\n private button1: IMessageFormButton;\r\n /**\r\n * the second button of the dialog.\r\n */\r\n private button2: IMessageFormButton;\r\n /**\r\n * The amount of times it takes to show this form in ms\r\n * if this value goes above 200 it will time out\r\n */\r\n private triedToShow: number;\r\n\r\n /**\r\n * Creates a new form to be shown to a player\r\n * @param title the title that this form should have\r\n * @param body extra text that should be displayed in the form\r\n */\r\n constructor(title?: string, body?: string) {\r\n this.title = title;\r\n this.body = body;\r\n this.form = new MessageFormData();\r\n\r\n if (title) this.form.title(title);\r\n if (body) this.form.body(body);\r\n\r\n this.triedToShow = 0;\r\n }\r\n\r\n /**\r\n * Method that sets the text for the first button of the dialog.\r\n * @param text text to show on this button\r\n * @param callback what happens when this button is clicked\r\n * @example ```\r\n * setButton1(\"settings\", () => {})\r\n * ```\r\n */\r\n setButton1(text: string, callback?: ButtonCallback): MessageForm {\r\n this.button1 = { text: text, callback: callback };\r\n this.form.button1(text);\r\n return this;\r\n }\r\n\r\n /**\r\n * Method that sets the text for the second button of the dialog.\r\n * @param text text to show on this button\r\n * @param callback what happens when this button is clicked\r\n * @example ```\r\n * setButton2(\"settings\", () => {})\r\n * ```\r\n */\r\n setButton2(text: string, callback?: ButtonCallback): MessageForm {\r\n this.button2 = { text: text, callback: callback };\r\n this.form.button2(text);\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows this form to the player\r\n * @param player player to show to\r\n */\r\n show(player: Player): void {\r\n this.form.show(player).then((response) => {\r\n if (response.canceled) {\r\n if (response.cancelationReason == \"userBusy\") {\r\n // check time and reshow form\r\n if (this.triedToShow > TIMEOUT_THRESHOLD)\r\n return player.tell(\r\n `\u00A7cForm Timeout: tried to show form, but you were busy (close chat after running command)`\r\n );\r\n this.triedToShow++;\r\n this.show(player);\r\n }\r\n return;\r\n }\r\n if (response.selection == 1) this.button1?.callback?.();\r\n if (response.selection == 0) this.button2?.callback?.();\r\n });\r\n }\r\n}\r\n", "/**\n * Splits a string into chunk sizes\n */\nexport function chunkString(str: string, length: number): string[] {\n return str.match(new RegExp(\".{1,\" + length + \"}\", \"g\"));\n}\n", "import type {\r\n IRegionDB,\r\n IMuteData,\r\n IBanData,\r\n IFreezeData,\r\n INpcLocation,\r\n LogData,\r\n IProtectionsConfig,\r\n} from \"../../types\";\r\nimport type { ROLES } from \"../../types\";\r\nimport { Database } from \"../../lib/Database/Database\";\r\n\r\n/**\r\n * All the Database tables that are created\r\n */\r\nexport const TABLES = {\r\n config: new Database(\"config\"),\r\n freezes: new Database(\"freezes\"),\r\n mutes: new Database(\"mutes\"),\r\n bans: new Database(\"bans\"),\r\n regions: new Database(\"regions\"),\r\n roles: new Database(\"roles\"),\r\n tasks: new Database(\"tasks\"),\r\n npcs: new Database(\"npcs\"),\r\n ids: new Database(\"ids\"),\r\n logs: new Database(\"logs\"),\r\n protections: new Database(\"protections\"),\r\n test: new Database(\"test\"),\r\n};\r\n", "import { BeforeChatEvent, Player } from \"@minecraft/server\";\r\n\r\nexport class CommandCallback {\r\n data: BeforeChatEvent;\r\n sender: Player;\r\n\r\n /**\r\n * Returns a commands callback\r\n * @param data chat data that was used\r\n */\r\n constructor(data: BeforeChatEvent) {\r\n this.data = data;\r\n this.sender = data.sender;\r\n }\r\n /**\r\n * Replies to the sender of a command callback\r\n * @param text Message or a lang code\r\n * @example ctx.reply('Hello World!');\r\n */\r\n reply(text: string) {\r\n this.sender.tell(text);\r\n }\r\n}\r\n", "import { BeforeChatEvent, Player, Vector, Vector3 } from \"@minecraft/server\";\nimport { PREFIX } from \"../../config/commands\";\nimport { LiteralArgumentType, LocationArgumentType } from \"./ArgumentTypes\";\nimport { CommandCallback } from \"./Callback\";\nimport type { Command } from \"./Command\";\n\n/**\n * Returns a Before chat events augments\n * @example this.getChatAugments(BeforeChatEvent)\n */\nexport function getChatAugments(\n message: string,\n prefix: string\n): Array {\n try {\n return message\n .slice(prefix.length)\n .trim()\n .match(/\"[^\"]+\"|[^\\s]+/g)\n .map((e) => e.replace(/\"(.+)\"/, \"$1\").toString());\n } catch (error) {\n return [];\n }\n}\n\n/**\n * Sends a command not found message to a player\n * @param player player to send message to\n */\nexport function commandNotFound(player: Player, command: string) {\n player.tell({\n rawtext: [\n {\n text: `\u00A7c`,\n },\n {\n translate: `commands.generic.unknown`,\n with: [`${command}`],\n },\n ],\n });\n}\n\n/**\n * Sends a command not found message to a player\n * @param player player to send message to\n */\nexport function noPerm(player: Player, command: Command) {\n player.tell({\n rawtext: [\n {\n text: command.data.invalidPermission\n ? command.data.invalidPermission\n : `\u00A7cYou do not have permission to use \"${command.data.name}\"`,\n },\n ],\n });\n}\n\n/**\n * Sends a syntax failure message to player\n * @param player\n * @param command\n * @param args\n * @param i\n */\nexport function commandSyntaxFail(\n player: Player,\n baseCommand: Command,\n command: Command,\n args: string[],\n i: number\n) {\n player.tell({\n rawtext: [\n {\n text: `\u00A7c`,\n },\n {\n translate: `commands.generic.syntax`,\n with: [\n `${PREFIX}${baseCommand.data.name} ${args.slice(0, i).join(\" \")}`,\n args[i] ?? \" \",\n args.slice(i + 1).join(\" \"),\n ],\n },\n ],\n });\n if (command.children.length > 1 || !args[i]) {\n // this type could be many things\n const types = command.children.map((c) =>\n c.type instanceof LiteralArgumentType ? c.type.name : c.type?.typeName\n );\n player.tell(\n `\u00A7c\"${args[i] ?? \"undefined\"}\" is not valid! Argument \"${\n [...new Set(command.children.map((c) => c.type.name))][0]\n }\" can be typeof: \"${types.join('\", \"')}\"`\n );\n } else {\n // this type is only 1 thing\n player.tell(`\u00A7c${command.children[0]?.type?.fail(args[i])}`);\n }\n}\n\n/**\n * Returns a location of the inputted argument\n * @example parseLocationArgs([\"~1\", \"3\", \"^7\"], { location: [1,2,3] , viewVector: [1,2,3] })\n */\nexport function parseLocationArgs(\n [x, y, z]: [x: string, y: string, z: string],\n { location, viewVector }: { location: Vector3; viewVector: Vector }\n): Vector3 {\n if (!x || !y || !x) return null;\n const locations = [location.x, location.y, location.z];\n const viewVectors = [viewVector.x, viewVector.y, viewVector.z];\n const a = [x, y, z].map((arg) => {\n const r = parseFloat(arg);\n return isNaN(r) ? 0 : r;\n });\n const b = [x, y, z].map((arg, index) => {\n return arg.includes(\"~\")\n ? a[index] + locations[index]\n : arg.includes(\"^\")\n ? a[index] + viewVectors[index]\n : a[index];\n });\n return { x: b[0], y: b[1], z: b[2] };\n}\n\n/**\n * Sends a callback back to the command\n * @param cmdArgs the args that the command used\n * @param args args to use\n */\nexport function sendCallback(\n cmdArgs: string[],\n args: Command[],\n event: BeforeChatEvent,\n baseCommand: Command\n) {\n const lastArg = args[args.length - 1] ?? baseCommand;\n const argsToReturn: any[] = [];\n for (const [i, arg] of args.entries()) {\n if (arg.type.name.endsWith(\"*\")) continue;\n if (arg.type instanceof LocationArgumentType) {\n argsToReturn.push(\n parseLocationArgs(\n [cmdArgs[i], cmdArgs[i + 1], cmdArgs[i + 2]],\n event.sender\n )\n );\n continue;\n }\n if (arg.type instanceof LiteralArgumentType) continue;\n argsToReturn.push(arg.type.matches(cmdArgs[i]).value ?? cmdArgs[i]);\n }\n lastArg.callback(new CommandCallback(event), ...argsToReturn);\n}\n", "import { Player, system, world } from \"@minecraft/server\";\r\nimport { ENTITY_INVENTORY, GUI_ITEM } from \"../../config/chest\";\r\nimport { getRole } from \"../../plugins/Anti-Cheat/utils.js\";\r\nimport { ChestGUI } from \"./Models/EntityChest\";\r\nimport { CHESTGUIS, CHEST_OPEN, getHeldItem } from \"./utils.js\";\r\nimport \"./pages/home\";\r\nimport { DIMENSIONS } from \"../../utils.js\";\r\n\r\nsystem.runSchedule(() => {\r\n for (const player of world.getPlayers()) {\r\n /**\r\n * Loop through all players, check if player has a chest gui\r\n * if not create them one\r\n * Once all players are checked verify there are no false entities\r\n */\r\n if (getHeldItem(player)?.typeId != GUI_ITEM) {\r\n if (CHESTGUIS[player.name]) CHESTGUIS[player.name].despawn();\r\n continue;\r\n }\r\n // Player has a item Held we need to verify that they have a gui\r\n if (Object.keys(CHESTGUIS).includes(player?.name)) continue;\r\n // Player does not have a chest gui spawn them in one\r\n if (getRole(player) != \"admin\") continue;\r\n CHESTGUIS[player.name] = new ChestGUI(player);\r\n }\r\n}, 5);\r\n\r\nworld.events.beforeDataDrivenEntityTriggerEvent.subscribe((data) => {\r\n if (!(data.entity instanceof Player)) return;\r\n if (data.id == \"rubedo:has_container_open\") {\r\n CHEST_OPEN.set(data.entity, true);\r\n } else if (data.id == \"rubedo:dosent_have_container_open\") {\r\n CHEST_OPEN.set(data.entity, false);\r\n }\r\n});\r\n\r\n/**\r\n * This system will detect false entities and kill them to\r\n * reduce lag and eliminate broken/left players/entities\r\n */\r\nsystem.runSchedule(() => {\r\n const validIds = Object.values(CHESTGUIS).map((c) => c.entity.id);\r\n for (const entity of DIMENSIONS.overworld.getEntities({\r\n type: ENTITY_INVENTORY,\r\n })) {\r\n if (validIds.includes(entity.id)) continue;\r\n // This entity is not valid so we despawn it\r\n entity.triggerEvent(\"despawn\");\r\n }\r\n}, 100);\r\n", "/*\n|--------------------------------------------------------------------------\n| Gui item\n|--------------------------------------------------------------------------\n|\n| This is the GUI item that is used to open up the gui\n| this is set to the identifier of item.json and is used to find the item\n| in the gui template\n|\n*/\nexport const GUI_ITEM = \"rubedo:gui\";\n\n/*\n|--------------------------------------------------------------------------\n| Entity Inventory\n|--------------------------------------------------------------------------\n|\n| The id of the entity inventory\n| this is found in the entities file\n| this will be updated if inventory entity is changed\n|\n*/\nexport const ENTITY_INVENTORY = \"rubedo:inventory\";\n\n/*\n|--------------------------------------------------------------------------\n| Default Static Page id\n|--------------------------------------------------------------------------\n|\n| This is the default static page id of what is open by default\n| when you click on the gui, this can be changed but it probably shouldn't\n| because static pages will need to be changed\n|\n*/\nexport const DEFAULT_STATIC_PAGE_ID = \"home\";\n", "import {\n world,\n Player,\n BlockLocation,\n MinecraftBlockTypes,\n Enchantment,\n GameMode,\n system,\n} from \"@minecraft/server\";\nimport type { ConfigType, ROLES } from \"../../types\";\nimport { TABLES } from \"../../lib/Database/tables\";\nimport { Region } from \"./modules/models/Region.js\";\nimport { ChangePlayerRoleTask } from \"./modules/models/Task\";\nimport type { IplayerTickRegister } from \"../../types\";\nimport { BANNED_BLOCKS, BANNED_ITEMS } from \"./config/moderation\";\nimport { ENCHANTMENTS } from \"./config/enchantments\";\nimport { APPEAL_LINK } from \"../../config/app\";\nimport { DIMENSIONS } from \"../../utils.js\";\n\n/**\n * Kicks a player\n * @param player player who should be kicked\n * @param message the message that should be show to player\n * @param onFail this needs to be used for loops to unregister\n */\nexport function kick(\n player: Player,\n message: Array = [],\n onFail?: () => void\n): void {\n if (isServerOwner(player)) {\n console.warn(`[WARNING]: TRIED TO KICK OWNER`);\n player.tell(`You have been tried to kick, but you cant!`);\n return onFail?.();\n }\n try {\n player.runCommandAsync(`kick @s \u00A7r${message.join(\"\\n\")}`);\n player.triggerEvent(\"kick\");\n } catch (error) {\n player.triggerEvent(\"kick\");\n if (!/\"statusCode\":-2147352576/.test(error)) return;\n // This function just tried to kick the owner\n if (onFail) onFail();\n }\n}\n\n/**\n * Gets the role of this player\n * @param player player to get role from\n * @example getRole(\"Smell of curry\")\n */\nexport function getRole(player: Player | string): keyof typeof ROLES {\n if (player instanceof Player) {\n return TABLES.roles.get(player.name) ?? \"member\";\n } else {\n return TABLES.roles.get(player) ?? \"member\";\n }\n}\n\n/**\n * Gets the role of this player sync, should be used in world load\n * @param player player to get role from\n * @example getRoleSync(\"Smell of curry\")\n */\nexport async function getRoleSync(\n player: Player | string\n): Promise {\n if (player instanceof Player) {\n return (await TABLES.roles.getSync(player.name)) ?? \"member\";\n } else {\n return (await TABLES.roles.getSync(player)) ?? \"member\";\n }\n}\n\n/**\n * Sets the role of this player\n * @example setRole(\"Smell of curry\", \"admin\")\n */\nexport function setRole(\n player: Player | string,\n value: keyof typeof ROLES\n): void {\n if (typeof player == \"string\") {\n // we need to create a task that will update the role for\n // that player when they join\n // also we need to set there db_role back\n TABLES.roles.set(player, value);\n /**\n * If the player is in the game just set it now\n * if they are not in the game we will need to create a task\n * to set there role when they join\n */\n const inGamePlayer = [...world.getPlayers()].find((p) => p.name == player);\n if (inGamePlayer) {\n inGamePlayer.setDynamicProperty(\"role\", value);\n } else {\n new ChangePlayerRoleTask(player, value);\n }\n } else {\n // just change both of them no need for task\n TABLES.roles.set(player.name, value);\n player.setDynamicProperty(\"role\", value);\n }\n}\n\n/**\n * Checks if a player is the owner of this world that was set using `/function`\n * @param player player to test\n * @returns if player is owner\n */\nexport function isServerOwner(player: Player): boolean {\n return world.getDynamicProperty(\"worldsOwner\") == player.id;\n}\n\n/**\n * Gets the server owner\n * @returns server owners id\n */\nexport function getServerOwner(): string | null {\n const id = world.getDynamicProperty(\"worldsOwner\") as string;\n if (!id || id == \"\") return null;\n return id;\n}\n\n/**\n * Gets the server owners name\n * @returns server owners name\n */\nexport function getServerOwnerName(): string | null {\n const ownerId = getServerOwner();\n if (!ownerId) return null;\n const ids = TABLES.ids.collection();\n return Object.keys(ids).find((key) => ids[key] === ownerId);\n}\n\n/**\n * Sets the server owner\n * @param player player to set the server owner too\n */\nexport function setServerOwner(player: Player) {\n if (!player) return world.setDynamicProperty(\"worldsOwner\", \"\");\n world.setDynamicProperty(\"worldsOwner\", player.id.toString());\n}\n\n/**\n * Checks if the server is locked down\n */\nexport function isLockedDown(): boolean {\n return (world.getDynamicProperty(\"isLockDown\") ?? false) as boolean;\n}\n\n/**\n * Sets the server's lock down status\n * @param val if the server is locked down or not\n */\nexport function setLockDown(val: boolean) {\n world.setDynamicProperty(\"isLockDown\", val);\n}\n\n/**\n * Sets Deny blocks at bottom of region every 5 mins\n */\nexport function loadRegionDenys() {\n for (const region of Region.getAllRegions()) {\n const loc1 = new BlockLocation(\n region.from.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.from.z\n );\n const loc2 = new BlockLocation(\n region.to.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.to.z\n );\n for (const blockLocation of loc1.blocksBetween(loc2)) {\n DIMENSIONS[region.dimensionId as keyof typeof DIMENSIONS]\n .getBlock(blockLocation)\n ?.setType(MinecraftBlockTypes.deny);\n }\n }\n}\n\n/**\n * Stores all the callbacks in an array\n */\nconst CALLBACKS: { [key: number]: IplayerTickRegister } = [];\n\n/**\n * Records the amount of times the forEachValidPlayer function is called\n * used to generate keys for callback\n */\nlet forEachValidPlayerCalls = 0;\n\n/**\n * Sends a callback for each player\n * @returns the key to disable this callback\n */\nexport function forEachValidPlayer(\n callback: (player: Player) => void,\n delay = 0\n): number {\n const key = forEachValidPlayerCalls;\n CALLBACKS[key] = {\n callback: callback,\n delay: delay,\n lastCall: 0,\n };\n forEachValidPlayerCalls = key + 1;\n return key;\n}\n\n/**\n * Sends a callback for each player\n * @returns the key to disable this callback\n */\nexport function clearForEachValidPlayer(key: number) {\n delete CALLBACKS[key];\n}\n\nsystem.runSchedule(async () => {\n const players = [...world.getPlayers()];\n for (const [i, player] of players.entries()) {\n if ([\"moderator\", \"admin\"].includes(await getRoleSync(player))) continue;\n for (const CALLBACK of Object.values(CALLBACKS)) {\n if (\n CALLBACK.delay != 0 &&\n system.currentTick - CALLBACK.lastCall < CALLBACK.delay\n )\n continue;\n CALLBACK.callback(player);\n if (i == players.length - 1) CALLBACK.lastCall = system.currentTick;\n }\n }\n});\n\n/**\n * Grabs config data from the database\n * @param id id to grab\n */\nexport function getConfigId(id: T): ConfigType[T] {\n switch (id) {\n case \"spam_config\":\n return (\n TABLES.config.get(\"spam_config\") ?? {\n repeatedMessages: true,\n zalgo: true,\n violationCount: 0,\n permMutePlayer: false,\n }\n );\n\n case \"cbe_config\":\n return (\n TABLES.config.get(\"cbe_config\") ?? {\n clearItem: true,\n violationCount: 0,\n banPlayer: false,\n canAddEnchantment: false,\n }\n );\n\n case \"gamemode_config\":\n return (\n TABLES.config.get(\"gamemode_config\") ?? {\n setToSurvival: true,\n clearPlayer: true,\n violationCount: 0,\n banPlayer: false,\n }\n );\n\n case \"nuker_data\":\n return (\n TABLES.config.get(\"nuker_data\") ?? {\n violationCount: 0,\n banPlayer: false,\n }\n );\n case \"banned_items\":\n return TABLES.config.get(\"banned_items\") ?? BANNED_ITEMS;\n case \"banned_blocks\":\n return TABLES.config.get(\"banned_blocks\") ?? BANNED_BLOCKS;\n case \"enchantments\":\n return TABLES.config.get(\"enchantments\") ?? ENCHANTMENTS;\n case \"appealLink\":\n return TABLES.config.get(\"appealLink\") ?? APPEAL_LINK;\n }\n}\n\n/**\n * Sets a config id\n * @param key key to set\n * @param value value to set key to\n */\nexport function setConfigId(\n key: T,\n value: ConfigType[T]\n) {\n TABLES.config.set(key, value);\n}\n\n/**\n * Gets the max level of a enchantment\n * @param enchantment enchantment to get\n * @returns max level\n * @example ```\n * getMaxLevel(MinecraftEnchantmentTypes.sharpness): 5\n * ```\n */\nexport function getMaxEnchantmentLevel(enchantment: Enchantment): number {\n const MAX_ENCHANTMENTS = getConfigId(\"enchantments\");\n return (\n MAX_ENCHANTMENTS[enchantment.type.id as keyof typeof ENCHANTMENTS] ??\n enchantment.type.maxLevel\n );\n}\n\n/**\n * Gets the Gamemode of a player\n * @param {Player} player player to get\n * @returns {keyof typeof GameMode}\n * @example if (getGamemode(player) == \"creative\") return;\n */\nexport function getGamemode(player: Player): keyof typeof GameMode {\n return Object.values(GameMode).find(\n (g) => [...world.getPlayers({ name: player.name, gameMode: g })].length\n );\n}\n", "import { BlockLocation, Entity, MinecraftBlockTypes } from \"@minecraft/server\";\nimport { DEFAULT_REGION_PERMISSIONS } from \"../../config/region\";\nimport { TABLES } from \"../../../../lib/Database/tables\";\nimport type { IRegionCords, IRegionPermissions } from \"../../../../types\";\nimport { loadRegionDenys } from \"../../utils.js\";\nimport { DIMENSIONS } from \"../../../../utils\";\n\n/**\n * Holds all regions in memory so its not grabbing them so much\n */\nexport let REGIONS: Array = [];\n\n/**\n * If the regions have been grabbed if not it will grab them and set this to true\n */\nlet REGIONS_HAVE_BEEN_GRABBED: boolean = false;\n\n/**\n * The Lowest Y value in minecraft\n */\nconst LOWEST_Y_VALUE: number = -64;\n\n/**\n * The HIGHEST Y value in minecraft\n */\nconst HIGHEST_Y_VALUE: number = 320;\n\n/**\n * Compare a array of numbers with 2 arrays\n * @param XYZa The first set of numbers\n * @param XYZb The second set of numbers\n * @param XYZc The set of numbers that should between the first and second set of numbers\n * @example betweenXYZ([1, 0, 1], [22, 81, 10], [19, 40, 6]));\n */\nfunction betweenXYZ(\n XYZa: [number, number, number],\n XYZb: [number, number, number],\n XYZc: [number, number, number]\n): boolean {\n return XYZc.every(\n (c, i) => c >= Math.min(XYZa[i], XYZb[i]) && c <= Math.max(XYZa[i], XYZb[i])\n );\n}\n\nexport class Region {\n dimensionId: string;\n from: IRegionCords;\n to: IRegionCords;\n key: string;\n permissions: IRegionPermissions;\n /**\n * Gets all regions\n */\n static async getAllRegionsSync(): Promise> {\n if (REGIONS_HAVE_BEEN_GRABBED) return REGIONS;\n const regions = (await TABLES.regions.valuesSync()).map(\n (region) =>\n new Region(\n region.from,\n region.to,\n region.dimensionId,\n region.permissions,\n region.key\n )\n );\n regions.forEach((r) => {\n REGIONS.push(r);\n });\n REGIONS_HAVE_BEEN_GRABBED = true;\n return regions;\n }\n\n static getAllRegions(): Array {\n if (REGIONS_HAVE_BEEN_GRABBED) return REGIONS;\n const regions = TABLES.regions\n .values()\n .map(\n (region) =>\n new Region(\n region.from,\n region.to,\n region.dimensionId,\n region.permissions,\n region.key\n )\n );\n regions.forEach((r) => {\n REGIONS.push(r);\n });\n REGIONS_HAVE_BEEN_GRABBED = true;\n return regions;\n }\n\n /**\n * Checks if a block location is in region\n */\n static blockLocationInRegion(\n blockLocation: BlockLocation,\n dimensionId: string\n ): Region | undefined {\n return this.getAllRegions().find(\n (region) =>\n region.dimensionId == dimensionId &&\n betweenXYZ(\n [region.from.x, LOWEST_Y_VALUE, region.from.z],\n [region.to.x, HIGHEST_Y_VALUE, region.to.z],\n [blockLocation.x, blockLocation.y, blockLocation.z]\n )\n );\n }\n\n /**\n * Checks if a block location is in region\n */\n static async blockLocationInRegionSync(\n blockLocation: BlockLocation,\n dimensionId: string\n ): Promise {\n return (await this.getAllRegionsSync()).find(\n (region) =>\n region.dimensionId == dimensionId &&\n betweenXYZ(\n [region.from.x, LOWEST_Y_VALUE, region.from.z],\n [region.to.x, HIGHEST_Y_VALUE, region.to.z],\n [blockLocation.x, blockLocation.y, blockLocation.z]\n )\n );\n }\n\n /**\n * Removes a region at a block Location\n * @param dimensionId the id of this dimension\n * @returns if the region was removed or not\n */\n static async removeRegionAtBlockLocation(\n blockLocation: BlockLocation,\n dimensionId: string\n ): Promise {\n const region = this.blockLocationInRegion(blockLocation, dimensionId);\n if (!region) return false;\n return await TABLES.regions.delete(region.key);\n }\n /**\n * Creates a new Region to store in db\n */\n constructor(\n from: IRegionCords,\n to: IRegionCords,\n dimensionId: string,\n permissions?: IRegionPermissions,\n key?: string\n ) {\n this.from = from;\n this.to = to;\n this.dimensionId = dimensionId;\n this.permissions = permissions ?? DEFAULT_REGION_PERMISSIONS;\n this.key = key ? key : Date.now().toString();\n\n if (!key) {\n this.update().then(() => {\n loadRegionDenys();\n REGIONS.push(this);\n });\n }\n }\n\n /**\n * Updates this region in the database\n */\n async update(): Promise {\n return await TABLES.regions.set(this.key, {\n key: this.key,\n from: this.from,\n dimensionId: this.dimensionId,\n permissions: this.permissions,\n to: this.to,\n });\n }\n\n /**\n * removes this region\n * @returns if the region was removed successfully\n */\n async delete(): Promise {\n const region = TABLES.regions.get(this.key);\n const loc1 = new BlockLocation(\n region.from.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.from.z\n );\n const loc2 = new BlockLocation(\n region.to.x,\n region.dimensionId == \"minecraft:overworld\" ? -64 : 0,\n region.to.z\n );\n for (const blockLocation of loc1.blocksBetween(loc2)) {\n DIMENSIONS[region.dimensionId as keyof typeof DIMENSIONS]\n .getBlock(blockLocation)\n ?.setType(MinecraftBlockTypes.bedrock);\n }\n REGIONS = REGIONS.filter((r) => r.key != this.key);\n return TABLES.regions.delete(this.key);\n }\n\n /**\n * Checks if a player is in this region\n * @returns if a entity is in this region or not\n */\n entityInRegion(entity: Entity): Boolean {\n return (\n this.dimensionId == entity.dimension.id &&\n betweenXYZ(\n [this.from.x, LOWEST_Y_VALUE, this.from.z],\n [this.to.x, HIGHEST_Y_VALUE, this.to.z],\n [entity.location.x, entity.location.y, entity.location.z]\n )\n );\n }\n\n /**\n * Changes a permission to on or off\n */\n changePermission(\n key: T,\n value: IRegionPermissions[T]\n ): void {\n this.permissions[key] = value;\n this.update();\n }\n}\n", "/**\n * The default permissions for all regions made\n */\nexport const DEFAULT_REGION_PERMISSIONS = {\n /**\n * If players in this region can use doors, trapdoors, and switches like buttons and levers\n */\n doorsAndSwitches: true,\n /**\n * If players in this region can open containers, this is like chests, furnaces, hoppers, etc\n */\n openContainers: true,\n /**\n * If the players in this region can fight each other\n */\n pvp: false,\n /**\n * the entities allowed in this region\n */\n allowedEntities: [\n \"minecraft:player\",\n \"minecraft:npc\",\n \"minecraft:item\",\n \"rubedo:inventory\",\n \"rubedo:database\",\n ],\n};\n\n/**\n * All doors and switches in minecraft\n */\nexport const DOORS_SWITCHES = [\n \"minecraft:acacia_door\",\n \"minecraft:acacia_trapdoor\",\n \"minecraft:acacia_button\",\n \"minecraft:birch_door\",\n \"minecraft:birch_trapdoor\",\n \"minecraft:birch_button\",\n \"minecraft:crimson_door\",\n \"minecraft:crimson_trapdoor\",\n \"minecraft:crimson_button\",\n \"minecraft:dark_oak_door\",\n \"minecraft:dark_oak_trapdoor\",\n \"minecraft:dark_oak_button\",\n \"minecraft:jungle_door\",\n \"minecraft:jungle_trapdoor\",\n \"minecraft:jungle_button\",\n \"minecraft:mangrove_door\",\n \"minecraft:mangrove_trapdoor\",\n \"minecraft:mangrove_button\",\n \"minecraft:spruce_door\",\n \"minecraft:spruce_trapdoor\",\n \"minecraft:spruce_button\",\n \"minecraft:warped_door\",\n \"minecraft:warped_trapdoor\",\n \"minecraft:warped_button\",\n \"minecraft:wooden_door\",\n \"minecraft:wooden_button\",\n \"minecraft:trapdoor\",\n \"minecraft:iron_door\",\n \"minecraft:iron_trapdoor\",\n \"minecraft:polished_blackstone_button\",\n \"minecraft:lever\",\n];\n\n/**\n * A List of all containers a item could be in\n */\nexport const BLOCK_CONTAINERS = [\n \"minecraft:chest\",\n \"minecraft:ender_chest\",\n \"minecraft:barrel\",\n \"minecraft:trapped_chest\",\n \"minecraft:dispenser\",\n \"minecraft:dropper\",\n \"minecraft:furnace\",\n \"minecraft:blast_furnace\",\n \"minecraft:lit_furnace\",\n \"minecraft:lit_blast_furnace\",\n \"minecraft:hopper\",\n \"minecraft:shulker_box\",\n \"minecraft:undyed_shulker_box\",\n \"minecraft:lit_smoker\",\n \"minecraft:smoker\",\n];\n", "import type { ROLES } from \"../../../../types\";\r\nimport { TABLES } from \"../../../../lib/Database/tables\";\r\nimport type { IChangePlayerRoleData } from \"../../../../types\";\r\n\r\nexport class ChangePlayerRoleTask {\r\n /**\r\n * The name of the player\r\n */\r\n playerName: string;\r\n /**\r\n * The role that the player should be set to\r\n */\r\n role: keyof typeof ROLES;\r\n\r\n /**\r\n * gets all tasks that are present\r\n * @returns all tasks\r\n */\r\n static getTasks(): Array {\r\n return TABLES.tasks.get(\"changePlayerRole\") ?? [];\r\n }\r\n\r\n /**\r\n * Gets the role this player needs to be set to\r\n * @param playerName name\r\n */\r\n static getPlayersRoleToSet(playerName: string): keyof typeof ROLES | null {\r\n const tasks = ChangePlayerRoleTask.getTasks();\r\n return tasks.find((t) => t.playerName == playerName)?.role;\r\n }\r\n\r\n constructor(playerName: string, role: keyof typeof ROLES) {\r\n let tasks = ChangePlayerRoleTask.getTasks();\r\n tasks.push({ playerName: playerName, role: role });\r\n TABLES.tasks.set(\"changePlayerRole\", tasks);\r\n }\r\n}\r\n", "import { MinecraftBlockTypes, MinecraftItemTypes } from \"@minecraft/server\";\n\n/**\n * Items that simply get removed from inventory but will not ban\n */\nexport const FORBIDDEN_ITEMS = [\n // Common CBE Items\n MinecraftItemTypes.beehive.id,\n MinecraftItemTypes.beeNest.id,\n MinecraftItemTypes.axolotlBucket.id,\n MinecraftItemTypes.codBucket.id,\n MinecraftItemTypes.tadpoleBucket.id,\n MinecraftItemTypes.tropicalFishBucket.id,\n MinecraftItemTypes.salmonBucket.id,\n MinecraftItemTypes.pufferfishBucket.id,\n];\n\n/**\n * List of items that if you hold you will be automatically banned\n */\nexport const BANNED_ITEMS = [\n // Op Only Items\n MinecraftItemTypes.allow.id,\n MinecraftItemTypes.barrier.id,\n MinecraftItemTypes.borderBlock.id,\n MinecraftItemTypes.debugStick?.id ?? \"minecraft:debug_stick\",\n MinecraftItemTypes.deny.id,\n MinecraftItemTypes.jigsaw.id,\n MinecraftItemTypes.lightBlock.id,\n MinecraftItemTypes.commandBlock.id,\n MinecraftItemTypes.repeatingCommandBlock.id,\n MinecraftItemTypes.chainCommandBlock.id,\n MinecraftItemTypes.commandBlockMinecart.id,\n MinecraftItemTypes.structureBlock.id,\n MinecraftItemTypes.structureVoid.id,\n\n // Not Normal Items\n MinecraftItemTypes.bedrock.id,\n MinecraftItemTypes.endPortalFrame.id,\n\n // Server Movement Blocks\n \"minecraft:info_update\",\n \"minecraft:info_update2\",\n \"minecraft:reserved3\",\n \"minecraft:reserved4\",\n \"minecraft:reserved6\",\n \"minecraft:movingBlock\",\n \"minecraft:moving_block\",\n \"minecraft:movingblock\",\n \"minecraft:piston_arm_collision\",\n \"minecraft:piston_arm_collision\",\n \"minecraft:pistonarmcollision\",\n \"minecraft:stickyPistonArmCollision\",\n \"minecraft:sticky_piston_arm_collision\",\n \"minecraft:unknown\",\n\n // Common Hacked Items\n \"minecraft:glowingobsidian\",\n \"minecraft:invisible_bedrock\",\n \"minecraft:invisiblebedrock\",\n \"minecraft:netherreactor\",\n \"minecraft:portal\",\n \"minecraft:fire\",\n \"minecraft:water\",\n \"minecraft:lava\",\n \"minecraft:flowing_lava\",\n \"minecraft:flowing_water\",\n \"minecraft:soul_fire\",\n];\n\n/**\n * Blocks in this list are forbidden from being placed but will not ban the placer\n */\nexport const FORBIDDEN_BLOCKS = [\n // Common CBE Blocks\n MinecraftBlockTypes.dispenser.id,\n];\n\n/**\n * List of blocks that cannot be placed down\n */\nexport const BANNED_BLOCKS = [\n // Should Not be Placed\n MinecraftBlockTypes.bedrock.id,\n MinecraftBlockTypes.barrier.id,\n \"minecraft:invisiblebedrock\",\n \"minecraft:movingBlock\",\n \"minecraft:movingblock\",\n \"minecraft:moving_block\",\n];\n\n/**\n * The currently supported block containers by script api\n */\nexport const API_CONTAINERS = [\n MinecraftBlockTypes.chest.id,\n MinecraftBlockTypes.trappedChest.id,\n];\n\n/**\n * A List of containers\n */\nexport const CONTAINERS = [\n MinecraftItemTypes.chest.id,\n MinecraftItemTypes.trappedChest.id,\n MinecraftItemTypes.barrel.id,\n MinecraftItemTypes.dispenser.id,\n MinecraftItemTypes.dropper.id,\n MinecraftItemTypes.furnace.id,\n \"minecraft:lit_furnace\",\n MinecraftItemTypes.blastFurnace.id,\n \"minecraft:lit_blast_furnace\",\n MinecraftItemTypes.smoker.id,\n \"minecraft:lit_smoker\",\n MinecraftItemTypes.hopper.id,\n MinecraftItemTypes.shulkerBox.id,\n MinecraftItemTypes.undyedShulkerBox.id,\n];\n\n/**\n * The block size to check for blockContainers\n */\nexport const CHECK_SIZE = { x: 7, y: 7, z: 7 };\n", "/*\n|--------------------------------------------------------------------------\n| Enchantments\n|--------------------------------------------------------------------------\n|\n| This is the default enchantments that can be added to items\n| each enchantment is set to its desired max level this can be changed here\n| or in game using -config enchantments set \"enchantment\" value\n|\n*/\nexport const ENCHANTMENTS = {\n aquaAffinity: 1,\n baneOfArthropods: 5,\n binding: 1,\n blastProtection: 4,\n channeling: 1,\n depthStrider: 3,\n efficiency: 5,\n featherFalling: 4,\n fireAspect: 2,\n fireProtection: 4,\n flame: 1,\n fortune: 3,\n frostWalker: 2,\n impaling: 5,\n infinity: 1,\n knockback: 2,\n looting: 3,\n loyalty: 4,\n luckOfTheSea: 3,\n lure: 3,\n mending: 1,\n multishot: 1,\n piercing: 4,\n power: 5,\n projectileProtection: 4,\n protection: 4,\n punch: 2,\n quickCharge: 3,\n respiration: 3,\n riptide: 3,\n sharpness: 5,\n silkTouch: 1,\n smite: 5,\n soulSpeed: 3,\n swiftSneak: 4,\n thorns: 3,\n unbreaking: 3,\n vanishing: 1,\n};\n", "/*\r\n|--------------------------------------------------------------------------\r\n| Version\r\n|--------------------------------------------------------------------------\r\n|\r\n| This is the version of rubedo recommended to NOT CHANGE could cause bugs.\r\n|\r\n*/\r\nexport const VERSION = \"2.6.3-beta\";\r\n\r\n/*\r\n|--------------------------------------------------------------------------\r\n| Game Version\r\n|--------------------------------------------------------------------------\r\n|\r\n| This is the version of minecraft that this version of rubedo\r\n| was made for its a simple constant to tell creators what version\r\n| this gametest api is supposed to work perfectly for.\r\n|\r\n*/\r\nexport const GAME_VERSION = \"1.19.50\";\r\n\r\n/*\r\n|--------------------------------------------------------------------------\r\n| Appeal Link\r\n|--------------------------------------------------------------------------\r\n|\r\n| This is the appeal link that gets showed when someone gets banned\r\n| this link pops up at the bottom of the ban message to show\r\n| where they can appeal there ban.\r\n|\r\n*/\r\nexport const APPEAL_LINK = \"https://discord.gg/dMa3A5UYKX\";\r\n", "import { Entity, Player, world } from \"@minecraft/server\";\r\nimport { AIR } from \"../../../index.js\";\r\nimport { ENTITY_INVENTORY } from \"../../../config/chest\";\r\nimport {\r\n ISlotChangeReturn,\r\n onEntityInventorySlotChange,\r\n} from \"../../Events/onSlotChange\";\r\nimport {\r\n CHESTGUIS,\r\n CHEST_OPEN,\r\n clearPlayersPointer,\r\n getItemAtSlot,\r\n PAGES,\r\n} from \"../utils.js\";\r\nimport { ItemGrabbedCallback } from \"./ItemGrabbedCallback\";\r\nimport { ISlot, Page } from \"./Page.js\";\r\n\r\nexport class ChestGUI {\r\n /**\r\n * The connected player to this gui\r\n */\r\n player: Player;\r\n /**\r\n * The entity that this chest gui is associated to\r\n */\r\n entity: Entity;\r\n /**\r\n * The event that is registered on this gui\r\n */\r\n tickEvent: any;\r\n\r\n /**\r\n * The page that this gui is currently viewing\r\n */\r\n page: Page;\r\n\r\n /**\r\n * The event that is used to test for changes in inventory\r\n */\r\n slotChangeEvent: number;\r\n\r\n /**\r\n * if the player has a chest open\r\n */\r\n hasChestOpen: boolean;\r\n\r\n /**\r\n * Spawns a entity to be attached to the player\r\n * @param player player this entity will be attached to\r\n */\r\n static spawnEntity(player: Player): Entity {\r\n try {\r\n return player.dimension.spawnEntity(\r\n ENTITY_INVENTORY,\r\n player.headLocation\r\n );\r\n } catch (error) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Links a new chest gui to a player\r\n * @param player player to link\r\n */\r\n constructor(player: Player) {\r\n this.player = player;\r\n this.entity = ChestGUI.spawnEntity(player);\r\n if (this.entity) {\r\n this.hasChestOpen = false;\r\n this.setPage(\"home\");\r\n }\r\n this.tickEvent = world.events.tick.subscribe(() => {\r\n if (!this.entity) return this.despawn();\r\n if (CHEST_OPEN.get(this.player)) {\r\n if (!this.hasChestOpen) {\r\n // Player has this inventory open run checks for changes\r\n this.slotChangeEvent = onEntityInventorySlotChange.subscribe(\r\n { type: ENTITY_INVENTORY },\r\n (entity, change) => {\r\n if (entity.id != this.entity.id) return;\r\n this.onSlotChange(change);\r\n }\r\n );\r\n }\r\n this.hasChestOpen = true;\r\n } else {\r\n // Player does not have inventory open but item is held\r\n try {\r\n this.entity.teleport(\r\n this.player.headLocation,\r\n this.player.dimension,\r\n this.player.rotation.x,\r\n this.player.rotation.y,\r\n true\r\n );\r\n } catch (error) {\r\n this.despawn();\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Sets this gui to a page of items\r\n * @param pageId page to set this gui too\r\n */\r\n setPage(pageId: string, extras?: any) {\r\n const c = this.entity.getComponent(\"inventory\").container;\r\n for (let i = 0; i < c.size; i++) {\r\n c.setItem(i, AIR);\r\n }\r\n if (!Object.keys(PAGES).includes(pageId))\r\n throw new Error(`pageId ${pageId} does not exist!`);\r\n const page = PAGES[pageId];\r\n this.page = page;\r\n\r\n page.fillType(this.entity, page, extras);\r\n this.entity.nameTag = `size:54`;\r\n }\r\n\r\n /**\r\n * This runs when a slot gets changed in the chest inventory\r\n */\r\n onSlotChange(change: ISlotChangeReturn) {\r\n /**\r\n * The guiItem that was changed\r\n */\r\n const slot: ISlot = this.page.slots[change.slot];\r\n\r\n if (!slot) {\r\n // item was added to page that is not a valid slot so set that slot back to air\r\n this.entity.getComponent(\"inventory\").container.setItem(change.slot, AIR);\r\n } else if (change.changeType == \"delete\") {\r\n // item was taken from this page\r\n if (slot.item) clearPlayersPointer(this.player, change.item);\r\n /**\r\n * if the slot has a item that returns when something is grabbed, this checks\r\n * if there is a item put into the slot to return, if not it will not send a\r\n * callback by returning before\r\n */\r\n if (!slot.item && !getItemAtSlot(this.entity, change.slot)) return;\r\n slot.action(new ItemGrabbedCallback(this, slot, change));\r\n }\r\n }\r\n\r\n /**\r\n * Deletes this gui and despawn its entity\r\n */\r\n despawn() {\r\n try {\r\n this.entity?.triggerEvent(\"despawn\");\r\n } catch (error) {}\r\n try {\r\n delete CHESTGUIS[this.player.name];\r\n } catch (error) {}\r\n if (this.tickEvent) world.events.tick.unsubscribe(this.tickEvent);\r\n if (this.slotChangeEvent)\r\n onEntityInventorySlotChange.unsubscribe(this.slotChangeEvent);\r\n }\r\n}\r\n", "import {\r\n Entity,\r\n EntityQueryOptions,\r\n ItemStack,\r\n PlayerInventoryComponentContainer,\r\n system,\r\n} from \"@minecraft/server\";\r\nimport { DIMENSIONS } from \"../../utils.js\";\r\n\r\ntype onSlotChangeCallback = (entity: Entity, change: ISlotChangeReturn) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: onSlotChangeCallback;\r\n entities: EntityQueryOptions;\r\n };\r\n} = {};\r\n\r\nconst MAPPED_INVENTORIES: { [key: string]: Array } = {};\r\nexport const PREVIOUS_CHANGE: { [key: string]: ISlotChangeReturn } = {};\r\n\r\nexport interface ISlotChangeReturn {\r\n /**\r\n * Slot that changed\r\n */\r\n slot: number;\r\n /**\r\n * The uid of this item\r\n */\r\n uid: string;\r\n /**\r\n * The old uid of this item\r\n */\r\n oldUid?: string;\r\n /**\r\n * the item that was grabbed / put\r\n */\r\n item: ItemStack;\r\n /**\r\n * The old itemStack that was in this slot\r\n */\r\n oldItem?: ItemStack;\r\n /**\r\n * How the inventory has changed\r\n */\r\n changeType: \"delete\" | \"put\" | \"swap\" | \"fluctuation\" | \"move\";\r\n}\r\n\r\ninterface IMappedInventoryItem {\r\n /**\r\n * a unique id for a itemStack\r\n */\r\n uid: string;\r\n /**\r\n * the item\r\n */\r\n item: ItemStack;\r\n}\r\n\r\n/**\r\n * Finds and returns a slot change in a inventory\r\n */\r\nfunction getSlotChanges(\r\n entity: Entity,\r\n oldInv: Array,\r\n newInv: Array\r\n): Array {\r\n if (oldInv.length != newInv.length) return [];\r\n const changes: Array = [];\r\n for (let i = 0; i < newInv.length; i++) {\r\n if (\r\n oldInv[i]?.item?.amount < newInv[i]?.item?.amount ||\r\n (oldInv[i]?.item?.amount > newInv[i]?.item?.amount &&\r\n oldInv[i]?.item?.amount != 0)\r\n ) {\r\n // Checks if the item is the same but checks if the amount has changed\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n oldUid: oldInv[i].uid,\r\n item: newInv[i].item,\r\n oldItem: oldInv[i].item,\r\n changeType: \"fluctuation\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n continue;\r\n }\r\n if (newInv[i].uid == oldInv[i].uid) continue; // no change\r\n if (oldInv[i]?.item && newInv[i]?.item) {\r\n // Checks if there was a new item but a new slot was not taken up\r\n // Meaning that the item got used like using a bucket on a cow\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n oldUid: oldInv[i].uid,\r\n item: newInv[i].item,\r\n oldItem: oldInv[i].item,\r\n changeType: \"swap\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n } else if (!newInv[i]?.item) {\r\n // There is no more item in this slot\r\n // Meaning the item has been moved across slots or been thrown out\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: oldInv[i].uid,\r\n item: oldInv[i].item,\r\n changeType: \"delete\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n } else if (newInv[i]?.item) {\r\n // New item has been added in this slot\r\n if (\r\n PREVIOUS_CHANGE[entity.id]?.changeType == \"delete\" &&\r\n PREVIOUS_CHANGE[entity.id]?.uid == newInv[i].uid\r\n ) {\r\n // item has been moved across slots\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n item: newInv[i].item,\r\n changeType: \"move\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n continue;\r\n } else {\r\n const change_data: ISlotChangeReturn = {\r\n slot: i,\r\n uid: newInv[i].uid,\r\n item: newInv[i].item,\r\n changeType: \"put\",\r\n };\r\n changes.push(change_data);\r\n PREVIOUS_CHANGE[entity.id] = change_data;\r\n }\r\n }\r\n }\r\n return changes;\r\n}\r\n\r\n/**\r\n * Converts a itemStack to a unique id\r\n * @param {ItemStack} item\r\n * @returns {string}\r\n */\r\nexport function getItemUid(item: ItemStack): string {\r\n if (!item) return \"\";\r\n const data = [];\r\n data.push(item.typeId);\r\n data.push(item.nameTag);\r\n data.push(item.data);\r\n data.push(item.getLore().join(\"\"));\r\n return data.join(\"\");\r\n}\r\n\r\n/**\r\n * Gets an entity's inventory but with mapped data\r\n */\r\nfunction mapInventory(\r\n container: PlayerInventoryComponentContainer\r\n): Array {\r\n const inventory = [];\r\n\r\n for (let i = 0; i < container.size; i++) {\r\n let item = container.getItem(i);\r\n inventory[i] = {\r\n uid: getItemUid(item),\r\n item: item,\r\n };\r\n }\r\n return inventory;\r\n}\r\n\r\nsystem.runSchedule(() => {\r\n for (const callback of Object.values(CALLBACKS)) {\r\n for (const entity of DIMENSIONS.overworld.getEntities(callback.entities)) {\r\n const inventory = mapInventory(\r\n entity.getComponent(\"inventory\").container\r\n );\r\n const changes = getSlotChanges(\r\n entity,\r\n MAPPED_INVENTORIES[entity.id] ?? inventory,\r\n inventory\r\n );\r\n MAPPED_INVENTORIES[entity.id] = inventory;\r\n if (changes.length == 0) continue;\r\n if (entity.hasTag(\"skipCheck\")) {\r\n entity.removeTag(\"skipCheck\");\r\n delete PREVIOUS_CHANGE[entity.id];\r\n continue;\r\n }\r\n for (const change of changes) {\r\n callback.callback(entity, change);\r\n }\r\n }\r\n }\r\n}, 5);\r\n\r\nexport class onEntityInventorySlotChange {\r\n /**\r\n * Subscribes to a callback to get notified when a entities inventory changes\r\n * @param callback what to be called when one of these entities inventory's changes\r\n * @param entities the entity's to grab from\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(\r\n entities: EntityQueryOptions,\r\n callback: onSlotChangeCallback\r\n ): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback, entities: entities };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n}\r\n", "import { Entity, ItemStack, Location, Player } from \"@minecraft/server\";\r\nimport { PlayerLog } from \"../../plugins/Anti-Cheat/modules/models/PlayerLog\";\r\nimport type { ChestGUI } from \"./Models/EntityChest\";\r\nimport type { Page } from \"./Models/Page\";\r\n\r\n/**\r\n * This will link a players name to a chest gui instance\r\n */\r\nexport const CHESTGUIS: { [key: string]: ChestGUI } = {};\r\n\r\n/**\r\n * This will link a players name to a chest gui instance\r\n */\r\nexport const PAGES: { [key: string]: Page } = {};\r\n\r\n/**\r\n * This will keep track if a player has a chest open\r\n */\r\nexport const CHEST_OPEN = new PlayerLog();\r\n\r\n/**\r\n * Gets a players held item\r\n */\r\nexport function getHeldItem(player: Player): ItemStack {\r\n const inventory = player.getComponent(\"minecraft:inventory\").container;\r\n return inventory.getItem(player.selectedSlot);\r\n}\r\n\r\n/**\r\n * Clears the player of a item in there pointer slot\r\n */\r\nexport async function clearPlayersPointer(\r\n player: Player,\r\n ItemToClear: ItemStack\r\n) {\r\n try {\r\n const inventory = player.getComponent(\"minecraft:inventory\").container;\r\n let itemsToLoad = [];\r\n for (let i = 0; i < inventory.size; i++) {\r\n const item = inventory.getItem(i);\r\n if (!item) continue;\r\n if (item?.typeId == ItemToClear?.typeId) {\r\n itemsToLoad.push({ slot: i, item: item });\r\n inventory.setItem;\r\n if (i < 9) {\r\n await player.runCommandAsync(\r\n `replaceitem entity @s slot.hotbar ${i} air`\r\n );\r\n } else {\r\n await player.runCommandAsync(\r\n `replaceitem entity @s slot.inventory ${i - 9} air`\r\n );\r\n }\r\n }\r\n }\r\n await player.runCommandAsync(\r\n `clear @s ${ItemToClear?.typeId} ${ItemToClear.data} ${ItemToClear.amount}`\r\n );\r\n for (const item of itemsToLoad) {\r\n inventory.setItem(item.slot, item.item);\r\n }\r\n } catch (error) {\r\n // the item couldn't be cleared that means\r\n // they now have a item witch is really BAD\r\n [\r\n ...player.dimension.getEntities({\r\n type: \"minecraft:item\",\r\n location: new Location(\r\n player.location.x,\r\n player.location.y,\r\n player.location.z\r\n ),\r\n maxDistance: 2,\r\n closest: 1,\r\n }),\r\n ].forEach((e) => e.kill());\r\n }\r\n}\r\n\r\n/**\r\n * Gets an item at slot\r\n */\r\nexport function getItemAtSlot(entity: Entity, slot: number): ItemStack | null {\r\n const inventory = entity.getComponent(\"minecraft:inventory\").container;\r\n return inventory.getItem(slot);\r\n}\r\n", "import { Player, world } from \"@minecraft/server\";\n\nexport class PlayerLog {\n data: Map;\n events: Object;\n\n constructor() {\n this.data = new Map();\n this.events = {\n playerLeave: world.events.playerLeave.subscribe((data) =>\n this.data.delete(data.playerName)\n ),\n };\n }\n\n /**\n * Logs a player to a value\n */\n set(player: Player, value: T): void {\n this.data.set(player.name, value);\n }\n\n /**\n * Gets a players value\n */\n get(player: Player): T | undefined {\n return this.data.get(player.name);\n }\n\n /**\n * Deletes a player from log\n */\n delete(player: Player) {\n this.data.delete(player.name);\n }\n\n /**\n * Clears this Player log\n */\n clear() {\n this.data.clear();\n }\n\n /**\n * Gets all the players in the log\n */\n playerNames(): Array {\n return [...this.data.keys()];\n }\n\n /**\n * Checks to see if a player is in this list\n * @param player player to check\n * @returns\n */\n includes(player: Player): boolean {\n return this.playerNames().includes(player.name);\n }\n}\n", "import {\n ActionFormData,\n MessageFormData,\n ModalFormData,\n ActionFormResponse,\n ModalFormResponse,\n MessageFormResponse,\n} from \"@minecraft/server-ui\";\nimport { ChestGUI } from \"./EntityChest\";\nimport { ItemStack } from \"@minecraft/server\";\nimport { ItemDatabase } from \"../database/Item\";\nimport type { ISlot } from \"./Page\";\nimport type { ISlotChangeReturn } from \"../../Events/onSlotChange\";\nimport { sleep } from \"../../../utils\";\n\ntype FormActionReturn = T extends ActionFormData\n ? Promise\n : T extends ModalFormData\n ? Promise\n : Promise;\n\nexport class ItemGrabbedCallback {\n gui: ChestGUI;\n slot: ISlot;\n change: ISlotChangeReturn;\n /**\n * New Callback\n */\n constructor(gui: ChestGUI, slot: ISlot, change: ISlotChangeReturn) {\n this.gui = gui;\n this.slot = slot;\n this.change = change;\n }\n\n /**\n * Messages to the owner of this gui\n * @example ctx.reply('Hello World!');\n */\n message(text: string) {\n this.gui.player.tell(text);\n }\n\n /**\n * Gets the item added\n */\n getItemAdded(): ItemStack | null {\n if (this.slot.item) return null;\n return this.gui.entity\n .getComponent(\"minecraft:inventory\")\n .container.getItem(this.change.slot);\n }\n\n /**\n * Gives the player the item the grabbed\n */\n GiveAction(item: ItemStack = this.slot.item.itemStack) {\n this.gui.player.getComponent(\"minecraft:inventory\").container.addItem(item);\n }\n\n /**\n * Gives the player the item that was grabbed also removes this item from the gui + db\n * @param db the item database to remove this item from\n */\n TakeAction(db: ItemDatabase = null) {\n this.gui.player\n .getComponent(\"minecraft:inventory\")\n .container.addItem(this.slot.item.itemStack);\n this.gui.page.slots[this.change.slot] = null;\n if (!db) return;\n db.delete(this.slot.item.components.dbKey);\n }\n\n /**\n * Changes the page of the chestGui when this item is grabbed\n * @param page page to send to\n * @param extras stuff to be passed onto the page\n */\n PageAction(page: string, extras?: any) {\n this.gui.setPage(page, extras);\n }\n\n /**\n * Closes the chest GUI when this item is grabbed\n */\n CloseAction() {\n this.gui.despawn();\n }\n\n /**\n * Sets the item back\n */\n SetAction() {\n const container = this.gui.entity.getComponent(\n \"minecraft:inventory\"\n ).container;\n container.setItem(this.change.slot, this.slot.item.itemStack);\n }\n\n /**\n * Opens a form to the player\n * @param {ActionFormData | ModalFormData | MessageFormData} form form to load\n * @returns {Promise}\n */\n async FormAction(\n form: T\n ): Promise> {\n this.CloseAction();\n await sleep(5);\n // @ts-ignore\n return await form.show(this.gui.player);\n }\n}\n", "import {\r\n Enchantment,\r\n EnchantmentList,\r\n ItemStack,\r\n ItemType,\r\n} from \"@minecraft/server\";\r\n\r\ninterface IPageItemComponents {\r\n /**\r\n * Number of the items in the stack. Valid values range between 0 and 64.\r\n */\r\n amount?: number;\r\n /**\r\n * A data value used to configure alternate states of the item.\r\n */\r\n data?: number;\r\n /**\r\n * Given name of this stack of items.\r\n */\r\n nameTag?: string;\r\n /**\r\n * a secondary display string - for an ItemStack.\r\n */\r\n loreList?: string[];\r\n /**\r\n * a collection of the enchantments on this item\r\n */\r\n enchantments?: Enchantment[];\r\n /**\r\n * A key that could be on this item, meaning its connect to database\r\n */\r\n dbKey?: string;\r\n}\r\n\r\nexport class PageItem {\r\n /**\r\n * The item type this item has\r\n */\r\n itemType: ItemType;\r\n /**\r\n * The components that this item\r\n * this stores information such as data, enchantments etc\r\n */\r\n components: IPageItemComponents;\r\n\r\n /**\r\n * The itemStack that was set at item creation\r\n */\r\n setItemStack: ItemStack | null;\r\n\r\n constructor(\r\n itemType: ItemType,\r\n components: IPageItemComponents = {},\r\n itemStack?: ItemStack\r\n ) {\r\n this.itemType = itemType;\r\n this.components = components;\r\n this.setItemStack = itemStack;\r\n }\r\n /**\r\n * gets itemStack that this PageItem is associated with\r\n */\r\n get itemStack(): ItemStack {\r\n if (this.setItemStack) return this.setItemStack;\r\n const itemStack = new ItemStack(this.itemType);\r\n if (this.components) {\r\n itemStack.amount = this.components?.amount ?? 1;\r\n itemStack.data = this.components?.data ?? 0;\r\n itemStack.nameTag = this.components?.nameTag;\r\n itemStack.setLore(this.components?.loreList ?? []);\r\n const enchantments: EnchantmentList =\r\n itemStack.getComponent(\"enchantments\").enchantments;\r\n for (const enchantment of this.components?.enchantments ?? []) {\r\n enchantments.addEnchantment(enchantment);\r\n }\r\n itemStack.getComponent(\"enchantments\").enchantments = enchantments;\r\n }\r\n return itemStack;\r\n }\r\n}\r\n", "import { Entity } from \"@minecraft/server\";\nimport { AIR } from \"../../../index.js\";\nimport { Page } from \"./Page.js\";\n\nexport type FillTypeCallback = (\n entity: Entity,\n page: Page,\n extras: any\n) => void;\n\n/**\n * Fills a entity with desired items\n */\nexport function DefaultFill(entity: Entity, page: Page, extras: any) {\n const container = entity.getComponent(\"minecraft:inventory\").container;\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n}\n", "import { PAGES } from \"../utils.js\";\r\nimport { DefaultFill, FillTypeCallback } from \"./FillTypes\";\r\nimport { ItemGrabbedCallback } from \"./ItemGrabbedCallback.js\";\r\nimport type { PageItem } from \"./PageItem\";\r\n\r\nexport interface ISlot {\r\n /**\r\n * The item that should be in this slot\r\n */\r\n item: PageItem;\r\n /**\r\n * What happens when there is a change in this slot\r\n */\r\n action: (ctx: ItemGrabbedCallback) => void;\r\n}\r\n\r\nexport class Page {\r\n /**\r\n * The id this page has\r\n */\r\n id: string;\r\n /**\r\n * How this page fills, these can be custom or kept default\r\n */\r\n fillType: FillTypeCallback;\r\n\r\n /**\r\n * The slots in this gui\r\n */\r\n slots: ISlot[];\r\n\r\n constructor(id: string, fillType: FillTypeCallback = DefaultFill) {\r\n if (Object.keys(PAGES).includes(id))\r\n throw new Error(`Page: ${id}, Already exists!`);\r\n this.id = id;\r\n this.fillType = fillType;\r\n this.slots = [];\r\n PAGES[id] = this;\r\n }\r\n\r\n /**\r\n * Sets slots in this page\r\n */\r\n setSlots(\r\n slot: Array,\r\n item: PageItem,\r\n action: (ctx: ItemGrabbedCallback) => void\r\n ): Page {\r\n const data = item ? { item: item, action: action } : null;\r\n for (const i of slot) {\r\n this.slots[i] = data;\r\n }\r\n return this;\r\n }\r\n}\r\n", "import { PageItem } from \"../Models/PageItem.js\";\r\nimport { Page } from \"../Models/Page.js\";\r\nimport { MinecraftItemTypes } from \"@minecraft/server\";\r\n\r\n/**\r\n * The Home page of this GUI this is the most important because\r\n * when the GUI is opened it will open up here, any plugin can\r\n * change this but this is the default screen\r\n */\r\nexport let HOME_PAGE = new Page(\"home\")\r\n .setSlots(\r\n [22],\r\n new PageItem(MinecraftItemTypes.enderChest, {\r\n nameTag: \"\u00A7l\u00A7bInventory Viewer\",\r\n }),\r\n (ctx) => {\r\n ctx.PageAction(\"moderation:see\");\r\n }\r\n )\r\n .setSlots(\r\n [54],\r\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\r\n (ctx) => {\r\n ctx.CloseAction();\r\n }\r\n );\r\n", "import type { Protection } from \"./modules/models/Protection\";\r\n\r\n/**\r\n * All protections in this anti-cheat\r\n */\r\nexport const PROTECTIONS: { [key: string]: Protection } = {};\r\n", "export const text = {\n \"api.name\": () => \"Smelly API\",\n \"api.error.unknown\": () => \"An unknown error has occurred.\",\n \"api.database.error.table_name\": (a: string, b: number) =>\n `The display name ${a} is too long for an objective, it can be at most ${b} characters long`,\n \"api.utilities.formatter.error.ms\": (a: string) =>\n `${a} is not a string or a number`,\n \"api.Providers.form.invalidType\": (a: string, b: string) =>\n `Type ${a} is not a valid type to add a ${b}`,\n \"modules.protections.cps.clickingToFast\": () =>\n `You are clicking to fast! Please click slower!`,\n \"modules.managers.mute.isMuted\": () =>\n `\u00A7cYou've been temporarily muted in chat.`,\n \"modules.commands.ban.reply\": (\n playerName: string,\n duration: string,\n reason: string = \"\"\n ) =>\n `\u00A7cBanned \u00A7f\"\u00A7a${playerName}\u00A7f\" \u00A7cfor ${duration} Because: \"${\n reason ?? \"No reason Provided\"\n }\" \u00A7aSuccessfully`,\n \"lockdown.kick.message\": () => [\n `\u00A7cYou have been kicked!`,\n `\u00A7aReason: \u00A7fServer is currently under LockDown`,\n `\u00A7fServer will be up soon, Try to join later`,\n ],\n \"commands.ban.list.player\": (name: string, reason: string, expire: string) =>\n `- \"${name}\" Because: ${reason}, Expiry ${expire}`,\n \"commands.freeze.list.player\": (name: string, reason: string) =>\n `- \"${name}\" Because: ${reason}`,\n \"commands.mutes.list.player\": (\n name: string,\n reason: string,\n expire: string\n ) => `- \"${name}\" Because: ${reason}, Expiry: ${expire}`,\n \"commands.lockdown.confirm\":\n \"Are you sure you want to lockdown the server, this will kick all active players and all players who try to join who are not admin\",\n};\n", "import { Location, Player } from \"@minecraft/server\";\r\nimport {\r\n LiteralArgumentType,\r\n IArgumentType,\r\n LocationArgumentType,\r\n StringArgumentType,\r\n IntegerArgumentType,\r\n ArrayArgumentType,\r\n BooleanArgumentType,\r\n} from \"./ArgumentTypes.js\";\r\nimport { CommandCallback } from \"./Callback.js\";\r\nimport { COMMANDS } from \"./index.js\";\r\nimport type { AppendArgument, ICommandData, ArgReturn } from \"./types\";\r\nexport { ArgumentTypes } from \"./ArgumentTypes\";\r\n\r\nexport class Command<\r\n Callback extends Function = (ctx: CommandCallback) => void\r\n> {\r\n /**\r\n * The Arguments on this command\r\n */\r\n children: Command[];\r\n\r\n /**\r\n * Function to run when this command is called\r\n */\r\n callback: Callback;\r\n\r\n constructor(\r\n public data: ICommandData,\r\n public type?: IArgumentType,\r\n public depth: number = 0,\r\n public parent?: Command\r\n ) {\r\n if (!data.requires) data.requires = (player: Player) => true;\r\n this.data = data;\r\n this.type = type ?? new LiteralArgumentType(this.data.name);\r\n this.children = [];\r\n this.depth = depth;\r\n this.parent = parent;\r\n this.callback = null;\r\n\r\n COMMANDS.push(this);\r\n }\r\n\r\n /**\r\n * Adds a ranch to this command of your own type\r\n * @param type a special type to be added\r\n * @returns new branch to this command\r\n */\r\n argument(type: T): ArgReturn {\r\n const cmd = new Command>(\r\n this.data,\r\n type,\r\n this.depth + 1,\r\n this\r\n );\r\n this.children.push(cmd);\r\n return cmd;\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n string(name: string): ArgReturn {\r\n return this.argument(new StringArgumentType(name));\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n int(name: string): ArgReturn {\r\n return this.argument(new IntegerArgumentType(name));\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n array>(\r\n name: string,\r\n types: T\r\n ): ArgReturn {\r\n return this.argument(new ArrayArgumentType(name, types));\r\n }\r\n\r\n /**\r\n * Adds a branch to this command of type string\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n boolean(name: string): ArgReturn {\r\n return this.argument(new BooleanArgumentType(name));\r\n }\r\n\r\n /**\r\n * Adds a argument to this command to add 3 parameters with location types and to return a Location\r\n * @param name name this argument should have\r\n * @returns new branch to this command\r\n */\r\n location(name: string): ArgReturn {\r\n const cmd = this.argument(new LocationArgumentType(name));\r\n if (!name.endsWith(\"*\")) {\r\n const newArg = cmd.location(name + \"_y*\").location(name + \"_z*\");\r\n //@ts-ignore\r\n return newArg;\r\n }\r\n //@ts-ignore\r\n return cmd;\r\n }\r\n\r\n /**\r\n * Adds a subCommand to this argument\r\n * @param name name this literal should have\r\n * @returns new branch to this command\r\n */\r\n literal(data: ICommandData): Command {\r\n const cmd = new Command(\r\n data,\r\n new LiteralArgumentType(data.name),\r\n this.depth + 1,\r\n this\r\n );\r\n this.children.push(cmd);\r\n return cmd;\r\n }\r\n\r\n /**\r\n * Registers this command and its appending arguments\r\n * @param callback what to run when this command gets called\r\n */\r\n executes(callback: Callback): Command {\r\n this.callback = callback;\r\n return this;\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport type { IBanData } from \"../../../../types.js\";\nimport { durationToMs } from \"../../../../utils.js\";\n\nfunction setBan(\n player: string | Player,\n id: string,\n duration?: string,\n reason: string = \"No Reason\",\n by: string = \"Rubedo Auto Mod\"\n) {\n const data: IBanData = {\n key: id,\n playerName: player instanceof Player ? player.name : player,\n date: Date.now(),\n duration: duration ? durationToMs(duration) : null,\n expire: duration ? durationToMs(duration) + Date.now() : null,\n reason: reason,\n by: by,\n };\n TABLES.bans.set(id, data);\n}\n\nexport class Ban {\n /**\n * Ban a player for a set length\n */\n constructor(\n player: string | Player,\n duration?: string,\n reason: string = \"No Reason\",\n by: string = \"Rubedo Auto Mod\"\n ) {\n if (player instanceof Player) {\n setBan(player, player.id, duration, reason, by);\n } else {\n setBan(player, TABLES.ids.get(player), duration, reason, by);\n }\n }\n}\n", "import { text } from \"../../../../lang/text.js\";\nimport type { CommandCallback } from \"../../../../lib/Command/Callback.js\";\nimport { Command, ArgumentTypes } from \"../../../../lib/Command/Command.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { confirmAction, msToTime } from \"../../../../utils.js\";\nimport { getRole } from \"../../utils.js\";\nimport { Ban } from \"../models/Ban.js\";\n\nfunction ban(\n ctx: CommandCallback,\n player: string,\n duration: string,\n reason: string,\n by: string\n) {\n if (TABLES.bans.get(TABLES.ids.get(player)))\n return ctx.reply(`\u00A7c${player} is already banned`);\n ctx.reply(`\u00A7aClose chat to confirm`);\n confirmAction(\n ctx.sender,\n `Are you sure you want to ban ${player}, for ${duration ?? \"forever\"}`,\n () => {\n new Ban(player, duration, reason, ctx.sender.name);\n ctx.reply(text[\"modules.commands.ban.reply\"](player, duration, reason));\n }\n );\n}\n\nconst root = new Command({\n name: \"ban\",\n description: \"Manage bans\",\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\n});\n\nroot\n .literal({\n name: \"add\",\n description: \"Bans a player\",\n })\n .argument(new ArgumentTypes.playerName())\n .executes((ctx, player) => {\n ban(ctx, player, null, null, ctx.sender.name);\n })\n .argument(new ArgumentTypes.duration(\"duration\"))\n .executes((ctx, player, duration) => {\n ban(ctx, player, duration, null, ctx.sender.name);\n })\n .string(\"reason\")\n .executes((ctx, player, duration, reason) => {\n ban(ctx, player, duration, reason, ctx.sender.name);\n });\n\nroot\n .literal({\n name: \"remove\",\n description: \"un-bans a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const banData = TABLES.bans\n .values()\n .find((ban) => ban.playerName == playerName);\n if (!banData) return ctx.reply(`${playerName} is not banned`);\n if (TABLES.bans.delete(banData.key)) {\n ctx.reply(`\u00A7a${playerName}\u00A7r has been Unbanned!`);\n } else {\n ctx.reply(`\u00A7cFailed to un-ban ${playerName}`);\n }\n });\n\nroot\n .literal({\n name: \"list\",\n description: \"Lists all bans\",\n })\n .executes((ctx) => {\n const bans = TABLES.bans.values();\n if (bans.length == 0) return ctx.sender.tell(`\u00A7cNo one is banned!`);\n ctx.sender.tell(`\u00A72--- Showing Bans (${bans.length}) ---`);\n for (const ban of bans) {\n ctx.sender.tell(\n text[\"commands.ban.list.player\"](\n ban.playerName,\n ban.reason,\n ban.expire ? msToTime(ban.duration) : \"Forever\"\n )\n );\n }\n });\n", "import { Command } from \"../../../../lib/Command/Command\";\nimport { TABLES } from \"../../../../lib/Database/tables\";\nimport { getRole } from \"../../utils\";\n\nconst root = new Command({\n name: \"database\",\n description: \"Interacts with SA Database\",\n aliases: [\"db\"],\n requires: (player) => getRole(player) == \"admin\",\n});\n\nroot\n .literal({\n name: \"get\",\n })\n .string(\"table\")\n .string(\"key\")\n .executes((ctx, table, key) => {\n try {\n const data = TABLES[table as keyof typeof TABLES].get(key);\n if (data) {\n ctx.reply(JSON.stringify(data));\n } else {\n ctx.reply(`No data could be found for key ${key}`);\n }\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"set\",\n })\n .string(\"table\")\n .string(\"key\")\n .string(\"value\")\n .executes((ctx, table, key, value) => {\n try {\n TABLES[table as keyof typeof TABLES].set(key, value);\n ctx.reply(`Set Key: \"${key}\", to value: \"${value}\" on table: \"${table}\"`);\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"clear\",\n })\n .string(\"table\")\n .executes((ctx, table) => {\n try {\n TABLES[table as keyof typeof TABLES].clear();\n ctx.reply(`Cleared Table ${table}`);\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"keys\",\n description: \"Returns all keys on a database\",\n })\n .string(\"table\")\n .executes((ctx, table) => {\n try {\n const keys = TABLES[table as keyof typeof TABLES].keys();\n ctx.reply(`Keys on database: ${table}: ${keys}`);\n } catch (error) {\n ctx.reply(error + error.stack);\n }\n });\n\nroot\n .literal({\n name: \"values\",\n description: \"Returns all values on a database\",\n })\n .string(\"table\")\n .executes((ctx, table) => {\n try {\n const values = TABLES[table as keyof typeof TABLES].values();\n ctx.reply(\n `Values on database: ${table}: ${JSON.stringify(values, null, 2)}`\n );\n } catch (error) {\n // likely occurs when table is empty\n if (error instanceof TypeError) {\n ctx.reply(`No values on database ${table}`);\n } else {\n ctx.reply(error + error.stack);\n }\n }\n });\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command.js\";\nimport { getRole } from \"../../utils.js\";\n\nnew Command({\n name: \"ecwipe\",\n description: \"Clears a players ender chest\",\n requires: (player) => getRole(player) == \"admin\",\n})\n .argument(new ArgumentTypes.player(\"player\"))\n .executes((ctx, player) => {\n for (let i = 0; i < 27; i++) {\n player.runCommandAsync(`replaceitem entity @s slot.enderchest ${i} air`);\n }\n ctx.reply(`\u00A7aCleared \"${player.name}\"'s Ender chest!`);\n });\n", "import { Player } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport type { IFreezeData } from \"../../../../types.js\";\n\nexport class Freeze {\n /**\n * Freeze a player\n */\n constructor(player: Player, reason: string = \"No Reason\") {\n const data: IFreezeData = {\n playerName: player.name,\n key: player.id,\n reason: reason,\n location: {\n x: player.location.x,\n y: player.location.y,\n z: player.location.z,\n dimension: player.dimension.id,\n },\n };\n TABLES.freezes.set(player.id, data);\n }\n}\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command.js\";\nimport { Freeze } from \"../models/Freeze.js\";\nimport { getRole } from \"../../utils.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { text } from \"../../../../lang/text.js\";\n\nconst root = new Command({\n name: \"freeze\",\n description: \"Manage Freezes\",\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\n});\n\nroot\n .literal({\n name: \"add\",\n description: \"Freezes a player\",\n })\n .argument(new ArgumentTypes.player(\"player\"))\n .string(\"reason\")\n .executes((ctx, player, reason) => {\n new Freeze(player, reason);\n ctx.reply(\n `\u00A7cFroze \u00A7f\"\u00A7a${player.name}\u00A7f\" Because: \"${reason}\" \u00A7aSuccessfully`\n );\n ctx.sender.tell(\n `\u00A7cYou have been frozen by \u00A7f\"\u00A7a${ctx.sender.name}\u00A7f\" Because: \"${reason}\"`\n );\n });\n\nroot\n .literal({\n name: \"remove\",\n description: \"unfreezes a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const freeze = TABLES.freezes\n .values()\n .find((freeze) => freeze.playerName == playerName);\n if (!freeze) return ctx.reply(`${playerName} is not frozen`);\n\n TABLES.freezes.delete(freeze.key);\n\n ctx.reply(`\u00A7a${playerName}\u00A7r has been UnFrozen!`);\n });\n\nroot\n .literal({\n name: \"list\",\n description: \"Lists all freezes\",\n })\n .executes((ctx) => {\n const freezes = TABLES.freezes.values();\n if (freezes.length == 0) return ctx.sender.tell(`\u00A7cNo one is frozen!`);\n ctx.sender.tell(`\u00A72--- Showing Freezes (${freezes.length}) ---`);\n for (const freeze of freezes) {\n ctx.sender.tell(\n text[\"commands.freeze.list.player\"](freeze.playerName, freeze.reason)\n );\n }\n });\n", "import { Player } from \"@minecraft/server\";\nimport { PREFIX } from \"../../../../config/commands.js\";\nimport {\n IArgumentReturnData,\n IArgumentType,\n} from \"../../../../lib/Command/ArgumentTypes.js\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { COMMANDS } from \"../../../../lib/Command/index.js\";\n\nclass CommandNameArgumentType implements IArgumentType {\n type: string;\n typeName = \"CommandName\";\n matches(value: string): IArgumentReturnData {\n return {\n success: Boolean(\n COMMANDS.find((c) => c.depth == 0 && c.data.name == value)\n ),\n value: value,\n };\n }\n fail(value: string): string {\n return `\"${value}\" is not a valid command`;\n }\n constructor(public name: string) {}\n}\n\n/**\n * Sends text in chat relation to the args in the command to player\n */\nfunction sendCommandType(\n baseCommand: Command,\n args: Command[],\n player: Player\n) {\n player.tell(\n `${PREFIX}${baseCommand.data.name} ${args\n .map((a) =>\n a.type.typeName == \"literal\"\n ? a.data.name\n : `<${a.type.name}: ${a.type.typeName}>`\n )\n .join(\" \")}`\n );\n}\n\nfunction sendArguments(bc: Command, c: Command, args: Command[], p: Player) {\n if (!c.data?.requires(p)) return;\n if (c.callback) {\n // command has a callback\n sendCommandType(bc, c.depth == 0 ? args : args.concat(c), p);\n }\n if (c.children.length > 0) {\n // cmd has arguments\n for (const child of c.children) {\n sendArguments(bc, child, c.depth == 0 ? args : args.concat(c), p);\n }\n }\n}\n\nfunction sendPageHeader(player: Player, p: number, maxPages: number) {\n player.tell(\n `\u00A72--- Showing help page ${p} of ${maxPages} (${PREFIX}help ) ---`\n );\n}\n\nfunction getCommands(player: Player): Command[] {\n return COMMANDS.filter((c) => {\n return c.depth == 0 && c.data?.requires(player);\n });\n}\n\nfunction getMaxPages(player: Player): number {\n const commands = getCommands(player);\n if (commands.length == 0) return 0;\n return Math.ceil(commands.length / 5);\n}\n\nconst root = new Command({\n name: \"help\",\n description: \"Provides help/list of commands.\",\n aliases: [\"?\", \"h\"],\n}).executes((ctx) => {\n // show page 1\n const maxPages = getMaxPages(ctx.sender);\n const commands = getCommands(ctx.sender).slice(1 * 5 - 5, 1 * 5);\n sendPageHeader(ctx.sender, 1, maxPages);\n for (const cmd of commands) {\n sendArguments(cmd, cmd, [], ctx.sender);\n }\n});\n\nroot.int(\"page\").executes((ctx, p) => {\n // shows page\n const maxPages = getMaxPages(ctx.sender);\n if (p > maxPages) p = maxPages;\n const commands = getCommands(ctx.sender).slice(p * 5 - 5, p * 5);\n sendPageHeader(ctx.sender, p, maxPages);\n for (const cmd of commands) {\n sendArguments(cmd, cmd, [], ctx.sender);\n }\n});\n\nroot\n .argument(new CommandNameArgumentType(\"command\"))\n .executes((ctx, command) => {\n // shows command\n const cmd = COMMANDS.filter(\n (c) => c.depth == 0 && c.data.name == command\n )[0];\n ctx.sender.tell(\n `\u00A7e${cmd.data.name}: ${\n cmd.data.aliases ? `aliases (${cmd.data.aliases.join(\", \")})` : \"\"\n }`\n );\n ctx.sender.tell(`\u00A7e${cmd.data.description}`);\n ctx.sender.tell(`Usage:`);\n sendArguments(cmd, cmd, [], ctx.sender);\n });\n", "import { world } from \"@minecraft/server\";\r\nimport { text } from \"../../../../lang/text.js\";\r\nimport { Command } from \"../../../../lib/Command/Command.js\";\r\nimport { confirmAction } from \"../../../../utils.js\";\r\nimport { getRole, isLockedDown, kick, setLockDown } from \"../../utils.js\";\r\n\r\nnew Command({\r\n name: \"lockdown\",\r\n description: \"Toggles the servers lockdown, meaning no one can join\",\r\n requires: (player) => getRole(player) == \"admin\",\r\n}).executes((ctx) => {\r\n if (isLockedDown()) {\r\n setLockDown(false);\r\n ctx.sender.tell(`\u00A7aUnlocked the server!`);\r\n } else {\r\n ctx.reply(`\u00A7aClose chat to confirm lockdown`);\r\n confirmAction(ctx.sender, text[\"commands.lockdown.confirm\"], () => {\r\n setLockDown(true);\r\n for (const player of world.getPlayers()) {\r\n if (getRole(player) == \"admin\") continue;\r\n kick(player, text[\"lockdown.kick.message\"]());\r\n }\r\n world.say(`\u00A7l\u00A7cServer is now LOCKED!`);\r\n });\r\n }\r\n});\r\n", "import { Player } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport type { IMuteData } from \"../../../../types.js\";\nimport { durationToMs } from \"../../../../utils.js\";\n\nexport class Mute {\n length: number;\n /**\n * Gets the mute data for this player\n */\n static getMuteData(player: Player): IMuteData {\n return TABLES.mutes.get(player.name);\n }\n /**\n * Mutes a player for a length\n */\n constructor(\n player: Player,\n duration?: string,\n reason: string = \"No Reason\",\n by: string = \"Rubedo Auto Mod\"\n ) {\n const msLength = duration ? durationToMs(duration) : null;\n const data: IMuteData = {\n playerName: player.name,\n date: Date.now(),\n duration: msLength,\n expire: msLength ? msLength + Date.now() : null,\n reason: reason,\n by: by,\n };\n TABLES.mutes.set(player.name, data);\n }\n}\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command.js\";\nimport { Mute } from \"../models/Mute.js\";\nimport { getRole } from \"../../utils.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { text } from \"../../../../lang/text.js\";\nimport { msToTime } from \"../../../../utils.js\";\n\nconst root = new Command({\n name: \"mute\",\n description: \"Manage Mutes\",\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\n});\n\nroot\n .literal({\n name: \"add\",\n description: \"Mutes a player\",\n })\n .argument(new ArgumentTypes.player(\"player\"))\n .argument(new ArgumentTypes.duration(\"duration\"))\n .string(\"reason\")\n .executes((ctx, player, duration, reason) => {\n new Mute(player, duration, reason, ctx.sender.name);\n ctx.reply(\n `\u00A7cMuted \u00A7f\"\u00A7a${player.name}\u00A7f\" \u00A7cfor ${duration} Because: \"${reason}\" \u00A7aSuccessfully`\n );\n player.tell(\n `\u00A7cYou have been muted by \u00A7f\"${ctx.sender.name}\" \u00A7cfor ${duration} Because: \"${reason}\"`\n );\n });\n\nroot\n .literal({\n name: \"remove\",\n description: \"un-mutes a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const mute = TABLES.mutes\n .values()\n .find((mute) => mute.playerName == playerName);\n if (!mute) return ctx.reply(`${playerName} is not muted!`);\n\n TABLES.mutes.delete(mute.playerName);\n try {\n ctx.sender.runCommandAsync(`ability \"${playerName}\" mute false`);\n } catch (error) {}\n ctx.reply(`\u00A7a${playerName}\u00A7r has been UnMuted!`);\n });\n\nroot\n .literal({\n name: \"list\",\n description: \"Lists all freezes\",\n })\n .executes((ctx) => {\n const mutes = TABLES.mutes.values();\n if (mutes.length == 0) return ctx.sender.tell(`\u00A7cNo one is muted!`);\n ctx.sender.tell(`\u00A72--- Showing Mutes (${mutes.length}) ---`);\n for (const mute of mutes) {\n ctx.sender.tell(\n text[\"commands.mutes.list.player\"](\n mute.playerName,\n mute.reason,\n mute.expire ? msToTime(mute.expire) : \"Forever\"\n )\n );\n }\n });\n", "import { Location } from \"@minecraft/server\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { getRole } from \"../../utils.js\";\nimport { Npc } from \"../models/Npc.js\";\n\nnew Command({\n name: \"npc\",\n description: \"Spawns a npc at your coordinates\",\n requires: (player) => getRole(player) == \"admin\",\n}).executes((ctx) => {\n const { x, y, z } = ctx.sender.location;\n new Npc(new Location(x, y, z), ctx.sender.dimension);\n ctx.reply(`Spawned a verified npc at your current location`);\n});\n", "import { Dimension, Entity, Location } from \"@minecraft/server\";\r\nimport { clearNpcLocations, NPC_LOCATIONS } from \"../../index.js\";\r\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\r\nimport type { INpcLocation } from \"../../../../types.js\";\r\nimport { LocationEquals } from \"../../../../utils.js\";\r\n\r\nexport class Npc {\r\n /**\r\n * Checks if a entity is a valid npc\r\n * @param entity npc\r\n */\r\n static isValid(entity: Entity): boolean {\r\n if (entity.typeId != \"minecraft:npc\") return false;\r\n if (NPC_LOCATIONS.find((l) => LocationEquals(l, entity.location)))\r\n return true;\r\n return TABLES.npcs.keys().find((key) => entity.id == key) ? true : false;\r\n }\r\n /**\r\n * Adds a new verified npc to the world\r\n */\r\n constructor(location: Location, dimension: Dimension) {\r\n NPC_LOCATIONS.push(location);\r\n const entity = dimension.spawnEntity(\"minecraft:npc\", location);\r\n\r\n const data: INpcLocation = {\r\n dimension: entity.dimension.id,\r\n x: entity.location.x,\r\n y: entity.location.y,\r\n z: entity.location.z,\r\n };\r\n TABLES.npcs.set(entity.id, data);\r\n clearNpcLocations();\r\n }\r\n}\r\n", "import { Command } from \"../../../../lib/Command/Command.js\";\nimport { world } from \"@minecraft/server\";\n\nnew Command({\n name: \"ping\",\n description: \"Returns the current Ticks Per Second of the servers ping\",\n}).executes((ctx) => {\n let pingTick = world.events.tick.subscribe(({ deltaTime }) => {\n ctx.reply(`Pong! Current Ticks Per Second: ${1 / deltaTime}`);\n world.events.tick.unsubscribe(pingTick);\n });\n});\n", "import { BlockLocation } from \"@minecraft/server\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { Region } from \"../models/Region.js\";\nimport { getRole } from \"../../utils.js\";\n\nconst command = new Command({\n name: \"region\",\n description: \"Create a Region\",\n requires: (player) => getRole(player) == \"admin\",\n});\n\ncommand\n .literal({\n name: \"add\",\n description: \"Adds a new protection region\",\n })\n .int(\"from_x\")\n .int(\"from_z\")\n .int(\"to_x\")\n .int(\"to_z\")\n .executes((ctx, from_x, from_z, to_x, to_z) => {\n new Region(\n { x: from_x, z: from_z },\n { x: to_x, z: to_z },\n ctx.sender.dimension.id\n );\n ctx.reply(\n `Created Region From ${from_x} -64 ${from_z} ${to_x} 320 ${to_z}`\n );\n });\n\ncommand\n .literal({\n name: \"remove\",\n description: \"Removes a region at the players current position\",\n })\n .executes((ctx) => {\n const loc = new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n );\n const r = Region.removeRegionAtBlockLocation(loc, ctx.sender.dimension.id);\n if (r) {\n ctx.reply(`Removed Region at ${loc.x} ${loc.y} ${loc.z}`);\n } else {\n ctx.reply(`Failed to find/remove region at ${loc.x} ${loc.y} ${loc.z}`);\n }\n });\n\ncommand\n .literal({\n name: \"removeAll\",\n description: \"Removes all regions\",\n })\n .executes((ctx) => {\n Region.getAllRegions().forEach((r) => r.delete());\n ctx.reply(`Removed All regions`);\n });\n\ncommand\n .literal({\n name: \"list\",\n description: \"Lists all regions and positions\",\n })\n .executes((ctx) => {\n const regions = Region.getAllRegions();\n for (const region of regions) {\n ctx.reply(\n `Region from ${region.from.x}, ${region.from.z} to ${region.to.x}, ${region.to.z} in dimension ${region.dimensionId}`\n );\n }\n if (regions.length == 0) return ctx.reply(`No regions have been made yet`);\n });\n\nconst permission = command.literal({\n name: \"permission\",\n description: \"Handles permissions for regions\",\n});\n\npermission\n .literal({\n name: \"set\",\n description:\n \"Sets a certain permission on the region the player is currently in to a value\",\n })\n .array(\"key\", [\"doorsAndSwitches\", \"openContainers\", \"pvp\"] as const)\n .boolean(\"value\")\n .executes((ctx, key, value) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n region.changePermission(key, value);\n ctx.reply(`Changed permission ${key} to ${value}`);\n });\n\npermission\n .literal({\n name: \"list\",\n description: \"Lists the permissions for the current region\",\n })\n .executes((ctx) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n ctx.reply(\n `Current region permissions ${JSON.stringify(region.permissions)}`\n );\n });\n\nconst entityCommands = permission.literal({\n name: \"entities\",\n description: \"Holds the subCommands for adding or removing allowedEntities\",\n});\n\nentityCommands\n .literal({\n name: \"add\",\n description: \"Adds a entity to the allowed entities list\",\n })\n .string(\"entity\")\n .executes((ctx, entity) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n const currentAllowedEntities = region.permissions.allowedEntities;\n currentAllowedEntities.push(entity);\n region.changePermission(\"allowedEntities\", currentAllowedEntities);\n ctx.reply(\n `Added entity ${entity} to the allowed entities of the region your currently standing in`\n );\n });\n\nentityCommands\n .literal({\n name: \"remove\",\n description: \"Removes a entity from the allowed entities in the region\",\n })\n .string(\"entity\")\n .executes((ctx, entity) => {\n const region = Region.blockLocationInRegion(\n new BlockLocation(\n ctx.sender.location.x,\n ctx.sender.location.y,\n ctx.sender.location.z\n ),\n ctx.sender.dimension.id\n );\n if (!region) return ctx.reply(`You are not in a region`);\n let currentAllowedEntities = region.permissions.allowedEntities;\n if (!currentAllowedEntities.includes(entity))\n return ctx.reply(\n `The entity ${entity} is not allowed to enter the region`\n );\n currentAllowedEntities = currentAllowedEntities.filter((v) => v != entity);\n region.changePermission(\"allowedEntities\", currentAllowedEntities);\n ctx.reply(\n `Removed entity ${entity} to the allowed entities of the region your currently standing in`\n );\n });\n", "import { Events, ItemStack, Player } from \"@minecraft/server\";\r\nimport type { APPEAL_LINK } from \"./config/app\";\r\nimport type { ENCHANTMENTS } from \"./plugins/Anti-Cheat/config/enchantments\";\r\nimport type {\r\n BANNED_BLOCKS,\r\n BANNED_ITEMS,\r\n} from \"./plugins/Anti-Cheat/config/moderation\";\r\nimport type { BlockInventory } from \"./plugins/Anti-Cheat/modules/models/BlockInventory\";\r\n\r\n/**\r\n * The roles that are in this server\r\n */\r\nexport enum ROLES {\r\n member,\r\n admin,\r\n moderator,\r\n builder,\r\n}\r\n\r\nexport interface IMsOptions {\r\n compactDuration?: string;\r\n fullDuration?: string;\r\n avoidDuration?: Array;\r\n}\r\n\r\nexport interface IplayerTickRegister {\r\n /**\r\n * callback to send\r\n */\r\n callback: (player: Player) => void;\r\n /**\r\n * delay in ticks\r\n */\r\n delay: number;\r\n /**\r\n * the last tick it sent a callback\r\n */\r\n lastCall: number;\r\n}\r\n\r\nexport interface ISlotChangeReturn {\r\n /**\r\n * Slot that changed\r\n */\r\n slot: number;\r\n /**\r\n * the item that was grabbed / put\r\n */\r\n item: ItemStack;\r\n}\r\n\r\nexport interface IEvents {\r\n [key: string]: any;\r\n}\r\n\r\nexport interface IContainerLocation {\r\n [key: string]: BlockInventory;\r\n}\r\n\r\nexport interface IBanData {\r\n /**\r\n * The unique id of this ban\r\n */\r\n key: string;\r\n /**\r\n * The playersName of who was banned\r\n * @example \"Smell of curry\"\r\n */\r\n playerName: string;\r\n /**\r\n * The date in MS when this player was banned\r\n */\r\n date: number;\r\n /**\r\n * The duration in ms that this ban will be for\r\n * if null player is banned forever\r\n */\r\n duration?: number;\r\n /**\r\n * When this ban will expire, if null it will never expire meaning player is banned forever\r\n */\r\n expire?: number;\r\n /**\r\n * The reason for why this player was banned\r\n * @example \"Hacking\"\r\n */\r\n reason?: string;\r\n /**\r\n * Who banned this player\r\n * @example \"Smell of curry\"\r\n * @example \"Rubedo Anti Cheat\"\r\n */\r\n by?: string;\r\n}\r\n\r\nexport interface IFreezeData {\r\n /**\r\n * Players name of who was banned\r\n */\r\n playerName: string;\r\n /**\r\n * Unique id of this freeze instance\r\n */\r\n key: string;\r\n /**\r\n * The reason for this freeze\r\n */\r\n reason?: string;\r\n /**\r\n * The location of this freeze\r\n */\r\n location: {\r\n x: number;\r\n y: number;\r\n z: number;\r\n dimension: string;\r\n };\r\n}\r\n\r\nexport interface IMuteData {\r\n /**\r\n * Players name of who is muted\r\n * @example \"Smell of curry\"\r\n */\r\n playerName: string;\r\n /**\r\n * The date this player got muted\r\n */\r\n date: number;\r\n /**\r\n * The duration of this mute in ms\r\n * if null player is muted forever\r\n */\r\n duration?: number;\r\n /**\r\n * When this players mute will expire in ms\r\n * if null this mute will never expire\r\n */\r\n expire?: number;\r\n /**\r\n * Why this player is muted\r\n * @example \"Spamming\"\r\n */\r\n reason?: string;\r\n /**\r\n * Who muted this player\r\n * @example \"Smell of curry\"\r\n * @example \"Rubedo Anti Cheat\"\r\n */\r\n by?: string;\r\n}\r\n\r\nexport interface INpcLocation {\r\n dimension: string;\r\n x: number;\r\n y: number;\r\n z: number;\r\n}\r\n\r\nexport interface IRegionDB {\r\n dimensionId: string;\r\n from: IRegionCords;\r\n to: IRegionCords;\r\n key: string;\r\n permissions: IRegionPermissions;\r\n}\r\n\r\nexport interface IRegionCords {\r\n x: number;\r\n z: number;\r\n}\r\n\r\nexport interface IRegionPermissions {\r\n /**\r\n * if the player can use chests, default: true\r\n */\r\n doorsAndSwitches: Boolean;\r\n /**\r\n * if the player can use doors, default: true\r\n */\r\n openContainers: Boolean;\r\n /**\r\n * if players can fight, default: false\r\n */\r\n pvp: Boolean;\r\n /**\r\n * the entities allowed in this region\r\n */\r\n allowedEntities: Array;\r\n}\r\n\r\nexport interface IChangePlayerRoleData {\r\n /**\r\n * The name of the player\r\n */\r\n playerName: string;\r\n /**\r\n * The role that the player should be set to\r\n */\r\n role: keyof typeof ROLES;\r\n}\r\n\r\nexport type durationSegmentType = \"y\" | \"w\" | \"d\" | \"h\" | \"m\" | \"s\" | \"ms\";\r\nexport type durationSegment = `${number}${durationSegmentType}`;\r\n\r\nexport type ConfigIds =\r\n | \"spam_config\"\r\n | \"cbe_config\"\r\n | \"gamemode_config\"\r\n | \"nuker_data\"\r\n | \"banned_items\"\r\n | \"banned_blocks\";\r\n\r\nexport type ConfigType = {\r\n spam_config: {\r\n /**\r\n * @default true\r\n */\r\n repeatedMessages: boolean;\r\n /**\r\n * @default true\r\n */\r\n zalgo: boolean;\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n permMutePlayer: boolean;\r\n };\r\n cbe_config: {\r\n /**\r\n * @default true\r\n */\r\n clearItem: boolean;\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n banPlayer: boolean;\r\n /**\r\n * @default false\r\n */\r\n canAddEnchantment: boolean;\r\n };\r\n gamemode_config: {\r\n /**\r\n * @default true\r\n */\r\n setToSurvival: boolean;\r\n /**\r\n * @default true\r\n */\r\n clearPlayer: boolean;\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n banPlayer: boolean;\r\n };\r\n nuker_data: {\r\n /**\r\n * @default 0\r\n */\r\n violationCount: number;\r\n /**\r\n * @default false\r\n */\r\n banPlayer: boolean;\r\n };\r\n /**\r\n * {@link BANNED_ITEMS}\r\n */\r\n banned_items: string[];\r\n /**\r\n * {@link BANNED_BLOCKS}\r\n */\r\n banned_blocks: string[];\r\n /**\r\n * {@link ENCHANTMENTS}\r\n */\r\n enchantments: {\r\n [Property in keyof typeof ENCHANTMENTS]: number;\r\n };\r\n /**\r\n * {@link APPEAL_LINK}\r\n */\r\n appealLink: string;\r\n};\r\n\r\nexport interface LogData {\r\n /**\r\n * An optional playerName who is associated with this log\r\n * @example \"Smell of curry\"\r\n */\r\n playerName?: string;\r\n /**\r\n * The message for this log\r\n * @example \"Smell of curry is bad\"\r\n */\r\n message: string;\r\n /**\r\n * An optional property to list what protection this was from\r\n */\r\n protection?: string;\r\n}\r\n\r\nexport type EventsReturnType = (\r\n arg: Parameters[0]>[0]\r\n) => void;\r\n\r\nexport type IProtectionsConfig = {\r\n [key: string]: boolean | string | number;\r\n /**\r\n * If this protection is enabled\r\n */\r\n enabled: boolean\r\n};\r\n", "import { ROLES } from \"../../../../types\";\nimport { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\nimport {\n getRole,\n getServerOwner,\n isServerOwner,\n setRole,\n setServerOwner,\n} from \"../../utils.js\";\nimport { TABLES } from \"../../../../lib/Database/tables\";\nimport { confirmAction } from \"../../../../utils\";\n\n// Helper\nconst StringIsNumber = (value: any) => isNaN(Number(value)) === false;\n\n// Turn enum into array\nfunction ToArray(enumme: any) {\n return (\n Object.keys(enumme)\n // @ts-ignore\n .filter(StringIsNumber)\n .map((key) => enumme[key])\n );\n}\n\nconst root = new Command({\n name: \"role\",\n description: \"Changes the role for a player\",\n requires: (player) => getRole(player) == \"admin\" || isServerOwner(player),\n});\n\nroot\n .literal({\n name: \"set\",\n description: \"Sets the role for a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .argument(new ArgumentTypes.array(\"role\", ToArray(ROLES) as string[]))\n .executes((ctx, playerName, role) => {\n setRole(playerName, role as keyof typeof ROLES);\n ctx.reply(`Changed role of ${playerName} to ${role}`);\n });\n\nroot\n .literal({\n name: \"get\",\n description: \"Gets the role of a player\",\n })\n .argument(new ArgumentTypes.playerName(\"playerName\"))\n .executes((ctx, playerName) => {\n const role = getRole(playerName);\n ctx.reply(`${playerName} has role: ${role}`);\n });\n\nconst ownerRoot = root.literal({\n name: \"owner\",\n description: \"Manages the owner\",\n});\n\nownerRoot\n .literal({\n name: \"get\",\n description: \"Gets the owner of the world\",\n })\n .executes((ctx) => {\n const ownerId = getServerOwner();\n const ids = TABLES.ids.collection();\n const ownerName = Object.keys(ids).find((key) => ids[key] === ownerId);\n ctx.reply(`\u00A7aServer Owner: ${ownerName} (id: ${ownerId})`);\n });\n\nownerRoot\n .literal({\n name: \"transfer\",\n description: \"Transfers the owner of the world\",\n requires: (player) => isServerOwner(player),\n })\n .argument(new ArgumentTypes.player())\n .executes((ctx, player) => {\n confirmAction(\n ctx.sender,\n `Are you sure you want to transfer the server ownership to ${player.name}, this action is not reversible!`,\n () => {\n setServerOwner(player);\n ctx.reply(\n `\u00A7aSet the server Owner to: ${player.name} (id: ${player.id})`\n );\n }\n );\n ctx.reply(`\u00A7aClose chat to confirm`);\n });\n\nownerRoot\n .literal({\n name: \"clear\",\n description: \"clear's the owner of the world\",\n requires: (player) => isServerOwner(player),\n })\n .executes((ctx) => {\n confirmAction(\n ctx.sender,\n \"Are you sure you want to clear the server owner, this action is not reversible!\",\n () => {\n setServerOwner(null);\n ctx.reply(\n `\u00A7aCleared the server owner! run \"/reload\" or reload world to run \"/function start\" again!`\n );\n }\n );\n ctx.reply(`\u00A7aClose chat to confirm`);\n });\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionFormData } from \"@minecraft/server-ui\";\r\nimport { TIMEOUT_THRESHOLD } from \"../../../config/form\";\r\nimport type { ButtonCallback, IActionFormButton } from \"../types\";\r\n\r\nexport class ActionForm {\r\n /**\r\n * the title that this form should have\r\n */\r\n title?: string;\r\n /**\r\n * extra text that should be displayed in the form\r\n */\r\n body?: string;\r\n /**\r\n * The buttons this form has\r\n */\r\n private buttons: IActionFormButton[];\r\n\r\n /**\r\n * The default minecraft form this form is based on\r\n */\r\n private form: ActionFormData;\r\n\r\n /**\r\n * The amount of times it takes to show this form in ms\r\n * if this value goes above 200 it will time out\r\n */\r\n private triedToShow: number;\r\n\r\n /**\r\n * Creates a new form to be shown to a player\r\n * @param title the title that this form should have\r\n * @param body extra text that should be displayed in the form\r\n */\r\n constructor(title?: string, body?: string) {\r\n this.title = title;\r\n this.body = body;\r\n this.form = new ActionFormData();\r\n\r\n if (title) this.form.title(title);\r\n if (body) this.form.body(body);\r\n\r\n this.buttons = [];\r\n\r\n this.triedToShow = 0;\r\n }\r\n\r\n /**\r\n * Adds a button to this form\r\n * @param text text to show on this button\r\n * @param iconPath the path this button shows\r\n * @param callback what happens when this button is clicked\r\n * @example ```\r\n * addButton(\"settings\", \"textures/items/sum\")\r\n * ```\r\n */\r\n addButton(\r\n text: string,\r\n iconPath: string = null,\r\n callback: ButtonCallback\r\n ): ActionForm {\r\n this.buttons.push({\r\n text: text,\r\n iconPath: iconPath,\r\n callback: callback,\r\n });\r\n this.form.button(text, iconPath);\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows this form to the player\r\n * @param player player to show to\r\n */\r\n show(player: Player): void {\r\n this.form.show(player).then((response) => {\r\n if (response.canceled) {\r\n if (response.cancelationReason == \"userBusy\") {\r\n // check time and reshow form\r\n if (this.triedToShow > TIMEOUT_THRESHOLD)\r\n return player.tell(\r\n `\u00A7cForm Timeout: tried to show form, but you were busy (close chat after running command)`\r\n );\r\n this.triedToShow++;\r\n this.show(player);\r\n }\r\n return;\r\n }\r\n this.buttons[response.selection].callback?.();\r\n });\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ModalFormData } from \"@minecraft/server-ui\";\r\nimport { TIMEOUT_THRESHOLD } from \"../../../config/form\";\r\nimport type { AppendFormField, IModalFormArg, Range } from \"../types\";\r\nimport { FormCallback } from \"./FormCallback\";\r\n\r\nexport class ModalForm void> {\r\n /**\r\n * the title that this form should have\r\n */\r\n title?: string;\r\n\r\n /**\r\n * The default minecraft form this form is based on\r\n */\r\n private form: ModalFormData;\r\n\r\n /**\r\n * The arguments this form has\r\n */\r\n private args: IModalFormArg[];\r\n\r\n /**\r\n * The amount of times it takes to show this form in ms\r\n * if this value goes above 200 it will time out\r\n */\r\n private triedToShow: number;\r\n\r\n /**\r\n * Creates a new form to be shown to a player\r\n * @param title the title that this form should have\r\n */\r\n constructor(title?: string) {\r\n this.title = title;\r\n this.form = new ModalFormData();\r\n\r\n if (title) this.form.title(title);\r\n\r\n this.args = [];\r\n\r\n this.triedToShow = 0;\r\n }\r\n\r\n /**\r\n * Adds a dropdown to this form\r\n * @param label label to show on dropdown\r\n * @param options the available options for this dropdown\r\n * @param defaultValueIndex the default value index\r\n * @returns this\r\n */\r\n addDropdown>(\r\n label: string,\r\n options: T,\r\n defaultValueIndex?: number\r\n ): ModalForm> {\r\n // @ts-ignore\r\n this.args.push({ type: \"dropdown\", options: options });\r\n // @ts-ignore\r\n this.form.dropdown(label, options, defaultValueIndex);\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a slider to this form\r\n * @param label label to be shown on this slider\r\n * @param minimumValue the smallest value this can be\r\n * @param maximumValue the maximum value this can be\r\n * @param valueStep how this slider increments\r\n * @param defaultValue the default value in slider\r\n * @returns this\r\n */\r\n addSlider(\r\n label: string,\r\n minimumValue: T,\r\n maximumValue: U,\r\n valueStep: number,\r\n defaultValue?: number\r\n ): ModalForm>> {\r\n this.args.push({ type: \"slider\" });\r\n this.form.slider(\r\n label,\r\n minimumValue,\r\n maximumValue,\r\n valueStep,\r\n defaultValue\r\n );\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a toggle to this form\r\n * @param label the name of this toggle\r\n * @param defaultValue the default toggle value could be true or false\r\n * @returns\r\n */\r\n addToggle(\r\n label: string,\r\n defaultValue?: boolean\r\n ): ModalForm> {\r\n this.args.push({ type: \"toggle\" });\r\n this.form.toggle(label, defaultValue);\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds a text field to this form\r\n * @param label label for this textField\r\n * @param placeholderText the text that shows on this field\r\n * @param defaultValue the default value that this field has\r\n */\r\n addTextField(\r\n label: string,\r\n placeholderText: string,\r\n defaultValue?: string\r\n ): ModalForm> {\r\n this.args.push({ type: \"textField\" });\r\n this.form.textField(label, placeholderText, defaultValue);\r\n // @ts-ignore\r\n return this;\r\n }\r\n\r\n /**\r\n * Shows this form to a player\r\n * @param player player to show to\r\n * @param callback sends a callback when this form is submitted\r\n */\r\n show(player: Player, callback: Callback): void {\r\n this.form.show(player).then((response) => { \r\n if (response.canceled) {\r\n if (response.cancelationReason == \"userBusy\") {\r\n // check time and reshow form\r\n if (this.triedToShow > TIMEOUT_THRESHOLD)\r\n return player.tell(\r\n `\u00A7cForm Timeout: tried to show form, but you were busy (close chat after running command)`\r\n );\r\n this.triedToShow++;\r\n this.show(player, callback);\r\n }\r\n return;\r\n }\r\n callback(\r\n new FormCallback(this, player, callback),\r\n ...response.formValues.map((v, i) =>\r\n this.args[i].type == \"dropdown\" ? this.args[i].options[v] : v\r\n )\r\n );\r\n });\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionForm } from \"./ActionForm\";\r\nimport { MessageForm } from \"./MessageForm\";\r\nimport { ModalForm } from \"./ModelForm\";\r\n\r\nexport class FormCallback {\r\n /**\r\n * form that was used in this call\r\n */\r\n private form: ActionForm | MessageForm | ModalForm;\r\n /**\r\n * player that this form used\r\n */\r\n private player: Player;\r\n\r\n /**\r\n * the function that was called\r\n */\r\n private callback: () => void;\r\n\r\n /**\r\n * Creates a new form callback instance that can be used by\r\n * buttons, and args to run various functions\r\n * @param form form that is used in this call\r\n */\r\n constructor(\r\n form: ActionForm | MessageForm | ModalForm,\r\n player: Player,\r\n callback: any\r\n ) {\r\n this.form = form;\r\n this.player = player;\r\n this.callback = callback;\r\n }\r\n\r\n /**\r\n * Reshow the form and shows the user a error message\r\n * @param message error message to show\r\n */\r\n error(message: string) {\r\n new MessageForm(\"Error\", message)\r\n .setButton1(\"Return to form\", () => {\r\n this.form.show(this.player, this.callback);\r\n })\r\n .setButton2(\"Cancel\", null)\r\n .show(this.player);\r\n }\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { APPEAL_LINK } from \"../../../../config/app\";\r\nimport { ENCHANTMENTS } from \"../../config/enchantments\";\r\nimport { ActionForm } from \"../../../../lib/Form/Models/ActionForm\";\r\nimport { ModalForm } from \"../../../../lib/Form/Models/ModelForm\";\r\nimport { getConfigId, setConfigId } from \"../../utils\";\r\n\r\nexport function manageBannedItemsForm(player: Player) {\r\n new ActionForm(\"Manage Banned Items\")\r\n .addButton(\"Remove a Banned Item\", null, () => {\r\n removeBannedItemForm(player);\r\n })\r\n .addButton(\"Ban an item\", null, () => {\r\n addBannedItemForm(player);\r\n })\r\n .show(player);\r\n}\r\nexport function removeBannedItemForm(player: Player) {\r\n new ModalForm(\"Remove Banned Items\")\r\n .addDropdown(\"Select item to remove\", getConfigId(\"banned_items\"))\r\n .show(player, (ctx, item) => {\r\n let items = getConfigId(\"banned_items\");\r\n items = items.filter((p) => p != item);\r\n setConfigId(\"banned_items\", items);\r\n player.tell(`Removed Banned item \"${item}\"`);\r\n });\r\n}\r\n\r\nexport function addBannedItemForm(player: Player) {\r\n new ModalForm(\"Add Banned Item\")\r\n .addTextField(\"Item Id\", \"minecraft:string\")\r\n .show(player, (ctx, item) => {\r\n let items = getConfigId(\"banned_items\");\r\n if (items.includes(item))\r\n return ctx.error(`\u00A7cItem \"${item}\" is already banned`);\r\n items.push(item);\r\n setConfigId(\"banned_items\", items);\r\n player.tell(`Banned the item \"${item}\"`);\r\n });\r\n}\r\n\r\nexport function manageBannedBlocksForm(player: Player) {\r\n new ActionForm(\"Manage Banned Blocks\")\r\n .addButton(\"Remove a Banned Block\", null, () => {\r\n removeBannedBlockForm(player);\r\n })\r\n .addButton(\"Ban an block\", null, () => {\r\n addBannedBlockForm(player);\r\n })\r\n .show(player);\r\n}\r\n\r\nexport function removeBannedBlockForm(player: Player) {\r\n new ModalForm(\"Remove Banned Block\")\r\n .addDropdown(\"Select block to remove\", getConfigId(\"banned_blocks\"))\r\n .show(player, (ctx, block) => {\r\n let blocks = getConfigId(\"banned_blocks\");\r\n blocks = blocks.filter((p) => p != block);\r\n setConfigId(\"banned_blocks\", blocks);\r\n player.tell(`Removed Banned block \"${block}\"`);\r\n });\r\n}\r\n\r\nexport function addBannedBlockForm(player: Player) {\r\n new ModalForm(\"Add Banned Block\")\r\n .addTextField(\"Block Id\", \"minecraft:barrier\")\r\n .show(player, (ctx, block) => {\r\n let blocks = getConfigId(\"banned_blocks\");\r\n if (blocks.includes(block))\r\n return ctx.error(`\u00A7cBlock \"${block}\" is already banned`);\r\n blocks.push(block);\r\n setConfigId(\"banned_blocks\", blocks);\r\n player.tell(`Banned the block \"${block}\"`);\r\n });\r\n}\r\n\r\nexport function manageEnchantmentLevelsForm(player: Player) {\r\n new ModalForm(\"Manage Enchantment Levels\")\r\n .addDropdown(\"Enchantment to change\", Object.keys(ENCHANTMENTS), 0)\r\n .addTextField(\"Level (number)\", \"5\")\r\n .show(player, (ctx, enchantment, levelString) => {\r\n if (isNaN(levelString as any))\r\n return ctx.error(\r\n `\u00A7c\"${levelString}\" is not a number, please enter a value like, \"3\", \"9\", etc.`\r\n );\r\n const level = parseInt(levelString);\r\n let enchants = getConfigId(\"enchantments\");\r\n enchants[enchantment as keyof typeof ENCHANTMENTS] = level;\r\n setConfigId(\"enchantments\", enchants);\r\n player.tell(`Set max level for ${enchantment} to ${level}`);\r\n });\r\n}\r\n\r\nexport function manageAppealLinkForm(player: Player) {\r\n new ModalForm(\"Manage Appeal Link\")\r\n .addTextField(\"Appeal Link\", APPEAL_LINK)\r\n .show(player, (ctx, link) => {\r\n setConfigId(\"appealLink\", link);\r\n player.tell(`Changed the servers appeal link to ${link}`);\r\n });\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionForm } from \"../../../../lib/Form/Models/ActionForm\";\r\nimport { ModalForm } from \"../../../../lib/Form/Models/ModelForm\";\r\nimport { IProtectionsConfig } from \"../../../../types\";\r\nimport { PROTECTIONS } from \"../../protections\";\r\nimport { Protection } from \"../models/Protection\";\r\nimport { showHomeForm } from \"./home\";\r\n\r\nexport function showAutoModHomeForm(player: Player) {\r\n const form = new ActionForm(\"Manage Protections\");\r\n\r\n for (const protection of Object.values(PROTECTIONS)) {\r\n form.addButton(protection.name, protection.iconPath, () => {\r\n showProtectionConfig(protection, player);\r\n });\r\n }\r\n form\r\n .addButton(\"Back\", \"textures/ui/arrow_dark_left_stretch.png\", () => {\r\n showHomeForm(player);\r\n })\r\n .show(player);\r\n}\r\n\r\nexport function showProtectionConfig(protection: Protection, player: Player) {\r\n const data = protection.getConfig();\r\n const form = new ModalForm(\r\n `Manage ${protection.name} Protection Config`\r\n ).addToggle(\"Enabled\", data[\"enabled\"]);\r\n let keys: string[] = [];\r\n for (const [key, value] of Object.entries(protection.configDefault)) {\r\n keys.push(key);\r\n if (typeof value.defaultValue == \"boolean\") {\r\n form.addToggle(value.description, data[key] as boolean);\r\n } else if (typeof value.defaultValue == \"number\") {\r\n form.addSlider(value.description, 0, 100, 1, data[key] as number);\r\n } else {\r\n form.addTextField(value.description, null, data[key] as string);\r\n }\r\n }\r\n form.show(player, (ctx, enabled, ...keys) => {\r\n if (enabled != data[\"enabled\"]) {\r\n if (enabled) protection.enable();\r\n if (!enabled) protection.disable();\r\n }\r\n let config: IProtectionsConfig = {\r\n enabled: enabled,\r\n };\r\n for (const [i, key] of Object.keys(protection.configDefault).entries()) {\r\n config[key] = keys[i];\r\n }\r\n protection.setConfig(config);\r\n player.tell(`Updated config for ${protection.name}!`);\r\n });\r\n}\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { ActionForm } from \"../../../../lib/Form/Models/ActionForm\";\r\nimport * as settings from \"./settings\";\r\nimport * as automod from \"./automod\";\r\n\r\nexport function showHomeForm(player: Player) {\r\n new ActionForm(\"Rubedo Settings\")\r\n .addButton(\"Auto Mod\", \"textures/ui/permissions_op_crown.png\", () => {\r\n automod.showAutoModHomeForm(player);\r\n })\r\n .addButton(\"Banned items\", \"textures/blocks/sculk_shrieker_top.png\", () => {\r\n settings.manageBannedItemsForm(player);\r\n })\r\n .addButton(\"Banned blocks\", \"textures/blocks/barrier.png\", () => {\r\n settings.manageBannedBlocksForm(player);\r\n })\r\n .addButton(\"Enchantments\", \"textures/items/book_enchanted.png\", () => {\r\n settings.manageEnchantmentLevelsForm(player);\r\n })\r\n .addButton(\"Appeal Link\", \"textures/ui/Feedback.png\", () => {\r\n settings.manageAppealLinkForm(player);\r\n })\r\n .show(player);\r\n}\r\n", "import { Command } from \"../../../../lib/Command/Command.js\";\r\nimport { getRole } from \"../../utils.js\";\r\nimport { showHomeForm } from \"../forms/home.js\";\r\n\r\nnew Command({\r\n name: \"settings\",\r\n description: \"Opens up the settings menu for the player\",\r\n requires: (player) => [\"admin\", \"moderator\"].includes(getRole(player)),\r\n}).executes((ctx) => {\r\n showHomeForm(ctx.sender);\r\n ctx.sender.tell(`\u00A7aForm request sent, close chat to continue!`);\r\n});\r\n", "import { Player, world } from \"@minecraft/server\";\nimport { Command } from \"../../../../lib/Command/Command.js\";\nimport { getRole } from \"../../utils.js\";\n\nfunction vanish(player: Player, say: boolean) {\n if (player.hasTag(`spectator`)) {\n player.runCommandAsync(`gamemode c`);\n player.triggerEvent(`removeSpectator`);\n player.removeTag(`spectator`);\n if (!say) return;\n world.say({\n rawtext: [\n {\n translate: \"multiplayer.player.joined\",\n with: [`\u00A7e${player.name}`],\n },\n ],\n });\n } else {\n player.runCommandAsync(`gamemode spectator`);\n player.triggerEvent(`addSpectator`);\n player.addTag(`spectator`);\n if (!say) return;\n world.say({\n rawtext: [\n {\n translate: \"multiplayer.player.left\",\n with: [`\u00A7e${player.name}`],\n },\n ],\n });\n }\n}\n\nnew Command({\n name: \"vanish\",\n description: \"Toggles Vanish Mode on the sender\",\n requires: (player) => getRole(player) == \"admin\",\n})\n .executes((ctx) => {\n vanish(ctx.sender, false);\n })\n .boolean(\"say\")\n .executes((ctx, say) => {\n vanish(ctx.sender, say);\n });\n", "import { Command } from \"../../../../lib/Command/Command.js\";\nimport { VERSION } from \"../../../../config/app\";\n\nnew Command({\n name: \"version\",\n description: \"Get Current Version\",\n aliases: [\"v\"],\n}).executes((ctx) => {\n ctx.reply(`Current Rubedo Version: ${VERSION}`);\n});\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\r\nimport { getRole, kick } from \"../../utils\";\r\n\r\nnew Command({\r\n name: \"kick\",\r\n description: \"Kicks a player from the game\",\r\n requires: (player) => getRole(player) == \"admin\",\r\n})\r\n .argument(new ArgumentTypes.player())\r\n .string(\"reason\")\r\n .executes((ctx, player, reason) => {\r\n kick(player, [reason]);\r\n ctx.reply(`\u00A7aKicked ${player.name} from world`);\r\n });\r\n", "import { TABLES } from \"../../../../lib/Database/tables\";\r\nimport type { LogData } from \"../../../../types\";\r\n\r\nexport class Log {\r\n /**\r\n * The data on this Log\r\n */\r\n data: LogData;\r\n constructor(data: LogData) {\r\n this.data = data;\r\n console.warn(`[LOG]: ${data.message}`);\r\n TABLES.logs.set(Date.now().toString(), data);\r\n }\r\n}\r\n", "import { PREFIX } from \"../../../../config/commands\";\r\nimport { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\r\nimport { TABLES } from \"../../../../lib/Database/tables\";\r\nimport { getRole } from \"../../utils\";\r\nimport { Log } from \"../models/Log\";\r\n\r\nfunction timeDifference(previous: number) {\r\n var msPerMinute = 60 * 1000;\r\n var msPerHour = msPerMinute * 60;\r\n var msPerDay = msPerHour * 24;\r\n var msPerMonth = msPerDay * 30;\r\n var msPerYear = msPerDay * 365;\r\n\r\n var elapsed = Date.now() - previous;\r\n\r\n if (elapsed < msPerMinute) {\r\n return Math.round(elapsed / 1000) + \" seconds ago\";\r\n } else if (elapsed < msPerHour) {\r\n return Math.round(elapsed / msPerMinute) + \" minutes ago\";\r\n } else if (elapsed < msPerDay) {\r\n return Math.round(elapsed / msPerHour) + \" hours ago\";\r\n } else if (elapsed < msPerMonth) {\r\n return \"approximately \" + Math.round(elapsed / msPerDay) + \" days ago\";\r\n } else if (elapsed < msPerYear) {\r\n return \"approximately \" + Math.round(elapsed / msPerMonth) + \" months ago\";\r\n } else {\r\n return \"approximately \" + Math.round(elapsed / msPerYear) + \" years ago\";\r\n }\r\n}\r\n\r\nconst root = new Command({\r\n name: \"log\",\r\n description: \"Manages the log command\",\r\n requires: (player) => getRole(player) == \"admin\",\r\n});\r\n\r\nroot\r\n .literal({\r\n name: \"add\",\r\n description: \"Adds a new log\",\r\n })\r\n .string(\"message\")\r\n .executes((ctx, message) => {\r\n new Log({ message: message });\r\n ctx.reply(`\u00A7aAdded new log: ${message}`);\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"getAll\",\r\n description: \"Gets all logs sorted in descending\",\r\n })\r\n .int(\"page\")\r\n .array(\"order\", [\"ascending\", \"descending\"] as const)\r\n .executes((ctx, page, order) => {\r\n const allLogs = Object.entries(TABLES.logs.collection()).sort((a, b) =>\r\n order == \"ascending\"\r\n ? parseInt(b[0]) - parseInt(a[0])\r\n : parseInt(a[0]) - parseInt(b[0])\r\n );\r\n if (allLogs.length == 0) return ctx.reply(`\u00A7cNo Logs have been made!`);\r\n const maxPages = Math.ceil(allLogs.length / 8);\r\n if (page > maxPages) page = maxPages;\r\n ctx.reply(\r\n `\u00A72--- Showing logs page ${page} of ${maxPages} (${PREFIX}log getAll ) ---`\r\n );\r\n\r\n for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) {\r\n ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`);\r\n }\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"getPlayersLogs\",\r\n description: \"Gets all logs associated with a player\",\r\n })\r\n .argument(new ArgumentTypes.playerName())\r\n .int(\"page\")\r\n .array(\"order\", [\"ascending\", \"descending\"] as const)\r\n .executes((ctx, playerName, page, order) => {\r\n const allLogs = Object.entries(TABLES.logs.collection())\r\n .filter((v) => v[1].playerName == playerName)\r\n .sort((a, b) =>\r\n order == \"ascending\"\r\n ? parseInt(b[0]) - parseInt(a[0])\r\n : parseInt(a[0]) - parseInt(b[0])\r\n );\r\n if (allLogs.length == 0)\r\n return ctx.reply(`\u00A7cNo Logs exists for \"${playerName}\"!`);\r\n const maxPages = Math.ceil(allLogs.length / 8);\r\n if (page > maxPages) page = maxPages;\r\n ctx.reply(\r\n `\u00A72--- Showing logs for \"${playerName}\" page ${page} of ${maxPages} ---`\r\n );\r\n\r\n for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) {\r\n ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`);\r\n }\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"getProtectionLogs\",\r\n description: \"Gets all logs associated with a protection\",\r\n })\r\n .string(\"protection\")\r\n .int(\"page\")\r\n .array(\"order\", [\"ascending\", \"descending\"] as const)\r\n .executes((ctx, protection, page, order) => {\r\n const allLogs = Object.entries(TABLES.logs.collection())\r\n .filter((v) => v[1].protection == protection)\r\n .sort((a, b) =>\r\n order == \"ascending\"\r\n ? parseInt(b[0]) - parseInt(a[0])\r\n : parseInt(a[0]) - parseInt(b[0])\r\n );\r\n if (allLogs.length == 0)\r\n return ctx.reply(`\u00A7cNo Logs exists for protection: \"${protection}\"!`);\r\n const maxPages = Math.ceil(allLogs.length / 8);\r\n if (page > maxPages) page = maxPages;\r\n ctx.reply(\r\n `\u00A72--- Showing logs for Protection: \"${protection}\" page ${page} of ${maxPages} ---`\r\n );\r\n\r\n for (const [key, value] of allLogs.slice(page * 8 - 8, page * 8)) {\r\n ctx.reply(`${timeDifference(parseInt(key))}: ${value.message}`);\r\n }\r\n });\r\n\r\nroot\r\n .literal({\r\n name: \"clearAll\",\r\n description: \"Clears all logs\",\r\n })\r\n .executes((ctx) => {\r\n TABLES.logs.clear();\r\n ctx.reply(`\u00A7aCleared All logs!`);\r\n });\r\n", "import { ArgumentTypes, Command } from \"../../../../lib/Command/Command\";\r\nimport { getRole } from \"../../utils\";\r\n\r\nconst root = new Command({\r\n name: \"teleport\",\r\n description: \"Teleports entities (players, mobs, etc.).\",\r\n aliases: [\"tp\"],\r\n requires: (player) => getRole(player) == \"admin\",\r\n});\r\n\r\nroot\r\n .argument(new ArgumentTypes.player())\r\n .location(\"destination\")\r\n .executes((ctx, player, destination) => {\r\n player.addTag(\"skip-movement-check\");\r\n player.teleport(destination, player.dimension, 0, 0);\r\n ctx.reply(\r\n `Teleported ${player.name} to ${destination.x} ${destination.y} ${destination.z}`\r\n );\r\n });\r\n", "import { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { msToTime } from \"../../../../utils.js\";\nimport { kick, forEachValidPlayer, getConfigId } from \"../../utils.js\";\n\nforEachValidPlayer((player) => {\n try {\n const banData = TABLES.bans.get(player.id);\n if (!banData) return;\n if (banData.expire && banData.expire < Date.now())\n return TABLES.bans.delete(player.id);\n kick(\n player,\n [\n `\u00A7cYou have been banned!`,\n `\u00A7aReason: \u00A7f${banData.reason}`,\n `\u00A7fExpiry: \u00A7b${\n banData.expire ? msToTime(banData.expire - Date.now()) : \"Forever\"\n }`,\n `\u00A7fAppeal at: \u00A7b${getConfigId(\"appealLink\")}`,\n ],\n () => {\n console.warn(new Error(\"Failed to kick player\"));\n TABLES.bans.delete(player.id);\n }\n );\n } catch (error) {\n console.warn(error + error.stack);\n }\n}, 20);\n", "import { Location } from \"@minecraft/server\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { DIMENSIONS } from \"../../../../utils.js\";\nimport { forEachValidPlayer } from \"../../utils.js\";\n\nforEachValidPlayer((player) => {\n try {\n const freezeData = TABLES.freezes.get(player.id);\n\n if (!freezeData)\n return player.getComponent(\"movement\").resetToDefaultValue();\n player.getComponent(\"movement\").setCurrent(0);\n\n player.teleport(\n new Location(\n freezeData.location.x,\n freezeData.location.y,\n freezeData.location.z\n ),\n DIMENSIONS[freezeData.location.dimension as keyof typeof DIMENSIONS],\n 0,\n 0\n );\n } catch (error) {}\n}, 200);\n", "import { world, BeforeChatEvent } from \"@minecraft/server\";\r\nimport { PREFIX } from \"../../config/commands\";\r\n\r\ntype beforeChatCallback = (arg: BeforeChatEvent) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: beforeChatCallback;\r\n };\r\n} = {};\r\n\r\nworld.events.beforeChat.subscribe((data) => {\r\n if (data.message.startsWith(PREFIX)) return; // This is a command\r\n for (const callback of Object.values(CALLBACKS)) {\r\n callback.callback(data);\r\n }\r\n});\r\n\r\nexport class beforeChat {\r\n /**\r\n * Subscribes to a callback to get notified when a chat is sent that is not a command\r\n * @param callback what to be called when one of these entity's inventory changes\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(callback: beforeChatCallback): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n}\r\n", "import { Mute } from \"../models/Mute.js\";\nimport { text } from \"../../../../lang/text.js\";\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\nimport { beforeChat } from \"../../../../lib/Events/beforeChat.js\";\n\nbeforeChat.subscribe((data) => {\n const muteData = Mute.getMuteData(data.sender);\n if (!muteData) return;\n if (muteData.expire && muteData.expire < Date.now())\n return TABLES.mutes.delete(data.sender.name);\n data.cancel = true;\n data.sender.tell(text[\"modules.managers.mute.isMuted\"]());\n});\n", "import { BlockLocation, Player, system, world } from \"@minecraft/server\";\nimport { Region } from \"../models/Region.js\";\nimport { forEachValidPlayer, getRole, loadRegionDenys } from \"../../utils.js\";\nimport { BLOCK_CONTAINERS, DOORS_SWITCHES } from \"../../config/region.js\";\nimport { DIMENSIONS } from \"../../../../utils.js\";\n\n/**\n * Sets Deny blocks at bottom of region every 5 mins\n */\nsystem.runSchedule(() => {\n loadRegionDenys();\n}, 6000);\n\n/**\n * Permissions for region\n */\nworld.events.beforeItemUseOn.subscribe((data) => {\n if ([\"moderator\", \"admin\"].includes(getRole(data.source as Player))) return;\n const region = Region.blockLocationInRegion(\n data.blockLocation,\n data.source.dimension.id\n );\n if (!region) return;\n const block = data.source.dimension.getBlock(data.blockLocation);\n if (\n DOORS_SWITCHES.includes(block.typeId) &&\n region.permissions.doorsAndSwitches\n )\n return;\n if (\n BLOCK_CONTAINERS.includes(block.typeId) &&\n region.permissions.openContainers\n )\n return;\n data.cancel = true;\n});\n\nworld.events.beforeExplosion.subscribe((data) => {\n for (let i = 0; i < data.impactedBlocks.length; i++) {\n const bL = data.impactedBlocks[i];\n let region = Region.blockLocationInRegion(bL, data.dimension.id);\n if (region) return (data.cancel = true);\n }\n});\n\nworld.events.entityCreate.subscribe(async ({ entity }) => {\n const region = await Region.blockLocationInRegionSync(\n new BlockLocation(entity.location.x, entity.location.y, entity.location.z),\n entity.dimension.id\n );\n if (!region) return;\n if (region.permissions.allowedEntities.includes(entity.typeId)) return;\n entity.teleport({ x: 0, y: -64, z: 0 }, entity.dimension, 0, 0);\n entity.kill();\n});\n\nsystem.runSchedule(async () => {\n for (const region of await Region.getAllRegionsSync()) {\n for (const entity of DIMENSIONS[\n region.dimensionId as keyof typeof DIMENSIONS\n ].getEntities({ excludeTypes: region.permissions.allowedEntities })) {\n if (!region.entityInRegion(entity)) continue;\n entity.teleport({ x: 0, y: -64, z: 0 }, entity.dimension, 0, 0);\n entity.kill();\n }\n }\n}, 100);\n\n/**\n * Gives player a tag if they are in a region\n */\nforEachValidPlayer(async (player) => {\n for (const region of await Region.getAllRegionsSync()) {\n if (region.entityInRegion(player)) {\n player.addTag(`inRegion`);\n if (!region.permissions.pvp) player.addTag(`region-protected`);\n } else {\n player.removeTag(`inRegion`);\n player.removeTag(`region-protected`);\n }\n }\n}, 5);\n", "import { world } from \"@minecraft/server\";\r\nimport { text } from \"../../../../lang/text\";\r\nimport { TABLES } from \"../../../../lib/Database/tables\";\r\nimport { awaitWorldLoad } from \"../../../../utils.js\";\r\nimport { getRoleSync, isLockedDown, kick, setRole } from \"../../utils\";\r\nimport { Mute } from \"../models/Mute\";\r\nimport { ChangePlayerRoleTask } from \"../models/Task\";\r\n\r\nworld.events.playerJoin.subscribe(async ({ player }) => {\r\n await awaitWorldLoad();\r\n if (isLockedDown() && (await getRoleSync(player)) != \"admin\")\r\n return kick(player, text[\"lockdown.kick.message\"]());\r\n // --\r\n if (Mute.getMuteData(player)) player.runCommandAsync(`ability @s mute true`);\r\n if (!TABLES.ids.has(player.name)) {\r\n // Player is new!\r\n TABLES.ids.set(player.name, player.id);\r\n } else {\r\n player.addTag(\"old\");\r\n }\r\n /**\r\n * This is a role that was tried to push when the player was offline\r\n * so were setting it now because the player just joined\r\n */\r\n const roleToSet = ChangePlayerRoleTask.getPlayersRoleToSet(player.name);\r\n if (roleToSet) setRole(player, roleToSet);\r\n});\r\n", "import {\n Entity,\n InventoryComponentContainer,\n Items,\n MinecraftItemTypes,\n world,\n} from \"@minecraft/server\";\nimport { AIR } from \"../../../../index.js\";\nimport { PageItem } from \"../../../../lib/Chest GUI/Models/PageItem\";\nimport { Page } from \"../../../../lib/Chest GUI/Models/Page\";\nimport { CHESTGUIS } from \"../../../../lib/Chest GUI/utils.js\";\nimport { ItemType } from \"@minecraft/server\";\n\n/**\n * The possible fillable slots where items can be put\n * this is for inventory fill\n */\nconst FILLABLE_SLOTS = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\n 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,\n 41, 42, 43, 44,\n];\n\n/**\n * The possible fillable slots where items can be put\n * this is for inventory fill\n */\nconst FILLABLE_SLOTS_ENDERCHEST = [\n 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32,\n 33, 34, 37, 38, 39, 40, 41, 42, 43,\n];\n\n/**\n * Fills the chest Screen with the desired kit\n */\nexport function ViewPlayersFill(entity: Entity, page: Page, extras: any) {\n const container: InventoryComponentContainer = entity.getComponent(\n \"minecraft:inventory\"\n ).container;\n\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n for (const [i, player] of [...world.getPlayers()].entries()) {\n const slot = FILLABLE_SLOTS[i];\n const item = new PageItem(MinecraftItemTypes.skull, {\n nameTag: player.name,\n data: 3,\n });\n container.setItem(slot, item.itemStack);\n page.slots[slot] = {\n item: item,\n action: (ctx) => {\n ctx.PageAction(\"moderation:see_inventory\", { name: player.name });\n },\n };\n }\n}\n\n/**\n * Fills the chest Screen with the desired kit\n */\nexport function ViewPlayerInventoryFill(\n entity: Entity,\n page: Page,\n extras: any\n) {\n const container = entity.getComponent(\"minecraft:inventory\").container;\n\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n const EnderChestItem = new PageItem(MinecraftItemTypes.enderChest, {\n nameTag: `\u00A7eView \u00A7f${extras?.name}\u00A7e Ender Chest\\n\u00A7fNote: \u00A7cThis will not grab \u00A7lANY NBT!\u00A7r`,\n });\n container.setItem(49, EnderChestItem.itemStack);\n page.slots[49] = {\n item: EnderChestItem,\n action: (ctx) => {\n ctx.PageAction(\"moderation:see_ender_chest\", { name: extras.name });\n },\n };\n const player = [...world.getPlayers()].find((p) => p.name == extras.name);\n if (!player) {\n const gui = Object.values(CHESTGUIS).find((e) => e.entity.id == entity.id);\n gui.despawn();\n player.tell(`\"${extras.name}\" Could not be found, Gui Crashed`);\n }\n const inventory = player.getComponent(\"inventory\").container;\n /**\n * the value of how many slots have been taken\n */\n let used_slots = 0;\n for (let i = 0; i < inventory.size; i++) {\n const item = inventory.getItem(i);\n const slot = FILLABLE_SLOTS[used_slots];\n used_slots++;\n if (!item) {\n container.setItem(slot, AIR);\n continue;\n }\n container.setItem(slot, item);\n page.slots[slot] = {\n item: new PageItem(\n Items.get(item.typeId),\n { amount: item.amount, data: item.data },\n item\n ),\n action: async (ctx) => {\n if (i < 9) {\n await player.runCommandAsync(\n `replaceitem entity @s slot.hotbar ${i} air`\n );\n } else {\n await player.runCommandAsync(\n `replaceitem entity @s slot.inventory ${i - 9} air`\n );\n }\n ctx.GiveAction();\n page.slots[slot] = {\n item: null,\n action: (ctx) => {\n inventory.addItem(ctx.getItemAdded());\n },\n };\n },\n };\n }\n}\n\n/**\n * Fills the chest Screen with the desired kit\n */\nexport async function ViewPlayerEnderChestFill(\n entity: Entity,\n page: Page,\n extras: any\n) {\n const container = entity.getComponent(\"minecraft:inventory\").container;\n for (let i = 0; i < container.size; i++) {\n const slot = page.slots[i];\n if (!slot || !slot.item) {\n container.setItem(i, AIR);\n continue;\n }\n container.setItem(i, slot.item.itemStack);\n }\n const player = [...world.getPlayers()].find((p) => p.name == extras?.name);\n if (!player) {\n const gui = Object.values(CHESTGUIS).find((e) => e.entity.id == entity.id);\n gui.despawn();\n player.tell(`\"${extras.name}\" Could not be found, Gui Crashed`);\n }\n /**\n * the value of how many slots have been taken\n */\n let used_slots = 0;\n const ItemTypes: ItemType[] = Object.values(MinecraftItemTypes);\n for (const item of ItemTypes) {\n try {\n await player.runCommandAsync(\n `testfor @s[hasitem={item=${item.id},location=slot.enderchest}]`\n );\n const ChestGuiItem = new PageItem(item, {\n nameTag: \"Note: \u00A7l\u00A7cThis is not the exact item\",\n });\n const slot = FILLABLE_SLOTS_ENDERCHEST[used_slots];\n container.setItem(slot, ChestGuiItem.itemStack);\n page.slots[slot] = {\n item: ChestGuiItem,\n action: (ctx) => {\n ctx.GiveAction();\n page.slots[slot] = null;\n },\n };\n used_slots++;\n } catch (error) {}\n }\n}\n\nnew Page(\"moderation:see\", ViewPlayersFill)\n .setSlots(\n [50],\n new PageItem(MinecraftItemTypes.arrow, {\n nameTag: \"\u00A7fBack\",\n }),\n (ctx) => {\n ctx.PageAction(\"home\");\n }\n )\n .setSlots(\n [48],\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\n (ctx) => {\n ctx.CloseAction();\n }\n );\n\nnew Page(\"moderation:see_inventory\", ViewPlayerInventoryFill)\n .setSlots(\n [50],\n new PageItem(MinecraftItemTypes.arrow, {\n nameTag: \"\u00A7fBack\",\n }),\n (ctx) => {\n ctx.PageAction(\"moderation:see\");\n }\n )\n .setSlots(\n [48],\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\n (ctx) => {\n ctx.CloseAction();\n }\n );\n\nnew Page(\"moderation:see_ender_chest\", ViewPlayerEnderChestFill)\n .setSlots(\n [50],\n new PageItem(MinecraftItemTypes.arrow, {\n nameTag: \"\u00A7fBack\",\n }),\n (ctx) => {\n ctx.PageAction(\"moderation:see\");\n }\n )\n .setSlots(\n [48],\n new PageItem(MinecraftItemTypes.barrier, { nameTag: \"\u00A7cClose GUI\" }),\n (ctx) => {\n ctx.CloseAction();\n }\n );\n", "import { Player, MinecraftBlockTypes } from \"@minecraft/server\";\nimport { FORBIDDEN_BLOCKS } from \"../../config/moderation\";\nimport { Npc } from \"../models/Npc\";\nimport { getConfigId, getRole } from \"../../utils\";\nimport { Ban } from \"../models/Ban\";\nimport { Protection } from \"../models/Protection\";\n\n/**\n * Entities that are not allowed to spawn because they can be used by CBE\n */\nconst CBE_ENTITIES = [\"minecraft:command_block_minecart\"];\n\nconst protection = new Protection<{\n entityCreate: boolean;\n banSpawnEggs: boolean;\n}>(\"cbe\", \"Stops CBE\", \"textures/blocks/command_block.png\").setConfigDefault({\n entityCreate: {\n description: \"Adds NPC protection\",\n defaultValue: true,\n },\n banSpawnEggs: {\n description: \"If spawn eggs should be banned\",\n defaultValue: true,\n },\n});\n\nprotection.subscribe(\"entityCreate\", async ({ entity }) => {\n const config = await protection.getConfigSync();\n if (!config.entityCreate) return;\n const kill = () => {\n try {\n entity.triggerEvent(\"despawn\");\n entity.kill();\n } catch (error) {\n entity.kill();\n }\n };\n if (CBE_ENTITIES.includes(entity.typeId)) return kill();\n if (entity.typeId == \"minecraft:npc\" && !Npc.isValid(entity)) return kill();\n});\n\nprotection.subscribe(\"beforeItemUseOn\", (data) => {\n if (!(data.source instanceof Player)) return;\n if ([\"admin\", \"moderator\"].includes(getRole(data.source))) return;\n const config = protection.getConfig();\n\n if (data.item.typeId.endsWith(\"spawn_egg\")) {\n if (!config.banSpawnEggs) return;\n const block = data.source.dimension.getBlock(data.blockLocation);\n if (block.typeId == MinecraftBlockTypes.mobSpawner.id) return;\n // Cancel use so players cant use spawnEggs on floor\n data.cancel = true;\n data.source.tell(`\u00A7c[Rubedo]: You cannot place spawnEggs on the floor!`);\n data.source.playSound(`note.bass`);\n } else {\n if (FORBIDDEN_BLOCKS.includes(data.item.typeId)) {\n data.cancel = true;\n return;\n }\n const BANNED_BLOCKS = getConfigId(\"banned_blocks\");\n if (!BANNED_BLOCKS.includes(data.item.typeId)) return;\n data.cancel = true;\n new Ban(data.source, null, \"Placing Banned Blocks\");\n }\n});\n\nprotection.enable();\n", "import { Events, Player, system, world } from \"@minecraft/server\";\r\nimport { TABLES } from \"../../../../lib/Database/tables.js\";\r\nimport { EventsReturnType, IProtectionsConfig } from \"../../../../types.js\";\r\nimport { PROTECTIONS } from \"../../protections.js\";\r\nimport { clearForEachValidPlayer, forEachValidPlayer } from \"../../utils.js\";\r\n\r\n/**\r\n * A protection instance\r\n */\r\nexport class Protection {\r\n /**\r\n * Events that this is subscribed to\r\n */\r\n private events: {\r\n -readonly [Key in keyof Events]+?: {\r\n /**\r\n * Callback this event is to run.\r\n */\r\n callback: ReturnType;\r\n /**\r\n * If this has been triggered on world.events\r\n */\r\n triggered: boolean;\r\n };\r\n };\r\n\r\n /**\r\n * List of events that this protection is scheduled\r\n */\r\n private schedules: {\r\n /**\r\n * Callback to run\r\n */\r\n callback: () => void;\r\n /**\r\n * Delay in ticks\r\n */\r\n tickInterval: number;\r\n /**\r\n * If null, this event hasn't been registered by {@link system.runSchedule}\r\n * if {@link number}, the event has been registered and this key can be used to {@link system.clearRunSchedule}\r\n */\r\n runScheduleId: number | null;\r\n }[];\r\n\r\n /**\r\n * A list of forEachValidPlayers keys used to unsubscribe\r\n */\r\n private forEachValidPlayers: {\r\n /**\r\n * Callback to run\r\n * @param player\r\n * @returns\r\n */\r\n callback: (player: Player) => void;\r\n /**\r\n * Delay in ticks\r\n */\r\n delay: number;\r\n /**\r\n * If null, this event hasn't been registered by {@link forEachValidPlayers}\r\n * if {@link number}, the event has been registered and this key can be used to unsubscribe\r\n */\r\n key: number | null;\r\n }[];\r\n\r\n /**\r\n * Callback to run on enable\r\n */\r\n private onEnableCallback: () => void | undefined;\r\n\r\n /**\r\n * Callback to run on disable\r\n */\r\n private onDisableCallback: () => void | undefined;\r\n\r\n /**\r\n * If this protection is enabled\r\n */\r\n private isEnabled: boolean;\r\n\r\n /**\r\n * The default config object\r\n */\r\n configDefault: {\r\n [key: string]: {\r\n description: string;\r\n defaultValue: string | boolean | number;\r\n };\r\n };\r\n\r\n /**\r\n * Creates a new protection module\r\n */\r\n constructor(\r\n public name: string,\r\n public description: string,\r\n public iconPath: string\r\n ) {\r\n this.name = name;\r\n this.description = description;\r\n this.iconPath = iconPath;\r\n this.configDefault = {};\r\n this.isEnabled = false;\r\n // ---- events\r\n this.events = {};\r\n this.schedules = [];\r\n this.forEachValidPlayers = [];\r\n // Save protection\r\n PROTECTIONS[this.name] = this;\r\n }\r\n\r\n /**\r\n * Sets the config to a typed object\r\n * @param data typed object\r\n * @returns\r\n */\r\n setConfigDefault(data: {\r\n [key: string]: {\r\n description: string;\r\n defaultValue: string | boolean | number;\r\n };\r\n }): Protection {\r\n this.configDefault = data;\r\n TABLES.protections.hasSync(this.name).then((v) => {\r\n if (v) return;\r\n let saveData: IProtectionsConfig = {\r\n enabled: true,\r\n };\r\n for (const key of Object.keys(data)) {\r\n saveData[key] = data[key as keyof typeof data].defaultValue;\r\n }\r\n TABLES.protections.set(this.name, saveData);\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the config data\r\n * @returns Config\r\n */\r\n getConfig(): Config {\r\n let config = TABLES.protections.get(this.name);\r\n if (!config) config = { enabled: this.isEnabled };\r\n return config as Config;\r\n }\r\n\r\n /**\r\n * Gets the config data sync, should be used for worldLoad calls\r\n * @returns Config\r\n */\r\n async getConfigSync(): Promise {\r\n let config = await TABLES.protections.getSync(this.name);\r\n if (!config) config = { enabled: this.isEnabled };\r\n return config as Config;\r\n }\r\n\r\n async setConfig(data: Config) {\r\n await TABLES.protections.set(this.name, data as IProtectionsConfig);\r\n return;\r\n }\r\n\r\n /**\r\n * Triggers a change to a activate this module or not.\r\n * @param enabled if this protection is enabled or not\r\n */\r\n private triggerChange(enabled: boolean) {\r\n if (enabled) {\r\n this.isEnabled = true;\r\n // Enable this protection\r\n this.onEnableCallback?.();\r\n for (const [key, value] of Object.entries(this.events)) {\r\n if (value.triggered) continue;\r\n let callback = world.events[key as keyof Events].subscribe(\r\n // @ts-ignore\r\n value.callback\r\n );\r\n value.triggered = true;\r\n value.callback = callback;\r\n }\r\n for (const v of this.forEachValidPlayers) {\r\n if (v.key) continue;\r\n let key = forEachValidPlayer(v.callback, v.delay);\r\n v.key = key;\r\n }\r\n for (const v of this.schedules) {\r\n if (v.runScheduleId) continue;\r\n let runScheduleId = system.runSchedule(v.callback);\r\n v.runScheduleId = runScheduleId;\r\n }\r\n } else {\r\n this.isEnabled = false;\r\n // Disable this protection\r\n this.onDisableCallback?.();\r\n for (const [key, value] of Object.entries(this.events)) {\r\n if (!value.triggered) continue;\r\n // @ts-ignore\r\n world.events[key as keyof Events].unsubscribe(value.callback);\r\n value.triggered = false;\r\n }\r\n for (const v of this.forEachValidPlayers) {\r\n if (!v.key) continue;\r\n clearForEachValidPlayer(v.key);\r\n v.key = null;\r\n }\r\n for (const v of this.schedules) {\r\n if (!v.runScheduleId) continue;\r\n system.clearRunSchedule(v.runScheduleId);\r\n v.runScheduleId = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Runs a callback once this protection is activated\r\n * @param callback function to run\r\n */\r\n onEnable(callback: () => void): Protection {\r\n this.onEnableCallback = callback;\r\n return this;\r\n }\r\n\r\n /**\r\n * Runs a callback once this protection is disabled\r\n * @param callback function to run\r\n */\r\n onDisable(callback: () => void): Protection {\r\n this.onDisableCallback = callback;\r\n return this;\r\n }\r\n\r\n /**\r\n * Subscribes to a worldEvent\r\n * @param id event id to subscribe\r\n * @param callback what to run on event callback\r\n * @returns this\r\n */\r\n subscribe(\r\n id: T,\r\n callback: EventsReturnType\r\n ): Protection {\r\n this.events[id] = {\r\n callback: callback,\r\n triggered: false,\r\n };\r\n return this;\r\n }\r\n\r\n /**\r\n * Schedules a callback to be run every x number of ticks\r\n * @param callback callback\r\n * @param tickInterval ticks\r\n */\r\n runSchedule(callback: () => void, tickInterval?: number): Protection {\r\n this.schedules.push({\r\n callback: callback,\r\n tickInterval: tickInterval,\r\n runScheduleId: null,\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Callback for each valid players\r\n * @param callback\r\n * @param delay\r\n */\r\n forEachValidPlayer(\r\n callback: (player: Player) => void,\r\n delay: number = 0\r\n ): Protection {\r\n this.forEachValidPlayers.push({\r\n callback: callback,\r\n delay: delay,\r\n key: null,\r\n });\r\n return this;\r\n }\r\n\r\n /**\r\n * Enables this protection\r\n */\r\n enable() {\r\n this.triggerChange(true);\r\n }\r\n\r\n /**\r\n * Disables this protection\r\n */\r\n disable() {\r\n this.triggerChange(false);\r\n }\r\n}\r\n", "import { Ban } from \"../models/Ban.js\";\nimport { Protection } from \"../models/Protection.js\";\n\n/**\n * Minecraft Bedrock Anti Crasher\n * @license MIT\n * @author Smell of curry\n * @version 1.0.0\n * --------------------------------------------------------------------------\n * This anti crasher works by testing if a player has reached a location\n * Horion's crasher teleports the player to 30 Million so we just test for\n * That location and if they are there we kick the player (USES: player.json)\n * --------------------------------------------------------------------------\n */\n\n/**\n * This is the distance where if you go past it will ban you\n */\nconst DISTANCE = 320000;\n\nnew Protection(\n \"crasher\",\n \"Protection against type 1 crasher\",\n \"textures/ui/servers.png\"\n).forEachValidPlayer((player) => {\n if (\n Math.abs(player.location.x) > DISTANCE ||\n Math.abs(player.location.y) > DISTANCE ||\n Math.abs(player.location.z) > DISTANCE\n ) {\n new Ban(player, null, \"Crasher detected\");\n }\n}).enable()\n", "import { GameMode, world } from \"@minecraft/server\";\nimport { getRole } from \"../../utils.js\";\nimport { Ban } from \"../models/Ban.js\";\nimport { Protection } from \"../models/Protection.js\";\nimport { PlayerLog } from \"../models/PlayerLog.js\";\n\n/**\n * The gamemode that you cannot be in unless you have staff tag\n */\nconst ILLEGAL_GAMEMODE = GameMode.creative;\n\n/**\n * Stores per world load violation data for players\n */\nconst ViolationCount = new PlayerLog();\n\nconst protection = new Protection<{\n clearPlayer: boolean;\n setToSurvival: boolean;\n banPlayer: boolean;\n violationCount: number;\n}>(\n \"gamemode\",\n \"Blocks illegal gamemode\",\n \"textures/ui/creative_icon.png\"\n).setConfigDefault({\n clearPlayer: {\n description: \"Whether to clear players inventory.\",\n defaultValue: true,\n },\n setToSurvival: {\n description: \"If player should be set to survival after being flagged.\",\n defaultValue: true,\n },\n banPlayer: {\n description: \"If player should be banned after violation count is met.\",\n defaultValue: false,\n },\n violationCount: {\n description: \"The amount of violations before ban.\",\n defaultValue: 0,\n },\n});\n\nprotection.runSchedule(async () => {\n const config = await protection.getConfigSync();\n for (const player of world.getPlayers({ gameMode: ILLEGAL_GAMEMODE })) {\n if ([\"moderator\", \"admin\", \"builder\"].includes(getRole(player))) continue;\n try {\n if (config.setToSurvival) player.runCommandAsync(`gamemode s`);\n if (config.clearPlayer) player.runCommandAsync(`clear @s`);\n } catch (error) {}\n const count = (ViolationCount.get(player) ?? 0) + 1;\n ViolationCount.set(player, count);\n if (config.banPlayer && count >= config.violationCount)\n new Ban(player, null, \"Illegal Gamemode\");\n }\n}, 20);\n\nprotection.enable();\n", "import {\r\n world,\r\n Location,\r\n Block,\r\n BlockPermutation,\r\n Dimension,\r\n Player,\r\n system,\r\n} from \"@minecraft/server\";\r\nimport { API_CONTAINERS } from \"../../plugins/Anti-Cheat/config/moderation\";\r\nimport { CONTAINER_LOCATIONS } from \"../../plugins/Anti-Cheat/modules/managers/containers.js\";\r\n\r\ntype beforeBlockBreakCallback = (arg0: BeforeBlockBreakEvent) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: beforeBlockBreakCallback;\r\n };\r\n} = {};\r\n\r\nworld.events.blockBreak.subscribe((data) => {\r\n for (const callback of Object.values(CALLBACKS)) {\r\n callback.callback(\r\n new BeforeBlockBreakEvent(\r\n data.block,\r\n data.brokenBlockPermutation,\r\n data.dimension,\r\n data.player\r\n )\r\n );\r\n }\r\n});\r\n\r\nexport class beforeBlockBreak {\r\n /**\r\n * Subscribes to a callback to get notified when a chat is sent that is not a command\r\n * @param callback what to be called when one of these entities inventory's changes\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(callback: beforeBlockBreakCallback): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n}\r\n\r\nclass BeforeBlockBreakEvent {\r\n /**\r\n * Contains information regarding an event before a player breaks a block.\r\n * @param block Block broken in this event. Note that because this event fires right after a block is broken, the block you will receive will likely be of type 'minecraft:air'. See the .brokenBlockPermutation property for information on this block before it was broken.\r\n * @param brokenBlockPermutation Returns permutation information about this block before it was broken.\r\n * @param dimension Dimension that contains the block that has been broken in this event.\r\n * @param player Player that broke the block for this event.\r\n */\r\n constructor(\r\n public block: Block,\r\n public brokenBlockPermutation: BlockPermutation,\r\n public dimension: Dimension,\r\n public player: Player\r\n ) {\r\n this.block = block;\r\n this.brokenBlockPermutation = brokenBlockPermutation;\r\n this.dimension = dimension;\r\n this.player = player;\r\n }\r\n\r\n set cancel(value: boolean) {\r\n // setting block back\r\n this.dimension\r\n .getBlock(this.block.location)\r\n .setPermutation(this.brokenBlockPermutation.clone());\r\n // setting chest inventory back\r\n if (API_CONTAINERS.includes(this.brokenBlockPermutation.type.id)) {\r\n const OLD_INVENTORY =\r\n CONTAINER_LOCATIONS[JSON.stringify(this.block.location)];\r\n if (OLD_INVENTORY) {\r\n OLD_INVENTORY.load(this.block.getComponent(\"inventory\").container);\r\n }\r\n }\r\n // killing dropped items\r\n system.run(() => {\r\n [\r\n ...this.dimension.getEntities({\r\n maxDistance: 2,\r\n type: \"minecraft:item\",\r\n location: new Location(\r\n this.block.location.x,\r\n this.block.location.y,\r\n this.block.location.z\r\n ),\r\n }),\r\n ].forEach((e) => e.kill());\r\n })\r\n }\r\n}\r\n", "import { system, world } from \"@minecraft/server\";\r\nimport { API_CONTAINERS, CHECK_SIZE } from \"../../config/moderation\";\r\nimport { IContainerLocation } from \"../../../../types\";\r\nimport { vector3ToBlockLocation } from \"../../../../utils.js\";\r\nimport { BlockInventory } from \"../models/BlockInventory\";\r\n\r\n/**\r\n * storage of all container locations in the world\r\n */\r\nexport let CONTAINER_LOCATIONS: IContainerLocation = {};\r\n\r\nsystem.runSchedule(() => {\r\n CONTAINER_LOCATIONS = {};\r\n for (const player of world.getPlayers()) {\r\n if (player.dimension.id != \"minecraft:overworld\") continue;\r\n const blockLoc = vector3ToBlockLocation(player.location);\r\n const pos1 = blockLoc.offset(CHECK_SIZE.x, CHECK_SIZE.y, CHECK_SIZE.z);\r\n const pos2 = blockLoc.offset(-CHECK_SIZE.x, -CHECK_SIZE.y, -CHECK_SIZE.z);\r\n\r\n for (const location of pos1.blocksBetween(pos2)) {\r\n if (location.y < -64) continue;\r\n const block = player.dimension.getBlock(location);\r\n if (!block) continue;\r\n if (!API_CONTAINERS.includes(block.typeId)) continue;\r\n CONTAINER_LOCATIONS[JSON.stringify(location)] = new BlockInventory(\r\n block.getComponent(\"inventory\").container\r\n );\r\n }\r\n }\r\n}, 100);\r\n", "import { BlockInventoryComponentContainer, ItemStack } from \"@minecraft/server\";\n\nexport class BlockInventory {\n emptySlotsCount: number;\n size: number;\n items: Array;\n /**\n * Coverts a blockInventoryComponentContainer and saves it\n * @param {BlockInventoryComponentContainer} inventory\n */\n constructor(inventory: BlockInventoryComponentContainer) {\n this.emptySlotsCount = inventory.emptySlotsCount;\n this.size = inventory.size;\n this.items = [];\n for (let i = 0; i < this.size; i++) {\n this.items[i] = inventory.getItem(i);\n }\n }\n\n /**\n * Loads this inventory onto a BlockInventoryComponentContainer\n * @param {BlockInventoryComponentContainer} block block to load on\n */\n load(block: BlockInventoryComponentContainer) {\n for (let i = 0; i < block.size; i++) {\n if (!this.items[i]) continue;\n block.setItem(i, this.items[i]);\n }\n }\n}\n", "import { PlayerLog } from \"../models/PlayerLog.js\";\nimport { getRole } from \"../../utils.js\";\nimport { Ban } from \"../models/Ban.js\";\nimport { beforeBlockBreak } from \"../../../../lib/Events/beforeBlockBreak.js\";\nimport { Protection } from \"../models/Protection.js\";\n\n/**\n * The log of the players break times\n */\nconst log = new PlayerLog();\n\n/**\n * if a block is broken faster than this time it is considered hacking\n */\nconst IMPOSSIBLE_BREAK_TIME = 15;\n\n/**\n * When breaking vegetation blocks it could cause a false trigger\n * so when a block gets broken and it has one of the block tags\n * it gets skipped and doesn't count in the nuker event\n *\n * @link https://wiki.bedrock.dev/blocks/block-tags.html\n */\nconst VALID_BLOCK_TAGS = [\n \"snow\",\n \"lush_plants_replaceable\",\n \"azalea_log_replaceable\",\n \"minecraft:crop\",\n \"fertilize_area\",\n];\n\n/**\n * A list of all the blocks that are impossible to break unless you have hacks\n */\nconst IMPOSSIBLE_BREAKS = [\n \"minecraft:water\",\n \"minecraft:flowing_water\",\n \"minecraft:lava\",\n \"minecraft:flowing_lava\",\n \"minecraft:bedrock\",\n];\n\n/**\n * Stores per world load violation data for players\n */\nconst ViolationCount = new PlayerLog();\n\nlet beforeBlockBreakKey: number = null;\n\nconst protection = new Protection<{\n banPlayer: boolean;\n violationCount: number;\n}>(\n \"nuker\",\n \"Blocks block breaking too fast\",\n \"textures/blocks/dirt.png\"\n).setConfigDefault({\n banPlayer: {\n description: \"If the player should be banned once violation count is met\",\n defaultValue: false,\n },\n violationCount: {\n description: \"Violations before ban\",\n defaultValue: 0,\n },\n});\n\nprotection\n .onEnable(async () => {\n const config = await protection.getConfigSync();\n beforeBlockBreakKey = beforeBlockBreak.subscribe((data) => {\n if ([\"moderator\", \"admin\"].includes(getRole(data.player))) return;\n if (data.block.getTags().some((tag) => VALID_BLOCK_TAGS.includes(tag)))\n return;\n const old = log.get(data.player);\n log.set(data.player, Date.now());\n if (!old) return;\n\n // If block is impossible to break skip check, reduces lag.\n if (!IMPOSSIBLE_BREAKS.includes(data.block.typeId)) {\n if (old < Date.now() - IMPOSSIBLE_BREAK_TIME) return;\n const count = (ViolationCount.get(data.player) ?? 0) + 1;\n ViolationCount.set(data.player, count);\n if (config.banPlayer && count >= config.violationCount)\n new Ban(data.player, null, \"Using Nuker\");\n }\n\n data.cancel = true;\n });\n })\n .onDisable(() => {\n beforeBlockBreak.unsubscribe(beforeBlockBreakKey);\n });\n\nprotection.enable();\n", "import { PREFIX } from \"../../../../config/commands\";\r\nimport { getRole } from \"../../utils\";\r\nimport { Mute } from \"../models/Mute\";\r\nimport { PlayerLog } from \"../models/PlayerLog\";\r\nimport { Protection } from \"../models/Protection\";\r\n\r\nconst previousMessage = new PlayerLog();\r\n\r\n/**\r\n * Stores per world load violation data for players\r\n */\r\nconst ViolationCount = new PlayerLog();\r\n\r\nconst protection = new Protection<{\r\n permMutePlayer: boolean;\r\n violationCount: number;\r\n repeatedMessages: boolean;\r\n zalgo: boolean;\r\n}>(\"spam\", \"Blocks spam in chat\", \"textures/ui/mute_on.png\").setConfigDefault({\r\n permMutePlayer: {\r\n description:\r\n \"If player should be permanently muted once violation count is met.\",\r\n defaultValue: false,\r\n },\r\n violationCount: {\r\n description: \"Violation count before permanent mute\",\r\n defaultValue: 0,\r\n },\r\n repeatedMessages: {\r\n description: \"Blocks repeated messages\",\r\n defaultValue: true,\r\n },\r\n zalgo: {\r\n description: \"Blocks zalgo\",\r\n defaultValue: true,\r\n },\r\n});\r\n\r\nprotection.subscribe(\"beforeChat\", (data) => {\r\n try {\r\n if (data.message.startsWith(PREFIX)) return;\r\n if ([\"admin\", \"moderator\"].includes(getRole(data.sender))) return;\r\n const config = protection.getConfig();\r\n const isSpam = () => {\r\n const count = (ViolationCount.get(data.sender) ?? 0) + 1;\r\n ViolationCount.set(data.sender, count);\r\n if (config.permMutePlayer && count >= config.violationCount)\r\n new Mute(data.sender, null, \"Spamming\");\r\n };\r\n if (\r\n config.repeatedMessages &&\r\n previousMessage.get(data.sender) == data.message\r\n ) {\r\n data.cancel = true;\r\n isSpam();\r\n return data.sender.tell(`\u00A7cRepeated message detected!`);\r\n }\r\n if (config.zalgo && /%CC%/g.test(encodeURIComponent(data.message))) {\r\n data.cancel = true;\r\n isSpam();\r\n return data.sender.tell(\r\n `\u00A7cYou message contains some type of zalgo and cannot be sent!`\r\n );\r\n }\r\n previousMessage.set(data.sender, data.message);\r\n } catch (error) {\r\n console.warn(error + error.stack);\r\n }\r\n});\r\n\r\nprotection.enable();\r\n", "import { Player } from \"@minecraft/server\";\r\nimport { FORBIDDEN_ITEMS } from \"../../config/moderation.js\";\r\nimport { AIR } from \"../../../../index.js\";\r\nimport { getConfigId, getMaxEnchantmentLevel } from \"../../utils\";\r\nimport { Ban } from \"../models/Ban.js\";\r\nimport { Log } from \"../models/Log.js\";\r\nimport { PlayerLog } from \"../models/PlayerLog.js\";\r\nimport { Protection } from \"../models/Protection.js\";\r\n\r\n/**\r\n * Stores violation count for player\r\n */\r\nconst ViolationCount = new PlayerLog();\r\n\r\n/**\r\n * Flags a player for a item they should not have\r\n * @param player player to flag\r\n * @param index the index of this item in the players inventory\r\n */\r\nfunction flag(player: Player, index: number) {\r\n const inventory = player.getComponent(\"inventory\").container;\r\n const item = inventory.getItem(index);\r\n const data = getConfigId(\"cbe_config\");\r\n // Clear Item\r\n if (data.clearItem) inventory.setItem(index, AIR);\r\n // Log action\r\n new Log({\r\n playerName: player.name,\r\n message: `${player.name} Has obtained a unobtainable item: ${item.typeId}`,\r\n protection: \"unobtainable\",\r\n });\r\n // Violation\r\n if (!data.banPlayer) return;\r\n const violations = (ViolationCount.get(player) ?? 0) + 1;\r\n ViolationCount.set(player, violations);\r\n if (violations < data.violationCount) return;\r\n new Ban(player, null, \"Possession of Unobtainable item\");\r\n}\r\n\r\nnew Protection(\r\n \"unobtainable\",\r\n \"Blocks unobtainable items\",\r\n \"textures/blocks/end_portal.png\"\r\n)\r\n .forEachValidPlayer((player) => {\r\n const BANNED_ITEMS = getConfigId(\"banned_items\");\r\n\r\n const inventory = player.getComponent(\"inventory\").container;\r\n for (let i = 0; i < inventory.size; i++) {\r\n const item = inventory.getItem(i);\r\n if (!item) continue;\r\n if (BANNED_ITEMS.includes(item.typeId)) return flag(player, i);\r\n if (FORBIDDEN_ITEMS.includes(item.typeId)) {\r\n // Log action\r\n new Log({\r\n playerName: player.name,\r\n message: `${player.name} Has obtained a Forbidden item: ${item.typeId}`,\r\n protection: \"unobtainable\",\r\n });\r\n return inventory.setItem(i, AIR);\r\n }\r\n // Player is allowed to have this itemType\r\n /**\r\n * List of all enchantments that are valid on this item\r\n */\r\n let enchantments: string[] = [];\r\n for (const enchantment of item.getComponent(\"enchantments\")\r\n .enchantments) {\r\n const MAX_LEVEL = getMaxEnchantmentLevel(enchantment);\r\n if (enchantment.level > MAX_LEVEL) return flag(player, i);\r\n if (enchantment.level < 1) return flag(player, i);\r\n if (enchantments.includes(enchantment.type.id)) return flag(player, i);\r\n // Enchantment Is valid\r\n enchantments.push(enchantment.type.id);\r\n }\r\n }\r\n })\r\n .enable();\r\n", "import {\r\n MinecraftBlockTypes,\r\n MinecraftEntityTypes,\r\n MinecraftItemTypes,\r\n Player,\r\n} from \"@minecraft/server\";\r\nimport { AIR } from \"../../../../index.js\";\r\nimport { getGamemode } from \"../../utils.js\";\r\nimport { Protection } from \"../models/Protection.js\";\r\n\r\n/**\r\n * List of blocks to test\r\n */\r\nconst BLOCKS = [\r\n MinecraftBlockTypes.chest.id,\r\n MinecraftBlockTypes.trappedChest.id,\r\n MinecraftBlockTypes.barrel.id,\r\n MinecraftBlockTypes.dispenser.id,\r\n MinecraftBlockTypes.dropper.id,\r\n MinecraftBlockTypes.furnace.id,\r\n MinecraftBlockTypes.litFurnace.id,\r\n MinecraftBlockTypes.blastFurnace.id,\r\n MinecraftBlockTypes.litBlastFurnace.id,\r\n MinecraftBlockTypes.smoker.id,\r\n MinecraftBlockTypes.litSmoker.id,\r\n MinecraftBlockTypes.hopper.id,\r\n MinecraftBlockTypes.beehive.id,\r\n MinecraftBlockTypes.beeNest.id,\r\n MinecraftBlockTypes.mobSpawner.id,\r\n];\r\n\r\n/**\r\n * List of items to test\r\n */\r\nconst CHEST_BOATS = [\r\n MinecraftItemTypes.chestBoat.id,\r\n MinecraftItemTypes.oakChestBoat.id,\r\n MinecraftItemTypes.birchChestBoat.id,\r\n MinecraftItemTypes.acaciaChestBoat.id,\r\n MinecraftItemTypes.jungleChestBoat.id,\r\n MinecraftItemTypes.spruceChestBoat.id,\r\n MinecraftItemTypes.darkOakChestBoat.id,\r\n MinecraftItemTypes.mangroveChestBoat.id,\r\n];\r\n\r\nnew Protection(\r\n \"nbt\",\r\n \"Blocks illegal nbt on items\",\r\n \"textures/ui/icon_random.png\"\r\n)\r\n .subscribe(\"blockPlace\", async ({ block }) => {\r\n if (!BLOCKS.includes(block.typeId)) return;\r\n const permutation = block.permutation;\r\n await block.dimension.runCommandAsync(\r\n `setblock ${block.x} ${block.y} ${block.z} ${block.typeId}`\r\n );\r\n block.setPermutation(permutation);\r\n })\r\n .subscribe(\"beforeItemUseOn\", (data) => {\r\n if (!(data.source instanceof Player)) return;\r\n if (!CHEST_BOATS.includes(data.item.typeId)) return;\r\n data.cancel = true;\r\n data.source.dimension.spawnEntity(\r\n MinecraftEntityTypes.chestBoat.id,\r\n data.blockLocation.above()\r\n );\r\n if (getGamemode(data.source) == \"creative\") return;\r\n data.source\r\n .getComponent(\"inventory\")\r\n .container.setItem(data.source.selectedSlot, AIR);\r\n })\r\n .enable();\r\n", "import {\r\n MinecraftEffectTypes,\r\n MinecraftItemTypes,\r\n Player,\r\n Vector3,\r\n} from \"@minecraft/server\";\r\nimport {\r\n ILocationLog,\r\n onPlayerMove,\r\n} from \"../../../../lib/Events/onPlayerMove\";\r\nimport {\r\n ANTI_TP_DISTANCE_THRESHOLD,\r\n MOVEMENT_CONSTANTS,\r\n MOVEMENT_DISTANCE_THRESHOLD,\r\n SPEED_EFFECT_INCREASE,\r\n TAGS,\r\n} from \"../../config/movement\";\r\nimport { getRole } from \"../../utils\";\r\nimport { PlayerLog } from \"../models/PlayerLog\";\r\nimport { Protection } from \"../models/Protection\";\r\n\r\nconst violations = new PlayerLog();\r\n\r\n/**\r\n * Calculates the distance from loc1 to loc2\r\n * @param {Location} loc1 location 1\r\n * @param {Location} loc2 location 2\r\n * @returns {number}\r\n */\r\nfunction distanceBetween(loc1: Vector3, loc2: Vector3): number {\r\n return Math.hypot(loc2.x - loc1.x, loc2.z - loc1.z);\r\n}\r\n\r\n/**\r\n * Gets the speed offset based on a players SpeedEffect\r\n * @param player player to get\r\n */\r\nfunction getSpeedOffset(player: Player): number {\r\n const speed = player.getEffect(MinecraftEffectTypes.speed)?.amplifier ?? 0;\r\n return speed * SPEED_EFFECT_INCREASE;\r\n}\r\n\r\n/**\r\n * Checks if a distance traveled is big enough to be flagged\r\n * @param distance distance the player has traveled\r\n * @returns if this distance is bad\r\n */\r\nfunction isDistanceFlag(distance: number, player: Player): boolean {\r\n const speedIntensity = getSpeedOffset(player);\r\n const offset = MOVEMENT_CONSTANTS.run.distance + MOVEMENT_DISTANCE_THRESHOLD;\r\n return distance > speedIntensity + offset;\r\n}\r\n\r\nfunction flag(player: Player, old: ILocationLog) {\r\n const violationCount = (violations.get(player) ?? 0) + 1;\r\n violations.set(player, violationCount);\r\n onPlayerMove.delete(player); // Reset Players old location\r\n if (violationCount < 3) return;\r\n player.teleport(\r\n old.location,\r\n old.dimension,\r\n player.rotation.x,\r\n player.rotation.y\r\n );\r\n}\r\n\r\n/**\r\n * The key used to unsubscribe from this event\r\n */\r\nlet onPlayerMoveSubKey: number = null;\r\n\r\nconst protection = new Protection<{\r\n tpCheck: boolean;\r\n}>(\r\n \"movement\",\r\n \"Blocks illegal movements on players\",\r\n \"textures/ui/move.png\"\r\n).setConfigDefault({\r\n tpCheck: {\r\n description: \"If teleports should be flagged\",\r\n defaultValue: true,\r\n },\r\n});\r\n\r\nprotection\r\n .onEnable(async () => {\r\n console.warn(`enabled movement protection`)\r\n const config = await protection.getConfigSync();\r\n onPlayerMoveSubKey = onPlayerMove.subscribe((player, old) => {\r\n if (getRole(player) == \"admin\") return;\r\n if (player.dimension.id != old.dimension.id) return;\r\n if (player.getTags().some((tag) => TAGS.includes(tag))) return;\r\n const distance = distanceBetween(player.location, old.location);\r\n if (player.hasTag(`skip-movement-check`))\r\n return player.removeTag(`skip-movement-check`);\r\n if (distance > ANTI_TP_DISTANCE_THRESHOLD) {\r\n if (!config.tpCheck) return;\r\n // Anti Tp.\r\n flag(player, old);\r\n } else {\r\n // Anti speed/jet pack\r\n if (!isDistanceFlag(distance, player)) return;\r\n // Flagged\r\n flag(player, old);\r\n }\r\n });\r\n })\r\n .onDisable(() => {\r\n console.warn(`disabled movement protection`);\r\n onPlayerMove.unsubscribe(onPlayerMoveSubKey);\r\n });\r\n\r\nprotection.subscribe(\"dataDrivenEntityTriggerEvent\", (data) => {\r\n if (!(data.entity instanceof Player)) return;\r\n if (data.id != \"on_death\") return;\r\n onPlayerMove.delete(data.entity); // Reset Players old location\r\n});\r\n\r\nprotection.subscribe(\"projectileHit\", ({ projectile, source }) => {\r\n if (projectile.typeId != MinecraftItemTypes.enderPearl.id) return;\r\n if (!(source instanceof Player)) return;\r\n onPlayerMove.delete(source); // Reset Players old location\r\n});\r\n\r\nprotection.subscribe(\"itemCompleteCharge\", ({ itemStack, source }) => {\r\n if (itemStack.typeId != MinecraftItemTypes.chorusFruit.id) return;\r\n if (!(source instanceof Player)) return;\r\n onPlayerMove.delete(source); // Reset Players old location\r\n});", "import { Dimension, Player, Vector3, world } from \"@minecraft/server\";\r\nimport { PlayerLog } from \"../../plugins/Anti-Cheat/modules/models/PlayerLog\";\r\n\r\ntype onPlayerMoveCallback = (player: Player, data: ILocationLog) => void;\r\n\r\nconst CALLBACKS: {\r\n [key: number]: {\r\n callback: onPlayerMoveCallback;\r\n };\r\n} = {};\r\n\r\nexport interface ILocationLog {\r\n /**\r\n * The Location this is\r\n */\r\n location: Vector3;\r\n /**\r\n * The dimension this location was in\r\n */\r\n dimension: Dimension;\r\n /**\r\n * The world tick this location log was set on\r\n */\r\n tickSet: number;\r\n}\r\n\r\n/**\r\n * Checks if two vectors are the same\r\n * @param from first vector\r\n * @param to second vector\r\n */\r\nfunction vector3Equals(from: Vector3, to: Vector3): boolean {\r\n if (from.x != to.x) return false;\r\n if (from.y != to.y) return false;\r\n if (from.z != to.z) return false;\r\n return true;\r\n}\r\n\r\n/**\r\n * Stores Last Previous grounded location\r\n */\r\nexport const playerLocation = new PlayerLog();\r\n\r\nworld.events.tick.subscribe((data) => {\r\n const sendCallback = (player: Player, data: ILocationLog) => {\r\n for (const callback of Object.values(CALLBACKS)) {\r\n callback.callback(player, data);\r\n }\r\n };\r\n for (const player of world.getPlayers()) {\r\n const oldLocation = playerLocation.get(player);\r\n if (oldLocation) {\r\n if (vector3Equals(player.location, oldLocation.location)) {\r\n continue;\r\n }\r\n }\r\n playerLocation.set(player, {\r\n location: player.location,\r\n dimension: player.dimension,\r\n tickSet: data.currentTick,\r\n });\r\n if (!oldLocation) continue;\r\n sendCallback(player, oldLocation);\r\n }\r\n});\r\n\r\nexport class onPlayerMove {\r\n /**\r\n * Subscribes to a callback to get notified when a player moves\r\n * @param callback what to be called when one of these entity's inventory changes\r\n * @returns the id that is used to unsubscribe\r\n */\r\n static subscribe(callback: onPlayerMoveCallback): number {\r\n const key = Date.now();\r\n CALLBACKS[key] = { callback: callback };\r\n return key;\r\n }\r\n static unsubscribe(key: number): void {\r\n delete CALLBACKS[key];\r\n }\r\n /**\r\n * Clears a players location\r\n * @param player player to clear\r\n */\r\n static delete(player: Player): void {\r\n playerLocation.delete(player);\r\n }\r\n}\r\n", "/**\r\n * The leeway that the distances can be off before it flags\r\n */\r\nexport const MOVEMENT_DISTANCE_THRESHOLD = 0.80;\r\n\r\n/**\r\n * Constant of speeds when players are moving\r\n */\r\nexport const MOVEMENT_CONSTANTS = {\r\n walk: {\r\n velocity: 0.17 as const,\r\n distance: 0.23 as const,\r\n },\r\n run: {\r\n velocity: 0.19 as const,\r\n distance: 0.35 as const,\r\n },\r\n};\r\n\r\n/**\r\n * The distance increase per speed effect increase\r\n */\r\nexport const SPEED_EFFECT_INCREASE = 0.056;\r\n\r\n/**\r\n * if the distance is over this amount the system will automatically flag tp\r\n */\r\nexport const ANTI_TP_DISTANCE_THRESHOLD = 10;\r\n\r\n/**\r\n * If your \r\n */\r\nexport const TAGS = [\"gliding\", \"riding\"];\r\n", "import { MinecraftEffectTypes, Player, world } from \"@minecraft/server\";\r\nimport { getServerOwnerName, setRole, setServerOwner } from \"../../utils\";\r\n\r\nlet e = world.events.beforeDataDrivenEntityTriggerEvent.subscribe((data) => {\r\n if (!(data.entity instanceof Player)) return;\r\n if (data.id != \"rubedo:becomeAdmin\") return;\r\n // Rubedo is now verified to be at the top\r\n data.entity.removeTag(\"CHECK_PACK\");\r\n const serverOwnerName = getServerOwnerName();\r\n if (serverOwnerName) {\r\n data.entity.playSound(\"note.bass\");\r\n data.entity.tell(\r\n `\u00A7cFailed to give server owner: \"${serverOwnerName}\" is already owner!`\r\n );\r\n return world.events.beforeDataDrivenEntityTriggerEvent.unsubscribe(e);\r\n }\r\n setRole(data.entity, \"admin\");\r\n setServerOwner(data.entity);\r\n data.entity.addEffect(MinecraftEffectTypes.blindness, 3, 255, true);\r\n data.entity.tell(\r\n `\u00A7aYou have now been set as the \"owner\" of this server. The command \"/function start\" will not do anything anymore, type \"-help\" for more information!`\r\n );\r\n});\r\n", "import { system } from \"@minecraft/server\";\r\n\r\nsystem.events.beforeWatchdogTerminate.subscribe((data) => {\r\n data.cancel = true;\r\n console.warn(`WATCHDOG TRIED TO CRASH = ${data.terminateReason}`);\r\n});\r\n", "import {\r\n DynamicPropertiesDefinition,\r\n EntityTypes,\r\n MinecraftEntityTypes,\r\n world,\r\n} from \"@minecraft/server\";\r\nimport {\r\n ENTITY_IDENTIFIER,\r\n ENTITY_LOCATION,\r\n} from \"../../../../config/database\";\r\nimport { OBJECTIVES } from \"../../../../config/objectives\";\r\nimport { DIMENSIONS } from \"../../../../utils.js\";\r\n\r\nworld.events.worldInitialize.subscribe(({ propertyRegistry }) => {\r\n /**\r\n * Loads Ticking Area\r\n */\r\n DIMENSIONS.overworld.runCommandAsync(\r\n `tickingarea add ${ENTITY_LOCATION.x} ${ENTITY_LOCATION.y} ${ENTITY_LOCATION.z} ${ENTITY_LOCATION.x} ${ENTITY_LOCATION.y} ${ENTITY_LOCATION.z} db true`\r\n );\r\n\r\n let def = new DynamicPropertiesDefinition();\r\n def.defineString(\"tableName\", 30);\r\n def.defineNumber(\"index\");\r\n propertyRegistry.registerEntityTypeDynamicProperties(\r\n def,\r\n EntityTypes.get(ENTITY_IDENTIFIER)\r\n );\r\n\r\n let def2 = new DynamicPropertiesDefinition();\r\n def2.defineString(\"role\", 30);\r\n propertyRegistry.registerEntityTypeDynamicProperties(\r\n def2,\r\n MinecraftEntityTypes.player\r\n );\r\n\r\n let def3 = new DynamicPropertiesDefinition();\r\n def3.defineString(\"worldsOwner\", 100);\r\n def3.defineBoolean(\"isLockDown\");\r\n propertyRegistry.registerWorldDynamicProperties(def3);\r\n\r\n for (const obj of OBJECTIVES) {\r\n world.scoreboard.addObjective(obj.objective, obj.displayName ?? \"\");\r\n }\r\n});\r\n", "/*\n|--------------------------------------------------------------------------\n| Objectives\n|--------------------------------------------------------------------------\n|\n| This is a list of all objectives this pack uses\n| please add any objective to this list so it can be added at world creation\n| make sure to add them before sending pack to others and new worlds.\n|\n*/\ninterface IObjective {\n objective: string;\n displayName?: string;\n}\n\nexport const OBJECTIVES: Array = [];\n", "import { Location } from \"@minecraft/server\";\r\nimport \"./protections\";\r\nimport \"./modules/commands/import\";\r\nimport \"./modules/managers/import\";\r\nimport \"./modules/pages/import\";\r\nimport \"./modules/protections/import\";\r\nimport \"./modules/events/import\";\r\n\r\n/**\r\n * Stores npc locations that are verified to allow NPC's to spawn in\r\n */\r\nexport let NPC_LOCATIONS: Array = [];\r\n\r\nexport function clearNpcLocations() {\r\n NPC_LOCATIONS = [];\r\n}\r\n", "console.warn(`----- Importing Plugins -----`);\r\n\r\nimport \"./Anti-Cheat/index\";\r\n//import \"./ChatRanks/index\";\r\n//import \"./GlobalBans/index\";\r\n"], + "mappings": "AACA,OAAS,aAAAA,GAAW,sBAAAC,OAA0B,oBCD9C,OAA0B,SAAAC,OAAa,oBCUhC,IAAMC,EAAS,ICVtB,OAAiB,SAAAC,OAAa,oBCA9B,OAEE,aAAAC,GACA,sBAAAC,GACA,UAAAC,OACK,oBCLP,OAAS,iBAAAC,OAAqB,oBAYvB,IAAMC,GAA2B,KAW3BC,GAAoB,kBAWpBC,EAAkB,IAAIH,GAAc,EAAG,IAAK,CAAC,EAU7CI,GAAiB,IC5C9B,OACE,iBAAAC,GAGA,2BAAAC,EAEA,UAAAC,EAEA,SAAAC,MACK,oBCRP,OAAS,mBAAAC,OAAuB,uBAIzB,IAAMC,EAAN,KAAkB,CAgCvB,YAAYC,EAAgBC,EAAe,CACzC,KAAK,MAAQD,EACb,KAAK,KAAOC,EACZ,KAAK,KAAO,IAAIC,GAEZF,GAAO,KAAK,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,aAAe,EAAE,CAEtE,CAAC,EEjCM,IAAIE,GAAiC,CAAC,EAEtC,SAASC,IAAoB,CAClCD,GAAgB,CAAC,CACnB,CCfA,QAAQ,KAAK,+BAA+B,ExFA5C,QAAQ,KAAK,2BAA2B,EASjC,IAAME,EAAM,IAAIC,GAAUC,GAAmB,MAAO,CAAC,EAKjDC,GAAkB,GAKtB,SAASC,IAAmB,CACjCD,GAAkB,EACpB", + "names": ["ItemStack", "MinecraftItemTypes", "world", "PREFIX", "world", "ItemStack", "MinecraftItemTypes", "system", "BlockLocation", "MAX_DATABASE_STRING_SIZE", "ENTITY_IDENTIFIER", "ENTITY_LOCATION", "INVENTORY_SIZE", "BlockLocation", "MinecraftDimensionTypes", "system", "world", "MessageFormData", "MessageForm", "title", "body", "MessageFormData", "text", "callback", "player", "response", "DIMENSIONS", "world", "MinecraftDimensionTypes", "durationToMs", "duration", "values", "ms", "value", "length", "unit", "msToTime", "vector3ToBlockLocation", "loc", "BlockLocation", "confirmAction", "player", "action", "onConfirm", "onCancel", "MessageForm", "sleep", "tick", "resolve", "runScheduleId", "system", "LocationEquals", "a", "b", "aLocations", "bLocations", "v", "awaitWorldLoad", "WORLD_IS_LOADED", "s", "DIMENSIONS", "setWorldIsLoaded", "onWorldLoad", "callback", "chunkString", "str", "length", "Database", "tableName", "system", "onWorldLoad", "index", "entity", "DIMENSIONS", "ENTITY_IDENTIFIER", "ENTITY_LOCATION", "e", "resolve", "data", "awaitWorldLoad", "entities", "chunks", "chunkString", "MAX_DATABASE_STRING_SIZE", "entitiesNeeded", "INVENTORY_SIZE", "inventory", "i", "chunk", "item", "ItemStack", "MinecraftItemTypes", "AIR", "v", "a", "b", "stringifiedData", "key", "value", "status", "TABLES", "Database", "fetch", "playerName", "world", "player", "LiteralArgumentType", "name", "value", "StringArgumentType", "IntegerArgumentType", "FloatArgumentType", "LocationArgumentType", "BooleanArgumentType", "PlayerArgumentType", "fetch", "TargetArgumentType", "ArrayArgumentType", "types", "DurationArgumentType", "PlayerNameArgumentType", "TABLES", "ArgumentTypes", "CommandCallback", "data", "text", "getChatAugments", "message", "prefix", "e", "commandNotFound", "player", "command", "noPerm", "commandSyntaxFail", "baseCommand", "args", "i", "PREFIX", "types", "c", "LiteralArgumentType", "parseLocationArgs", "x", "y", "z", "location", "viewVector", "locations", "viewVectors", "a", "arg", "r", "b", "index", "sendCallback", "cmdArgs", "event", "lastArg", "argsToReturn", "LocationArgumentType", "CommandCallback", "COMMANDS", "world", "data", "PREFIX", "args", "getChatAugments", "command", "event", "commandNotFound", "noPerm", "verifiedCommands", "getArg", "start", "i", "arg", "v", "commandSyntaxFail", "sendCallback", "Player", "system", "world", "GUI_ITEM", "ENTITY_INVENTORY", "world", "Player", "BlockLocation", "MinecraftBlockTypes", "GameMode", "system", "BlockLocation", "MinecraftBlockTypes", "DEFAULT_REGION_PERMISSIONS", "DOORS_SWITCHES", "BLOCK_CONTAINERS", "REGIONS", "REGIONS_HAVE_BEEN_GRABBED", "LOWEST_Y_VALUE", "HIGHEST_Y_VALUE", "betweenXYZ", "XYZa", "XYZb", "XYZc", "c", "i", "Region", "regions", "TABLES", "region", "r", "blockLocation", "dimensionId", "from", "to", "permissions", "key", "DEFAULT_REGION_PERMISSIONS", "loadRegionDenys", "loc1", "BlockLocation", "loc2", "DIMENSIONS", "MinecraftBlockTypes", "entity", "value", "ChangePlayerRoleTask", "TABLES", "playerName", "t", "role", "tasks", "MinecraftBlockTypes", "MinecraftItemTypes", "FORBIDDEN_ITEMS", "BANNED_ITEMS", "FORBIDDEN_BLOCKS", "BANNED_BLOCKS", "API_CONTAINERS", "CONTAINERS", "CHECK_SIZE", "ENCHANTMENTS", "VERSION", "APPEAL_LINK", "kick", "player", "message", "onFail", "isServerOwner", "error", "getRole", "Player", "TABLES", "getRoleSync", "setRole", "value", "inGamePlayer", "world", "p", "ChangePlayerRoleTask", "getServerOwner", "id", "getServerOwnerName", "ownerId", "ids", "key", "setServerOwner", "isLockedDown", "setLockDown", "val", "loadRegionDenys", "region", "Region", "loc1", "BlockLocation", "loc2", "blockLocation", "DIMENSIONS", "MinecraftBlockTypes", "CALLBACKS", "forEachValidPlayerCalls", "forEachValidPlayer", "callback", "delay", "clearForEachValidPlayer", "system", "players", "i", "CALLBACK", "getConfigId", "BANNED_ITEMS", "BANNED_BLOCKS", "ENCHANTMENTS", "APPEAL_LINK", "setConfigId", "getMaxEnchantmentLevel", "enchantment", "getGamemode", "GameMode", "g", "world", "system", "CALLBACKS", "MAPPED_INVENTORIES", "PREVIOUS_CHANGE", "getSlotChanges", "entity", "oldInv", "newInv", "changes", "i", "change_data", "getItemUid", "item", "data", "mapInventory", "container", "inventory", "system", "callback", "DIMENSIONS", "change", "onEntityInventorySlotChange", "entities", "key", "Location", "world", "PlayerLog", "data", "player", "value", "CHESTGUIS", "PAGES", "CHEST_OPEN", "PlayerLog", "getHeldItem", "player", "clearPlayersPointer", "ItemToClear", "inventory", "itemsToLoad", "i", "item", "Location", "e", "getItemAtSlot", "entity", "slot", "ItemGrabbedCallback", "gui", "slot", "change", "text", "item", "db", "page", "extras", "form", "sleep", "ChestGUI", "player", "ENTITY_INVENTORY", "world", "CHEST_OPEN", "onEntityInventorySlotChange", "entity", "change", "pageId", "extras", "c", "AIR", "PAGES", "page", "slot", "clearPlayersPointer", "getItemAtSlot", "ItemGrabbedCallback", "CHESTGUIS", "ItemStack", "PageItem", "itemType", "components", "itemStack", "enchantments", "enchantment", "DefaultFill", "entity", "page", "extras", "container", "i", "slot", "AIR", "Page", "id", "fillType", "DefaultFill", "PAGES", "slot", "item", "action", "data", "MinecraftItemTypes", "HOME_PAGE", "Page", "PageItem", "ctx", "system", "player", "world", "getHeldItem", "GUI_ITEM", "CHESTGUIS", "getRole", "ChestGUI", "data", "Player", "CHEST_OPEN", "validIds", "c", "entity", "DIMENSIONS", "ENTITY_INVENTORY", "PROTECTIONS", "text", "a", "b", "playerName", "duration", "reason", "name", "expire", "Command", "data", "type", "depth", "parent", "player", "LiteralArgumentType", "COMMANDS", "cmd", "name", "StringArgumentType", "IntegerArgumentType", "types", "ArrayArgumentType", "BooleanArgumentType", "LocationArgumentType", "callback", "Player", "setBan", "player", "id", "duration", "reason", "by", "data", "Player", "durationToMs", "TABLES", "Ban", "ban", "ctx", "player", "duration", "reason", "by", "TABLES", "confirmAction", "Ban", "text", "root", "Command", "getRole", "ArgumentTypes", "playerName", "banData", "bans", "msToTime", "root", "Command", "player", "getRole", "ctx", "table", "key", "data", "TABLES", "error", "value", "keys", "values", "Command", "player", "getRole", "ArgumentTypes", "ctx", "i", "Freeze", "player", "reason", "data", "TABLES", "root", "Command", "player", "getRole", "ArgumentTypes", "ctx", "reason", "Freeze", "playerName", "freeze", "TABLES", "freezes", "text", "CommandNameArgumentType", "name", "value", "COMMANDS", "c", "sendCommandType", "baseCommand", "args", "player", "PREFIX", "a", "sendArguments", "bc", "p", "child", "sendPageHeader", "maxPages", "getCommands", "getMaxPages", "commands", "root", "Command", "ctx", "cmd", "command", "world", "Command", "player", "getRole", "ctx", "isLockedDown", "setLockDown", "confirmAction", "text", "world", "kick", "Mute", "player", "TABLES", "duration", "reason", "by", "msLength", "durationToMs", "data", "root", "Command", "player", "getRole", "ArgumentTypes", "ctx", "duration", "reason", "Mute", "playerName", "mute", "TABLES", "mutes", "text", "msToTime", "Location", "Npc", "entity", "NPC_LOCATIONS", "l", "LocationEquals", "TABLES", "key", "location", "dimension", "data", "clearNpcLocations", "Command", "player", "getRole", "ctx", "x", "y", "z", "Npc", "Location", "world", "Command", "ctx", "pingTick", "deltaTime", "BlockLocation", "command", "Command", "player", "getRole", "ctx", "from_x", "from_z", "to_x", "to_z", "Region", "loc", "BlockLocation", "r", "regions", "region", "permission", "key", "value", "entityCommands", "entity", "currentAllowedEntities", "v", "ROLES", "StringIsNumber", "value", "ToArray", "enumme", "key", "root", "Command", "player", "getRole", "isServerOwner", "ArgumentTypes", "ROLES", "ctx", "playerName", "role", "setRole", "ownerRoot", "ownerId", "getServerOwner", "ids", "TABLES", "ownerName", "confirmAction", "setServerOwner", "ActionFormData", "ActionForm", "title", "body", "ActionFormData", "text", "iconPath", "callback", "player", "response", "ModalFormData", "FormCallback", "form", "player", "callback", "message", "MessageForm", "ModalForm", "title", "ModalFormData", "label", "options", "defaultValueIndex", "minimumValue", "maximumValue", "valueStep", "defaultValue", "placeholderText", "player", "callback", "response", "FormCallback", "v", "manageBannedItemsForm", "player", "ActionForm", "removeBannedItemForm", "addBannedItemForm", "ModalForm", "getConfigId", "ctx", "item", "items", "p", "setConfigId", "manageBannedBlocksForm", "removeBannedBlockForm", "addBannedBlockForm", "block", "blocks", "manageEnchantmentLevelsForm", "ENCHANTMENTS", "enchantment", "levelString", "level", "enchants", "manageAppealLinkForm", "APPEAL_LINK", "link", "showAutoModHomeForm", "player", "form", "ActionForm", "protection", "PROTECTIONS", "showProtectionConfig", "showHomeForm", "data", "ModalForm", "keys", "key", "value", "ctx", "enabled", "config", "i", "showHomeForm", "player", "ActionForm", "showAutoModHomeForm", "manageBannedItemsForm", "manageBannedBlocksForm", "manageEnchantmentLevelsForm", "manageAppealLinkForm", "Command", "player", "getRole", "ctx", "showHomeForm", "world", "vanish", "player", "say", "world", "Command", "getRole", "ctx", "Command", "ctx", "VERSION", "Command", "player", "getRole", "ArgumentTypes", "ctx", "reason", "kick", "Log", "data", "TABLES", "timeDifference", "previous", "msPerMinute", "msPerHour", "msPerDay", "msPerMonth", "msPerYear", "elapsed", "root", "Command", "player", "getRole", "ctx", "message", "Log", "page", "order", "allLogs", "TABLES", "a", "b", "maxPages", "PREFIX", "key", "value", "ArgumentTypes", "playerName", "v", "protection", "root", "Command", "player", "getRole", "ArgumentTypes", "ctx", "destination", "forEachValidPlayer", "player", "banData", "TABLES", "kick", "msToTime", "getConfigId", "error", "Location", "forEachValidPlayer", "player", "freezeData", "TABLES", "Location", "DIMENSIONS", "world", "CALLBACKS", "world", "data", "PREFIX", "callback", "beforeChat", "key", "beforeChat", "data", "muteData", "Mute", "TABLES", "text", "BlockLocation", "system", "world", "system", "loadRegionDenys", "world", "data", "getRole", "region", "Region", "block", "DOORS_SWITCHES", "BLOCK_CONTAINERS", "i", "bL", "entity", "BlockLocation", "DIMENSIONS", "forEachValidPlayer", "player", "world", "world", "player", "awaitWorldLoad", "isLockedDown", "getRoleSync", "kick", "text", "Mute", "TABLES", "roleToSet", "ChangePlayerRoleTask", "setRole", "Items", "MinecraftItemTypes", "world", "FILLABLE_SLOTS", "FILLABLE_SLOTS_ENDERCHEST", "ViewPlayersFill", "entity", "page", "extras", "container", "i", "slot", "AIR", "player", "world", "item", "PageItem", "MinecraftItemTypes", "ctx", "ViewPlayerInventoryFill", "EnderChestItem", "p", "CHESTGUIS", "e", "inventory", "used_slots", "Items", "ViewPlayerEnderChestFill", "ItemTypes", "ChestGuiItem", "Page", "Player", "MinecraftBlockTypes", "system", "world", "Protection", "name", "description", "iconPath", "PROTECTIONS", "data", "TABLES", "v", "saveData", "key", "config", "enabled", "value", "callback", "world", "forEachValidPlayer", "runScheduleId", "system", "clearForEachValidPlayer", "id", "tickInterval", "delay", "CBE_ENTITIES", "protection", "Protection", "entity", "kill", "Npc", "data", "Player", "getRole", "config", "MinecraftBlockTypes", "FORBIDDEN_BLOCKS", "getConfigId", "Ban", "DISTANCE", "Protection", "player", "Ban", "GameMode", "world", "ILLEGAL_GAMEMODE", "GameMode", "ViolationCount", "PlayerLog", "protection", "Protection", "config", "player", "world", "getRole", "count", "Ban", "world", "Location", "system", "system", "world", "BlockInventory", "inventory", "i", "block", "CONTAINER_LOCATIONS", "system", "player", "world", "blockLoc", "vector3ToBlockLocation", "pos1", "CHECK_SIZE", "pos2", "location", "block", "API_CONTAINERS", "BlockInventory", "CALLBACKS", "world", "data", "callback", "BeforeBlockBreakEvent", "beforeBlockBreak", "key", "block", "brokenBlockPermutation", "dimension", "player", "value", "API_CONTAINERS", "OLD_INVENTORY", "CONTAINER_LOCATIONS", "system", "Location", "e", "log", "PlayerLog", "IMPOSSIBLE_BREAK_TIME", "VALID_BLOCK_TAGS", "IMPOSSIBLE_BREAKS", "ViolationCount", "beforeBlockBreakKey", "protection", "Protection", "config", "beforeBlockBreak", "data", "getRole", "tag", "old", "count", "Ban", "previousMessage", "PlayerLog", "ViolationCount", "protection", "Protection", "data", "PREFIX", "getRole", "config", "isSpam", "count", "Mute", "error", "ViolationCount", "PlayerLog", "flag", "player", "index", "inventory", "item", "data", "getConfigId", "AIR", "Log", "violations", "Ban", "Protection", "BANNED_ITEMS", "i", "FORBIDDEN_ITEMS", "enchantments", "enchantment", "MAX_LEVEL", "getMaxEnchantmentLevel", "MinecraftBlockTypes", "MinecraftEntityTypes", "MinecraftItemTypes", "Player", "BLOCKS", "MinecraftBlockTypes", "CHEST_BOATS", "MinecraftItemTypes", "Protection", "block", "permutation", "data", "Player", "MinecraftEntityTypes", "getGamemode", "AIR", "MinecraftEffectTypes", "MinecraftItemTypes", "Player", "world", "CALLBACKS", "vector3Equals", "from", "to", "playerLocation", "PlayerLog", "world", "data", "sendCallback", "player", "callback", "oldLocation", "onPlayerMove", "key", "MOVEMENT_CONSTANTS", "SPEED_EFFECT_INCREASE", "ANTI_TP_DISTANCE_THRESHOLD", "TAGS", "violations", "PlayerLog", "distanceBetween", "loc1", "loc2", "getSpeedOffset", "player", "MinecraftEffectTypes", "SPEED_EFFECT_INCREASE", "isDistanceFlag", "distance", "speedIntensity", "offset", "MOVEMENT_CONSTANTS", "flag", "old", "violationCount", "onPlayerMove", "onPlayerMoveSubKey", "protection", "Protection", "config", "getRole", "tag", "TAGS", "ANTI_TP_DISTANCE_THRESHOLD", "data", "Player", "projectile", "source", "MinecraftItemTypes", "itemStack", "MinecraftEffectTypes", "Player", "world", "e", "world", "data", "Player", "serverOwnerName", "getServerOwnerName", "setRole", "setServerOwner", "MinecraftEffectTypes", "system", "data", "DynamicPropertiesDefinition", "EntityTypes", "MinecraftEntityTypes", "world", "OBJECTIVES", "world", "propertyRegistry", "DIMENSIONS", "ENTITY_LOCATION", "def", "DynamicPropertiesDefinition", "EntityTypes", "ENTITY_IDENTIFIER", "def2", "MinecraftEntityTypes", "def3", "obj", "OBJECTIVES", "NPC_LOCATIONS", "clearNpcLocations", "AIR", "ItemStack", "MinecraftItemTypes", "WORLD_IS_LOADED", "setWorldIsLoaded"] } diff --git a/src/config/app.ts b/src/config/app.ts index 3d54f15..1b1a913 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -6,7 +6,7 @@ | This is the version of rubedo recommended to NOT CHANGE could cause bugs. | */ -export const VERSION = "2.6.2-beta"; +export const VERSION = "2.6.3-beta"; /* |-------------------------------------------------------------------------- diff --git a/texts/bg_BG.lang b/texts/bg_BG.lang index a2c1ac1..7646fa1 100644 --- a/texts/bg_BG.lang +++ b/texts/bg_BG.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Този анти-чийт е създаден от най-добрите създатели на Minecraft и също така използва най-добрата функционалност на Minecraft, за да забрани тези хакери и да защити вашия сървър или всяко творение, което искате да запазите. diff --git a/texts/cs_CZ.lang b/texts/cs_CZ.lang index 410d3e2..21e31b4 100644 --- a/texts/cs_CZ.lang +++ b/texts/cs_CZ.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Tento anti-cheat byl vytvořen nejlepšími tvůrci Minecraftu a také využívá špičkovou funkci Minecraftu k zákazu těchto hackerů a ochraně vašeho serveru nebo jakéhokoli výtvoru, který chcete mít v bezpečí. diff --git a/texts/da_DK.lang b/texts/da_DK.lang index 39103b8..9864aa3 100644 --- a/texts/da_DK.lang +++ b/texts/da_DK.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Denne anti-cheat blev skabt af Minecrafts topskabere og bruger også Minecrafts topfunktionalitet til at forbyde disse hackere og beskytte din server eller enhver skabelse, du ønsker at holde sikker. diff --git a/texts/de_DE.lang b/texts/de_DE.lang index ce763b7..a2a934d 100644 --- a/texts/de_DE.lang +++ b/texts/de_DE.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Dieser Anti-Cheat wurde von den Top-Entwicklern von Minecraft entwickelt und nutzt auch die Top-Funktionalität von Minecraft, um diese Hacker zu verbieten und Ihren Server oder jede Kreation zu schützen, die Sie schützen möchten. diff --git a/texts/el_GR.lang b/texts/el_GR.lang index 1db8e8c..554d23d 100644 --- a/texts/el_GR.lang +++ b/texts/el_GR.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Αυτό το anti-cheat δημιουργήθηκε από τους κορυφαίους δημιουργούς του Minecraft και χρησιμοποιεί επίσης την κορυφαία λειτουργικότητα του Minecraft για να απαγορεύσει αυτούς τους χάκερ και να προστατεύσει τον διακομιστή σας ή οποιαδήποτε δημιουργία θέλετε να κρατήσετε ασφαλή. diff --git a/texts/en_GB.lang b/texts/en_GB.lang index 401a3c5..9c849a5 100644 --- a/texts/en_GB.lang +++ b/texts/en_GB.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=This anti-cheat was created by Minecraft's top creators and also uses Minecraft's top functionality to ban those hackers and protect your server or any creation you want to keep safe. diff --git a/texts/en_US.lang b/texts/en_US.lang index 401a3c5..9c849a5 100644 --- a/texts/en_US.lang +++ b/texts/en_US.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=This anti-cheat was created by Minecraft's top creators and also uses Minecraft's top functionality to ban those hackers and protect your server or any creation you want to keep safe. diff --git a/texts/es_ES.lang b/texts/es_ES.lang index 3d2b9ab..8037b17 100644 --- a/texts/es_ES.lang +++ b/texts/es_ES.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Este anti-trampas fue creado por los principales creadores de Minecraft y también utiliza la funcionalidad superior de Minecraft para prohibir a esos piratas informáticos y proteger su servidor o cualquier creación que desee mantener segura. diff --git a/texts/es_MX.lang b/texts/es_MX.lang index 3d2b9ab..8037b17 100644 --- a/texts/es_MX.lang +++ b/texts/es_MX.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Este anti-trampas fue creado por los principales creadores de Minecraft y también utiliza la funcionalidad superior de Minecraft para prohibir a esos piratas informáticos y proteger su servidor o cualquier creación que desee mantener segura. diff --git a/texts/fi_FI.lang b/texts/fi_FI.lang index 16bee44..7a5a371 100644 --- a/texts/fi_FI.lang +++ b/texts/fi_FI.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Tämän huijauksen eston ovat luoneet Minecraftin parhaat luojat, ja se käyttää myös Minecraftin huipputoimintoja estääkseen hakkerit ja suojellakseen palvelintasi tai mitä tahansa luomusta, jonka haluat pitää turvassa. diff --git a/texts/fr_CA.lang b/texts/fr_CA.lang index d808bb6..ff87646 100644 --- a/texts/fr_CA.lang +++ b/texts/fr_CA.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Cet anti-triche a été créé par les meilleurs créateurs de Minecraft et utilise également les meilleures fonctionnalités de Minecraft pour interdire ces pirates et protéger votre serveur ou toute création que vous souhaitez protéger. diff --git a/texts/fr_FR.lang b/texts/fr_FR.lang index d808bb6..ff87646 100644 --- a/texts/fr_FR.lang +++ b/texts/fr_FR.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Cet anti-triche a été créé par les meilleurs créateurs de Minecraft et utilise également les meilleures fonctionnalités de Minecraft pour interdire ces pirates et protéger votre serveur ou toute création que vous souhaitez protéger. diff --git a/texts/hu_HU.lang b/texts/hu_HU.lang index 487346f..057b697 100644 --- a/texts/hu_HU.lang +++ b/texts/hu_HU.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Ezt a csalás elleni védelmet a Minecraft legjobb alkotói hozták létre, és a Minecraft legfőbb funkcióit is használja a hackerek kitiltására, valamint a szerver vagy a biztonságban tartani kívánt alkotások védelmére. diff --git a/texts/id_ID.lang b/texts/id_ID.lang index 770b02b..af9b16e 100644 --- a/texts/id_ID.lang +++ b/texts/id_ID.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Anti-cheat ini dibuat oleh pembuat top Minecraft dan juga menggunakan fungsionalitas teratas Minecraft untuk melarang peretas tersebut dan melindungi server Anda atau kreasi apa pun yang ingin Anda jaga agar tetap aman. diff --git a/texts/it_IT.lang b/texts/it_IT.lang index 8f6477e..a0b6316 100644 --- a/texts/it_IT.lang +++ b/texts/it_IT.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Questo anti-cheat è stato creato dai migliori creatori di Minecraft e utilizza anche le migliori funzionalità di Minecraft per bandire quegli hacker e proteggere il tuo server o qualsiasi creazione che desideri tenere al sicuro. diff --git a/texts/ja_JP.lang b/texts/ja_JP.lang index 7d5a644..0b4916c 100644 --- a/texts/ja_JP.lang +++ b/texts/ja_JP.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cルベド §7v2.6.2-beta +pack.name=§l§o§kii§r §cルベド §7v2.6.3-beta pack.description=このチート対策は Minecraft のトップ クリエイターによって作成され、Minecraft のトップ機能を使用してそれらのハッカーを禁止し、サーバーや安全に保ちたいすべての作品を保護します。 diff --git a/texts/ko_KR.lang b/texts/ko_KR.lang index 040006b..e6f6964 100644 --- a/texts/ko_KR.lang +++ b/texts/ko_KR.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=이 안티 치트는 Minecraft의 최고 제작자에 의해 만들어졌으며 Minecraft의 최고 기능을 사용하여 해당 해커를 차단하고 서버 또는 안전하게 유지하려는 모든 창작물을 보호합니다. diff --git a/texts/nb_NO.lang b/texts/nb_NO.lang index f39604c..68f9352 100644 --- a/texts/nb_NO.lang +++ b/texts/nb_NO.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Denne anti-juksen ble laget av Minecrafts beste skapere og bruker også Minecrafts toppfunksjonalitet for å utestenge disse hackerne og beskytte serveren din eller en hvilken som helst kreasjon du vil holde trygg. diff --git a/texts/nl_NL.lang b/texts/nl_NL.lang index af7de9d..a54ce7b 100644 --- a/texts/nl_NL.lang +++ b/texts/nl_NL.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Deze anti-cheat is gemaakt door de beste makers van Minecraft en gebruikt ook de topfunctionaliteit van Minecraft om die hackers te verbannen en je server of elke creatie die je veilig wilt houden te beschermen. diff --git a/texts/pl_PL.lang b/texts/pl_PL.lang index 9cde15f..5dde864 100644 --- a/texts/pl_PL.lang +++ b/texts/pl_PL.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Ten anty-cheat został stworzony przez najlepszych twórców Minecrafta, a także wykorzystuje najlepsze funkcje Minecrafta do blokowania tych hakerów i ochrony serwera lub dowolnego dzieła, które chcesz zabezpieczyć. diff --git a/texts/pt_BR.lang b/texts/pt_BR.lang index de0b1e6..131c322 100644 --- a/texts/pt_BR.lang +++ b/texts/pt_BR.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Este anti-cheat foi criado pelos principais criadores do Minecraft e também usa a principal funcionalidade do Minecraft para banir esses hackers e proteger seu servidor ou qualquer criação que você queira manter segura. diff --git a/texts/pt_PT.lang b/texts/pt_PT.lang index de0b1e6..131c322 100644 --- a/texts/pt_PT.lang +++ b/texts/pt_PT.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Este anti-cheat foi criado pelos principais criadores do Minecraft e também usa a principal funcionalidade do Minecraft para banir esses hackers e proteger seu servidor ou qualquer criação que você queira manter segura. diff --git a/texts/ru_RU.lang b/texts/ru_RU.lang index 86dc9be..103bdcf 100644 --- a/texts/ru_RU.lang +++ b/texts/ru_RU.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Этот античит был создан лучшими создателями Minecraft, а также использует лучшие функциональные возможности Minecraft для блокировки этих хакеров и защиты вашего сервера или любого творения, которое вы хотите сохранить в безопасности. diff --git a/texts/sk_SK.lang b/texts/sk_SK.lang index 2ee353e..7dc6fbb 100644 --- a/texts/sk_SK.lang +++ b/texts/sk_SK.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Tento anti-cheat bol vytvorený špičkovými tvorcami Minecraftu a tiež využíva špičkové funkcie Minecraftu na zákaz týchto hackerov a ochranu vášho servera alebo akéhokoľvek výtvoru, ktorý chcete zachovať v bezpečí. diff --git a/texts/sv_SE.lang b/texts/sv_SE.lang index e11c2e3..3a61853 100644 --- a/texts/sv_SE.lang +++ b/texts/sv_SE.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Detta anti-fusk skapades av Minecrafts främsta skapare och använder även Minecrafts toppfunktioner för att förbjuda dessa hackare och skydda din server eller någon skapelse du vill hålla säker. diff --git a/texts/tr_TR.lang b/texts/tr_TR.lang index 7e8addc..2298098 100644 --- a/texts/tr_TR.lang +++ b/texts/tr_TR.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Bu hile karşıtı, Minecraft'ın en iyi yaratıcıları tarafından oluşturuldu ve aynı zamanda bu bilgisayar korsanlarını yasaklamak ve sunucunuzu veya güvende tutmak istediğiniz herhangi bir ürünü korumak için Minecraft'ın en iyi işlevselliğini kullanıyor. diff --git a/texts/uk_UA.lang b/texts/uk_UA.lang index 699cdab..1b91580 100644 --- a/texts/uk_UA.lang +++ b/texts/uk_UA.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=Цей античіт був створений найкращими творцями Minecraft, а також використовує найкращі функції Minecraft, щоб заборонити цих хакерів і захистити ваш сервер або будь-яке творіння, яке ви хочете зберегти. diff --git a/texts/zh_CN.lang b/texts/zh_CN.lang index 2421c6f..a318f86 100644 --- a/texts/zh_CN.lang +++ b/texts/zh_CN.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=这种反作弊是由 Minecraft 的顶级创作者创建的,并且还使用 Minecraft 的顶级功能来禁止这些黑客并保护您的服务器或您想要保持安全的任何创作。 diff --git a/texts/zh_TW.lang b/texts/zh_TW.lang index 2421c6f..a318f86 100644 --- a/texts/zh_TW.lang +++ b/texts/zh_TW.lang @@ -1,2 +1,2 @@ -pack.name=§l§o§kii§r §cRubedo §7v2.6.2-beta +pack.name=§l§o§kii§r §cRubedo §7v2.6.3-beta pack.description=这种反作弊是由 Minecraft 的顶级创作者创建的,并且还使用 Minecraft 的顶级功能来禁止这些黑客并保护您的服务器或您想要保持安全的任何创作。