├── pack_icon.png ├── .vscode └── settings.json ├── package.json ├── scripts ├── utils │ └── kick.js ├── modules │ ├── speed_detection.js │ ├── crasher_detection.js │ ├── spam_detection.js │ ├── item_place_detection.js │ ├── nuker_detection.js │ ├── enchant_detection.js │ └── item_detection.js └── main.js ├── README.md ├── manifest.json ├── .github └── workflows │ └── release-6.yml ├── entities └── player.json └── .gitignore /pack_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FeedFall8/Hydra/HEAD/pack_icon.png -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "github-actions.workflows.pinned.workflows": [] 3 | } 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@minecraft/server": "^1.16.0", 4 | "@minecraft/server-ui": "^1.3.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /scripts/utils/kick.js: -------------------------------------------------------------------------------- 1 | import { world } from "@minecraft/server"; 2 | 3 | export function removePlayer(player) { 4 | world 5 | .getDimension("overworld") 6 | .runCommandAsync( 7 | `kick "${ 8 | player.nameTag.replace(/"/g, "") || player.name.replace(/"/g, "") 9 | }" You have been removed from the game` 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /scripts/modules/speed_detection.js: -------------------------------------------------------------------------------- 1 | import { world, system } from "@minecraft/server"; 2 | 3 | const SpeedDetection = () => { 4 | system.run((tick) => { 5 | var players = world.getPlayers(); 6 | for (const player of players) { 7 | const comp = player.getComponent("minecraft:movement"); 8 | comp.resetToDefaultValue(); 9 | } 10 | }); 11 | }; 12 | 13 | export { SpeedDetection }; 14 | -------------------------------------------------------------------------------- /scripts/modules/crasher_detection.js: -------------------------------------------------------------------------------- 1 | import { world, system } from "@minecraft/server"; 2 | 3 | const Crasher_Detection = () => { 4 | system.run((tick) => { 5 | const players = [...world.getPlayers()]; 6 | 7 | players.forEach((player) => { 8 | const { x, y, z } = player.location; 9 | 10 | if ( 11 | Math.abs(x) > 30000000 || 12 | Math.abs(y) > 30000000 || 13 | Math.abs(z) > 30000000 14 | ) { 15 | player.triggerEvent("hydra:kick"); 16 | } 17 | }); 18 | }); 19 | }; 20 | 21 | export { Crasher_Detection }; 22 | -------------------------------------------------------------------------------- /scripts/main.js: -------------------------------------------------------------------------------- 1 | /* Item Detection */ 2 | import { ItemChecker } from './modules/item_detection.js' 3 | ItemChecker() 4 | 5 | /* Speed Detection */ 6 | import { SpeedDetection } from './modules/speed_detection.js' 7 | SpeedDetection() 8 | 9 | /* Spam Detection */ 10 | import { SpamDetection } from './modules/spam_detection.js' 11 | SpamDetection() 12 | 13 | /* Nuker Detection */ 14 | import { Nuker_Detection } from './modules/nuker_detection.js' 15 | Nuker_Detection() 16 | /*Item Place Detection/Block Detection */ 17 | import { Item_Detection} from './modules/item_place_detection.js' 18 | Item_Detection() 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hydra 2 | a public MCBE anti cheat that is free, open source and public for all! 3 | # Terms of usage 4 | if you are using hydra, and/or its foundation code please follow the terms: 5 | 6 | - you may NOT redistribute hydra as your own and monetize it 7 | - you are strictly binded to the GNU liscence and therefore must comply and keep any redistributions free and secure 8 | - we ask you credit us via ingame chat with hydra(this means dont cut out code that is for crediting!) 9 | - we will punish you if you violate any of these terms 10 | - again do not monetize hydra!! 11 | ©2022, FeedFall8, All Rights Reserved. 12 | -------------------------------------------------------------------------------- /scripts/modules/spam_detection.js: -------------------------------------------------------------------------------- 1 | import { world } from "@minecraft/server"; 2 | import { removePlayer } from "../utils/kick"; 3 | 4 | const SpamDetection = () => { 5 | const messages = new Map(); 6 | 7 | world.beforeEvents.chatSend.subscribe((chat) => { 8 | if (messages.has(chat.sender.name)) { 9 | var user = messages.get(chat.sender.name); 10 | } else { 11 | var user = []; 12 | } 13 | if (user.includes(chat.message)) { 14 | removePlayer(chat.sender); 15 | return; 16 | } 17 | if (user.length > 2) user.shift(); 18 | user.push(chat.message); 19 | messages.set(chat.sender.name, user); 20 | }); 21 | }; 22 | 23 | export { SpamDetection }; 24 | -------------------------------------------------------------------------------- /scripts/modules/item_place_detection.js: -------------------------------------------------------------------------------- 1 | const blocks = [ 2 | "minecraft:mob_spawner", 3 | "minecraft:beehive", 4 | "minecraft:unknown", 5 | "minecraft:bee_nest", 6 | "minecraft:moving_block", 7 | "minecraft:movingblock", 8 | "minecraft:bed", 9 | "minecraft:axolotl_bucket", 10 | "minecraft:cod_bucket", 11 | "minecraft:powder_snow_bucket", 12 | "minecraft:pufferfish_bucket", 13 | "minecraft:salmon_bucket", 14 | "minecraft:tropical_fish_bucket", 15 | "minecraft:invisible_bedrock", 16 | ]; 17 | const buckets = "_bucket"; 18 | import { world } from "@minecraft/server"; 19 | const Item_Detection = () => { 20 | world.beforeEvents.itemUseOn.subscribe((block) => { 21 | if ( 22 | blocks.includes(block.item.id) || 23 | block.item.id.endswith("_spawn_egg") 24 | ) { 25 | block.cancel = true; 26 | } 27 | }); 28 | }; 29 | 30 | const Thrown_Item_Detection = () => { 31 | world.events.itemUse.subscribe((event) => { 32 | console.log(event.item.id); 33 | }); 34 | }; 35 | export { Item_Detection, Thrown_Item_Detection }; 36 | -------------------------------------------------------------------------------- /scripts/modules/nuker_detection.js: -------------------------------------------------------------------------------- 1 | import { world } from "@minecraft/server"; 2 | 3 | var BlockLog = new Map(); 4 | 5 | const Nuker_Detection = () => { 6 | world.beforeEvents.playerBreakBlock.subscribe((use) => { 7 | if (BlockLog.has(use.player.nameTag)) { 8 | var logs = BlockLog.get(use.player.nameTag); 9 | } else { 10 | var logs = []; 11 | } 12 | 13 | logs.push(new Date()); 14 | 15 | var filtered = logs.filter( 16 | (time) => time.getTime() > new Date().getTime() - 100 17 | ); 18 | BlockLog.set(use.player.nameTag, filtered); 19 | 20 | if (filtered.length > 2) { 21 | var permutation = use.brokenBlockPermutation.clone(); 22 | const { x, y, z } = use.block; 23 | const block = world 24 | .getDimension("overworld") 25 | .getBlock({ x: x, y: y, z: z }); 26 | block.setPermutation(permutation); 27 | try { 28 | use.player.runCommandAsync( 29 | "kill @e[x=" + x + ",y=" + y + ",z=" + z + ",r=10,c=1,type=item]" 30 | ); 31 | } catch (e) {} 32 | } 33 | }); 34 | }; 35 | 36 | export { Nuker_Detection }; 37 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "format_version": 2, 3 | "header": { 4 | "name": "Hydra Anticheat", 5 | "description": "A general purpose/nbt anticheat", 6 | "uuid": "8961fe27-8677-4e1c-b2c6-96a9a57db4d3", 7 | "version": [2, 0, 9], 8 | "min_engine_version": [1, 16, 210] 9 | }, 10 | "metadata": { 11 | "authors": ["Feed/Roman/Balloon/Kaiiii"], 12 | "url": "https://github.com/FeedFall8/Hydra" 13 | }, 14 | "modules": [ 15 | { 16 | "type": "data", 17 | "uuid": "e0bd5c5d-6b48-482e-aebc-1634d5d5b511", 18 | "version": [1, 0, 0] 19 | }, 20 | { 21 | "description": "Hydra", 22 | "type": "script", 23 | "language": "javascript", 24 | "uuid": "77421f33-2cc9-4387-9d6e-7dd2f7c43c12", 25 | "version": [1, 0, 0], 26 | "entry": "scripts/main.js" 27 | } 28 | ], 29 | "dependencies": [ 30 | { 31 | "module_name": "@minecraft/server", 32 | "version": "1.18.0-beta" 33 | }, 34 | { 35 | "module_name": "@minecraft/server-gametest", 36 | "version": "1.0.0-beta" 37 | }, 38 | { 39 | "module_name": "@minecraft/server-ui", 40 | "version": "1.4.0-beta" 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /scripts/modules/enchant_detection.js: -------------------------------------------------------------------------------- 1 | // @baboonie#2522 2 | import { 3 | world, 4 | MinecraftEnchantmentTypes, 5 | ItemStack, 6 | MinecraftItemTypes, 7 | system, 8 | } from "@minecraft/server"; 9 | import { removePlayer } from "../utils/kick"; 10 | 11 | const Enchant_Detection = () => { 12 | let allEnchants = Object.keys(MinecraftEnchantmentTypes); 13 | 14 | system.run((tick) => { 15 | const players = [...world.getPlayers()]; 16 | 17 | players.forEach((player) => { 18 | const inventory = player.getComponent("minecraft:inventory").container; 19 | 20 | for (let i = 0; i < inventory.size; i++) { 21 | const item = inventory.getItem(i); 22 | if (!item) continue; 23 | 24 | const itemEnchantments = item.getComponent( 25 | "minecraft:enchantments" 26 | ).enchantments; 27 | for (const enchantmentKey of allEnchants) { 28 | const enchantment = MinecraftEnchantmentTypes[enchantmentKey]; 29 | if (!itemEnchantments.hasEnchantment(enchantment)) continue; 30 | 31 | const enchantmentData = itemEnchantments.getEnchantment(enchantment); 32 | if (enchantmentData.level > enchantmentData.type.maxLevel) { 33 | itemEnchantments.removeEnchantment(enchantment); 34 | inventory.setItem( 35 | i, 36 | new ItemStack(MinecraftItemTypes["air"], 0, 0) 37 | ); 38 | removePlayer(player); 39 | } 40 | } 41 | } 42 | }); 43 | }); 44 | }; 45 | 46 | export { Enchant_Detection }; 47 | -------------------------------------------------------------------------------- /.github/workflows/release-6.yml: -------------------------------------------------------------------------------- 1 | name: Release Action 2 | 3 | on: 4 | release: 5 | types: 6 | - created 7 | 8 | jobs: 9 | package-release: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v2 15 | 16 | - name: Install Node.js 17 | uses: actions/setup-node@v3 18 | with: 19 | node-version: "20" 20 | 21 | - name: Install jq 22 | run: | 23 | sudo apt-get update 24 | sudo apt-get install -y jq 25 | 26 | - name: Update Manifest Version 27 | run: | 28 | release_version="${GITHUB_REF#refs/tags/}" 29 | major=$(echo "$release_version" | cut -d. -f1) 30 | minor=$(echo "$release_version" | cut -d. -f2) 31 | patch=$(echo "$release_version" | cut -d. -f3) 32 | jq ".header.version = [$major, $minor, $patch]" manifest.json > manifest.json.new 33 | mv manifest.json.new manifest.json 34 | 35 | - name: Create ZIP file 36 | run: | 37 | zip -r release.zip * 38 | 39 | - name: Upload Release as ZIP 40 | uses: actions/upload-release-asset@v1 41 | with: 42 | upload_url: ${{ github.event.release.upload_url }} 43 | asset_path: ./release.zip 44 | asset_name: release${{ github.ref_name }}.zip 45 | asset_content_type: application/zip 46 | env: 47 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 48 | 49 | - name: Create MCPACK file 50 | run: | 51 | cp release.zip release.mcpack 52 | 53 | - name: Upload Release as MCPACK 54 | uses: actions/upload-release-asset@v1 55 | with: 56 | upload_url: ${{ github.event.release.upload_url }} 57 | asset_path: ./release.mcpack 58 | asset_name: release${{ github.ref_name }}.mcpack 59 | asset_content_type: application/zip 60 | env: 61 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 62 | -------------------------------------------------------------------------------- /scripts/modules/item_detection.js: -------------------------------------------------------------------------------- 1 | import { world, system } from "@minecraft/server"; 2 | import { removePlayer } from "../utils/kick"; 3 | 4 | const items = [ 5 | "minecraft:portal", 6 | "minecraft:item.soul_campfire", 7 | "minecraft:fire", 8 | "minecraft:item.chain", 9 | "minecraft:item.warped_door", 10 | "minecraft:item.crimson_door", 11 | "minecraft:item.campfire", 12 | "minecraft:item.kelp", 13 | "minecraft:bee_nest", 14 | "minecraft:beehive", 15 | "minecraft:item.wooden_door", 16 | "minecraft:item.iron_door", 17 | "minecraft:item.cake", 18 | "minecraft:item.reeds", 19 | "minecraft:item.camera", 20 | "minecraft:item.frame", 21 | "minecraft:pistonarmcollision", 22 | "minecraft:movingBlock", 23 | "minecraft:item.cake", 24 | "minecraft:item.flower_pot", 25 | "minecraft:info_update2", 26 | "minecraft:stickyPistonArmCollision", 27 | "minecraft:movingblock", 28 | "minecraft:invisiblebedrock", 29 | "minecraft:glowingobsidian", 30 | "minecraft:flowing_water", 31 | "minecraft:flowing_lava", 32 | "minecraft:item.nether_sprouts", 33 | ]; 34 | 35 | const ItemChecker = () => { 36 | system.run((tick) => { 37 | var players = world.getPlayers(); 38 | for (const player of players) { 39 | let inv = player.getComponent("minecraft:inventory").container; 40 | let inv_items = []; 41 | for (let i = 0; i < inv.size; i++) { 42 | try { 43 | let inv_i = inv.getItem(i); 44 | inv_items.push(inv_i.id); 45 | } catch (e) {} 46 | } 47 | inv_items.forEach((item) => { 48 | if (items.includes(item)) { 49 | try { 50 | world 51 | .getDimension("overworld") 52 | .runCommandAsync( 53 | `clear "${ 54 | player.nameTag.replace(/"/g, "") || 55 | player.name.replace(/"/g, "") 56 | }"` 57 | ); 58 | } catch (e) {} 59 | removePlayer(player); 60 | } 61 | }); 62 | items.forEach((item) => { 63 | try { 64 | world 65 | .getDimension("overworld") 66 | .runCommandAsync(`clear @a ${item.split(":")[1]}`); 67 | } catch (e) {} 68 | }); 69 | } 70 | }); 71 | }; 72 | 73 | // mind making this cool someone please anyone? 74 | 75 | export { ItemChecker }; 76 | -------------------------------------------------------------------------------- /entities/player.json: -------------------------------------------------------------------------------- 1 | { 2 | "format_version": "1.17.0", 3 | "minecraft:entity": { 4 | "description": { 5 | "identifier": "minecraft:player", 6 | "is_spawnable": false, 7 | "is_summonable": true, 8 | "is_experimental": false 9 | }, 10 | "component_groups": { 11 | "hydra:kick": { 12 | "minecraft:instant_despawn": { 13 | "remove_child_entities": true 14 | } 15 | } 16 | }, 17 | "components": { 18 | "minecraft:type_family": { 19 | "family": [ 20 | "player" 21 | ] 22 | }, 23 | "minecraft:loot": { 24 | "table": "loot_tables/empty.json" 25 | }, 26 | "minecraft:collision_box": { 27 | "width": 0.6, 28 | "height": 1.8 29 | }, 30 | "minecraft:can_climb": {}, 31 | "minecraft:movement": { 32 | "value": 0.1 33 | }, 34 | "minecraft:player.saturation": { 35 | "value": 20 36 | }, 37 | "minecraft:player.exhaustion": { 38 | "value": 0, 39 | "max": 4 40 | }, 41 | "minecraft:player.level": { 42 | "value": 0, 43 | "max": 24791 44 | }, 45 | "minecraft:player.experience": { 46 | "value": 0, 47 | "max": 1 48 | }, 49 | "minecraft:breathable": { 50 | "totalSupply": 15, 51 | "suffocateTime": -1, 52 | "inhaleTime": 3.75, 53 | "generatesBubbles": false 54 | }, 55 | "minecraft:nameable": { 56 | "alwaysShow": true, 57 | "allowNameTagRenaming": false 58 | }, 59 | "minecraft:physics": {}, 60 | "minecraft:insomnia": { 61 | "days_until_insomnia": 3 62 | }, 63 | "minecraft:rideable": { 64 | "seat_count": 2, 65 | "family_types": [ 66 | "parrot_tame" 67 | ], 68 | "pull_in_entities": true, 69 | "seats": [ 70 | { 71 | "position": [ 72 | 0.4, 73 | -0.15, 74 | 0.04 75 | ], 76 | "min_rider_count": 0, 77 | "max_rider_count": 0, 78 | "lock_rider_rotation": 0 79 | }, 80 | { 81 | "position": [ 82 | -0.4, 83 | -0.15, 84 | 0.04 85 | ], 86 | "min_rider_count": 1, 87 | "max_rider_count": 2, 88 | "lock_rider_rotation": 0 89 | } 90 | ] 91 | }, 92 | "minecraft:scaffolding_climber": {} 93 | }, 94 | "events": { 95 | "hydra:kick": { 96 | "add": { 97 | "component_groups": [ 98 | "hydra:kick" 99 | ] 100 | } 101 | } 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # Docusaurus cache and generated files 108 | .docusaurus 109 | 110 | # Serverless directories 111 | .serverless/ 112 | 113 | # FuseBox cache 114 | .fusebox/ 115 | 116 | # DynamoDB Local files 117 | .dynamodb/ 118 | 119 | # TernJS port file 120 | .tern-port 121 | 122 | # Stores VSCode versions used for testing VSCode extensions 123 | .vscode-test 124 | 125 | # yarn v2 126 | .yarn/cache 127 | .yarn/unplugged 128 | .yarn/build-state.yml 129 | .yarn/install-state.gz 130 | .pnp.* --------------------------------------------------------------------------------