├── README.md └── scripts ├── antiBLM.js ├── antiXray.js ├── attackParticle.js ├── bannedMob.js ├── bossbar.js ├── bowDing.js ├── customprefix.js ├── elevator.js ├── essentialsPlus.js ├── fun.js ├── gui_images ├── no.png └── yes.png ├── guiform.js ├── index.js ├── ipBan.js ├── kit.js ├── mobHealthBossbar.js ├── mobReward.js ├── mocking.js ├── pay.js ├── playerJoin.js ├── techSelect.js ├── weather.js └── xraytoggle.js /README.md: -------------------------------------------------------------------------------- 1 | # EZ-Scripts 2 | ## Server Scripts for [ElementZero](https://github.com/Element-0/ElementZero) 3 | 4 | written in JaveScript 5 | 6 | ## How to use 7 | 8 | 9 | 1. Turn off your [ElementZero](https://github.com/Element-0/ElementZero) server 10 | 2. Download and unzip this repo directory 11 | 3. Drag the "/scripts" directory into your [ElementZero](https://github.com/Element-0/ElementZero) server root directory 12 | 4. Delete the script in `index.js` and only keep the scripts you want. 13 | 5. Configure the script and change the settings if you wish to 14 | 6. Enable ScriptingSupport in custom.yaml `ScriptingSupport: enabled: true` 15 | 7. boot up the server 16 | -------------------------------------------------------------------------------- /scripts/antiBLM.js: -------------------------------------------------------------------------------- 1 | import { 2 | onChat 3 | } from "ez:chat"; 4 | 5 | const system = server.registerSystem(0, 0); 6 | 7 | const blm = ['blm']; 8 | const blackLivesMatter = ['blacklivesmatter']; 9 | const alm = ['alm']; 10 | const allLivesMatter = ['alllivesmatter']; 11 | 12 | onChat((clown) => { 13 | try { 14 | const rawText1 = { 15 | rawtext : [{ 16 | text : "<§eInto§6CMD§r> Naw bro All Lives Matter." 17 | }] 18 | }; 19 | const rawText2 = { 20 | rawtext : [{ 21 | text : "<§eInto§6CMD§r> Yes All Lives Matter." 22 | }] 23 | }; 24 | if (clown.content.replace(/[^\w\t\r\n!?]/g,'').toLowerCase().includes(blm[0])) { 25 | system.executeCommand(`kill "${clown.sender}"`, () => {}); 26 | system.executeCommand(`tellraw @a ${JSON.stringify(rawText1)}`, () => {}); 27 | } 28 | if (clown.content.replace(/[^\w\t\r\n!?]/g,'').toLowerCase().includes(blackLivesMatter[0])) { 29 | system.executeCommand(`kill "${clown.sender}"`, () => {}); 30 | system.executeCommand(`tellraw @a ${JSON.stringify(rawText1)}`, () => {}); 31 | } 32 | if (clown.content.replace(/[^\w\t\r\n!?]/g,'').toLowerCase().includes(alm[0])) { 33 | system.executeCommand(`tellraw @a ${JSON.stringify(rawText2)}`, () => {}); 34 | } 35 | if (clown.content.replace(/[^\w\t\r\n!?]/g,'').toLowerCase().includes(allLivesMatter[0])) { 36 | system.executeCommand(`tellraw @a ${JSON.stringify(rawText2)}`, () => {}); 37 | } 38 | } catch(err) { 39 | console.error(err); 40 | } 41 | }); 42 | 43 | console.log("antiBLM.js loaded"); -------------------------------------------------------------------------------- /scripts/antiXray.js: -------------------------------------------------------------------------------- 1 | const system = server.registerSystem(0, 0); 2 | 3 | system.listenForEvent("minecraft:player_destroyed_block", ({data: eventData}) => { 4 | const { 5 | player: entity, 6 | block_identifier: blockName, 7 | block_position: blockPosition 8 | } = eventData 9 | let entityName = system.getComponent(entity, "minecraft:nameable" ).data.name 10 | 11 | const mineBlocks = { 12 | "minecraft:iron_ore" : blockName, 13 | "minecraft:gold_ore": blockName, 14 | "minecraft:diamond_ore": blockName, 15 | "minecraft:lapis_ore": blockName, 16 | "minecraft:redstone_ore": blockName, 17 | "minecraft:lit_redstone_ore": blockName, 18 | "minecraft:coal_ore": blockName, 19 | "minecraft:emerald_ore": blockName, 20 | "minecraft:quartz_ore": blockName, 21 | "minecraft:nether_gold_ore": blockName 22 | } 23 | if (blockName in mineBlocks) { 24 | system.executeCommand(`tellraw @a[tag=xrayAlert] {"rawtext":[{"text":"§3${entityName}§7 mined §f${blockName.replace("minecraft:","")}§7 at §6${Object.values(blockPosition).join(", ")}"}]}`, () => {}) 25 | } 26 | } 27 | ) 28 | console.log("antiXray.js loaded"); -------------------------------------------------------------------------------- /scripts/attackParticle.js: -------------------------------------------------------------------------------- 1 | const system = server.registerSystem(0, 0); 2 | 3 | system.listenForEvent("minecraft:player_attacked_entity", ({data: eventData}) => { 4 | const { 5 | player: entity, 6 | attacked_entity: attackedEntity 7 | 8 | } = eventData 9 | 10 | let particleEventData = system.createEventData( "minecraft:spawn_particle_attached_entity" ) 11 | particleEventData.data.effect = "minecraft:redstone_ore_dust_particle" 12 | particleEventData.data.offset = [ 0, 1, 0 ] 13 | particleEventData.data.entity = attackedEntity 14 | system.broadcastEvent("minecraft:spawn_particle_attached_entity", particleEventData) 15 | }) 16 | console.log("attackParticle.js loaded"); -------------------------------------------------------------------------------- /scripts/bannedMob.js: -------------------------------------------------------------------------------- 1 | const system = server.registerSystem(0, 0); 2 | 3 | system.listenForEvent("minecraft:entity_created", (eventData) => { 4 | const entityCreated = eventData.data.entity 5 | let entityIdentifier = entityCreated.__identifier__.replace("minecraft:", ""); 6 | 7 | const bannedMobs = { 8 | "wither" : entityIdentifier 9 | }; 10 | 11 | if (entityIdentifier in bannedMobs) { 12 | system.executeCommand(`kill @e[type=${entityIdentifier}]`, () => {}); 13 | } 14 | } 15 | ) 16 | console.log("bannedMob.js loaded"); -------------------------------------------------------------------------------- /scripts/bossbar.js: -------------------------------------------------------------------------------- 1 | import { 2 | onPlayerInitialized 3 | } from "ez:player"; 4 | 5 | import { 6 | create 7 | } from "ez:bossbar"; 8 | 9 | const system = server.registerSystem(0, 0); 10 | 11 | onPlayerInitialized(player => { 12 | //player: PlayerEntry, text: string, percent: number 13 | create(player,'§e§lInto§6CMD §r§7Season §b8',100) 14 | console.log("bossbar activated for " + player.name); 15 | }) 16 | console.log("bossbar.js loaded"); -------------------------------------------------------------------------------- /scripts/bowDing.js: -------------------------------------------------------------------------------- 1 | import { 2 | executeCommand 3 | } from "ez:command"; 4 | 5 | const system = server.registerSystem(0, 0); 6 | 7 | system.listenForEvent("minecraft:entity_hurt", ({data: eventData}) => { 8 | const { 9 | attacker, 10 | entity, 11 | cause 12 | } = eventData 13 | const attackerName = system.getComponent(attacker, "minecraft:nameable").data.name; 14 | if (cause === "projectile") { 15 | system.executeCommand(`execute "${attackerName}" ~ ~ ~ playsound random.orb @s ~ ~ ~ 0.4 0.5`, () => {}); 16 | 17 | } 18 | }) 19 | console.log("bowDing.js loaded"); -------------------------------------------------------------------------------- /scripts/customprefix.js: -------------------------------------------------------------------------------- 1 | import { 2 | getBalance, 3 | updateBalance 4 | } from "ez:economy"; 5 | 6 | import { 7 | executeCommand, 8 | registerCommand, 9 | registerOverride 10 | } from "ez:command"; 11 | 12 | import { 13 | send 14 | } from "ez:formui"; 15 | 16 | const price = 4000; 17 | const maxPrefixLength = 8; 18 | 19 | registerCommand("customprefix", "Open custom prefix store.", 0); 20 | registerOverride("customprefix", [], function () { 21 | if (this.player) { 22 | const playerBal = getBalance(this.player) 23 | send(this.player, { 24 | type: "custom_form", 25 | title: "§l§aCustom §bPrefix §eStore", 26 | content: [ 27 | { 28 | "type": "label", 29 | "text": "§6Price: §e$" + price 30 | }, 31 | { 32 | "type": "toggle", 33 | "text": "Bold", 34 | "default": false 35 | }, 36 | { 37 | "type": "input", 38 | "text": "insert prefix below", 39 | "placeholder": "Prefix" 40 | } 41 | ] 42 | }, data => { 43 | if (data == null) return; 44 | let playerName = this.player.name; 45 | let [placeholder, bold, prefix] = data; 46 | console.log(prefix.length); 47 | if (playerBal < price) { 48 | executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§cno can do, you need $${price}"}]}`); 49 | }else if (prefix.length <= maxPrefixLength) { 50 | updateBalance(this.player, -price, "change prefix"); 51 | if (bold) executeCommand("custom-name set prefix \"" + playerName + "\" \"§r§7~§r§l" + prefix + " §r\""); 52 | else executeCommand("custom-name set prefix \"" + playerName + "\" \"§r§7~§r" + prefix + " §r\""); 53 | }else executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§cno can do, prefix character limit: ${maxPrefixLength}"}]}`); 54 | } 55 | ); 56 | return null 57 | } 58 | throw ["error, this command can only be used in game!"] 59 | }); 60 | 61 | console.log("customprefix.js loaded"); -------------------------------------------------------------------------------- /scripts/elevator.js: -------------------------------------------------------------------------------- 1 | const system = server.registerSystem(0, 0); 2 | 3 | //what block is used for elevator 4 | let eBlockName = "minecraft:iron_block"; 5 | //max elevator teleport distance 6 | let maxUpDis = 10; 7 | 8 | system.listenForEvent("minecraft:entity_sneak", ({data: eventData}) => { 9 | const { 10 | entity, 11 | sneaking 12 | } = eventData 13 | let playerPos = system.getComponent(entity, "minecraft:position").data; 14 | let playerName = system.getComponent(entity, "minecraft:nameable" ).data.name; 15 | let pX = transNum(playerPos.x); 16 | let pY = transNum(playerPos.y); 17 | let pZ = transNum(playerPos.z); 18 | let bX = pX 19 | let bY = pY-1 20 | let bZ = pZ 21 | let tickAreaCmp = system.getComponent(entity, "minecraft:tick_world" /* TickWorld */); 22 | let tickingArea = tickAreaCmp.data.ticking_area; 23 | let ifFind = false; 24 | let block = system.getBlock(tickingArea, bX, bY, bZ); 25 | let blockName = block.__identifier__; 26 | if (blockName == eBlockName && sneaking === true) { 27 | for (let i = 1; i <= maxUpDis; i++) { 28 | let tblock = system.getBlock(tickingArea, bX, bY - i, bZ); 29 | let testBlockName = tblock.__identifier__; 30 | if (testBlockName == blockName) { 31 | let targetY = bY - i + 1 32 | system.executeCommand(`execute "${playerName}" ~ ~ ~ tp ~ ` + targetY + ` ~`, data => { }); 33 | system.executeCommand(`playsound tile.piston.in "${playerName}" ${bX} ${targetY} ${bZ} 1 1`, data => { }); 34 | ifFind = true; 35 | i = maxUpDis + 1; 36 | } 37 | } 38 | if (!ifFind) { 39 | system.executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§cUnable to find ${eBlockName} in ${maxUpDis} blocks below"}]}`, data => { }); 40 | } 41 | } 42 | }) 43 | 44 | system.listenForEvent("minecraft:block_destruction_started", ({data: eventData}) => { 45 | const { 46 | player 47 | } = eventData 48 | let playerPos = getPosCmp(player); 49 | let playerName = system.getComponent(player, "minecraft:nameable" ).data.name; 50 | let pX = transNum(playerPos.x); 51 | let pY = transNum(playerPos.y); 52 | let pZ = transNum(playerPos.z); 53 | let bX = pX 54 | let bY = pY-1 55 | let bZ = pZ 56 | let tickAreaCmp = system.getComponent(player, "minecraft:tick_world" /* TickWorld */); 57 | let tickingArea = tickAreaCmp.data.ticking_area; 58 | let ifFind = false; 59 | let block = system.getBlock(tickingArea, bX, bY, bZ); 60 | let blockName = block.__identifier__; 61 | if (blockName == eBlockName) { 62 | for (let i = 1; i <= maxUpDis; i++) { 63 | let tblock = system.getBlock(tickingArea, bX, bY + i, bZ); 64 | let testBlockName = tblock.__identifier__; 65 | if (testBlockName == blockName) { 66 | let targetY = bY + i + 1 67 | system.executeCommand(`execute "${playerName}" ~ ~ ~ tp ~ ` + targetY + ` ~`, data => { }); 68 | system.executeCommand(`playsound tile.piston.out "${playerName}" ${bX} ${targetY} ${bZ} 1 1`, data => { }); 69 | i = maxUpDis + 1; 70 | ifFind = true; 71 | } 72 | } 73 | if (!ifFind) { 74 | system.executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§cUnable to find ${eBlockName} in ${maxUpDis} blocks above"}]}`, data => { }); 75 | } 76 | } 77 | }); 78 | 79 | function transNum(n) { 80 | return Math.floor(n); 81 | } 82 | function getPosCmp(entity) { 83 | return system.getComponent(entity, "minecraft:position").data; 84 | } 85 | 86 | console.log("elevator.js loaded"); -------------------------------------------------------------------------------- /scripts/essentialsPlus.js: -------------------------------------------------------------------------------- 1 | import { 2 | getBalance, 3 | updateBalance 4 | } from "ez:economy"; 5 | 6 | import { 7 | executeCommand, 8 | registerCommand, 9 | registerOverride, 10 | addEnum 11 | } from "ez:command"; 12 | 13 | const system = server.registerSystem(0, 0); 14 | 15 | //define sea level 16 | const seaLevel = 63 17 | //define how many block you can tp using /top and /down 18 | let testBlockNum = 100; 19 | //most mobs can be spawned with custom summon 20 | const mostSpawnAmount = 50 21 | 22 | registerCommand("suicide", "Commit suicide.", 0); 23 | registerCommand("info", "Show your connection info.", 0); 24 | registerCommand("balcheck", "Check other player's balance.", 0); 25 | registerCommand("depth", "Displays your current block depth.", 0); 26 | 27 | registerCommand("bc", "Broadcast a message.", 1); 28 | registerCommand("smite", "Smite players.", 1); 29 | registerCommand("top", "Teleport to the very top air block.", 1); 30 | registerCommand("down", "Teleport to the very buttom air block.", 1); 31 | registerCommand("punish", "punish a player.", 1); 32 | registerCommand("spawnmob", "Spawns a mob.", 1); 33 | registerCommand("gmc", "Change player gamemode.", 1); 34 | registerCommand("gms", "Change player gamemode.", 1); 35 | 36 | registerOverride("suicide", [], function () { 37 | if (this.entity) { 38 | this.entity.kill(); 39 | }else throw ["error, this command can only be used in game!"]; 40 | }); 41 | registerOverride("info", [], function () { 42 | if (this.player) { 43 | let playerName = this.player.name; 44 | let playerXuid = this.player.xuid; 45 | let playerUuid = this.player.uuid; 46 | let playerIP = this.player.address.split("|")[0]; 47 | let playerPort = this.player.address.split("|")[1]; 48 | executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§b---§e${playerName}§b---\n§eXUID: §6${playerXuid}\n§aUUID: §6${playerUuid}\n§bIP: §6${playerIP}\n§5Port: §6${playerPort}\n§aDont worry only you can see the info above."}]}`); 49 | }else throw ["error, this command can only be used in game!"]; 50 | }); 51 | registerOverride("balcheck", [{type: "players", name: "player", optional: false}], function (targets) { 52 | if (targets.length != 1) throw "You can only check 1 player's balance at a time."; 53 | let targetName = targets[0].name; 54 | let targetBal = getBalance(targets[0]); 55 | if (this.player) { 56 | let thisName = this.player.name; 57 | executeCommand(`tellraw "${thisName}" {"rawtext":[{"text":"§e${targetName}'s balance: §b${targetBal}"}]}`); 58 | if (targetName === thisName) executeCommand(`tellraw "${thisName}" {"rawtext":[{"text":"§6tips:\n§eyou can just use §3/balance §eto check your own balance"}]}`); 59 | }else throw[targetName + "'s balance: " + targetBal]; 60 | }); 61 | registerOverride("depth", [], function () { 62 | if (this.entity) { 63 | let playerName = this.player.name; 64 | let yPos = Math.floor(system.getComponent(this.entity.vanilla, "minecraft:position").data.y); 65 | if (yPos > seaLevel) { 66 | let yDifference = yPos - seaLevel 67 | executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§6You are §c${yDifference} §6block(s) above sea level."}]}`); 68 | }else if (yPos < seaLevel) { 69 | let yDifference = seaLevel - yPos 70 | executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§6You are §c${yDifference} §6block(s) below sea level."}]}`); 71 | }else executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§6You are at sea level."}]}`); 72 | }else throw ["error, this command can only be used in game!"]; 73 | }); 74 | 75 | registerOverride("bc", [{type: "string", name: "text", optional: false}], function (content) { 76 | executeCommand(`tellraw @a {"rawtext":[{"text":"${content}"}]}`); 77 | }); 78 | registerOverride("smite", [{type: "players", name: "player", optional: false}], function (targets) { 79 | if (targets.length != 1) throw "You can only smite 1 player at a time."; 80 | let targetName = targets[0].name; 81 | executeCommand(`execute "${targetName}" ~ ~ ~ summon lightning_bolt`); 82 | if (this.player) { 83 | let smiteName = this.player.name; 84 | executeCommand(`tellraw @a {"rawtext":[{"text":"§6${targetName} §egot smote by §b${smiteName}"}]}`); 85 | }else executeCommand(`tellraw @a {"rawtext":[{"text":"§6${targetName} §egot smote by §bServer"}]}`); 86 | }); 87 | registerOverride("top", [], function () { 88 | if (this.player) { 89 | var tickingArea = system.getComponent(this.entity.vanilla, "minecraft:tick_world").data.ticking_area; 90 | let playerName = this.player.name 91 | let playerPos = system.getComponent(this.entity.vanilla, "minecraft:position").data; 92 | let playerPosX = playerPos.x; 93 | let playerPosY = Math.floor(playerPos.y); 94 | let playerPosZ = playerPos.z; 95 | for (var i = 1; i < testBlockNum; i++) { 96 | var curBlock = system.getBlock(tickingArea, playerPosX, playerPosY + i, playerPosZ).__identifier__; 97 | var nextBlock = system.getBlock(tickingArea, playerPosX, playerPosY + i + 1, playerPosZ).__identifier__; 98 | var next2Block = system.getBlock(tickingArea, playerPosX, playerPosY + i + 2, playerPosZ).__identifier__; 99 | if (curBlock != "minecraft:air" && nextBlock == "minecraft:air" && next2Block == "minecraft:air") { 100 | system.executeCommand("tp @a[name=\"" + this.name + "\"] " + playerPosX + " " + (playerPosY + i + 1) + " " + playerPosZ, function(data) {}); 101 | i = testBlockNum + 1; 102 | } 103 | if (i == testBlockNum - 1) { 104 | throw "No safe air block found in " + testBlockNum + " blocks above"; 105 | } 106 | } 107 | }else throw ["error, this command can only be used in game!"]; 108 | }); 109 | registerOverride("down", [], function () { 110 | if (this.player) { 111 | var tickingArea = system.getComponent(this.entity.vanilla, "minecraft:tick_world").data.ticking_area; 112 | let playerName = this.player.name 113 | let playerPos = system.getComponent(this.entity.vanilla, "minecraft:position").data; 114 | let playerPosX = playerPos.x; 115 | let playerPosY = Math.floor(playerPos.y); 116 | let playerPosZ = playerPos.z; 117 | for (var i = 2; i < testBlockNum; i++) { 118 | var curBlock = system.getBlock(tickingArea, playerPosX, playerPosY - i, playerPosZ).__identifier__; 119 | var nextBlock = system.getBlock(tickingArea, playerPosX, playerPosY - i + 1, playerPosZ).__identifier__; 120 | var next2Block = system.getBlock(tickingArea, playerPosX, playerPosY - i + 2, playerPosZ).__identifier__; 121 | if (curBlock != "minecraft:air" && nextBlock == "minecraft:air" && next2Block == "minecraft:air") { 122 | system.executeCommand("tp @a[name=\"" + this.name + "\"] " + playerPosX + " " + (playerPosY - i + 1) + " " + playerPosZ, function(data) {}); 123 | i = testBlockNum + 1; 124 | } 125 | if (i == testBlockNum - 1) { 126 | throw "No safe air block found in " + testBlockNum + " blocks below"; 127 | } 128 | } 129 | }else throw ["error, this command can only be used in game!"]; 130 | }); 131 | addEnum("punish-type", ["ban", "kick"]); 132 | registerOverride("punish", [{type: "enum", enum: "punish-type", name: "type", optional: false},{type: "players", name: "player", optional: false},{type: "string", name: "reason", optional: true}], function (type,targets,reason) { 133 | if (targets.length != 1) throw "You can only punish 1 player at a time."; 134 | let targetName = targets[0].name; 135 | var reason = (typeof reason === 'undefined') ? "no reason provided" : reason; 136 | if (type === 0) { 137 | executeCommand(`tellraw @a {"rawtext":[{"text":"§c${targetName} has been banned from the server.\n§bReason: §e${reason}"}]}`); 138 | executeCommand(`ban "${targetName}" "§cYou have been banned from the server\n§cReason: §e${reason}§r"`); 139 | }else { 140 | executeCommand(`tellraw @a {"rawtext":[{"text":"§c${targetName} has been kicked from the server.\n§bReason: §e${reason}"}]}`); 141 | executeCommand(`kick "${targetName}" "§e${reason}§r"`); 142 | } 143 | }); 144 | registerOverride("spawnmob", [{type: "players", name: "player", optional: false},{type: "string", name: "entityType", optional: false},{type: "int", name: "amount", optional: false},{type: "string", name: "nameTag", optional: false}], function (targets, mobType, amount, nameTag) { 145 | if (amount > mostSpawnAmount) throw "That is way too much to spawn."; 146 | if (targets.length != 1) throw "You can only spawn mobs for 1 player at a time."; 147 | let playerName = targets[0].name; 148 | for (var i = 0; i < amount; i++) { 149 | executeCommand(`execute "${playerName}" ~ ~ ~ summon ${mobType} ${nameTag}`); 150 | } 151 | }); 152 | registerOverride("gmc", [], function () { 153 | if (this.player) { 154 | let playerName = this.player.name; 155 | executeCommand(`gamemode 1 ${playerName}`); 156 | } 157 | }) 158 | registerOverride("gms", [], function () { 159 | if (this.player) { 160 | let playerName = this.player.name; 161 | executeCommand(`gamemode 0 ${playerName}`); 162 | } 163 | }) 164 | 165 | console.log("essentialsPlus.js loaded"); -------------------------------------------------------------------------------- /scripts/fun.js: -------------------------------------------------------------------------------- 1 | import { 2 | onChat 3 | } from "ez:chat"; 4 | 5 | const system = server.registerSystem(0, 0); 6 | 7 | const foo = { 8 | "marco" : "polo", 9 | "lol" : "Whats so funny", 10 | "lmao" : "Whats so funny", 11 | "hongyi is handsome" : "He is super handsome", 12 | "hongyi is ugly" : "Your mom is ugly", 13 | "hongyimc is handsome" : "He is super handsome", 14 | "hongyimc is ugly" : "Your mom is ugly", 15 | "who is candice" : "Candice d**k fit in your mouth?", 16 | "who is candice?" : "Candice d**k fit in your mouth?", 17 | "how to play" : "Use a boat to leave spawn and enjoy vanilla survival", 18 | "how to play survival" : "Use a boat to leave spawn and enjoy vanilla survival", 19 | "how do i play" : "Use a boat to leave spawn and enjoy vanilla survival", 20 | "how do i play survival" : "Use a boat to leave spawn and enjoy vanilla survival", 21 | "how do i leave spawn" : "Use a boat to leave spawn and enjoy vanilla survival", 22 | "how to leave spawn" : "Use a boat to leave spawn and enjoy vanilla survival", 23 | "how to play?" : "Use a boat to leave spawn and enjoy vanilla survival", 24 | "how to play survival?" : "Use a boat to leave spawn and enjoy vanilla survival", 25 | "how do i play?" : "Use a boat to leave spawn and enjoy vanilla survival", 26 | "how do i play survival?" : "Use a boat to leave spawn and enjoy vanilla survival", 27 | "how do i leave spawn?" : "Use a boat to leave spawn and enjoy vanilla survival", 28 | "how to leave spawn?" : "Use a boat to leave spawn and enjoy vanilla survival", 29 | "hi" : "hello!" 30 | }; 31 | 32 | onChat( ({ content }) => { 33 | if (content.toLowerCase() in foo) { 34 | const rawText = { 35 | rawtext : [{ 36 | text : "<§eInto§6CMD§r> " + foo[content.toLowerCase()] 37 | }] 38 | }; 39 | system.executeCommand(`tellraw @a ${JSON.stringify(rawText)}`, () => {}); 40 | } 41 | }); 42 | console.log("fun.js loaded"); -------------------------------------------------------------------------------- /scripts/gui_images/no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HongyiMC/EZ-Scripts/2b34ecdc850b3cd8311350c33a9230a068ca0736/scripts/gui_images/no.png -------------------------------------------------------------------------------- /scripts/gui_images/yes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HongyiMC/EZ-Scripts/2b34ecdc850b3cd8311350c33a9230a068ca0736/scripts/gui_images/yes.png -------------------------------------------------------------------------------- /scripts/guiform.js: -------------------------------------------------------------------------------- 1 | import { 2 | executeCommand, 3 | registerCommand, 4 | registerOverride 5 | } from "ez:command"; 6 | 7 | import { 8 | send 9 | } from "ez:formui"; 10 | 11 | registerCommand("guiform", "Open image gui.", 0); 12 | registerOverride("guiform", [], function () { 13 | if (this.player) { 14 | send(this.player, { 15 | "type": "form", 16 | "title": "§eTell me about you", 17 | "content": "Are you handsome?", 18 | "buttons": [ 19 | { 20 | "text": "§l§aYES", 21 | "image": { 22 | "type": "url", 23 | "data": "https://raw.githubusercontent.com/HongyiMC/EZ-Scripts/master/scripts/gui_images/yes.png?raw=true" 24 | } 25 | }, 26 | { 27 | "text": "§l§cNO", 28 | "image": { 29 | "type": "url", 30 | "data": "https://raw.githubusercontent.com/HongyiMC/EZ-Scripts/master/scripts/gui_images/no.png?raw=true" 31 | } 32 | } 33 | ] 34 | }, data => { 35 | if (data == null) return; 36 | let playerName = this.player.name 37 | if (data == 0) executeCommand("tellraw \"" + playerName + "\" {\"rawtext\":[{\"text\":\"§aYou are a handsome boy.\"}]}"); 38 | else executeCommand("tellraw \"" + playerName + "\" {\"rawtext\":[{\"text\":\"§cEww go away...\"}]}"); 39 | } 40 | ); 41 | return null 42 | } 43 | throw ["error, this command can only be used in game!", "/guiform"] 44 | }); 45 | 46 | console.log("guiform.js loaded"); -------------------------------------------------------------------------------- /scripts/index.js: -------------------------------------------------------------------------------- 1 | import "./antiBLM.js" 2 | import "./antiXray.js" 3 | import "./attackParticle.js" 4 | import "./bannedMob.js" 5 | import "./bossbar.js" 6 | import "./bowDing.js" 7 | import "./customprefix.js" 8 | import "./elevator.js" 9 | import "./essentialsPlus.js" 10 | import "./fun.js" 11 | import "./guiform.js" 12 | import "./ipBan.js" 13 | import "./kit.js" 14 | import "./mobHealthBossbar.js" 15 | import "./mobReward.js" 16 | import "./mocking.js" 17 | import "./pay.js" 18 | import "./playerJoin.js" 19 | import "./techSelect.js" 20 | import "./weather.js" 21 | import "./xraytoggle.js" -------------------------------------------------------------------------------- /scripts/ipBan.js: -------------------------------------------------------------------------------- 1 | import { 2 | onPlayerJoined, 3 | getPlayerByNAME 4 | } from "ez:player"; 5 | 6 | const system = server.registerSystem(0, 0); 7 | 8 | onPlayerJoined(player => { 9 | const playerInfo = player.name 10 | const playerName = getPlayerByNAME(playerInfo); 11 | const playerIP = playerName.address.split("|")[0] 12 | const fIp = playerIP.split(".")[0] 13 | const sIp = playerIP.split(".")[1] 14 | const tIp = playerIP.split(".")[2] 15 | const newIp = fIp + "." + sIp + "." + tIp 16 | const bannedIP = { 17 | "192.119.160" : newIp, 18 | "104.232.37" : newIp, 19 | "152.89.162" : newIp, 20 | "46.19.139" : newIp, 21 | "179.43.168" : newIp, 22 | "185.209.177" : newIp 23 | } 24 | if (newIp in bannedIP) { 25 | console.log(playerInfo + " is trying to log on using banned ip: " + playerIP); 26 | system.executeCommand(`ban "${playerInfo}" "Banned IP"`, () => {}); 27 | console.log("Banned " + playerInfo); 28 | } 29 | else { 30 | console.log("IP: " + playerIP + " is good.") 31 | } 32 | }) 33 | console.log("ipBan.js loaded"); -------------------------------------------------------------------------------- /scripts/kit.js: -------------------------------------------------------------------------------- 1 | import { 2 | executeCommand, 3 | registerCommand, 4 | registerOverride, 5 | addEnum 6 | } from "ez:command"; 7 | 8 | registerCommand("kit", "Recieve kits.", 0); 9 | addEnum("selectKit", ["starter"]); 10 | registerOverride("kit", [{type: "enum", name: "selectKit", optional: false, enum: "selectKit"}], function () { 11 | let playerName = this.player.name; 12 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_sword`); 13 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_pickaxe`); 14 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_shovel`); 15 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] cooked_beef 32`); 16 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] shield`); 17 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_helmet`); 18 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_chestplate`); 19 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_leggings`); 20 | executeCommand(`give @a[tag=!kitStarter,name=${playerName}] iron_boots`); 21 | executeCommand(`tellraw @a[tag=kitStarter,name=${playerName}] {"rawtext":[{"text":"§cYou have already claimed your starter kit."}]}`); 22 | executeCommand(`tag @a[tag=!kitStarter,name=${playerName}] add kitStarter`); 23 | }); 24 | 25 | console.log("kit.js loaded"); -------------------------------------------------------------------------------- /scripts/mobHealthBossbar.js: -------------------------------------------------------------------------------- 1 | import { 2 | getPlayerByNAME 3 | } from "ez:player"; 4 | 5 | import { 6 | create 7 | } from "ez:bossbar"; 8 | 9 | const system = server.registerSystem(0, 0); 10 | 11 | function percentage(healthNow, healthMax) 12 | { 13 | return (healthNow/healthMax); 14 | } 15 | 16 | system.listenForEvent("minecraft:entity_hurt", ({data: eventData}) => { 17 | const { 18 | attacker, 19 | damage, 20 | entity 21 | } = eventData; 22 | if (entity.__identifier__ === "minecraft:player") return; 23 | const healthMax = system.getComponent(entity, "minecraft:health").data.max; 24 | const healthBefore = system.getComponent(entity, "minecraft:health").data.value; 25 | const healthNow = healthBefore - damage; 26 | let healthPercentage = percentage(healthNow, healthMax); 27 | const hitter = system.getComponent(attacker, "minecraft:nameable").data.name; 28 | const hitterName = getPlayerByNAME(hitter); 29 | const bar = create(hitterName,entity.__identifier__,healthPercentage); 30 | setTimeout(() => bar.destory(), 10); 31 | //console.log(hitterName.name + " hit " + entity.__identifier__, healthMax, healthBefore, damage, healthNow, healthPercentage); 32 | if (healthPercentage < 0) { 33 | let healthPercentage = 0 34 | bar 35 | } 36 | else { 37 | bar 38 | } 39 | }) 40 | console.log("mobHealthBossbar.js loaded"); -------------------------------------------------------------------------------- /scripts/mobReward.js: -------------------------------------------------------------------------------- 1 | import { 2 | getBalance, 3 | updateBalance 4 | } from "ez:economy"; 5 | 6 | import { 7 | getPlayerByNAME 8 | } from "ez:player"; 9 | 10 | 11 | const system = server.registerSystem(0, 0); 12 | 13 | function randomReward(min, max) { 14 | min = Math.ceil(min); 15 | max = Math.floor(max); 16 | return ((Math.random() * (max - min + 1)) | 0) + min; 17 | } 18 | 19 | function percentage(num){ 20 | if (LootPercentage > 100) { 21 | console.log("Please do not enter a percentage that is higher than 100"); 22 | let LootPercentage = 100; 23 | return (num/100)*LootPercentage; 24 | } 25 | else { 26 | return (num/100)*LootPercentage; 27 | } 28 | } 29 | 30 | //customize the percentage of player losing money when get killed by another player 31 | let LootPercentage = 5 32 | 33 | system.listenForEvent("minecraft:entity_death", ({data: eventData}) => { 34 | //customize how much money should a mob drop (min, max) 35 | const mobs = { 36 | "zombie" : randomReward(1,1), 37 | "zombie_villager_v2" : randomReward(1,1), 38 | "husk" : randomReward(1,1), 39 | "skeleton" : randomReward(1,1), 40 | "stray" : randomReward(1,1), 41 | "creeper" : randomReward(1,1), 42 | "spider" : randomReward(1,1), 43 | "cave_spider" : randomReward(1,1), 44 | "witch" : randomReward(2,3), 45 | "phantom" : randomReward(1,2), 46 | "blaze" : randomReward(2,2), 47 | "ghast" : randomReward(3,3), 48 | "wither_skeleton" : randomReward(3,4), 49 | "ender_dragon" : randomReward(200,200), 50 | "piglin" : randomReward(1,3), 51 | "zoglin" : randomReward(2,5), 52 | "player" : randomReward(1,1) 53 | }; 54 | 55 | const { 56 | entity: deadEntity, 57 | killer, 58 | cause 59 | } = eventData; 60 | const kill = system.getComponent(killer, "minecraft:nameable").data.name; 61 | const deadEntityIdentifier = deadEntity.__identifier__.replace("minecraft:", ""); 62 | const killerName = getPlayerByNAME(kill); 63 | 64 | if (deadEntityIdentifier in mobs) { 65 | if (deadEntity.__identifier__ === "minecraft:player") { 66 | const moneyOld = getBalance(killerName); 67 | const victim = system.getComponent(deadEntity, "minecraft:nameable").data.name; 68 | const victimName = getPlayerByNAME(victim); 69 | const victimMoney = getBalance(victimName); 70 | const result = percentage(victimMoney); 71 | const victimLoot = Math.round(result); 72 | const deductVictimLoot = victimLoot * -1; 73 | updateBalance(killerName, victimLoot, "add"); 74 | system.executeCommand(`title "${killerName.name}" actionbar §fYou earned §e$${victimLoot} §a(${LootPercentage} Percent) §ffor killing §6${victimName.name}\n§7Previous: §b${moneyOld} §7=> Now: §b${getBalance(killerName)}`, () => {}); 75 | updateBalance(victimName, deductVictimLoot, "deduct"); 76 | system.executeCommand(`tellraw @a {"rawtext":[{"text":"§6${victimName.name} §flost §e$${victimLoot} §a(${LootPercentage} Percent) §ffor getting killed by §6${killerName.name}\n§7Previous: §b${victimMoney} §7=> Now: §b${getBalance(victimName)}"}]}`, () => {}); 77 | } 78 | else if (cause === "entity_attack") { 79 | let moneyOld = getBalance(killerName) 80 | updateBalance(killerName, mobs[deadEntityIdentifier], "add"); 81 | system.executeCommand(`title "${killerName.name}" actionbar §fYou earned §e$${mobs[deadEntityIdentifier]} §ffor killing §6${deadEntityIdentifier}\n§7Previous: §b${moneyOld} §7=> Now: §b${getBalance(killerName)}`, () => {}); 82 | } 83 | } 84 | else{ 85 | system.executeCommand(`title "${killerName.name}" actionbar §fYou killed §6${deadEntityIdentifier}`, () => {}); 86 | } 87 | }) 88 | console.log("mobReward.js loaded"); -------------------------------------------------------------------------------- /scripts/mocking.js: -------------------------------------------------------------------------------- 1 | //mocking player's chat when player typed something in game 2 | 3 | import { 4 | onChat 5 | } from "ez:chat"; 6 | 7 | import { 8 | executeCommand 9 | } from "ez:command"; 10 | 11 | //customize the probability of a player's chat getting mocked by 12 | let mockPercentage = 1 13 | //customize who is mocking the player 14 | let mockByWho = "§eInto§6CMD" 15 | 16 | function flipCase(str) { 17 | var flip = ''; 18 | for (var i = 0; i < str.length; i++) { 19 | if (Math.random() > .5){ 20 | flip += str.charAt(i).toUpperCase(); 21 | } else { 22 | flip += str.charAt(i).toLowerCase(); 23 | } 24 | } 25 | return flip; 26 | } 27 | 28 | onChat((chat)=> { 29 | const probability = mockPercentage/100; 30 | if (probability >= Math.random()){ 31 | const mockChat = "<" + mockByWho + "§r> Imagine saying: §e" + flipCase(chat.content); 32 | executeCommand("tellraw @a {\"rawtext\":[{\"text\":\"" + mockChat + "\"}]}"); 33 | } 34 | }); 35 | 36 | console.log("mocking.js loaded"); 37 | -------------------------------------------------------------------------------- /scripts/pay.js: -------------------------------------------------------------------------------- 1 | import { 2 | getBalance, 3 | updateBalance 4 | } from "ez:economy"; 5 | 6 | import { 7 | executeCommand, 8 | registerCommand, 9 | registerOverride 10 | } from "ez:command"; 11 | 12 | //edit the percentage of tax here 13 | let taxPercentage = 5 14 | //edit the least amount of money a player can send 15 | let leastAmount = 20 16 | 17 | registerCommand("pay", "Transfer balance to other players.", 0); 18 | registerOverride("pay", [{type: "players", name: "player", optional: false}, {type: "int", name: "amount", optional: false}], function (targets, count) { 19 | if (targets.length != 1) throw "You can only pay money to 1 player at a time."; 20 | let sender = this.player 21 | let target = targets[0]; 22 | let senderName = sender.name 23 | let targetName = target.name 24 | let finalAmount = Math.round((100 - taxPercentage) * count / 100) 25 | if (this.player) { 26 | if (count < leastAmount) { 27 | throw "No Transactions under $" + leastAmount + " please."; 28 | }else { 29 | updateBalance(sender, -count, "deduct"); 30 | updateBalance(target, finalAmount, "add"); 31 | executeCommand("tellraw \"" + senderName + "\" {\"rawtext\":[{\"text\":\"§6You send §b" + targetName + " §e$" + count + "\n§atax: " + taxPercentage + "% §6They get §e$" + finalAmount + "\"}]}"); 32 | executeCommand("tellraw \"" + targetName + "\" {\"rawtext\":[{\"text\":\"§b" + senderName + " §6send you §e$" + count + "\n§atax: " + taxPercentage + "% §6you got §e$" + finalAmount + "\"}]}"); 33 | } 34 | } 35 | }); 36 | 37 | console.log("pay.js loaded"); 38 | -------------------------------------------------------------------------------- /scripts/playerJoin.js: -------------------------------------------------------------------------------- 1 | import { 2 | onPlayerInitialized 3 | } from "ez:player"; 4 | 5 | const system = server.registerSystem(0, 0); 6 | 7 | onPlayerInitialized(player => { 8 | let playerName = player.name 9 | //add old objectives, if not added already 10 | system.executeCommand(`scoreboard objectives add old dummy`,{}); 11 | //update all player's old score 12 | system.executeCommand(`execute @a[name="${playerName}"] ~ ~ ~ scoreboard players add @s old 0`,{}); 13 | //title greeting new players 14 | system.executeCommand(`execute @a[name="${playerName}",scores={old=0}] ~ ~ ~ title @s title §aWelcome to\n§eInto§6CMD\n§b@s`,{}); 15 | //global alart all player a new players has joined 16 | system.executeCommand(`execute @a[name="${playerName}",scores={old=0}] ~ ~ ~ tellraw @a {"rawtext":[{"text":"§d${playerName} just joined IntoCMD for the first time!!!"}]}`,{}); 17 | //title greeting old players 18 | system.executeCommand(`execute @a[name="${playerName}",scores={old=1}] ~ ~ ~ title @s title §aWelcome back\n§b@s`,{}); 19 | //set new player to old player 20 | system.executeCommand(`execute @a[name="${playerName}",scores={old=0}] ~ ~ ~ scoreboard players set @s old 1`,{}); 21 | }) 22 | //output log to console 23 | console.log("playerJoin.js loaded"); -------------------------------------------------------------------------------- /scripts/techSelect.js: -------------------------------------------------------------------------------- 1 | import { 2 | executeCommand, 3 | registerCommand, 4 | registerOverride 5 | } from "ez:command"; 6 | 7 | import { 8 | send 9 | } from "ez:formui"; 10 | 11 | const serverName = "§l§eInto§6CMD"; 12 | const ios = "§l§biOS"; 13 | const android = "§l§6Android"; 14 | const win10 = "§l§eWin10"; 15 | const xbox = "§l§aXbox"; 16 | const nintendo = "§l§cNS"; 17 | const playStation = "§l§9PS"; 18 | 19 | registerCommand("tech", "tell people what device you are playing on.", 0); 20 | registerOverride("tech", [], function () { 21 | if (this.player) { 22 | send(this.player, { 23 | "type": "custom_form", 24 | "title": "§l§bDevice selection", 25 | "content": [ 26 | { 27 | "type": "dropdown", 28 | "text": "Please select the device you are playing " + serverName + " §ron", 29 | "options": ["Please select one from below", ios, android, win10, xbox, nintendo, playStation] 30 | }, 31 | { 32 | "type": "label", 33 | "text": "\n\n" 34 | } 35 | ] 36 | }, data => { 37 | if (data === null) return; 38 | let [device, placeholder] = data; 39 | let playerName = this.player.name; 40 | if (device === 0) { 41 | executeCommand(`tellraw "${playerName}" {"rawtext":[{"text":"§cPlease select one option."}]}`); 42 | } 43 | if (device === 1) { 44 | executeCommand("custom-name set postfix \"" + playerName +"\" \" " + ios + "§r\""); 45 | } 46 | if (device === 2) { 47 | executeCommand("custom-name set postfix \"" + playerName +"\" \" " + android + "§r\""); 48 | } 49 | if (device === 3) { 50 | executeCommand("custom-name set postfix \"" + playerName +"\" \" " + win10 + "§r\""); 51 | } 52 | if (device === 4) { 53 | executeCommand("custom-name set postfix \"" + playerName +"\" \" " + xbox + "§r\""); 54 | } 55 | if (device === 5) { 56 | executeCommand("custom-name set postfix \"" + playerName +"\" \" " + nintendo + "§r\""); 57 | } 58 | if (device === 6) { 59 | executeCommand("custom-name set postfix \"" + playerName +"\" \" " + playStation + "§r\""); 60 | } 61 | });return null 62 | }else throw ["error, this command can only be used in game!"] 63 | }); 64 | 65 | console.log("techSelect.js loaded"); -------------------------------------------------------------------------------- /scripts/weather.js: -------------------------------------------------------------------------------- 1 | const system = server.registerSystem(0, 0); 2 | 3 | system.listenForEvent("minecraft:weather_changed", ({data: eventData}) => { 4 | const { 5 | raining, 6 | lightning 7 | } = eventData 8 | if (raining === true){ 9 | if (lightning === true){ 10 | system.executeCommand(`tellraw @a {"rawtext":[{"text":"§aAnd as the sound of the trumpet grew louder and louder, Moses spoke, and God answered him in thunder.\n§7- §eExodus 19:19"}]}`, () => {}); 11 | } 12 | else system.executeCommand(`tellraw @a {"rawtext":[{"text":"§aHe provides rain for the earth; he sends water on the countryside.\n§7- §eJob 5:10"}]}`, () => {}); 13 | } 14 | else system.executeCommand(`tellraw @a {"rawtext":[{"text":"§aThe light is pleasant, and it is good for the eyes to see the sun.\n§7- §eEcclesiastes 11:7"}]}`, () => {}); 15 | }) 16 | console.log("weather.js loaded"); -------------------------------------------------------------------------------- /scripts/xraytoggle.js: -------------------------------------------------------------------------------- 1 | import { 2 | executeCommand, 3 | registerCommand, 4 | registerOverride 5 | } from "ez:command"; 6 | 7 | registerCommand("xraytoggle", "Toggle xray alart for staff member.", 0); 8 | registerOverride("xraytoggle", [{type: "bool", name: "value", optional: false}], function (toggleResult) { 9 | if (this.player) { 10 | let thisPlayer = this.player.name; 11 | if (toggleResult) { 12 | executeCommand(`tag @a[name="${thisPlayer}",tag=staff] add xrayAlert`); 13 | executeCommand(`tellraw @a[name="${thisPlayer}",tag=staff] {"rawtext":[{"text":"§aYou will now recieve ore mining alert"}]}`); 14 | executeCommand(`tellraw @a[name="${thisPlayer}",tag=!staff] {"rawtext":[{"text":"§cYou are not in staff team."}]}`); 15 | }else{ 16 | executeCommand(`tag @a[name="${thisPlayer}",tag=staff] remove xrayAlert`); 17 | executeCommand(`tellraw @a[name="${thisPlayer}",tag=staff] {"rawtext":[{"text":"§6You will no longer recieve ore mining alert"}]}`); 18 | executeCommand(`tellraw @a[name="${thisPlayer}",tag=!staff] {"rawtext":[{"text":"§cYou are not in staff team."}]}`); 19 | } 20 | }else throw ["error, this command can only be used in game!", "/xraytoggle"]; 21 | }); 22 | 23 | console.log("xraytoggle.js loaded"); --------------------------------------------------------------------------------