Skip to content

Commit 996d0c2

Browse files
committed
Add anti-32k and delete cmd blocks
personal use but they're useless code so
1 parent dbf75d8 commit 996d0c2

File tree

5 files changed

+142
-0
lines changed

5 files changed

+142
-0
lines changed

scripts/anti-32k/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 JaylyDev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

scripts/anti-32k/Notice.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
THIRD PARTY NOTICE
2+
3+
The anti-32k script incorporates material from third parties.
4+
The original copyright notice and the license are listed below.
5+
6+
--------------------------------------------------------------------------------------
7+
8+
Minecraft Bedrock Anti Hacked Items
9+
MIT
10+
MIT license
11+
12+
Copyright (c) 2022 Smell of curry
13+
14+
Permission is hereby granted, free of charge, to any person obtaining
15+
a copy of this software and associated documentation files (the
16+
"Software"), to deal in the Software without restriction, including
17+
without limitation the rights to use, copy, modify, merge, publish,
18+
distribute, sublicense, and/or sell copies of the Software, and to
19+
permit persons to whom the Software is furnished to do so, subject to
20+
the following conditions:
21+
22+
The above copyright notice and this permission notice shall be
23+
included in all copies or substantial portions of the Software.
24+
25+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32+
33+
--------------------------------------------------------------------------------------

scripts/anti-32k/anti-32k.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Minecraft Bedrock Anti Hacked Items
3+
* @license MIT
4+
* @author Smell of curry & JaylyMC
5+
* @version 1.1.0
6+
* --------------------------------------------------------------------------
7+
* This is a anti hacked items, meaning it checks a players inventory every
8+
* tick then it tests if they have any banned items, then checks if they have
9+
* items that have hacked enchants and clears the item from inventory
10+
* --------------------------------------------------------------------------
11+
*/
12+
import { MinecraftEnchantmentTypes, EnchantmentList, world, EntityInventoryComponent } from "mojang-minecraft";
13+
14+
function onTick () {
15+
for (const player of world.getPlayers()) {
16+
/** @type {EntityInventoryComponent} */
17+
// @ts-ignore
18+
const inventory = player.getComponent("minecraft:inventory");
19+
const container = inventory.container;
20+
for (let i = 0; i < container.size; i++) {
21+
const item = container.getItem(i);
22+
if (!item) continue;
23+
/** @type {EnchantmentList} */
24+
const enchantments = item.getComponent("enchantments").enchantments;
25+
let change = false;
26+
for (const Enchantment in MinecraftEnchantmentTypes) {
27+
const ItemEnchantment = enchantments.getEnchantment(MinecraftEnchantmentTypes[Enchantment]);
28+
if (!ItemEnchantment) continue;
29+
const remove = () => {
30+
enchantments.removeEnchantment(ItemEnchantment.type);
31+
change = true;
32+
};
33+
const changeLevel = () => {
34+
enchantments.removeEnchantment(ItemEnchantment.type);
35+
ItemEnchantment.level = ItemEnchantment.type.maxLevel;
36+
enchantments.addEnchantment(ItemEnchantment);
37+
change = true;
38+
};
39+
if (enchantments.slot === 0 && !enchantments.canAddEnchantment(MinecraftEnchantmentTypes[Enchantment])) remove();
40+
else if (ItemEnchantment.level > ItemEnchantment.type.maxLevel) changeLevel();
41+
}
42+
if (!change) continue;
43+
item.getComponent("enchantments").enchantments = enchantments;
44+
container.setItem(i, item);
45+
}
46+
}
47+
};
48+
49+
world.events.tick.subscribe(onTick);

scripts/delete-command-blocks/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 JaylyDev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { world, MinecraftBlockTypes } from "mojang-minecraft";
2+
3+
async function DeleteCommandBlocks () {
4+
let CommandBlocks = MinecraftBlockTypes.getAllBlockTypes().filter(blockType => blockType.id.endsWith("command_block"));
5+
6+
for (const player of world.getPlayers()) {
7+
for (let CommandBlock of CommandBlocks) {
8+
for (let index = 0; index < (384 / 32); index++) {
9+
const { x, z } = player.location;
10+
const y = index * 32 - 64;
11+
12+
player.runCommandAsync(`fill ${x - 15} ${y} ${z - 15} ${x + 16} ${y + 31} ${z + 16} air 0 replace ${CommandBlock.id}`);
13+
}
14+
};
15+
};
16+
};
17+
18+
world.events.tick.subscribe(DeleteCommandBlocks);

0 commit comments

Comments
 (0)