├── snippets
├── display
│ ├── README.md
│ ├── Display-Quick-Sand.sk
│ ├── Display-Mini-Structure.sk
│ ├── Display-Chisel-Block.sk
│ ├── Display-Sign-Shop.sk
│ ├── Display-Bush.sk
│ └── Display-Structure-Placer.sk
├── chunkgenerator
│ ├── structures
│ │ ├── mars_pond.nbt
│ │ ├── red_blob.nbt
│ │ ├── stone_blob.nbt
│ │ └── README.md
│ ├── README.md
│ ├── blue_planet
│ │ ├── README.md
│ │ ├── blue-planet-gen.sk
│ │ ├── blue-planet-biomes-legacy.sk
│ │ └── blue-planet-biomes.sk
│ ├── mars.sk
│ ├── vanilla-vanilla-decor.sk
│ └── vanilla-simple-decor.sk
├── dialog
│ ├── README.md
│ ├── static
│ │ ├── Bad-Word-Notice-Dialog.sk
│ │ ├── Gamemode-Multi-Action-Dialog.sk
│ │ ├── World-Spawns-Multi-Action-Dialog.sk
│ │ ├── Server-Links-Multi-Action-Dialog.sk
│ │ ├── Block-Break-Confirmation-Dialog.sk
│ │ └── Server-Rules-Multi-Action-Dialog.sk
│ └── dynamic
│ │ ├── Bad-Word-Notice-Dialog.sk
│ │ ├── Warp-Menu-Multi-Action-Dialog.sk
│ │ ├── Weather-Changer-Multi-Action-Dialog.sk
│ │ ├── Home-Menu-Multi-Action-Dialog.sk
│ │ ├── Block-Break-Confirmation-Dialog.sk
│ │ ├── Ban-Menu-Multi-Action-Dialog.sk
│ │ ├── Gamerule-Menu-Multi-Action-Dialog.sk
│ │ ├── Shop-Menu-Multi-Action-Dialog.sk
│ │ └── Email-Multi-Action-Dialog.sk
├── enchantment
│ ├── GreenThumb.sk
│ ├── Auto-Smelt.sk
│ ├── README.md
│ ├── Explosive.sk
│ └── Feller.sk
├── entity
│ ├── NamedDroppedItems.sk
│ └── Attack-Pig.sk
├── command
│ ├── Spawn-Command.sk
│ ├── Command-With-Permission.sk
│ ├── brigadier
│ │ ├── Server.sk
│ │ └── Warps.sk
│ ├── ChunkFixer.sk
│ ├── Pathfinder.sk
│ ├── Random-Teleport.sk
│ └── Debug-Command-Functions.sk
├── inventory
│ ├── item-components
│ │ ├── Tool-Component.sk
│ │ ├── Attribute-Modifier-Component.sk
│ │ └── Food-Component.sk
│ ├── Simple-Item-Cooldown.sk
│ ├── Compressor.sk
│ ├── Simple-GUI-Vanilla.sk
│ ├── Vaults-NBT.sk
│ ├── Sign-Inventory.sk
│ ├── Inventory-Serializer.sk
│ ├── C4.sk
│ ├── Simple-GUI-Skript-Gui.sk
│ └── Backpack.sk
├── Tiny-Text.sk
├── player
│ ├── Tablist-Sorted-SkBee-Team.sk
│ ├── Skin-Changer.sk
│ ├── Combat-Log.sk
│ ├── Tablist-Sorted-Vanilla-Team.sk
│ ├── Chat.sk
│ ├── Resource-Pack.sk
│ └── Server-Stats.sk
├── other
│ ├── deobfuscate.sk
│ ├── Ingame-Skripting.sk
│ ├── Mine-Reset.sk
│ ├── Spiral.sk
│ └── Conveyor.sk
├── Arclight-Syntaxes.sk
├── block
│ ├── Falling-Blocks.sk
│ └── Suspicious-Grass.sk
├── customItems
│ ├── Custom-Item-YAML-Example.yml
│ └── Custom-Item-Loader.sk
├── NMS-Stuff.sk
└── Functions.sk
├── README.md
└── LICENSE
/snippets/display/README.md:
--------------------------------------------------------------------------------
1 | # DISPLAY
2 | This package contains scripts based around Minecraft's new Display Entities.
3 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/structures/mars_pond.nbt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShaneBeee/SkriptSnippets/HEAD/snippets/chunkgenerator/structures/mars_pond.nbt
--------------------------------------------------------------------------------
/snippets/chunkgenerator/structures/red_blob.nbt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShaneBeee/SkriptSnippets/HEAD/snippets/chunkgenerator/structures/red_blob.nbt
--------------------------------------------------------------------------------
/snippets/chunkgenerator/structures/stone_blob.nbt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ShaneBeee/SkriptSnippets/HEAD/snippets/chunkgenerator/structures/stone_blob.nbt
--------------------------------------------------------------------------------
/snippets/chunkgenerator/README.md:
--------------------------------------------------------------------------------
1 | # ChunkGenerator
2 | Some examples that use SkBee's chunk generator.
3 |
4 | See [**Chunk Generator Wiki**](https://github.com/ShaneBeee/SkBee/wiki/Chunk-Generator) for more info
5 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/structures/README.md:
--------------------------------------------------------------------------------
1 | # ChunkGenerator Structures
2 | These are some of the structures used in my chunk generator examples.
3 | These will be added on your server:
4 | `(main world)/generated/minecraft/structures/`
5 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SkriptSnippets
2 | A little repo for some of my Skript snippets
3 |
4 | These snippets/scripts are all open source, you are free to use them however you wish.
5 | Please see the [**LICENSE**](https://github.com/ShaneBeee/SkriptSnippets/blob/master/LICENSE) if you have any concerns.
6 |
--------------------------------------------------------------------------------
/snippets/dialog/README.md:
--------------------------------------------------------------------------------
1 | # DIALOGS
2 | This is a collection of scripts that use Minecraft's new [**Dialog**](https://minecraft.wiki/w/Dialog) feature.
3 |
4 | All of these scripts will require [**SkNMS**](https://github.com/ShaneBeee/SkNMS) 1.3.0+ and a Paper 1.21.6+ server.
5 |
6 | See the [**SkNMS Dialog Wiki**](https://github.com/ShaneBeee/SkNMS/wiki/Dialog-Registration) for more info.
7 |
8 | Dialogs can be used in 2 different ways:
9 | - Static = Register a dialog to the registry, and open it later (similar to a datapack).
10 | - Dynamic = Created and opened on the fly.
11 |
--------------------------------------------------------------------------------
/snippets/enchantment/GreenThumb.sk:
--------------------------------------------------------------------------------
1 | # GreenThumb
2 | # By: ShaneBee
3 |
4 | # This snippet shows how to use a custom enchantment to create an auto crop replanter.
5 |
6 | # Requirements: SkBee, Beer (Datapack - See ReadME), Minecraft 1.21+
7 |
8 | on break:
9 | if all:
10 | type of event-block is tagged as (minecraft block tag "minecraft:crops")
11 | player's tool is tagged as minecraft item tag "minecraft:hoes"
12 | enchantment level of beer:green_thumb of player's tool > 0
13 | age of event-block = max age of event-block
14 | then:
15 | set {_data} to blockdata of event-block
16 | set blockdata tag "age" of {_data} to 0
17 | wait 5 tick
18 | set event-block to {_data}
19 |
--------------------------------------------------------------------------------
/snippets/entity/NamedDroppedItems.sk:
--------------------------------------------------------------------------------
1 | # Give your dropped items some lovely names
2 | # By: ShaneBee
3 |
4 | function setName(e: entity):
5 | set {_amount} to item amount of item of {_e}
6 | set {_m::1} to text component from "&b%{_amount}%&7x "
7 | if name of item of {_e} is set:
8 | set {_m::2} to text component of name of item of {_e}
9 | else:
10 | set {_m::2} to translate component of item of {_e}
11 | set color format of {_m::2} to light blue
12 |
13 | set {_m} to merge components {_m::*}
14 | set component entity display name of {_e} to {_m}
15 |
16 | on item spawn:
17 | setName(event-entity)
18 |
19 | on item merge:
20 | set {_f} to future event-entity
21 | wait 1 tick
22 | setName({_f})
23 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/blue_planet/README.md:
--------------------------------------------------------------------------------
1 | # Blue Planet
2 |
3 | I've split this one up into 2 snippets to make things a bit cleaner:
4 | - `blue-planet-biomes.sk` = This snippet holds the custom biomes for our generator, these biomes are made with [SkNMS](https://modrinth.com/plugin/sknms).
5 | You can also create custom biomes in a datapack.
6 | - `blue-planet-gen.sk` = The generator itself
7 |
8 | ## Pictures:
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/snippets/dialog/static/Bad-Word-Notice-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Bad World Notice
2 | # By: ShaneBee
3 |
4 | # This is a simple dialog popup when a player says a bad word.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | registry registration:
11 | register notice dialog with id "custom:bad_words":
12 | title: "Chat Monitor"
13 | body:
14 | add plain message body:
15 | contents: mini message from "You said a bad word, please dont!"
16 |
17 | on load:
18 | set {-badwords::*} to "shit", "fuck" and "cooked"
19 |
20 | on chat:
21 | loop {-badwords::*}:
22 | if message contains loop-value:
23 | cancel event
24 | open dialog with id "custom:bad_words" to player
25 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Bad-Word-Notice-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Bad World Notice
2 | # By: ShaneBee
3 |
4 | # This is a simple dialog popup when a player says a bad word.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | on load:
11 | set {-badwords::*} to "shit", "fuck" and "cooked"
12 |
13 | on chat:
14 | loop {-badwords::*}:
15 | if message contains loop-value:
16 | set {_v} to loop-value
17 | cancel event
18 | open notice dialog to player:
19 | title: "Chat Monitor"
20 | body:
21 | add plain message body:
22 | contents: mini message from "You said a bad word!!!"
23 | add plain message body:
24 | contents: mini message from "Please don't say ""%{_v}%"""
25 | exit loop
26 |
--------------------------------------------------------------------------------
/snippets/command/Spawn-Command.sk:
--------------------------------------------------------------------------------
1 | # Spawn Command
2 | # By: ShaneBee
3 |
4 | # This is a simple example of a spawn command with a wait and move check
5 | # Requirements: None
6 |
7 | command /spawn:
8 | trigger:
9 | # Set a var to where the player runs the command
10 | set {_l} to location of player
11 |
12 | # loop however many times you wanna delay this for in seconds
13 | loop reversed 5 times:
14 | send "Teleporting in %loop-number% seconds"
15 | wait 1 second
16 |
17 | # Check if the player moved, if so, stop the command
18 | if distance between player and {_l} > 0.1:
19 | send "OOPS you moved, try again!!!"
20 | stop
21 |
22 | # If the player stood still, they get teleported
23 | teleport player to spawn of world "world"
24 |
--------------------------------------------------------------------------------
/snippets/enchantment/Auto-Smelt.sk:
--------------------------------------------------------------------------------
1 | # Explosive
2 | # By: ShaneBee
3 |
4 | # This snippet shows how to use a custom enchantment to create an auto smelting pickaxe.
5 |
6 | # Requirements: Skript 2.9+, Beer (Datapack - See ReadME), Minecraft 1.21+
7 |
8 | on break of iron ore, gold ore or copper ore:
9 | set {_lvl} to enchantment level of beer:auto_smelt of player's tool
10 | if {_lvl} > 0:
11 | clear drops
12 | loop drops of event-block using player's tool:
13 | if loop-item = raw iron:
14 | add (item amount of loop-item) of iron ingot to {_i::*}
15 | else if type of loop-item = 1 of raw gold:
16 | add (item amount of loop-item) of gold ingot to {_i::*}
17 | else if loop-item = raw copper:
18 | add (item amount of loop-item) of copper ingot to {_i::*}
19 | else:
20 | add loop-value to {_i::*}
21 | drop {_i::*} at event-block
22 |
--------------------------------------------------------------------------------
/snippets/display/Display-Quick-Sand.sk:
--------------------------------------------------------------------------------
1 | # QuickSand
2 | # By: ShaneBee
3 |
4 | # This simple little script allows you to turn a block into quick sand
5 |
6 | # Requires Minecraft 1.19.4+ and SkBee 2.8.1+
7 |
8 | #! FUNCTION !#
9 | # Function to turn a block into quick sand
10 | function quickSand(b: block):
11 | set {_l} to exact location of {_b}
12 | spawn block display at {_l}
13 | set {_e} to last spawned entity
14 | set display block data of {_e} to sand[]
15 | set block at {_b} to cobweb
16 | set {_n} to nbt of block at {_b}
17 | set uuid tag "custom;quickSand" of {_n} to uuid of {_e}
18 |
19 | #! EVENT HANDLER !#
20 | on break of cobweb:
21 | set {_n} to nbt of event-block
22 | if {_n} has tag "custom;quickSand":
23 | cancel event
24 | set event-block to air
25 | set {_u} to uuid tag "custom;quickSand" of {_n}
26 | set {_e} to {_u} parsed as entity
27 | kill {_e}
28 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Warp-Menu-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Warp Menu
2 | # By: ShaneBee
3 |
4 | # This is a simple warp menu with action buttons for each warp.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | command /warp []:
11 | trigger:
12 | if arg-1 is set:
13 | teleport player to {warps::%arg-1%}
14 | else:
15 | open multi action dialog to player:
16 | title: mini message from "Warp Menu"
17 | body:
18 | add plain message body:
19 | contents: "&b&l&nSelect a warp to teleport to:"
20 | actions:
21 | loop {warps::*}:
22 | add static action button:
23 | label: "%loop-index%"
24 | action: click event to run command "/warp %loop-index%"
25 |
26 | command /setwarp :
27 | trigger:
28 | set {warps::%arg-1%} to location of player
29 |
--------------------------------------------------------------------------------
/snippets/dialog/static/Gamemode-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Gamemode Switcher
2 | # By: ShaneBee
3 |
4 | # This is a simple gamemode switcher dialog.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | registry registration:
11 | register multi action dialog with id "custom:gamemodes":
12 | title: "Gamemode"
13 | can_close_with_escape: true
14 | columns: 1
15 | body:
16 | add plain message body:
17 | contents: "Choose a gamemode"
18 | actions:
19 | loop all gamemodes:
20 | add static action button:
21 | label: translate component from "gameMode.%loop-value%"
22 | action: click event to run command "/gm %loop-value%"
23 |
24 | command /gm []:
25 | trigger:
26 | if arg-1 is not set:
27 | open dialog with id "custom:gamemodes" to player
28 | else:
29 | set gamemode of player to arg-1
30 |
--------------------------------------------------------------------------------
/snippets/inventory/item-components/Tool-Component.sk:
--------------------------------------------------------------------------------
1 | # Tool Component
2 | # By: ShaneBee
3 |
4 | # This snippet shows examples of applying tool properties to items
5 | # Requirements: SkBee 3.6.0+
6 |
7 | on load:
8 | # Create a stick tool that matches a Diamond Pickaxe
9 | set {-items::stick_pickaxe} to 1 of stick
10 | set component custom item name of {-items::stick_pickaxe} to mini message from "Stickaxe"
11 | set max stack size component of {-items::stick_pickaxe} to 1
12 | set max damage of {-items::stick_pickaxe} to 1561
13 | set damage of {-items::stick_pickaxe} to 0
14 | apply tool component to {-items::stick_pickaxe}:
15 | damage per block: 1
16 | rules:
17 | apply tool rule:
18 | correct for drops: false
19 | block tag: minecraft block tag "minecraft:incorrect_for_diamond_tool"
20 | apply tool rule:
21 | correct for drops: true
22 | speed: 8.0
23 | block tag: minecraft block tag "minecraft:mineable/pickaxe"
24 |
--------------------------------------------------------------------------------
/snippets/Tiny-Text.sk:
--------------------------------------------------------------------------------
1 | # Tiny Text
2 | # By: ShaneBee
3 |
4 | # This little snippet converts regular text to "ᴛɪɴʏ ᴛᴇxᴛ"
5 |
6 | #! Setup variables for tiny text !#
7 | on load:
8 | set {-tiny::*} to "ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ" split at ""
9 | set {_lower} to "abcdefghijklmnopqrstuvwxyz"
10 | set {-lower::*} to {_lower} split at ""
11 | set {-upper::*} to (uppercase {_lower}) split at ""
12 |
13 | #! Function to make tiny text !#
14 | function tinyText(text: text) :: text:
15 | loop {-tiny::*}:
16 | replace {-lower::%loop-index%} and {-upper::%loop-index%} with loop-value in {_text}
17 | # puts back color codes
18 | replace "§%loop-value%" with "§%{-lower::%loop-index%}%" in {_text}
19 | return {_text}
20 |
21 | #! Example Usages !#
22 | command /tinytool :
23 | trigger:
24 | set {_text} to tinyText(uncolored {_name})
25 | set name of player's tool to "&b%{_text}%"
26 |
27 | on chat:
28 | set message to tinyText(message)
29 |
--------------------------------------------------------------------------------
/snippets/command/Command-With-Permission.sk:
--------------------------------------------------------------------------------
1 | # Run Command With Permission
2 | # By: ShaneBee
3 |
4 | # This little snippet creates a custom effect which allows you to make a player
5 | # run a command they dont have perm for, by temporarily giving them perms
6 |
7 | on load:
8 | set {-skript} to server.getServer().getPluginManager().getPlugin("Skript")
9 |
10 | #! CUSTOM EFFECT !#
11 | # Temporarily give a player permission to run a command
12 | effect execute %player% command %string% with permission %string%:
13 | trigger:
14 | set {_p} to expr-1
15 | set {_perm} to expr-3
16 | {_p}.addAttachment({-skript}, {_perm}, true, 1)
17 | execute {_p} command expr-2
18 |
19 | # Example usage
20 | command /test:
21 | trigger:
22 | if gamemode of player = survival:
23 | execute player command "/gamemode creative" with permission "minecraft.command.gamemode"
24 | else:
25 | execute player command "/gamemode survival" with permission "minecraft.command.gamemode"
26 |
--------------------------------------------------------------------------------
/snippets/enchantment/README.md:
--------------------------------------------------------------------------------
1 | # ENCHANTMENT
2 | > [!NOTE]
3 | > These snippets require Minecraft 1.21+
4 |
5 | > [!WARNING]
6 | > These snippets are not meant to be copy/pasted onto your server, they're intended to show inspiration.
7 | > The point of these snippets is to show the base of how things work.
8 | > They wont always be 100% accurate and may often include flaws.
9 |
10 | These snippets are to showcase how to use custom enchantments in Skript.
11 |
12 | As of Minecraft 1.21, custom enchantments can be registered via datapacks.
13 |
14 | These snippets do not actually create custom enchantments, that is done in a datapack.
15 | These snippets merely show off how you can manage what the enchantments do in Skript.
16 |
17 | All of the custom enchantments here use my [**Beer**](https://github.com/ShaneBeee/Beer) datapack.
18 | You can obviously make your own datapack and create your own custom enchantments.
19 | This is strictly to show you the things you can do.
20 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Weather-Changer-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Weather Changer
2 | # By: ShaneBee
3 |
4 | # This is a simple weather changer script.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | command /weather []:
11 | trigger:
12 | if arg-1 is set:
13 | set weather in world of player to arg-1
14 | else:
15 | open multi action dialog to player:
16 | title: "Weather Selector"
17 | columns: 1
18 | body:
19 | add plain message body:
20 | contents: "Select the weather for your world:"
21 | actions:
22 | add static action button:
23 | label: "Sunny"
24 | action: click event to run command "/weather clear"
25 | add static action button:
26 | label: "Rainy"
27 | action: click event to run command "/weather rain"
28 | add static action button:
29 | label: "Thunder"
30 | action: click event to run command "/weather thunder"
31 |
--------------------------------------------------------------------------------
/snippets/dialog/static/World-Spawns-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # World Spawns
2 | # By: ShaneBee
3 |
4 | # This is a simple world spawn dialog.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | registry registration:
11 | register multi action dialog with id "custom:worlds":
12 | title: "World Spawns"
13 | can_close_with_escape: true
14 | columns: 1
15 | body:
16 | add plain message body:
17 | contents: "Choose a world to teleport to!"
18 | actions:
19 | loop all worlds:
20 | set {_name} to "%loop-value%"
21 | replace "_" with " " in {_name}
22 | set {_name} to proper case {_name}
23 | add static action button:
24 | label: {_name}
25 | action: click event to run command "/world %loop-value%"
26 |
27 | command /world []:
28 | trigger:
29 | if arg-1 is not set:
30 | open dialog with id "custom:worlds" to player
31 | else:
32 | teleport player to spawn of arg-1
33 |
--------------------------------------------------------------------------------
/snippets/dialog/static/Server-Links-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Server Links
2 | # By: ShaneBee
3 |
4 | # This is a simple dialog that will give the player a few links that are important to the server.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | registry registration:
11 | register multi action dialog with id "custom:server_links":
12 | title: "Server Links"
13 | columns: 1
14 | body:
15 | add plain message body:
16 | contents: "Some links for our server!"
17 | actions:
18 | add static action button:
19 | label: "Google"
20 | action: click event to open url "https://google.com"
21 | add static action button:
22 | label: "Discord"
23 | action: click event to open url "https://discord.com"
24 | add static action button:
25 | label: "Forums"
26 | action: click event to open url "https://your-forum-link.com"
27 |
28 | command /serverlinks:
29 | trigger:
30 | open dialog with id "custom:server_links" to player
31 |
--------------------------------------------------------------------------------
/snippets/inventory/Simple-Item-Cooldown.sk:
--------------------------------------------------------------------------------
1 | # Simple Item Cooldown
2 | # By: ShaneBee
3 |
4 | # Obviously adjust the event as need be
5 | on right click holding any hoe:
6 | # This means the cooldown is in the future, and the player has to wait
7 | # Obviously adjust the variable as need be
8 | if {-cooldowns::%uuid of player%::hoe} > now:
9 | # Stop the player from using the tool
10 | cancel event
11 | # We get a simple difference between now and our cooldown, and let the player know how long they need to wait
12 | set {_diff} to difference between {-cooldowns::%uuid of player%::hoe} and now
13 | send "You have to wait %{_diff}% to use this tool"
14 | else:
15 | # If the cooldown isn't set or enough time has passed we allow the player to use the tool then set the cooldown
16 | set {-cooldowns::%uuid of player%::hoe} to 10 seconds from now
17 |
18 | on quit:
19 | # If you are not using RAM variables, delete this to prevent clogging up the variable file
20 | # If your cooldown is for a long time, you may want to keep it
21 | delete {-cooldowns::%uuid of player%::*}
22 |
--------------------------------------------------------------------------------
/snippets/entity/Attack-Pig.sk:
--------------------------------------------------------------------------------
1 | # ATTACK PIG
2 | # By: ShaneBee
3 |
4 | # This fun little script is used as an example for making a mob into a hostile mob
5 |
6 | # REQUIRES: SkBee
7 |
8 | #! FUNCTION !#
9 | # Spawn a new attack pig
10 | function spawnAttackPig(l: location):
11 | spawn a pig at {_l}:
12 | set boolean tag "custom;attackPig" of nbt of entity to true
13 | set name of entity to "&cAttack Pig"
14 |
15 | #! LISTENER !#
16 | # Checks when entity is loaded and enables attack status
17 | on entity added to world:
18 | wait 1 tick
19 | set {_e} to event-entity
20 | if type of {_e} = pig:
21 | if nbt of {_e} has tag "custom;attackPig":
22 | while {_e} is alive:
23 | set {_p} to nearest player in radius 15 around {_e}
24 | if gamemode of {_p} = survival or adventure:
25 | set path target of {_e} to {_p}
26 | if distance between {_e} and {_p} < 1:
27 | make {_e} damage {_p} by 1
28 | wait 5 ticks
29 |
30 | #! COMMAND !#
31 | # Spawn an attack pig
32 | command /attackpig:
33 | trigger:
34 | set {_l} to location 0.5 above target block
35 | spawnAttackPig({_l})
36 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Home-Menu-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Home Menu
2 | # By: ShaneBee
3 |
4 | # This is a simple home menu with action buttons for each home.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | command /home []:
11 | trigger:
12 | if arg-1 is set:
13 | teleport player to {homes::%uuid of player%::%arg-1%}
14 | else:
15 | if {homes::%uuid of player%::*} is not set:
16 | send "&cYou have no homes!"
17 | stop
18 | set {_p} to player
19 | open multi action dialog to player:
20 | title: mini message from "Home Menu"
21 | body:
22 | add plain message body:
23 | contents: "&b&l&nSelect a home to teleport to:"
24 | actions:
25 | loop {homes::%uuid of {_p}%::*}:
26 | add static action button:
27 | label: "%loop-index%"
28 | action: click event to run command "/home %loop-index%"
29 |
30 | command /sethome :
31 | trigger:
32 | set {homes::%uuid of player%::%arg-1%} to location of player
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Shane Bee
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.
22 |
--------------------------------------------------------------------------------
/snippets/enchantment/Explosive.sk:
--------------------------------------------------------------------------------
1 | # Explosive
2 | # By: ShaneBee
3 |
4 | # This snippet shows how to use a custom enchantment to create an explosive pickaxe.
5 |
6 | # Requirements: Skript 2.9+, Beer (Datapack - See ReadME), skript-reflect, Minecraft 1.21+
7 |
8 | on break:
9 | if event-block is solid:
10 | set {_lvl} to enchantment level of beer:explosive of player's tool
11 | if {_lvl} > 0:
12 | set {_l1} to location of event-block ~ vector({_lvl},{_lvl},{_lvl})
13 | set {_lvl} to {_lvl} * -1
14 | set {_l2} to location of event-block ~ vector({_lvl},{_lvl},{_lvl})
15 | loop blocks within {_l1} and {_l2}:
16 | if all:
17 | loop-block is not event-block
18 | loop-block is not bedrock
19 | loop-block is solid
20 | then:
21 | create fake explosion at loop-block
22 | # This requires reflect, this method breaks the block naturally but also plays the particles
23 | # You can alternatively use:
24 | # break loop-block naturally using tool of player
25 | loop-block.breakNaturally(1 of player's tool, true)
26 | damage player's tool by 1
27 | chance of 5%:
28 | set loop-block to fire
29 |
--------------------------------------------------------------------------------
/snippets/inventory/item-components/Attribute-Modifier-Component.sk:
--------------------------------------------------------------------------------
1 | # Apply Attribute Modifiers to Items
2 | # By: ShaneBee
3 |
4 | # This snippet shows examples of applying attribute modifiers to items
5 | # Requirements: SkBee 3.5.9+, Minecraft 1.21+
6 | # (If you wanna test these on Minecraft 1.20.x and below, remove ID and use name/uuid instead)
7 |
8 | on load:
9 | set {-items::gravity_boots} to 1 of netherite boots with nbt from "{""minecraft:item_name"":'{""text"":""Gravity Boots""}'}"
10 | apply attribute modifier to {-items::gravity_boots}:
11 | id: "my_mods:gravity"
12 | attribute: gravity
13 | amount: -0.05
14 | operation: add_number
15 | slot: feet_slot_group
16 |
17 | apply attribute modifier to {-items::gravity_boots}:
18 | id: "my_mods:fall_scale"
19 | attribute: fall damage multiplier
20 | amount: -0.5
21 | operation: add_number
22 | slot: feet_slot_group
23 |
24 | apply attribute modifier to {-items::gravity_boots}:
25 | id: "my_mods:safe_fall"
26 | attribute: safe fall distance
27 | amount: 12
28 | operation: add_number
29 | slot: feet_slot_group
30 |
--------------------------------------------------------------------------------
/snippets/player/Tablist-Sorted-SkBee-Team.sk:
--------------------------------------------------------------------------------
1 | # Sorted Tablist
2 | # By: ShaneBee
3 |
4 | # This snippet allows your players to be ordered in the tablist based on their rank
5 | # This snipped may not work with plugins like TAB or any other plugin that messes with vanilla teams
6 |
7 | # Requirements = SkBee
8 |
9 | #! Setup teams and prefixes for teams !#
10 | on load:
11 | set team prefix of team named "a-team" to "&7[&bOWNER&7] "
12 | set team prefix of team named "b-team" to "&7[&aADMIN&7] "
13 | set team prefix of team named "c-team" to "&7[&6MOD&7] "
14 | set team prefix of team named "d-team" to "&7[&dVIP&7] "
15 | # more if you'd like
16 | set team prefix of team named "z-team" to "&7[&cPLAYER&7] "
17 |
18 | #! Simple Function To Rank Player!#
19 | function rankPlayer(p: player):
20 | if {_p} has permission "rank.owner":
21 | set {_t} to team named "a-team"
22 | else if {_p} has permission "rank.admin":
23 | set {_t} to team named "b-team"
24 | else if {_p} has permission "rank.mod":
25 | set {_t} to team named "c-team"
26 | else:
27 | set {_t} to team named "z-team"
28 |
29 | # SkBee 2.11.0+
30 | add {_p} to {_t}
31 |
32 | # SkBee 2.10.0 or below
33 | add {_p} to team entries of {_t}
34 |
35 | on connect:
36 | rankPlayer(player)
37 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/blue_planet/blue-planet-gen.sk:
--------------------------------------------------------------------------------
1 | # Blue colored planet
2 | # By ShaneBee
3 |
4 | # This snippet includes generation for a blue colored planet
5 | # Biomes are from the 'blue-planet-biomes.sk' snippet
6 |
7 | # Requirements: SkBee 3.10+
8 |
9 | #! LOAD WORLD FROM GENERATOR !#
10 | on load:
11 | # Wait a tick to make sure generator is properly loaded
12 | # without this the spawn area doesn't generate properly (it's flat)
13 | wait 1 tick
14 | if world("world_blue_planet") is not loaded:
15 | set {_w} to world creator named "world_blue_planet"
16 | set chunk generator of {_w} to chunk generator with id "blue_planet"
17 | load world from creator {_w}
18 |
19 | #! REGISTER GENERATOR !#
20 | register chunk generator with id "blue_planet":
21 | vanilla caves: true
22 | vanilla decor: true
23 | vanilla structures: true
24 | biome gen:
25 | # We allow vanilla chunk generation
26 | # So we grab the generator's noise points and create biomes based on that
27 | set {_param} to biome parameter point
28 |
29 | # Simple method to split the world up
30 | # Weirdness often borders biomes nicely with rivers
31 | if fixed biome weirdness of {_param} > 0:
32 | set chunkdata biome to my_biomes:blue_plains
33 | else:
34 | set chunkdata biome to my_biomes:blue_forest
35 |
--------------------------------------------------------------------------------
/snippets/inventory/Compressor.sk:
--------------------------------------------------------------------------------
1 | # Compressor
2 | # By: ShaneBee
3 |
4 | # This little snippets shows how to register simple compressors
5 |
6 | # REQUIRES: SkBee (for hiding flags on items)
7 |
8 | # Function to register your compressor
9 | # From = The item to compress
10 | # To = The item that will be compressed into
11 | # Required = The amount of 'From' that will be required to compress
12 | function registerCompressor(from: itemtype, to: itemtype, required: number):
13 | set {-comp::%{_from}%::to} to {_to}
14 | set {-comp::%{_from}%::required} to {_required}
15 |
16 | # Function to run when compression needs to happen
17 | function compress(p: player, from: itemtype):
18 | set {_required} to 1 of {-comp::%{_from}%::required}
19 | set {_give} to {-comp::%{_from}%::to}
20 | if {_required} is set:
21 | while {_p} has {_required} of plain {_from}:
22 | remove {_required} of plain {_from} from {_p}
23 | give {_give} to {_p}
24 |
25 | # Register your compressors
26 | on load:
27 | set {_i} to cobblestone of unbreaking named "&bCompressed Cobble" with all flags hidden
28 | registerCompressor(1 of cobblestone, {_i}, 64)
29 | set {_i} to diamond of unbreaking named "&aCompressed Diamond" with all flags hidden
30 | registerCompressor(1 of diamond, {_i}, 64)
31 |
32 | # Run the compressor function when a player picks up an item
33 | on pickup:
34 | wait 1 tick
35 | compress(player, event-item)
36 |
--------------------------------------------------------------------------------
/snippets/inventory/Simple-GUI-Vanilla.sk:
--------------------------------------------------------------------------------
1 | # Simple Vanilla Gui Example
2 | # By: ShaneBee
3 |
4 | # This showcases how to create a simple GUI in Skript without any addons.
5 | # While this may work for most people, Skript has a few flags that can cause issues
6 | # I personally prefer Skript-GUI as it is simpler/cleaner to write/use.
7 |
8 | command /spawn:
9 | trigger:
10 | # create our custom inventory
11 | set {_g} to chest inventory with 1 row named "&bSpawns"
12 |
13 | # fill all empty slots with glass
14 | set slots (integers between 0 and 8) of {_g} to black stained glass pane named " "
15 |
16 | # set our slots that will have actions
17 | set slot 0 of {_g} to grass block named "&aWorld Spawn"
18 | set slot 1 of {_g} to netherrack named "&cNether Spawn"
19 |
20 | # store the gui in the player for click events
21 | set metadata tag "my-gui" of player to {_g}
22 |
23 | # open the gui to the player
24 | open {_g} to player
25 |
26 | on inventory click:
27 | # verify the inventory the player is clicking is our GUI
28 | if clicked inventory = metadata tag "my-gui" of player:
29 | # stop them from stealing
30 | cancel event
31 |
32 | # check the slot they're clicking
33 | if index of clicked slot = 0:
34 | # run an action
35 | teleport player to spawn of world "world"
36 | else if index of clicked slot = 1:
37 | teleport player to spawn of world "world_nether"
38 |
--------------------------------------------------------------------------------
/snippets/inventory/item-components/Food-Component.sk:
--------------------------------------------------------------------------------
1 | # Food Component
2 | # By: ShaneBee
3 |
4 | # This snippet shows examples of applying food properties to items
5 | # Requirements: SkBee 3.6.0+
6 |
7 | # Example creating a simple food item out of a stick
8 | on load:
9 | set {-items::yummy_stick} to 1 of stick with nbt from "{""minecraft:item_name"":'{""text"":""Yummy Stick""}'}"
10 | apply food component to {-items::yummy_stick}:
11 | nutrition: 3
12 | saturation: 1
13 | effects:
14 | apply potion effect of strength of tier 2 without particles for 1 minute
15 |
16 | # Example creating a food item with custom model data and a recipe
17 | on load:
18 | set {-items::roasted_flesh} to rotten flesh with custom model data 10881
19 | set component custom item name of {-items::roasted_flesh} to mini message from "Roasted Flesh"
20 | set max stack size component of {-items::roasted_flesh} to 16
21 |
22 | apply food component to {-items::roasted_flesh}:
23 | saturation: 1
24 | nutrition: 7
25 | effects:
26 | apply potion effect of nausea without particles for 10 seconds with probability 0.8
27 | apply potion effect of poison without particles for 3 seconds with probability 0.2
28 | apply potion effect of hunger without particles for 10 seconds with probability 0.3
29 |
30 | register smoking recipe:
31 | id: "my_recipes:roasted_flesh"
32 | result: {-items::roasted_flesh}
33 | input: rotten flesh
34 |
--------------------------------------------------------------------------------
/snippets/command/brigadier/Server.sk:
--------------------------------------------------------------------------------
1 | # Server Selector Command
2 |
3 | # This little snippet shows a command for transfering player's to other servers
4 | # You register the name of all your servers and plop this on all servers
5 | # The current server will not show up
6 |
7 | # This uses Minecraft's transfer system, this is NOT for bungee/velocity!
8 |
9 | # Requirements: SkBee, Minecraft 1.20.5+, SkBriggy
10 |
11 | function registerServer(port: number, name: string, tooltip: string):
12 | if {-port} = {_port}:
13 | stop
14 | set {-servers::%{_name}%} to {_port}
15 | set {-servers::%{_name}%::tooltip} to {_tooltip}
16 |
17 | on load:
18 | set {-port} to server.getServer().getPort()
19 | registerServer(25565, "hub", "The main server")
20 | registerServer(25566, "fun", "The fun server")
21 | registerServer(25567, "test", "Invalid test server")
22 |
23 | brig command tree /server:
24 | string arg "server":
25 | suggestions:
26 | loop {-servers::*}:
27 | apply suggestion loop-index with tooltip {-servers::%loop-index%::tooltip}
28 | optional players arg "players":
29 | trigger:
30 | if {-servers::%{_server}%} is not set:
31 | send "&7[&bServers&7] &cInvalid server: &e%{_server}%"
32 | stop
33 | set {_players::*} to {_players::*} ? player
34 | send "&7[&bServers&7] &6Transferring to server: &a%{_server}%" to {_players::*}
35 | wait 1 second
36 | transfer {_players::*} to server "localhost" on port {-servers::%{_server}%}
37 |
--------------------------------------------------------------------------------
/snippets/other/deobfuscate.sk:
--------------------------------------------------------------------------------
1 | # Deobfuscate
2 | # By: ShaneBee
3 |
4 | # This snippet allows you to deobfuscate scripts that were obfuscated using WildSkript
5 | # This will be useless for most, but storing it just in case
6 |
7 | # Requirements: SkBriggy, skript-reflect
8 |
9 | #! HOW TO USE !#
10 | # Step 1) throw a wildskript.jar in the "plugins/skript-reflect" folder
11 | # (we dont want to run it as a plugin)
12 |
13 | # Step 2) Create the following folder "plugins/Skript/obfuscated/"
14 | # Step 3) Throw your obfuscated scripts in that folder
15 |
16 | # Step 4) Run the command:
17 | # file = the name of the file to deobfuscate
18 | # power = the power it was obfuscated with (you might have to run thru many numbers and guess)
19 |
20 | # Step 5) The resulting script will now be in the "plugins/Skript/obfuscated/output/" folder
21 |
22 | import:
23 | java.io.File
24 | net.dzikoysk.wildskript.collections.obfuscator.Obfuscator
25 | java.io.FileWriter
26 |
27 | brig command /deobfuscate:
28 | arguments:
29 | register string arg "file":
30 | apply suggestions {-obfuscated-files::*}
31 | register int arg "power"
32 | trigger:
33 | set {_f} to new File("plugins/Skript/obfuscated/%{_file}%.sko")
34 | set {_o} to Obfuscator.load({_f}, {_power})
35 | set {_out} to new File("plugins/Skript/obfuscated/output/")
36 | if {_out}.exists() = false:
37 | {_out}.mkdirs()
38 | set {_w} to new FileWriter("plugins/Skript/obfuscated/output/%{_file}%.sk")
39 | {_w}.write({_o})
40 | {_w}.close()
41 |
--------------------------------------------------------------------------------
/snippets/enchantment/Feller.sk:
--------------------------------------------------------------------------------
1 | # Feller
2 | # By: ShaneBee
3 |
4 | # This snippet shows how to use a custom enchantment to create a tree feller axe.
5 |
6 | # Requirements: Skript 2.9+, SkBee, Beer (Datapack - See ReadME), Minecraft 1.21+
7 |
8 | #! FUNCTIONS !#
9 | # This function breaks connected logs/wood
10 | function fell(b: block, p: player, lvl: number, t: timespan):
11 | set {_l1} to location of {_b} ~ vector(1,1,1)
12 | set {_l2} to location of {_b} ~ vector(-1,-1,-1)
13 | loop blocks within {_l1} and {_l2}:
14 | if all:
15 | loop-block != {_b}
16 | type of loop-block is tagged as minecraft block tag "minecraft:logs"
17 | durability of tool of {_p} > 0
18 | enchantment level of beer:feller of tool of {_p} = {_lvl}
19 | then:
20 | break loop-block with effects and with xp using tool of {_p}
21 |
22 | if gamemode of {_p} = survival or adventure:
23 | damage tool of {_p} by 1
24 | if {_t} > 0 ticks:
25 | wait {_t}
26 | fell(loop-block, {_p}, {_lvl}, {_t})
27 |
28 | #! EVENTS !#
29 | # Handle breaking a log/wood with our enchanted item
30 | on break:
31 | if type of event-block is tagged as minecraft block tag "minecraft:logs":
32 | set {_lvl} to enchantment level of beer:feller of player's tool
33 | if {_lvl} > 0:
34 | # The time between block breaks is determinded by the level of enchantment
35 | # The higher the level the faster the blocks break
36 | # After level 5, it will break instantly
37 | set {_t} to (6 - {_lvl})
38 | set {_t} to "%{_t}% ticks" parsed as timespan
39 | fell(event-block, player, {_lvl}, {_t})
40 |
--------------------------------------------------------------------------------
/snippets/dialog/static/Block-Break-Confirmation-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Block Break Confirmation
2 | # By: ShaneBee
3 |
4 | # This script opens a dialog box when a player breaks a block
5 | # asking them to confirm whether to break the block
6 |
7 | # Do note, this is not intended for production, only for educational purposes
8 |
9 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
10 |
11 | registry registration:
12 | register multi action dialog with id "custom:block_break_confirmation_dialog":
13 | title: "Block Break Confirmation"
14 | can_close_with_escape: false
15 | columns: 1
16 | body:
17 | add plain message body:
18 | contents: mini message from "Do you want to break this block?"
19 | actions:
20 | add dynamic action button:
21 | label: mini message from "Confirm Break"
22 | tooltip: mini message from "I wish for the block to break and drop stuff"
23 | id: "custom:confirm_break"
24 | add static action button:
25 | label: mini message from "Cancel Break"
26 | tooltip: mini message from "I do not wish for the block to break"
27 | # No action as we want nothing to happen
28 |
29 | on mine:
30 | if gamemode of player is survival:
31 | cancel event
32 | set {-targetblock::%uuid of player%} to event-block
33 | open dialog with id "custom:block_break_confirmation_dialog" to player
34 |
35 | on dynamic button click:
36 | if "%event-namespacedkey%" contains "custom:confirm_break":
37 | if {-targetblock::%uuid of player%} is set:
38 | break {-targetblock::%uuid of player%} with effects using player's tool
39 | delete {-targetblock::%uuid of player%}
40 |
--------------------------------------------------------------------------------
/snippets/Arclight-Syntaxes.sk:
--------------------------------------------------------------------------------
1 | # Arclight Syntaxes
2 | # By: ShaneBee
3 |
4 | # This little snippet allows for some useful syntaxes on an Arclight server
5 |
6 | # REQUIRES: SkBee and skript-reflect
7 |
8 | import:
9 | org.bukkit.entity.EntityType
10 | ch.njol.skript.sections.EffSecSpawn
11 |
12 | #! SPAWN A MODDED MOB !#
13 | # This effect allows you to spawn a modded mob
14 | # supports `last spawned entity`
15 | # EXAMPLES:
16 | # `mod spawn mod_name:mod_entity at location(1,1,1)`
17 | # `mod spawn tfc:turkey at player`
18 |
19 | effect mod[ded] spawn <(.+)> at %location%:
20 | trigger:
21 | set {_t} to uppercase "%regex-1%"
22 | replace ":" with "_" in {_t}
23 | set {_e} to EntityType.valueOf({_t})
24 | if {_e} is not set:
25 | stop
26 | set {_loc} to expr-1
27 | set {_w} to world of {_loc}
28 | set EffSecSpawn.lastSpawned to {_w}.spawnEntity({_loc}, {_e})
29 |
30 | #! MODDED BLOCKDATA !#
31 | # This effect allows you to set a block to a modded blockdata
32 | # EXAMPLE -> `mod set target block to tfc:clay/silt`
33 |
34 | effect mod[ded] set [block data of] %block% to <(.+)>:
35 | trigger:
36 | set {_data} to server.getServer().createBlockData("%regex-1%")
37 | if {_data} is set:
38 | set block at expr-1 to {_data}
39 |
40 | #! MODDED ITEMTYPE !#
41 | # This expression returns an itemtype from a mod
42 | # EXAMPLE -> `give player mod item tfc:wild_crop/oat`
43 |
44 | expression mod[ded] item[[ ]type] [from] <(.+)>:
45 | get:
46 | set {_i::*} to "%regex-1%" split at ":"
47 | set {_i::1} to "minecraft:%{_i::1}%_"
48 | set {_i} to join {_i::*}
49 | return itemtype from namespacedkey from {_i}
50 |
--------------------------------------------------------------------------------
/snippets/player/Skin-Changer.sk:
--------------------------------------------------------------------------------
1 | # Simple Skin Changer
2 | # By: ShaneBee
3 |
4 | # This little snippet allows you to change a player's skin and their profile name
5 |
6 | # Requires: Skript-Reflect and Paper (I should hope you already have Paper)
7 |
8 |
9 | #! SET SKIN EFFECT !#
10 | # Player = the player who's skin is going to change
11 | # String = the name of the player to grab a skin from
12 | effect set skin of %player% to %string%:
13 | trigger:
14 | set {_p} to expr-1
15 | set {_n} to expr-2
16 |
17 | create new section with {_name}, {_player} stored in {_sec}:
18 | set {_pro} to server.getServer().createProfile({_name})
19 | {_pro}.complete(true)
20 | set {_text} to {_pro}.getTextures()
21 | set {_pro} to {_player}.getPlayerProfile()
22 | {_pro}.setTextures({_text})
23 | return {_pro}
24 | run section {_sec} async with arguments {_n} and {_p} and store result in {_pro} and wait
25 | {_p}.setPlayerProfile({_pro})
26 |
27 | #! PROFILE NAME EXPRESSION !#
28 | # this allows you to change the player's profile name (name in tablist and above head)
29 | expression [player] profile name of %player%:
30 | get:
31 | return (expr-1).getPlayerProfile().getName()
32 | set:
33 | set {_player} to expr-1
34 | set {_name} to change value
35 | if length of {_name} > 16:
36 | set {_name} to first 16 characters of {_name}
37 | set {_pro} to {_player}.getPlayerProfile()
38 | {_pro}.setName({_name})
39 | {_player}.setPlayerProfile({_pro})
40 |
41 | #! EXAMPLE USAGE !#
42 | command /setskin :
43 | trigger:
44 | set profile name of player to {_name}
45 | set skin of player to {_name}
46 |
--------------------------------------------------------------------------------
/snippets/player/Combat-Log.sk:
--------------------------------------------------------------------------------
1 | # Simple Combat Log
2 | # By Shane Bee
3 |
4 | # This simple example shows you how to setup a combat timer
5 |
6 | # Requirements: SkBee
7 | options:
8 | # Time you want combat log to last
9 | combat_time: 15 seconds
10 | # Prefix for action bar
11 | prefix: &7[&bCombat&7]
12 |
13 | function combatTimer(p: player):
14 | if {-combat::%uuid of {_p}%} is not set:
15 | set {-combat::%uuid of {_p}%} to {@combat_time} from now
16 | while {-combat::%uuid of {_p}%} is set:
17 | if {-combat::%uuid of {_p}%} > now:
18 | set {_diff} to (seconds of (difference between {-combat::%uuid of {_p}%} and now)) + 1
19 | send action bar "{@prefix} &cYou're in combat for %{_diff}% seconds!" to {_p}
20 | else:
21 | delete {-combat::%uuid of {_p}%}
22 | wait 5 ticks
23 | send action bar "{@prefix} &aYou're out of combat!" to {_p}
24 | else:
25 | set {-combat::%uuid of {_p}%} to {@combat_time} from now
26 |
27 | function checkCombat(p: player) :: boolean:
28 | if {-combat::%uuid of {_p}%} > now:
29 | return true
30 | else:
31 | delete {-combat::%uuid of {_p}%}
32 | return false
33 |
34 | # Activate the combat timer
35 | on damage of player:
36 | if attacker is a player:
37 | combatTimer(attacker)
38 | combatTimer(victim)
39 |
40 | # Cancel event if timer is going
41 | # Add other events you see fit
42 | on break:
43 | if checkCombat(player) = true:
44 | cancel event
45 | send "{@prefix} &cYou cant break blocks in combat" to player
46 |
47 | # Kill player if timer logs out
48 | on quit:
49 | if checkCombat(player) = true:
50 | kill player
51 | delete {-combat::%uuid of player%}
52 |
--------------------------------------------------------------------------------
/snippets/block/Falling-Blocks.sk:
--------------------------------------------------------------------------------
1 | # Falling Blocks
2 | # By: ShaneBee
3 |
4 | # This little snippet shows an example of making other blocks fall like sand/gravel
5 | # Currently setup for leaves/logs/grass_block/dirt
6 | # Requirements: SkBee, Minecraft 1.19.4+
7 |
8 | options:
9 | # The max distance a loop will check for falling blocks
10 | # Higher numbers can be more performance heavy
11 | max_fall_check: 10
12 |
13 | function isFallable(b: block) :: boolean:
14 | set {_type} to type of {_b}
15 | if any:
16 | type of {_b} is tagged as block tag "logs"
17 | type of {_b} is tagged as block tag "leaves"
18 | type of {_b} is grass block or dirt
19 | then:
20 | return true
21 | else:
22 | return false
23 |
24 | function fall(b: block):
25 | set {_data} to block data of {_b}
26 | set block at {_b} to air
27 | le spawn falling {_data} at location 0.5 below {_b}
28 |
29 | function updateAbove(b: block):
30 | wait 2 ticks
31 | if isFallable(block above {_b}) = true:
32 | updateNeighbour({_b}, 0)
33 | set {_b} to block above {_b}
34 | fall({_b})
35 | updateAbove({_b})
36 |
37 | function updateNeighbour(b: block, dist: number):
38 | if {_dist} > {@max_fall_check}:
39 | stop
40 | wait 2 ticks
41 | add 1 to {_dist}
42 | updateAbove({_b})
43 | loop blocks in radius 1 around {_b}:
44 | if all:
45 | y coord of {_b} = y coord of loop-block
46 | isFallable(loop-block) = true
47 | block below loop-block is not solid
48 | then:
49 | fall(loop-block)
50 | updateNeighbour(loop-block, {_dist})
51 | updateAbove(loop-block)
52 |
53 | on break:
54 | updateNeighbour(event-block, 0)
55 |
56 | on place:
57 | updateNeighbour(event-block, 0)
58 |
--------------------------------------------------------------------------------
/snippets/inventory/Vaults-NBT.sk:
--------------------------------------------------------------------------------
1 | # Vaults
2 | # By: ShaneBee
3 | # Requires Skript 2.6+, SkBee 2.7.0+
4 |
5 | # This Skript snippet shows a simple method for saving vaults into a Player's NBT
6 | # By using this method you can greatly reduce the amount of variables your server is using
7 |
8 | # Save the inventory contents to the player's NBT
9 | function saveInv(p: player, name: string):
10 | loop (slots of current inventory of {_p}) times:
11 | set {_s} to loop-number - 1
12 | if slot {_s} of current inventory of {_p} is not air:
13 | set {_item} to slot {_s} of current inventory of {_p}
14 | set {_i} to full nbt of {_item}
15 | set byte tag "Slot" of {_i} to {_s}
16 | add {_i} to {_items::*}
17 | set {_n} to nbt compound of {_p}
18 | set compound list tag "custom;vaults;%{_name}%" of {_n} to {_items::*}
19 |
20 | # Load the inventory contents from the player's NBT
21 | function loadInv(p: player, name: string):
22 | set {_g} to chest inventory named "&3Vault ##%{_name}%" with 3 rows
23 | set {_n} to nbt compound of {_p}
24 | set {_v::*} to compound list tag "custom;vaults;Vault-%{_name}%" of {_n}
25 | loop {_v::*}:
26 | set {_s} to tag "Slot" of loop-value
27 | set {_i} to nbt item from loop-value
28 | set slot {_s} of {_g} to {_i}
29 | open {_g} to {_p}
30 |
31 |
32 | # Sample vault command for loading
33 | command /vault :
34 | trigger:
35 | loadInv(player, "%arg-1%")
36 |
37 | # Sample event for saving
38 | on inventory close:
39 | if name of current inventory of player contains "&3Vault ##":
40 | set {_n} to uncolored name of current inventory of player
41 | replace " ##" with "-" in {_n}
42 | saveInv(player, {_n})
43 |
--------------------------------------------------------------------------------
/snippets/display/Display-Mini-Structure.sk:
--------------------------------------------------------------------------------
1 | # Mini Structure
2 | # By: ShaneBee
3 |
4 | # This little script allows you to place scaled (up/down) versions of structures
5 | # using block display entities.
6 |
7 | # Requires Minecraft 1.19.4+ and SkBee 2.8.1+
8 |
9 | #! FUNCTION !#
10 | # Place a fake block
11 | function placeFakeBlock(loc: location, data: block data, size: number = 1):
12 | if {_data} = air[]:
13 | stop
14 | spawn block display at {_loc}
15 | set {_e} to last spawned entity
16 | set display block data of {_e} to {_data}
17 | set display scale of {_e} to vector({_size}, {_size}, {_size})
18 |
19 | #! COMMAND !#
20 | # Command to place your mini (or large) structure
21 | # structure = a structure namespace, such as "minecraft:village/taiga/houses/taiga_masons_house_1", "test", "skbee:test"
22 | # scale = the size you want this to produce, such as 0.5 (half the size), 2 (twice the size)
23 | command /ministructure :
24 | trigger:
25 | set {_s} to structure named {_structure}
26 | set {_loc} to location of target block ~ vector(-0.5,0.5,-0.5)
27 | loop blockstates of structure {_s}:
28 | set {_data} to blockstate blockdata of loop-value
29 | set {_off} to blockstate offset of loop-value
30 | set x component of {_off} to x component of {_off} * {_scale}
31 | set y component of {_off} to y component of {_off} * {_scale}
32 | set z component of {_off} to z component of {_off} * {_scale}
33 | set {_l} to {_loc} ~ {_off}
34 | placeFakeBlock({_l}, {_data}, {_scale})
35 |
36 | on tab complete of "/ministructure":
37 | set tab completions for position 1 to ""
38 | set tab completions for position 2 to ""
39 |
--------------------------------------------------------------------------------
/snippets/dialog/static/Server-Rules-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Rule Agreement
2 | # By: ShaneBee
3 |
4 | # This is a simple rule agreement for when players join.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | registry registration:
11 | register multi action dialog with id "custom:join_rules":
12 | title: "Server Rules"
13 | can_close_with_escape: false
14 | columns: 1
15 | body:
16 | add plain message body:
17 | contents: mini message from "Please read our server rules!"
18 | add plain message body:
19 | contents: "Rules:"
20 | # SETUP RULES
21 | add "1) Be nice" to {_rules::*}
22 | add "2) Don't break other people's stuff" to {_rules::*}
23 | add "3) No bad language" to {_rules::*}
24 | set {_rules} to mini message from (join {_rules::*} using "")
25 | add plain message body:
26 | contents: {_rules}
27 | inputs:
28 | add text input:
29 | key: "name_input"
30 | label: "Input your name to confirm:"
31 | initial: "name"
32 | actions:
33 | add dynamic action button:
34 | label: mini message from "Agree"
35 | tooltip: mini message from "By clicking this I agree to the server rules."
36 | id: "custom:accept_rules"
37 | add dynamic action button:
38 | label: mini message from "Disconnect"
39 | tooltip: mini message from "I'd rather leave!"
40 | id: "custom:decline_rules"
41 |
42 | on join:
43 | open dialog with id "custom:join_rules" to player
44 |
45 | on dynamic button click:
46 | if "%event-namespacedkey%" contains "custom:accept_rules":
47 | if string tag "name_input" of event-nbtcompound != player's name:
48 | open dialog with id "custom:join_rules" to player
49 | if "%event-namespacedkey%" contains "custom:decline_rules":
50 | kick player due to "&cYou have declined our rules!"
51 |
--------------------------------------------------------------------------------
/snippets/command/brigadier/Warps.sk:
--------------------------------------------------------------------------------
1 | # Warps Command Tree
2 | # By ShaneBee
3 |
4 | # This snippet shows off a simple warp command using a command tree
5 |
6 | # Requirements: SkBriggy
7 |
8 | brig command tree /warps:
9 | description: All your warpin needs!
10 | # We use literal args to make sure the player can only type these options
11 | literal arg "set":
12 | # Each subcommand can have its own permission
13 | permission: warps.set
14 | string arg "warp":
15 | trigger:
16 | if {warps::%{_warp}%} is set:
17 | send "&7[&bWarps&7] &6Warp already set &r'&c%{_warp}%&r'"
18 | else:
19 | set {warps::%{_warp}%} to location of player
20 | send "&7[&bWarps&7] &6Created new warp &r'&b%{_warp}%&r'"
21 |
22 | literal arg "delete":
23 | permission: warps.delete
24 | string arg "warp":
25 | suggestions:
26 | apply suggestions (indexes of {warps::*})
27 | trigger:
28 | if {warps::%{_warp}%} is set:
29 | delete {warps::%{_warp}%}
30 | send "&7[&bWarps&7] &6Deleted warp &r'&b%{_warp}%&r'"
31 | else:
32 | send "&7[&bWarps&7] &6Unknown warp &r'&c%{_warp}%&r'"
33 |
34 | literal arg "warp":
35 | permission: warps.warp
36 | string arg "warp":
37 | suggestions:
38 | loop {warps::*}:
39 | set {_s} to "&7x: &b%x coord of loop-value% &7y: &b%y coord of loop-value% &7z: &b%z coord of loop-value% &7world: &a%world of loop-value%"
40 | apply suggestion loop-index with tooltip {_s}
41 | players arg "players":
42 | permission: warps.warp.other
43 | trigger:
44 | if {warps::%{_warp}%} is set:
45 | teleport {_players::*} to {warps::%{_warp}%}
46 | else:
47 | send "&7[&bWarps&7] &6Unknown warp &r'&c%{_warp}%&r'"
48 | trigger:
49 | if {warps::%{_warp}%} is set:
50 | teleport player to {warps::%{_warp}%}
51 | else:
52 | send "&7[&bWarps&7] &6Unknown warp &r'&c%{_warp}%&r'"
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/snippets/player/Tablist-Sorted-Vanilla-Team.sk:
--------------------------------------------------------------------------------
1 |
2 | # Sorted Tablists
3 | # By: ShaneBee
4 |
5 | # This simple script allows you to sort your players in tablist based on their rank.
6 | # This uses the vanilla team system via simple console commands.
7 |
8 |
9 | # Function to register a new team and set it's prefix/suffix
10 | function registerTeam(name: string, prefix: string, suffix: string):
11 | execute console command "/team add %{_name}%"
12 | if length of {_prefix} > 0:
13 | execute console command "/team modify %{_name}% prefix ""%{_prefix}% """
14 | if length of {_suffix} > 0:
15 | execute console command "/team modify %{_name}% suffix ""%{_suffix}% """
16 |
17 | # Function to join a player to a team
18 | function joinTeam(player: player, team: string):
19 | execute console command "/team leave %{_player}%" # We do this to prevent being on more than 1 team
20 | execute console command "/team join %{_team}% %{_player}%"
21 |
22 |
23 | # When the server loads we will register our teams
24 | # Subsequent loads, this will throw some warnings in the console
25 | # You can either ignore these, or remove this section of code once teams are registered
26 | on skript load:
27 | # We use a, b, c to rank our teams from highest to lowest
28 | # You can name the team whatever you want but they will show up in
29 | # the tablist in alphabetical order
30 | registerTeam("a", "&7[&aOWNER&7]", "")
31 | registerTeam("b", "&7[&cADMIN&7]", "")
32 | registerTeam("c", "&7[&bMOD&7]", "")
33 | registerTeam("d", "&7[&7PLAYER&7]", "")
34 |
35 | # When the player joins, let's add them to the appropriate team
36 | # Use whatever permissions you see fit
37 | on join:
38 | wait 1 tick
39 | if player has permission "rank.owner":
40 | joinTeam(player, "a")
41 | else if player has permission "rank.admin":
42 | joinTeam(player, "b")
43 | else if player has permission "rank.mod":
44 | joinTeam(player, "c")
45 | else:
46 | joinTeam(player, "d")
47 |
48 |
--------------------------------------------------------------------------------
/snippets/command/ChunkFixer.sk:
--------------------------------------------------------------------------------
1 | # REQUIRES SkBee
2 |
3 | #! Run this command with the world you wanna copy to load the copied world !#
4 | command /loadworld :
5 | trigger:
6 | set {_world} to world("%arg-1%_copy")
7 | if {_world} is set:
8 | send "&7[&bChunk&3Fixer&7] &cThe world is already loaded!"
9 | stop
10 | send "&7[&bChunk&3Fixer&7] &aLoading world..."
11 | set {_n} to now
12 | set {_w} to world creator named "%arg-1%_copy" to copy world(arg-1)
13 | load world from creator {_w}
14 | wait 1 tick
15 | send "&7[&bChunk&3Fixer&7] &aWorled loaded in &b%difference between now and {_n}%"
16 |
17 | on tab complete of "/loadworld":
18 | set tab completions for position 1 to worlds
19 |
20 | command /fixchunk:
21 | trigger:
22 | set {_w} to "%world of player%"
23 | set {_w} to world("%{_w}%_copy")
24 | if {_w} is not set:
25 | send formatted "&7[&bChunk&3Fixer&7] &cThe world is not loaded! &6Run &a/loadworld %world of player% &6to load the world!"
26 | stop
27 | set {_l} to location of target block of player
28 | if {_l} is not set:
29 | set {_l} to location of player
30 | fixChunk({_l}, {_w})
31 |
32 | function fixChunk(loc: location, w: world):
33 | if {_w} is not set:
34 | stop
35 | set {_chunk1} to chunk at {_loc}
36 | set world of {_loc} to {_w}
37 | set {_chunk2} to chunk at {_loc}
38 | loop integers between 0 and 15:
39 | loop integers between 0 and 15:
40 | loop integers between -64 and 140:
41 | set {_x} to loop-number-1
42 | set {_z} to loop-number-2
43 | set {_y} to loop-number-3
44 | set {_b1} to block at {_x}, {_y}, {_z} in {_chunk1}
45 | set {_b2} to block at {_x}, {_y}, {_z} in {_chunk2}
46 | set {_d1} to block data of {_b1}
47 | set {_d2} to block data of {_b2}
48 | if {_d1} != {_d2}:
49 | set block data of block at {_b1} without updates to {_d2}
50 | wait 1 tick
51 |
52 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Block-Break-Confirmation-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Block Break Confirmation
2 | # By: ShaneBee
3 |
4 | # This script opens a dialog box when a player breaks a block
5 | # asking them to confirm whether to break the block.
6 |
7 | # Unlike the registration version of this same script,
8 | # this version opens a dynamic dialog along with the location of the block
9 | # which is passed thru to the event, no variables needed.
10 |
11 | # Do note, this is not intended for production, only for educational purposes
12 |
13 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
14 |
15 | on mine:
16 | if gamemode of player is survival:
17 | set {_n} to nbt from "{}"
18 | set float tag "x" of {_n} to x coord of event-block
19 | set float tag "y" of {_n} to y coord of event-block
20 | set float tag "z" of {_n} to z coord of event-block
21 | open multi action dialog to player:
22 | title: "Block Break Confirmation"
23 | can_close_with_escape: false
24 | columns: 1
25 | body:
26 | add plain message body:
27 | contents: mini message from "Do you want to break this block?"
28 | actions:
29 | add dynamic action button:
30 | label: mini message from "Confirm Break"
31 | tooltip: mini message from "I wish for the block to break and drop stuff"
32 | id: "custom:confirm_break"
33 | additions: {_n}
34 | add static action button:
35 | label: mini message from "Cancel Break"
36 | tooltip: mini message from "I do not wish for the block to break"
37 | # No action as we want nothing to happen
38 |
39 | on dynamic button click:
40 | if "%event-namespacedkey%" contains "custom:confirm_break":
41 | set {_n} to event-nbtcompound
42 | if {_n} is set:
43 | set {_x} to float tag "x" of {_n}
44 | set {_y} to float tag "y" of {_n}
45 | set {_z} to float tag "z" of {_n}
46 | set {_loc} to location({_x},{_y},{_z},world of player)
47 | break block at {_loc} with effects using player's tool
48 |
--------------------------------------------------------------------------------
/snippets/other/Ingame-Skripting.sk:
--------------------------------------------------------------------------------
1 | # InGame Skripting
2 | # By: ShaneBee
3 |
4 | # Requires: Skript-Reflect
5 |
6 | # This little script allows you to create/edit scripts in game
7 |
8 | import:
9 | java.io.File
10 | java.io.FileWriter
11 | ch.njol.skript.ScriptLoader
12 | ch.njol.skript.log.RedirectingLogHandler
13 | org.bukkit.event.player.PlayerEditBookEvent
14 |
15 | # create the bookfile (this is where the script is actually saved)
16 | # its recommended to have RAM variables setup for this
17 | on load:
18 | set {-bookfile} to new File("plugins/Skript/scripts/bookcode.sk")
19 |
20 | on unload:
21 | # failsafe incase you dont have RAM vars setup
22 | delete {-bookfile}
23 |
24 | # Command to give yourself the book
25 | command /bookskript:
26 | trigger:
27 | give player a writable book named "&bBook&3Skript"
28 |
29 | # Using Bukkit event instead of having to deal with Skript's 2 different events
30 | on PlayerEditBookEvent:
31 | set {_player} to event.getPlayer()
32 | set {_book} to tool of {_player}
33 | if {_book} != writable book named "&bBook&3Skript":
34 | stop
35 | {_book}.setItemMeta(event.getNewBookMeta())
36 |
37 | set {_page} to join pages of {_book} by nl
38 | if event.isSigning():
39 | cancel event
40 |
41 | if {_page} is not set:
42 | set {_page} to nl
43 |
44 | set {_writer} to new FileWriter({-bookfile})
45 | {_writer}.write("##! Written in game by %{_player}% !##%nl%%nl%")
46 | {_writer}.write({_page})
47 | {_writer}.close()
48 |
49 | set {_logger} to new RedirectingLogHandler({_player}, "&7[&bBook&3Skript&7] ").start()
50 | set {_n} to (unix timestamp of now * 1000)
51 | ScriptLoader.reloadScript({-bookfile}, {_logger})
52 | set {_f} to (unix timestamp of now * 1000) - {_n}
53 | set {_errors} to {_logger}.numErrors()
54 | set {_e} to "errors" if {_errors} > 1 else "error"
55 | if {_errors} > 0:
56 | send "&7[&bBook&3Skript&7] &cEncountered &6%{_errors}%&c %{_e}% while reloading &6bookcode &7(&6%{_f}%ms&7)" to {_player}
57 | else:
58 | send "&7[&bBook&3Skript&7] &aSuccessfully reloaded &6bookcode &7(&6%{_f}%ms&7)" to {_player}
59 |
--------------------------------------------------------------------------------
/snippets/player/Chat.sk:
--------------------------------------------------------------------------------
1 | # Chat
2 | # By Shane Bee
3 |
4 | # Requirements: SkBee
5 |
6 | # This little snippet shows of some useful chat functions:
7 | # - bad word filter
8 | # - [item] in chat
9 | # - delete messages
10 |
11 | function registerBadWord(s: string, r: string):
12 | set {-badwords::%{_s}%} to {_r}
13 |
14 | on load:
15 | registerBadWord("shit", "shirt")
16 | registerBadWord("fuck", "fork")
17 | registerBadWord("bitch", "bench")
18 | registerBadWord("ass", "ash")
19 | registerBadWord("dick", "deck")
20 | registerBadWord("cock", "cork")
21 | registerBadWord("faggot", "puppy")
22 | registerBadWord("nigger", "kitty cat")
23 |
24 | on async chat:
25 | # Create our chat format
26 | set {_p} to player
27 | set {_t} to team prefix of team of {_p}
28 | set {_w} to "%world of {_p}%"
29 | replace "_" with " " in {_w}
30 | set {_w} to strict proper case {_w}
31 | if world of {_p} = world "world_nether":
32 | set {_w} to "&cNether"
33 | set {_m::1} to text component from "&7[&c-&7]"
34 | set {_m::2} to text component from "%{_t}%&b%display name of {_p}% &7» &r"
35 | set {_m::3} to async chat message
36 |
37 | # Prepare signed message for deletion
38 | set {_sig} to signed chat message
39 | add {_sig} to {-signatures::*}
40 | create callback for {_m::1}:
41 | if player has permission "chat.delete":
42 | remove all players from {_sig}
43 |
44 | set {_format} to merge components {_m::*}
45 |
46 | # Replace [item] in chat
47 | if "%{_format}%" contains "[item]":
48 | set {_t} to translate component of player's tool
49 | set color format of {_t} to rgb(0, 253, 196)
50 | set hover event of {_t} to hover event showing player's tool
51 | set {_m} to merge components ("[", {_t}, "]")
52 | component replace "\[item]" with {_m} in {_format}
53 |
54 | # Replace bad words
55 | loop {-badwords::*}:
56 | component replace loop-index with loop-value in {_format}
57 | # Finally set the chat format
58 | set async chat format to {_format}
59 |
60 | command /clearchat:
61 | trigger:
62 | loop {-signatures::*}:
63 | set {_s} to loop-value
64 | remove all players from {_s}
65 | delete {-signatures::*}
66 |
--------------------------------------------------------------------------------
/snippets/inventory/Sign-Inventory.sk:
--------------------------------------------------------------------------------
1 | # Sign Inventory
2 | # By: ShaneBee
3 |
4 | # Requirements: SkBee
5 |
6 | on sign change:
7 | loop 4 times:
8 | set line loop-number of event-block to colored line loop-number of event-block
9 | if line 1 of event-block = "&bInventory":
10 | set line 2 of event-block to "&7Items: &a0"
11 |
12 | on right click on sign:
13 | if line 1 of event-block = "&bInventory":
14 | cancel event
15 | if tag "custom;Viewer" of nbt of event-block is not set:
16 | set uuid tag "custom;Viewer" of nbt of event-block to player
17 | set {_g} to hopper inventory named "&bSign Inventory"
18 | set {_i::*} to compound list tag "custom;Inventory" of nbt of event-block
19 | loop {_i::*}:
20 | set {_s} to byte tag "Slot" of loop-value
21 | set {_i} to nbt item from loop-value
22 | set slot {_s} of {_g} to {_i}
23 | open {_g} to player
24 | set metadata tag "sign-inv" of player to event-block
25 | else:
26 | set {_view} to (uuid tag "custom;Viewer" of nbt of event-block) parsed as player
27 | send "&b%{_view}% &cis viewing this inventory"
28 |
29 |
30 | on inventory close:
31 | if metadata tag "sign-inv" of player is set:
32 | set {_block} to metadata tag "sign-inv" of player
33 | delete metadata tag "sign-inv" of player
34 | set {_size} to 0
35 | loop items in current inventory of player:
36 | add (item amount of loop-value) to {_size}
37 | set {_n} to full nbt of loop-value
38 | set byte tag "Slot" of {_n} to index of loop-value
39 | add {_n} to {_i::*}
40 | set compound list tag "custom;Inventory" of nbt of {_block} to {_i::*}
41 | delete uuid tag "custom;Viewer" of nbt of {_block}
42 | set line 2 of {_block} to "&7Items: &a%{_size}%"
43 |
44 | on break of sign:
45 | if nbt of event-block has tag "custom;Viewer":
46 | cancel event
47 | set {_view} to (uuid tag "custom;Viewer" of nbt of event-block) parsed as player
48 | send "&b%{_view}% &cis viewing this inventory"
49 | if nbt of event-block has tag "custom;Inventory":
50 | loop compound list tag "custom;Inventory" of nbt of event-block:
51 | set {_i} to nbt item from loop-value
52 | drop {_i} at event-block
53 |
--------------------------------------------------------------------------------
/snippets/inventory/Inventory-Serializer.sk:
--------------------------------------------------------------------------------
1 | # Inventory Serializer
2 | # By: ShaneBee
3 |
4 | # This little snippet allows you to serialize/save a player's inventory into a spot in their NBT or into a variable
5 | # It also allows you to quickly and easily restore their inventory from NBT/Variable
6 |
7 | # REQUIRES: SkBee
8 |
9 | #! Save player's inventory in their NBT !#
10 | function saveInvNBT(p: player, key: string):
11 | loop inventory of {_p}:
12 | set {_s} to index of loop-slot
13 | set {_i} to full nbt of loop-slot
14 | set int tag "Slot" of {_i} to {_s}
15 | add {_i} to {_i::*}
16 | set compound list tag "custom;SavedInv;%{_key}%" of nbt of {_p} to {_i::*}
17 |
18 | #! Restore player's inventory from their NBT !#
19 | function restoreInvNBT(p: player, key: string):
20 | set {_i::*} to compound list tag "custom;SavedInv;%{_key}%" of nbt of {_p}
21 | loop {_i::*}:
22 | set {_s} to int tag "Slot" of loop-value
23 | set {_i} to nbt item from loop-value
24 | set slot {_s} of {_p} to {_i}
25 | delete tag "custom;SavedInv;%{_key}%" of nbt of {_p}
26 |
27 | #! Save player's inventory into a variable !#
28 | function saveInvVAR(p: player, key: string):
29 | loop inventory of {_p}:
30 | set {_s} to index of loop-slot
31 | set {_i} to full nbt of loop-slot
32 | set int tag "Slot" of {_i} to {_s}
33 | add {_i} to {_i::*}
34 | set {_n} to nbt from "{}"
35 | set compound list tag "SavedInv" of {_n} to {_i::*}
36 | set {SavedInv::%uuid of {_p}%::%{_key}%} to {_n}
37 |
38 | #! Restore player's inventory from a variable !#
39 | function restoreInvVAR(p: player, key: string):
40 | set {_i::*} to compound list tag "SavedInv" of {SavedInv::%uuid of {_p}%::%{_key}%}
41 | loop {_i::*}:
42 | set {_s} to int tag "Slot" of loop-value
43 | set {_i} to nbt item from loop-value
44 | set slot {_s} of {_p} to {_i}
45 | delete {SavedInv::%uuid of {_p}%::%{_key}%}
46 |
47 | #! EXAMPLE USAGES !#
48 | command /savetonbt:
49 | trigger:
50 | saveInvNBT(player, "backup")
51 | clear inventory of player
52 |
53 | command /restorefromnbt:
54 | trigger:
55 | clear inventory of player
56 | restoreInvNBT(player, "backup")
57 |
58 | command /savetovar:
59 | trigger:
60 | saveInvVAR(player, "backup")
61 | clear inventory of player
62 |
63 | command /restorefromvar:
64 | trigger:
65 | clear inventory of player
66 | restoreInvVAR(player, "backup")
67 |
--------------------------------------------------------------------------------
/snippets/command/Pathfinder.sk:
--------------------------------------------------------------------------------
1 | # Pathfinder
2 | # By: ShaneBee
3 |
4 | # A fun little script to visualize entity pathfinding
5 |
6 | # Requires: SkBee
7 |
8 | #! FUNCTIONS !#
9 | # Draw a line
10 | function draw(l1: location, l2: location, c: color):
11 | set {_v} to vector between {_l1} and {_l2}
12 | set {_d} to distance between {_l1} and {_l2}
13 | loop ({_d} / 0.2) times:
14 | set vector length of {_v} to (loop-value * 0.2)
15 | draw 1 of dust using dustOption({_c}, 0.8) at {_l1} ~ {_v} with force
16 |
17 | # Pathfind an entity
18 | function path(e: entity):
19 | while path points of {_e} is set:
20 | delete {_l1}
21 | set {_s} to floor(150 / (size of path points of {_e}))
22 | set {_g} to 100
23 | set {_b} to 200
24 | loop path points of {_e}:
25 | add {_s} to {_g}
26 | remove {_s} from {_b}
27 | set {_rgb} to rgb(0, {_g}, {_b})
28 | if {_l1} is not set:
29 | set {_l1} to location of block at loop-value
30 | else:
31 | set {_l2} to location of block at loop-value
32 | draw({_l1}, {_l2}, {_rgb})
33 | set {_l1} to location of block at loop-value
34 | if {_e} is not alive:
35 | stop
36 | if {-path} is not set:
37 | stop
38 | wait 5 ticks
39 |
40 | #! EVENT LISTENER !#
41 | on entity starts pathfinding:
42 | if {-path} is not set:
43 | stop
44 | set {_e} to event-entity
45 | if type of {_e} != {-path}:
46 | stop
47 |
48 | wait 1 tick
49 | path({_e})
50 |
51 | #! COMMAND !#
52 | command /path []:
53 | trigger:
54 | if arg-1 = "disable":
55 | delete {-path}
56 | send "&7[&bPath&3Finder&7] &cDisabled"
57 | else:
58 | set {_e} to arg-1
59 | replace "_" with " " in {_e}
60 | set {_e} to {_e} parsed as entity type
61 | if {_e} is not set:
62 | send "&7[&bPath&3Finder&7] &cInvalid entity type &b%arg-1%"
63 | stop
64 | set {-path} to {_e}
65 | send "&7[&bPath&3Finder&7] &aEnabled for &b%{_e}%"
66 |
67 | # set available entity types as strings for tab complete
68 | on load:
69 | delete {-etypes::*}
70 | loop all available entity types:
71 | set {_e} to "%loop-value%"
72 | replace " " with "_" in {_e}
73 | add {_e} to {-etypes::*}
74 | add "disable", "living_entity", "mob", "monster", "creature", "animal", "golem", "water_mob", "raider", "illager" and "spellcaster" to {-etypes::*}
75 |
76 | on tab complete of "/path":
77 | set tab completions for position 1 to {-etypes::*}
78 |
--------------------------------------------------------------------------------
/snippets/customItems/Custom-Item-YAML-Example.yml:
--------------------------------------------------------------------------------
1 | # Sample YAML for Custom-Item-Loader.sk
2 | items:
3 | custom:
4 | # Item Key (ex: this item will be "custom:some_item")
5 | some_item:
6 | # Minecraft Key of item for this custom item
7 | type: minecraft:diamond_sword
8 | # ItemStack amount of this item by default (mostly used in recipes)
9 | amount: 1
10 | # Name of item (optional)
11 | name: "&aBOB"
12 | # Lore of item (optional)
13 | lore:
14 | - "&cLook mah im in a yaml file"
15 | - "&bdont tell dad"
16 | # Enchantments of item (optional)
17 | enchantments:
18 | # Format: "minecraft:enchantment_key=level"
19 | - minecraft:sharpness=5
20 | - minecraft:unbreaking=3
21 | # Additional NBT to be included on the item (optional)
22 | nbt: '{AttributeModifiers:[{AttributeName:"generic.attack_damage",Amount:20,Slot:mainhand,Name:"generic.attack_damage",UUID:[I;-124119,27795,161253,-55590]},{AttributeName:"generic.attack_speed",Amount:4,Slot:mainhand,Name:"generic.attack_speed",UUID:[I;-124119,27895,161253,-55790]}]}'
23 | # Recipe for item (optional)
24 | # The key for this recipe will be the key of this item (this example: "custom:some_item")
25 | recipe:
26 | # Represents the group of a recipe to keep certain items together (optional)
27 | group: some_group
28 | # Represents the shape of a recipe (required)
29 | shape:
30 | - 'aaa'
31 | - 'bbb'
32 | - 'aaa'
33 | # Ingredients to match shape (required)
34 | # Accepts Minecraft items as well as custom items from this config, see below example
35 | ingredients:
36 | a: minecraft:stick
37 | b: minecraft:stone
38 |
39 | my_cool_item:
40 | type: minecraft:netherite_sword
41 | amount: 1
42 | name: "&bMy Cool Item"
43 | lore:
44 | - "&cOk lets test this out"
45 | enchantments:
46 | - minecraft:sharpness=10
47 | - minecraft:unbreaking=10
48 | recipe:
49 | shape:
50 | - 'aaa'
51 | - ' b '
52 | - 'aaa'
53 | ingredients:
54 | a: minecraft:stick
55 | # This recipe takes the first item from this config as an ingredient
56 | # The item used here (MUST BE REGISTERED BEFORE THIS ONE)
57 | b: custom:some_item
58 |
--------------------------------------------------------------------------------
/snippets/inventory/C4.sk:
--------------------------------------------------------------------------------
1 | # C4
2 | # By: ShaneBee
3 |
4 | # This fun little script allows players to place C4 explosives at detonate them with a remote detonator
5 |
6 | # REQUIRES: SkBee
7 |
8 | options:
9 | prefix: &7[&cC4&7]
10 | # How many C4s can be placed at once
11 | max c4: 40
12 | # Power of C4 explosion
13 | power: 8
14 |
15 | #! LOAD THE ITEMS !#
16 | on load:
17 | set {_n} to nbt from "{SkullOwner:{Id:[I;1833486433,77415117,-1965145857,1385826899],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzQyNzQ3NTQ4OTE4NzMxZDY1ZDhlNTNlNWY5YTM3Nzg2YjdiOTcxNzFjYTcyNDA4ZDlhYTgzMzgxNDNmNTM5In19fQ==""}]}}}"
18 | set {_l::1} to "&7- Place down"
19 | set {_l::2} to "&7- Use detonator to detonate"
20 | set {-c4} to player head with nbt {_n} named "&cC4" with lore {_l::*}
21 |
22 | set {_n} to nbt from "{SkullOwner:{Id:[I;412561732,1822181074,-1787971855,699281441],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTQ2OTQ3ZTJjZmZkMzgwNDdkZTcwM2ZkOTg3OGFjZmM5OTQyZWI3MTJlZGM4ZjI1N2IxMjljYzEwZmFkMDY2NyJ9fX0=""}]}}}"
23 | set {_l::1} to "&7Right-Click to detonate"
24 | set {_l::2} to "&7placed C4"
25 | set {-detonator} to player head with nbt {_n} named "&bDetonator" with lore {_l::*}
26 |
27 |
28 | #! COMMANDS !#
29 | # Give yourself a C4
30 | command /c4 :
31 | trigger:
32 | give player {_amount} of {-c4}
33 |
34 | # Give yourself a detonator
35 | command /detonator:
36 | trigger:
37 | give player 1 of {-detonator}
38 |
39 | #! EVENT HANDLING !#
40 | on place:
41 | if 1 of player's tool is {-c4}:
42 | if size of {-c4::%uuid of player%::*} >= {@max c4}:
43 | cancel event
44 | send "{@prefix} &cYou can only place {@max c4} C4!"
45 | else:
46 | set {-c4::%uuid of player%::%location of event-block%} to location of event-block
47 |
48 | on right click:
49 | if 1 of player's tool = {-detonator}:
50 | cancel event
51 | if size of {-c4::%uuid of player%::*} < 1:
52 | send "{@prefix} &cYou haven't placed any C4!"
53 | else:
54 | loop 5 times:
55 | loop {-c4::%uuid of player%::*}:
56 | lerp 1 vibration using vibration(loop-value-2, 3 seconds) at player
57 | wait 3 ticks
58 |
59 | wait 1.5 seconds
60 | loop {-c4::%uuid of player%::*}:
61 | set block at loop-value to air
62 | create explosion of force {@power} at loop-value
63 | delete {-c4::%uuid of player%::*}
64 |
--------------------------------------------------------------------------------
/snippets/command/Random-Teleport.sk:
--------------------------------------------------------------------------------
1 | # Random Teleport
2 | # By: ShaneBee
3 |
4 | # A Simple little random teleport command, that won't lag your server
5 |
6 | # Requirements = SkBee 2.10.1+, Skript 2.8+
7 |
8 | options:
9 | # Max radius from 0,0
10 | radius: 100000
11 | # How many times to try look for a random location
12 | # This typically shouldn't take more than 5 tries
13 | attempts: 10
14 |
15 | #! FUNCTIONS !#
16 | # Check if a block is safe to spawn at
17 | function isSafeBlock(b: block) :: boolean:
18 | if all:
19 | {_b} is not solid
20 | {_b} != lava[], water[] or sweet_berry_bush[]
21 | then:
22 | return true
23 | return false
24 |
25 | # Get the highest safe block at a location
26 | function getHighestBlock(l: location) :: location:
27 | if world environment of world of {_l} = normal:
28 | set {_b} to highest block at {_l}
29 | if {_b} is tagged as minecraft block tag "minecraft:leaves":
30 | loop blocks below block below {_b}:
31 | if all:
32 | loop-block is solid
33 | loop-block is not tagged as minecraft block tag "minecraft:leaves"
34 | isSafeBlock(block above loop-block) = true
35 | isSafeBlock(block 2 above loop-block) = true
36 | then:
37 | return location 0.5 above loop-block
38 | else if {_b} is solid:
39 | return location 0.5 above {_b}
40 | else if world environment of world of {_l} = nether:
41 | loop blocks above {_l}:
42 | if all:
43 | loop-block is solid
44 | isSafeBlock(block above loop-block) = true
45 | isSafeBlock(block 2 above loop-block) = true
46 | then:
47 | return location 0.5 above loop-block
48 |
49 | #! COMMAND !#
50 | command /rtp []:
51 | trigger:
52 | send "&7[&bRTP&7] Looking for a suitable location..."
53 | loop {@attempts} times:
54 | set {_x} to random integer between -{@radius} and {@radius}
55 | set {_z} to random integer between -{@radius} and {@radius}
56 | set {_loc} to location({_x}, 1, {_z}, {_world})
57 | async load chunk at {_loc}
58 | set {_b} to getHighestBlock({_loc})
59 | if {_b} is set:
60 | set {_safe} to {_b}
61 | exit loop
62 | if {_safe} is set:
63 | send "&7[&bRTP&7] &aFound a suitable location!"
64 | set yaw of {_safe} to yaw of player
65 | set pitch of {_safe} to pitch of player
66 | teleport player to {_safe}
67 | else:
68 | send "&7[&bRTP&7] &cFailed to find a suitable location!"
69 |
70 | on tab complete of "rtp":
71 | set tab completions for position 1 to all worlds
72 |
--------------------------------------------------------------------------------
/snippets/display/Display-Chisel-Block.sk:
--------------------------------------------------------------------------------
1 | # ChisledBlocks
2 | # By: ShaneBee
3 |
4 | # This script allows you to make blocks that you can chisel
5 | # It really has no purpose it was more so for fooling around
6 |
7 | # Requires Minecraft 1.19.4+, SkBee 2.8.1+ and Skript-Reflect
8 |
9 | # This just creates a var with all colored concrete blocks
10 | on load:
11 | delete {-c::*}
12 | loop all available block datas:
13 | if "%loop-value%" contains "concrete":
14 | if "%loop-value%" doesn't contain "powder":
15 | add loop-value to {-c::*}
16 | #! FUNCTIONS !#
17 | # Place a fake block
18 | function placeFakeBlock(loc: location, data: block data, size: number = 1) :: entity:
19 | if {_data} = air[]:
20 | stop
21 | #set {_loc} to {_loc} ~ vector(-0.25, 0, -0.25)
22 | spawn block display at {_loc}
23 | set {_e} to last spawned entity
24 | set display block data of {_e} to {_data}
25 | set display scale of {_e} to vector({_size}, {_size}, {_size})
26 | return {_e}
27 |
28 | # Place an interaction entity and display block scaled
29 | function f(l: location, scale: number):
30 | set {_o} to {_scale} / 2
31 | set {_loc} to {_l} ~ vector({_o}, 0, {_o})
32 | spawn interaction at {_loc}
33 | set {_e} to last spawned entity
34 |
35 | set interaction width of {_e} to {_scale}
36 | set interaction height of {_e} to {_scale}
37 |
38 | set {_d} to random element of {-c::*}
39 | set {_b} to placeFakeBlock({_l}, {_d}, {_scale})
40 | set tag "custom;block" of nbt of {_e} to uuid int array of {_b}
41 |
42 | command /chiselblock :
43 | trigger:
44 | set {_loc} to exact location of block above target block
45 | loop {_scale} times:
46 | loop {_scale} times:
47 | loop {_scale} times:
48 | set {_x} to (loop-value-1 - 1) / {_scale}
49 | set {_y} to (loop-value-2 - 1) / {_scale}
50 | set {_z} to (loop-value-3 - 1) / {_scale}
51 | set {_l} to {_loc} ~ vector({_x}, {_y}, {_z})
52 | set {_s} to 1 / {_scale}
53 | f({_l}, {_s})
54 |
55 |
56 | #! EVENT HANDLERS !#
57 | on damage:
58 | if "%victim.getType()%" contains "INTERACTION":
59 | set {_n} to nbt of victim
60 | set {_u} to uuid tag "custom;block" of {_n}
61 | set {_e} to {_u} parsed as entity
62 | kill {_e}
63 | kill victim
64 |
65 | on right click:
66 | if "%(clicked entity).getType()%" contains "INTERACTION":
67 | cancel event
68 | set {_n} to nbt of clicked entity
69 | set {_u} to uuid tag "custom;block" of {_n}
70 | set {_e} to {_u} parsed as entity
71 | set display block item type of {_e} to type of player's tool
72 |
--------------------------------------------------------------------------------
/snippets/inventory/Simple-GUI-Skript-Gui.sk:
--------------------------------------------------------------------------------
1 | # Simple Gui Examples
2 | # By: ShaneBee
3 |
4 | # This showcases simple examples of creating GUIs with skript-gui
5 | # I showcase 2 options here:
6 | # 1) On demand, the GUI is created each time the command is run (this can be hard on the server depending what you're doing)
7 | # This way may be needed, if for example the GUI needs to change PER PLAYER
8 |
9 | # 2) On Load create GUI with ID. This cuts down on server resources, since we just make the GUI once and open when needed
10 |
11 | # Requirements: skript-gui (https://github.com/APickledWalrus/skript-gui/releases/latest)
12 |
13 | #! Create a gui on demand !#
14 | # Each time this command is run the GUI will be created
15 | command /spawn:
16 | trigger:
17 | # Create your gui
18 | create gui with virtual chest inventory with 3 rows named "&a&lMy Gui":
19 | # Format all slots to make sure player's cant put anything in the GUI
20 | format gui slots (integers between 0 and 26) with grey stained glass pane named " "
21 |
22 | # Format a slot to do something
23 | format gui slot 0 with grass named "&bWORLD SPAWN":
24 | # When the slot is clicked, the code in this section is executed
25 | teleport player to spawn of world "world"
26 | close inventory of player
27 |
28 | format gui slot 1 with netherrack named "&cNETHER SPAWN":
29 | teleport player to spawn of world "world_nether"
30 | close inventory of player
31 |
32 | # Open the gui to the player
33 | open last gui to player
34 |
35 | #! Create a gui with an ID !#
36 | # This way the gui is created once, we don't need to keep creating it each time we need it
37 | # This saves server resources if a lot of people are running the command
38 | on load:
39 | # Create your gui
40 | create gui with id "spawn-gui" with virtual chest inventory with 3 rows named "&a&lMy Gui":
41 | # Format all slots to make sure player's cant put anything in the GUI
42 | format gui slots (integers between 0 and 26) with grey stained glass pane named " "
43 |
44 | # Format a slot to do something
45 | format gui slot 0 with grass named "&bWORLD SPAWN":
46 | # When the slot is clicked, the code in this section is executed
47 | teleport player to spawn of world "world"
48 | close inventory of player
49 |
50 | format gui slot 1 with netherrack named "&cNETHER SPAWN":
51 | teleport player to spawn of world "world_nether"
52 | close inventory of player
53 |
54 | command /spawn2:
55 | trigger:
56 | # Now we open the GUI from its ID rather than creating it all the time
57 | open gui with id "spawn-gui" to player
58 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Ban-Menu-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Ban Menu
2 | # By: ShaneBee
3 |
4 | # This is a simple ban menu with several inputs.
5 |
6 | # Do note, this is not intended for production, only for educational purposes
7 |
8 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
9 |
10 | command /leban []:
11 | trigger:
12 | set {_p} to name of arg-1
13 | open multi action dialog to player:
14 | title: "Ban Menu"
15 | body:
16 | if {_p} is set:
17 | add plain message body:
18 | contents: "Ban &b%{_p}%"
19 | else:
20 | add plain message body:
21 | contents: "Ban a player"
22 | add item body:
23 | item: 1 of mace
24 | show_tooltip: false
25 | inputs:
26 | if {_p} is not set:
27 | add text input:
28 | key: "to_ban"
29 | label: "Player to ban:"
30 | add number range input:
31 | key: "time_input"
32 | label: "Time"
33 | start: 0
34 | end: 100
35 | step: 1
36 | initial: 0
37 | add single option input:
38 | key: "span_input"
39 | label: "Span"
40 | options:
41 | add options entry:
42 | id: "minutes"
43 | display: "Minutes"
44 | add options entry:
45 | id: "hours"
46 | display: "Mours"
47 | add options entry:
48 | id: "days"
49 | display: "Days"
50 | add options entry:
51 | id: "permanent"
52 | display: "&cPermanent"
53 | add text input:
54 | key: "reason_input"
55 | label: "Reason:"
56 | max_length: 100
57 | actions:
58 | if {_p} is set:
59 | add dynamic action button:
60 | label: "Ban %{_p}%!"
61 | id: "custom:ban_player"
62 | additions: nbt from "{to_ban:""%{_p}%""}"
63 | else:
64 | add dynamic action button:
65 | label: "Ban!"
66 | id: "custom:ban_player"
67 |
68 | on dynamic action button click:
69 | if "%event-namespacedkey%" = "custom:ban_player":
70 | set {_n} to event-nbtcompound
71 | set {_time} to float tag "time_input" of {_n}
72 | set {_span} to (string tag "span_input" of {_n}) parsed as timespan period
73 | set {_timespan} to timespan({_time}, {_span})
74 | set {_reason} to "&c" + string tag "reason_input" of {_n}
75 | set {_p} to offlineplayer(string tag "to_ban" of {_n})
76 | if {_span} is set:
77 | broadcast "BAN: %{_reason}% // %{_timespan}%"
78 | ban {_p} due to {_reason} for {_timespan}
79 | kick {_p} due to ("&cTemporary Ban%nl%&eReason: " + {_reason} + "%nl%&eLength: %{_timespan}%")
80 | else:
81 | ban {_p} due to {_reason}
82 | kick {_p} due to ("&cPermanent Ban%nl%&eReason: " + {_reason})
83 |
--------------------------------------------------------------------------------
/snippets/block/Suspicious-Grass.sk:
--------------------------------------------------------------------------------
1 | # Suspicious Grass
2 | # By: ShaneBee
3 |
4 | # This little snippet shows an example of making other blocks act similar to suspicious sand/gravel.
5 | # Requirements: SkBee, Minecraft 1.19.4+
6 |
7 | # Get direction for item to animate out of block
8 | function getDirection(face: blockface) :: vector:
9 | if {_face} = up_face:
10 | return vector(0,0.1,0)
11 | else if {_face} = east_face:
12 | return vector(0.1,0,0)
13 | else if {_face} = west_face:
14 | return vector(-0.1,0,0)
15 | else if {_face} = south_face:
16 | return vector(0,0,0.1)
17 | else if {_face} = north_face:
18 | return vector(0,0,-0.1)
19 |
20 | on right click on grass block holding a brush:
21 | if {-brushing::%player%} is not set:
22 | set {_block} to event-block
23 | set {_face} to event-blockface
24 | set {_vec} to getDirection({_face})
25 | set {-brushing::%player%} to true
26 |
27 | # Setup item to drop
28 | if nbt of {_block} has tag "custom;archaeology;item":
29 | set {_item} to nbt item from compound tag "custom;archaeology;item" of nbt of {_block}
30 | else:
31 | if chance of 10%:
32 | set {_table} to loottable from key "minecraft:archaeology/trail_ruins_rare"
33 | else:
34 | set {_table} to loottable from key "minecraft:archaeology/trail_ruins_common"
35 | set {_item} to random element of (looted items from {_table})
36 | set compound tag "custom;archaeology;item" of nbt of {_block} to full nbt of {_item}
37 | spawn item display at {_block}:
38 | set display item of entity to {_item}
39 | set teleport duration of entity to 30
40 | if {_face} = north_face or south_face:
41 | set yaw of entity to 90
42 | set display brightness of entity to displayBrightness(15,15)
43 | set display scale of entity to vector(0.65,0.65,0.65)
44 | set {_e} to entity
45 | set {_origin} to location of {_e}
46 |
47 | # Item animation
48 | while {-brushing::%player%} is true:
49 | set {_dist} to distance between {_e} and {_origin}
50 | make player see damage of {_block} as ({_dist}/2)
51 | set {_l} to location of {_e} ~ {_vec}
52 | teleport {_e} to {_l}
53 | if {_dist} > 0.97:
54 | set {_canDrop} to true
55 | exit loop
56 | wait 10 ticks
57 |
58 | # Prepare drop or reset
59 | make player see damage of {_block} as 0
60 | if {_canDrop} = true:
61 | delete tag "custom;archaeology" of nbt of {_block}
62 | drop 1 of {_item} at {_l}
63 | set block at {_block} to coarse dirt
64 | else:
65 | teleport {_e} to {_origin}
66 | wait 30 ticks
67 | kill {_e}
68 |
69 | on player stop using item:
70 | delete {-brushing::%player%}
71 |
--------------------------------------------------------------------------------
/snippets/NMS-Stuff.sk:
--------------------------------------------------------------------------------
1 | # NMS Stuff
2 | # By: ShaneBee
3 |
4 | # This snippet just provides some quick NMS things
5 | # Requirements: Skript-Reflect
6 |
7 | #! OPEN TERRAIN LOADING SCREEN !#
8 | # This will open the terrain loading screen to a player
9 | # It will automatically close after 30 seconds
10 | # You can manually close it by using the close inventory effect
11 | # Requires Paper 1.20.6+
12 | import:
13 | net.minecraft.network.protocol.game.ClientboundRespawnPacket
14 |
15 | effect open loading terrain screen for %players%:
16 | trigger:
17 | loop exprs-1:
18 | set {_level} to loop-value.getWorld().getHandle()
19 | set {_common} to loop-value.getHandle().createCommonSpawnInfo({_level})
20 | set {_packet} to new ClientboundRespawnPacket({_common}, 3)
21 | loop-value.getHandle().connection.send({_packet})
22 |
23 |
24 | #! FULL VANILLA NBT !#
25 | # This expression will return vanilla item components in NBT
26 | # This includes all the default components an item has that doesn't normally show in NBT
27 | # Requires Paper 1.20.6+, SkBee
28 | import:
29 | net.minecraft.nbt.NbtOps
30 | net.minecraft.core.component.DataComponentMap
31 | net.minecraft.nbt.CompoundTag
32 | com.shanebeestudios.skbee.api.nbt.NBTContainer
33 |
34 | expression [:full] vanilla nbt of %itemtype%:
35 | get:
36 | set {_i} to expr-1.getRandom().handle
37 | set {_ra} to (world "world").getHandle().registryAccess()
38 | set {_c} to DataComponentMap.CODEC.encode({_i}.getComponents(), {_ra}.createSerializationContext(NbtOps.INSTANCE), new CompoundTag()).getOrThrow()
39 | set {_comp} to new NBTContainer({_c})
40 | if parse tags contains "full":
41 | set {_nbt} to full nbt of expr-1
42 | set compound tag "components" of {_nbt} to {_comp}
43 | return {_nbt}
44 | else:
45 | return {_comp}
46 |
47 | #! VANILLA MINECRAFT NBT OF CHUNK !#
48 | # This will return the nbt of a chunk how Minecraft would save a chunk
49 | # This differs from SkBee's `nbt of %chunk%` as it will provide all data in a chunk
50 | # You can read more about the chunk nbt format at https://minecraft.wiki/w/Chunk_format
51 | # Requires Paper 1.20.6+, SkBee
52 | import:
53 | net.minecraft.world.level.chunk.status.ChunkStatus
54 | net.minecraft.world.level.chunk.storage.ChunkSerializer
55 | com.shanebeestudios.skbee.api.nbt.NBTContainer
56 |
57 | expression minecraft nbt of %chunk%:
58 | get:
59 | set {_chunk} to expr-1
60 | set {_nmsChunk} to {_chunk}.getHandle(ChunkStatus.FULL)
61 | set {_level} to {_chunk}.worldServer
62 | set {_nmsNBT} to ChunkSerializer.write({_level}, {_nmsChunk})
63 | set {_nbt} to new NBTContainer({_nmsNBT})
64 | return {_nbt}
65 |
--------------------------------------------------------------------------------
/snippets/other/Mine-Reset.sk:
--------------------------------------------------------------------------------
1 | # Simple Mine Reset
2 | # By ShaneBee
3 |
4 | # Reset a block in the mine
5 | # Change percents/ores to whatever you want
6 | function resetBlock(b: block):
7 | if chance of 1%:
8 | set block at {_b} to diamond ore
9 | else if chance of 2%:
10 | set block at {_b} to emerald ore
11 | else if chance of 5%:
12 | set block at {_b} to redstone ore
13 | else if chance of 7%:
14 | set block at {_b} to gold ore
15 | else if chance of 7%:
16 | set block at {_b} to iron ore
17 | else if chance of 7%:
18 | set block at {_b} to copper ore
19 | else if chance of 15%:
20 | set block at {_b} to coal ore
21 | else:
22 | set block at {_b} to stone
23 |
24 | # Will reset mine from left to right
25 | function resetMineLeftRight(l1: location, l2: location):
26 | set {_x1} to floor(x coord of {_l1})
27 | set {_x2} to floor(x coord of {_l2})
28 | set {_y1} to floor(y coord of {_l1})
29 | set {_y2} to floor(y coord of {_l2})
30 | set {_z1} to floor(z coord of {_l1})
31 | set {_z2} to floor(z coord of {_l2})
32 | loop integers between {_x1} and {_x2}:
33 | loop integers between {_z1} and {_z2}:
34 | loop integers between {_y1} and {_y2}:
35 | set {_b} to block at location(loop-number-1, loop-number-3, loop-number-2)
36 | resetBlock({_b})
37 | wait 1 tick
38 |
39 | # Will reset mine from bottom up
40 | function resetMineBottomUp(l1: location, l2: location):
41 | set {_x1} to floor(x coord of {_l1})
42 | set {_x2} to floor(x coord of {_l2})
43 | set {_y1} to floor(y coord of {_l1})
44 | set {_y2} to floor(y coord of {_l2})
45 | set {_z1} to floor(z coord of {_l1})
46 | set {_z2} to floor(z coord of {_l2})
47 | loop integers between {_y1} and {_y2}:
48 | loop integers between {_x1} and {_x2}:
49 | loop integers between {_z1} and {_z2}:
50 | set {_b} to block at location(loop-number-2, loop-number-1, loop-number-3)
51 | resetBlock({_b})
52 | wait 1 tick
53 |
54 | # Will reset mine from top down
55 | function resetMineTopDown(l1: location, l2: location):
56 | set {_x1} to floor(x coord of {_l1})
57 | set {_x2} to floor(x coord of {_l2})
58 | set {_y1} to floor(y coord of {_l1})
59 | set {_y2} to floor(y coord of {_l2})
60 | set {_z1} to floor(z coord of {_l1})
61 | set {_z2} to floor(z coord of {_l2})
62 | loop reversed integers between {_y1} and {_y2}:
63 | loop integers between {_x1} and {_x2}:
64 | loop integers between {_z1} and {_z2}:
65 | set {_b} to block at location(loop-number-2, loop-number-1, loop-number-3)
66 | resetBlock({_b})
67 | wait 1 tick
68 |
69 | # Simple example usage
70 | command /test:
71 | trigger:
72 | resetMineTopDown({1},{2})
73 |
--------------------------------------------------------------------------------
/snippets/customItems/Custom-Item-Loader.sk:
--------------------------------------------------------------------------------
1 | # Custom Item Creator
2 | # By: ShaneBee
3 |
4 | # This little script loads custom items from a config, and registers recipes along side them
5 |
6 | # REQUIREMENTS: SkBee, Skript-Yaml
7 |
8 | options:
9 | # This is where your yaml file will be
10 | file_path: plugins/Test/test.yml
11 |
12 | # This is the variable your items will be saved in
13 | # This example = `{-customItems::some_item}`
14 | item_variable: -customItems
15 |
16 | on load:
17 | load yaml "{@file_path}" as "custom_item_yaml"
18 | loop yaml node keys "items.custom" of "custom_item_yaml":
19 | loadItem(loop-value)
20 |
21 | function getItemFromKey(key: string) :: itemtype:
22 | set {_s::*} to {_key} split at ":"
23 | if {_s::1} = "minecraft":
24 | return itemtype from key (namespaced key of {_key})
25 | else:
26 | return {{@item_variable}::%{_s::2}%}
27 |
28 | function getEnchantFromKey(key: string) :: enchantment:
29 | return enchantment from key (namespaced key of {_key})
30 |
31 | function loadItem(key: string):
32 | #! Create Item !#
33 | set {_name} to yaml value "items.custom.%{_key}%.name" of "custom_item_yaml"
34 | set {_type} to getItemFromKey(yaml value "items.custom.%{_key}%.type" of "custom_item_yaml")
35 | set {_amount} to yaml value "items.custom.%{_key}%.amount" of "custom_item_yaml"
36 | set {_lore::*} to yaml list "items.custom.%{_key}%.lore" of "custom_item_yaml"
37 | set {_i} to {_amount} of {_type} named {_name} with lore colored {_lore::*}
38 | set {_nbt} to nbt from (yaml value "items.custom.%{_key}%.nbt" of "custom_item_yaml")
39 | add {_nbt} to nbt of {_i}
40 |
41 | #! Enchant Item !#
42 | loop yaml list "items.custom.%{_key}%.enchantments" of "custom_item_yaml":
43 | set {_s::*} to loop-value split at "="
44 | set {_e} to getEnchantFromKey({_s::1})
45 | set {_l} to {_s::2} parsed as number
46 | set enchantment level of {_e} of {_i} to {_l}
47 |
48 | #! Save Item To Var !#
49 | set {{@item_variable}::%{_key}%} to {_i}
50 |
51 | #! Create Recipe Parts !#
52 | set {_shape::*} to yaml list "items.custom.%{_key}%.recipe.shape" of "custom_item_yaml"
53 | set {_group} to yaml value "items.custom.%{_key}%.recipe.group" of "custom_item_yaml"
54 | loop yaml node keys "items.custom.%{_key}%.recipe.ingredients" of "custom_item_yaml":
55 | set {_ing::%loop-value%} to getItemFromKey(yaml value "items.custom.%{_key}%.recipe.ingredients.%loop-value%" of "custom_item_yaml")
56 |
57 | #! Register Recipe !#
58 | if {_shape::*} is set:
59 | register shaped recipe:
60 | id: "custom:%{_key}%"
61 | result: {_i}
62 | shape: {_shape::*}
63 | group: {_group}
64 | ingredients:
65 | loop {_ing::*}:
66 | set ingredient of loop-index to loop-value
67 |
--------------------------------------------------------------------------------
/snippets/display/Display-Sign-Shop.sk:
--------------------------------------------------------------------------------
1 | # Sign Shop
2 | # By: ShaneBee
3 |
4 | # This little snippet gives an example of how to use text displays for sign shops
5 |
6 | # REQUIRES: SkBee, MC 1.19.4+
7 |
8 | function setPrice(item: string, buy: number, sell: number):
9 | set {-prices::%{_item}%::buy} to {_buy}
10 | set {-prices::%{_item}%::sell} to {_sell}
11 |
12 | # Setup the prices for the shop
13 | on load:
14 | setPrice("stone", 5, 2)
15 | setPrice("diamond", 100, 75)
16 | setPrice("diamond sword", 150, 0)
17 | setPrice("emerald", 500, 200)
18 |
19 | function getText(p: string) :: string:
20 | set {_t::1} to "&b&l&nShopThingy&r"
21 | set {_t::2} to "&7Product: <##38F5A7>%{_p}%"
22 | set {_buy} to {-prices::%{_p}%::buy} ? 0
23 | set {_t::3} to "&7Buy: &e$&c%{_buy}%"
24 | set {_sell} to {-prices::%{_p}%::sell} ? 0
25 | set {_t::4} to "&7Sell: &e$&a%{_sell}%"
26 | return (join {_t::*} using nl)
27 |
28 | function spawnText(p: string, l: location) :: entities:
29 | spawn a text display at {_l}:
30 | set display text of entity to getText({_p})
31 | set display translation of entity to vector(0,0.3,-0.4)
32 | set display text background color of entity to bukkitColor(100,0,0,0)
33 | set {_e::1} to last spawned entity
34 | spawn a text display at {_l}:
35 | set display text of entity to getText({_p})
36 | set display translation of entity to vector(0,0.29,-0.41)
37 | set display scale of entity to vector(1.02,1.02,1)
38 | set display text background color of entity to bukkitColor(100,255,122,240)
39 | set {_e::2} to last spawned entity
40 |
41 | set {-e::%{_l}%::*} to {_e::*}
42 | set display scale of {_e::*} to vector(0,0,0)
43 | wait 1 tick
44 | set interpolation duration of {_e::*} to 5
45 | set interpolation start of {_e::*} to -1
46 | wait 1 tick
47 | set display scale of {_e::1} to vector(1,1,1)
48 | set display scale of {_e::2} to vector(1.02,1.02,1)
49 |
50 | function manageSign(p: player):
51 | if {-target::%{_p}%} is not set:
52 | set {-target::%{_p}%} to exact target block of {_p}
53 | set {_loc} to location of {-target::%{_p}%}
54 | set {_line} to line 2 of {-target::%{_p}%}
55 |
56 | spawnText({_line}, {_loc})
57 | while exact target block of {_p} = {-target::%{_p}%}:
58 | wait 1 tick
59 | delete {-target::%{_p}%}
60 |
61 | set {_e::*} to {-e::%{_loc}%::*}
62 | set interpolation duration of {_e::*} to 5
63 | set interpolation start of {_e::*} to -1
64 | set display scale of {_e::*} to vector(0,0,0)
65 | wait 5 ticks
66 | kill {_e::*}
67 |
68 | on join:
69 | while player is connected:
70 | if exact target block of player is any wall sign:
71 | if distance between player and exact target block < 7:
72 | if {-target::%player%} is not set:
73 | manageSign(player)
74 | wait 1 tick
75 |
--------------------------------------------------------------------------------
/snippets/Functions.sk:
--------------------------------------------------------------------------------
1 | # Functions
2 | # By: Shane Bee
3 |
4 | # This is a set of random functions for you to use
5 |
6 | # Round a timespam (generally will round the seconds)
7 | function roundTimespan(t: timespan) :: timespan:
8 | set {_a::*} to "%{_t}%" split at " "
9 | loop {_a::*}:
10 | set {_n} to loop-value parsed as a number
11 | if {_n} is set:
12 | set {_a::%loop-index%} to "%round({_n})%"
13 | set {_a} to join {_a::*} using " "
14 | return {_a} parsed as timespan
15 |
16 | # Round a timespam down (generally will round the seconds)
17 | function floorTimespan(t: timespan) :: timespan:
18 | set {_a::*} to "%{_t}%" split at " "
19 | loop {_a::*}:
20 | set {_n} to loop-value parsed as a number
21 | if {_n} is set:
22 | set {_a::%loop-index%} to "%floor({_n})%"
23 | set {_a} to join {_a::*} using " "
24 | return {_a} parsed as timespan
25 |
26 | # Round a timespam up (generally will round the seconds)
27 | function ceilTimespan(t: timespan) :: timespan:
28 | set {_a::*} to "%{_t}%" split at " "
29 | loop {_a::*}:
30 | set {_n} to loop-value parsed as a number
31 | if {_n} is set:
32 | set {_a::%loop-index%} to "%ceil({_n})%"
33 | set {_a} to join {_a::*} using " "
34 | return {_a} parsed as timespan
35 |
36 | # Progress Bar
37 | # percent = percent along the bar (from 0 to 100)
38 | # bars = the number of bars to show
39 | function progress(percent: number, bars: number) :: string:
40 | set {_g} to floor(({_percent} / 100) * {_bars})
41 | set {_r} to {_bars} - {_g}
42 | set {_g} to "&a|" repeated {_g} times if {_g} > 0 else ""
43 | set {_r} to "&c|" repeated {_r} times if {_r} > 0 else ""
44 | return "%{_g}%%{_r}%"
45 |
46 | #! ITEM WITH HIDDEN ATTRIBUTE MODIFIERS !#
47 | # This snippet helps fix an issue relating to MC 1.20.5+
48 | # Requires SkBee and skript-reflect
49 |
50 | expression %itemtype% with hidden attributes:
51 | get:
52 | set {_i} to expr-1.getRandom()
53 | set {_meta} to {_i}.getItemMeta()
54 | {_meta}.addItemFlags(hide attributes)
55 | set {_map} to {_i}.getType().getDefaultAttributeModifiers()
56 | loop ...{_map}.keySet():
57 | {_meta}.addAttributeModifier(loop-value, {_map}.get(loop-value).get(0))
58 |
59 | {_i}.setItemMeta({_meta})
60 | return {_i}
61 |
62 | # example usage
63 | on join:
64 | give player diamond sword with hidden attributes
65 |
66 | #! FORMATTED TIMESPAN !#
67 | # this will format a timespan like 1d, 3h, 10m, 1s
68 | # Modify to your loking
69 |
70 | function time(time: timespan) :: string:
71 | set {_time} to "%{_time}%"
72 | replace " and " with ", " in {_time}
73 | replace " days" and " day" with "d" in {_time}
74 | replace " hours" and " hour" with "h" in {_time}
75 | replace " minutes" and " minute" with "m" in {_time}
76 | replace " seconds" and " second" with "s" in {_time}
77 | set {_time} to {_time}.replaceAll("\.\d+", "")
78 |
79 | return {_time}
80 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/blue_planet/blue-planet-biomes-legacy.sk:
--------------------------------------------------------------------------------
1 | # Blue colored planet
2 | # By ShaneBee
3 |
4 | # This snippet includes custom biomes for a blue colored planet
5 | # Kept it simple with blue_plains and a blue_forest
6 | # You can expand to your hearts desire
7 |
8 | # Requirements: SkBee, SkNMS, Minecraft 1.21.10 and below
9 |
10 | #! REGISTER CUSTOM BIOMES !#
11 | registry registration:
12 | register new biome:
13 | id: "my_biomes:blue_plains"
14 | has_precipitation: true
15 | temperature: 0.8
16 | downfall: 0.2
17 | effects:
18 | fog_color: 12638463
19 | sky_color: 7907327
20 | foliage_color: rgb(37, 245, 201)
21 | water_color: rgb(37, 211, 245)
22 | water_fog_color: 2302743
23 | grass_color: rgb(129, 206, 249)
24 | tags:
25 | apply to tag "minecraft:has_structure/village_plains"
26 | spawners:
27 | creature:
28 | apply spawner for cow, sheep and pig with weight 10 and with min count 2 and max count 4
29 | features:
30 | underground_ores:
31 | apply feature "minecraft:ore_dirt"
32 | apply feature "minecraft:ore_coal_upper"
33 | apply feature "minecraft:ore_coal_lower"
34 | apply feature "minecraft:disk_sand"
35 | apply feature "minecraft:disk_clay"
36 | apply feature "minecraft:disk_gravel"
37 | vegetal_decoration:
38 | apply feature "minecraft:flower_plains"
39 | apply feature "minecraft:patch_grass_plain"
40 | apply feature "minecraft:patch_waterlily"
41 | apply feature "minecraft:patch_sugar_cane"
42 | register new biome:
43 | id: "my_biomes:blue_forest"
44 | has_precipitation: true
45 | temperature: 0.8
46 | downfall: 0.2
47 | effects:
48 | fog_color: 12638463
49 | sky_color: 7907327
50 | foliage_color: rgb(37, 245, 201)
51 | water_color: rgb(37, 211, 245)
52 | water_fog_color: 2302743
53 | grass_color: rgb(43, 171, 196)
54 | tags:
55 | apply to tag "minecraft:has_structure/village_plains"
56 | spawners:
57 | creature:
58 | apply spawner for cow, sheep and pig with weight 10 and with min count 2 and max count 4
59 | features:
60 | underground_ores:
61 | apply feature "minecraft:ore_dirt"
62 | apply feature "minecraft:ore_coal_upper"
63 | apply feature "minecraft:ore_coal_lower"
64 | apply feature "minecraft:disk_sand"
65 | apply feature "minecraft:disk_clay"
66 | apply feature "minecraft:disk_gravel"
67 | vegetal_decoration:
68 | apply feature "minecraft:glow_lichen"
69 | apply feature "minecraft:forest_flowers"
70 | apply feature "minecraft:trees_birch_and_oak_leaf_litter"
71 | apply feature "minecraft:patch_bush"
72 | apply feature "minecraft:flower_default"
73 | apply feature "minecraft:patch_grass_forest"
74 | apply feature "minecraft:brown_mushroom_normal"
75 | apply feature "minecraft:red_mushroom_normal"
76 | apply feature "minecraft:patch_pumpkin"
77 | apply feature "minecraft:patch_sugar_cane"
78 | apply feature "minecraft:patch_firefly_bush_near_water"
79 |
--------------------------------------------------------------------------------
/snippets/other/Spiral.sk:
--------------------------------------------------------------------------------
1 | # Spiral
2 | # By Shane Bee
3 |
4 | # This is used to creates spirals, and log the location of the last location in a spiral
5 | # This could be useful for a SkyBlock system
6 |
7 | # REQUIREMENTS: SkBee
8 |
9 | options:
10 | # Where your spiral should originate (the center)
11 | spiral-center: location(1,129,1, world "world")
12 | # The gap between each location
13 | spread: 2
14 |
15 | #! CREATE OFFSETS !#
16 | # This just creates our offset vars
17 | on load:
18 | set {-dir::1} to vector({@spread},0,0)
19 | set {-dir::2} to vector(0,0,-{@spread})
20 | set {-dir::3} to vector(-{@spread},0,0)
21 | set {-dir::4} to vector(0,0,{@spread})
22 |
23 | #! LOAD INITIAL NBT DATA !#
24 | # This creates your INITIAL NBT compound for storing data
25 | # This only needs to be run once obviously
26 | on load:
27 | if {spiral::nbt} is not set:
28 | set {spiral::nbt} to nbt compound from "{}"
29 | set int tag "gape" of {spiral::nbt} to 0
30 | set int tag "pos" of {spiral::nbt} to 0
31 | set byte tag "vec" of {spiral::nbt} to 1
32 | set compound tag "lastLoc" of {spiral::nbt} to saveLoc({@spiral-center})
33 |
34 | #! GET LOC FROM NBT FUNCTION !#
35 | # this just gets a location from NBT you wont need to worry about this
36 | function getLoc(n: nbt compound) :: location:
37 | set {_x} to int tag "x" of {_n}
38 | set {_y} to int tag "y" of {_n}
39 | set {_z} to int tag "z" of {_n}
40 | set {_ws} to string tag "world" of {_n}
41 | set {_w} to world({_ws})
42 | set {_l} to location({_x}, {_y}, {_z}, {_w})
43 | return {_l}
44 |
45 | #! SAVE LOC TO NBT FUNCTION !#
46 | # this just saves a location into NBT format, you wont need to worry about this
47 | function saveLoc(l: location) :: nbt compound:
48 | set {_n} to nbt compound from "{}"
49 | set int tag "x" of {_n} to x coord of {_l}
50 | set int tag "y" of {_n} to y coord of {_l}
51 | set int tag "z" of {_n} to z coord of {_l}
52 | set {_w} to "%world of {_l}%"
53 | set string tag "world" of {_n} to {_w}
54 | return {_n}
55 |
56 | #! MAIN SPIRAL FUNCTION !#
57 | # this gets the next location in your spiral
58 | # this is the key ingredient you are going to want to use
59 | function getNext() :: location:
60 | set {_lastLoc} to compound tag "lastLoc" of {spiral::nbt}
61 | set {_loc} to getLoc({_lastLoc})
62 | set {_gape} to int tag "gape" of {spiral::nbt}
63 | set {_pos} to int tag "pos" of {spiral::nbt}
64 | set {_vec} to byte tag "vec" of {spiral::nbt}
65 | set {_loc} to {_loc} ~ {-dir::%{_vec}%}
66 | add 1 to {_pos}
67 | if {_pos} >= {_gape}:
68 | set {_pos} to 0
69 | add 1 to {_vec}
70 | if {_vec} = 2 or 4:
71 | add 1 to {_gape}
72 | if {_vec} > 4:
73 | set {_vec} to 1
74 | set int tag "gape" of {spiral::nbt} to {_gape}
75 | set int tag "pos" of {spiral::nbt} to {_pos}
76 | set byte tag "vec" of {spiral::nbt} to {_vec}
77 | set compound tag "lastLoc" of {spiral::nbt} to saveLoc({_loc})
78 | return {_loc}
79 |
80 | # this was just a test to show how you get the next location in your spiral
81 | command /test:
82 | trigger:
83 | loop 10 times:
84 | set {_loc} to getNext()
85 | set block at {_loc} to white wool
86 | wait 1 ticks
87 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/blue_planet/blue-planet-biomes.sk:
--------------------------------------------------------------------------------
1 | # Blue colored planet
2 | # By ShaneBee
3 |
4 | # This snippet includes custom biomes for a blue colored planet
5 | # Kept it simple with blue_plains and a blue_forest
6 | # You can expand to your hearts desire
7 |
8 | # Requirements: SkBee, SkNMS, Minecraft 1.21.11+
9 |
10 | #! REGISTER CUSTOM BIOMES !#
11 | registry registration:
12 | register new biome:
13 | id: "my_biomes:blue_plains"
14 | has_precipitation: true
15 | temperature: 0.8
16 | downfall: 0.2
17 | effects:
18 | foliage_color: rgb(37, 245, 201)
19 | water_color: rgb(37, 211, 245)
20 | grass_color: rgb(129, 206, 249)
21 | attributes:
22 | set environmental attribute "visual/sky_color" to 7907327
23 | set environmental attribute "visual/fog_color" to 12638463
24 | set environmental attribute "visual/water_fog_color" to 2302743
25 | tags:
26 | apply to tag "minecraft:has_structure/village_plains"
27 | spawners:
28 | creature:
29 | apply spawner for cow, sheep and pig with weight 10 and with min count 2 and max count 4
30 | features:
31 | underground_ores:
32 | apply feature "minecraft:ore_dirt"
33 | apply feature "minecraft:ore_coal_upper"
34 | apply feature "minecraft:ore_coal_lower"
35 | apply feature "minecraft:disk_sand"
36 | apply feature "minecraft:disk_clay"
37 | apply feature "minecraft:disk_gravel"
38 | vegetal_decoration:
39 | apply feature "minecraft:flower_plains"
40 | apply feature "minecraft:patch_grass_plain"
41 | apply feature "minecraft:patch_waterlily"
42 | apply feature "minecraft:patch_sugar_cane"
43 | register new biome:
44 | id: "my_biomes:blue_forest"
45 | has_precipitation: true
46 | temperature: 0.8
47 | downfall: 0.2
48 | effects:
49 | foliage_color: rgb(37, 245, 201)
50 | water_color: rgb(37, 211, 245)
51 | grass_color: rgb(43, 171, 196)
52 | attributes:
53 | set environmental attribute "visual/sky_color" to 7907327
54 | set environmental attribute "visual/fog_color" to 12638463
55 | set environmental attribute "visual/water_fog_color" to 2302743
56 | tags:
57 | apply to tag "minecraft:has_structure/village_plains"
58 | spawners:
59 | creature:
60 | apply spawner for cow, sheep and pig with weight 10 and with min count 2 and max count 4
61 | features:
62 | underground_ores:
63 | apply feature "minecraft:ore_dirt"
64 | apply feature "minecraft:ore_coal_upper"
65 | apply feature "minecraft:ore_coal_lower"
66 | apply feature "minecraft:disk_sand"
67 | apply feature "minecraft:disk_clay"
68 | apply feature "minecraft:disk_gravel"
69 | vegetal_decoration:
70 | apply feature "minecraft:glow_lichen"
71 | apply feature "minecraft:forest_flowers"
72 | apply feature "minecraft:trees_birch_and_oak_leaf_litter"
73 | apply feature "minecraft:patch_bush"
74 | apply feature "minecraft:flower_default"
75 | apply feature "minecraft:patch_grass_forest"
76 | apply feature "minecraft:brown_mushroom_normal"
77 | apply feature "minecraft:red_mushroom_normal"
78 | apply feature "minecraft:patch_pumpkin"
79 | apply feature "minecraft:patch_sugar_cane"
80 | apply feature "minecraft:patch_firefly_bush_near_water"
81 |
--------------------------------------------------------------------------------
/snippets/player/Resource-Pack.sk:
--------------------------------------------------------------------------------
1 | # Resource Pack
2 | # By: ShaneBee
3 |
4 | # This little snippet allows you to send multiple resource packs, remove packs and clear all packs
5 | # Some of this can be done on Spigot, but Paper went and broke the setResourcePack method... good job Paper
6 |
7 | # Requires: Skript-Reflect, Minecraft 1.20.3+
8 |
9 | import:
10 | java.util.UUID
11 | net.minecraft.network.protocol.common.ClientboundResourcePackPopPacket
12 | net.minecraft.network.protocol.common.ClientboundResourcePackPushPacket
13 | org.bukkit.craftbukkit.v1_20_R3.util.CraftChatMessage
14 | java.util.Optional
15 |
16 | #! SEND A RESOURCE PACK !#
17 | # Send a resource pack to a player
18 |
19 | # Player = The player to send to
20 | # uuid = A unique ID for the pack
21 | # url = The url pointing towards your pack
22 | # msg = Message to show to client when prompting pack
23 | # force = Whether or not to force the client to download the pack
24 | function sendPack(p: player, uuid: string, url: string, msg: string, force: boolean):
25 | set {_u} to UUID.fromString({_uuid})
26 | set {_packet} to new ClientboundResourcePackPushPacket({_u}, {_url}, "", {_force}, CraftChatMessage.fromStringOrNull({_msg}, true))
27 | {_p}.getHandle().c.b({_packet})
28 |
29 | #! REMOVE A RESOURCE PACK !#
30 | # Remove a resource pack from a player
31 |
32 | # Player = The player to remove a pack from
33 | # uuid = A unique ID for the pack
34 | function removePack(p: player, uuid: string):
35 | set {_u} to UUID.fromString({_uuid})
36 | set {_packet} to new ClientboundResourcePackPopPacket(Optional.of({_u}))
37 | player.getHandle().c.b({_p})
38 |
39 | #! CLEAR RESOURCE PACKS !#
40 | # Will clear all server packs the player currently has
41 |
42 | # Player = The player to clear packs
43 | function clearPacks(p: player):
44 | set {_packet} to new ClientboundResourcePackPopPacket(Optional.empty())
45 | player.getHandle().c.b({_p})
46 |
47 | #! EXAMPLES !#
48 | # Example when joining
49 | on join:
50 | set {_u} to "1748129a-525b-44eb-8fb5-8953d0287508"
51 | set {_url} to raw "https://www.dropbox.com/scl/fi/wd89suog92c8tbdjvp6qy/Faithful-32x-1.20.2.zip?rlkey=9sn4w6d1oa8y4d5k1wqm6dwrg&dl=1"
52 | sendPack(player, {_u}, {_url}, "Testing Faithful", true)
53 |
54 | set {_u} to "1748129a-525b-44eb-8fb5-8953d0287509"
55 | set {_url} to raw "https://www.dropbox.com/scl/fi/mxlzwr339jg0kji65g8tg/Default-Dark-Mode-1.20.2-2023.9.0.zip?rlkey=nl1ygihkei47jjhkorjmg01fr&dl=1"
56 | sendPack(player, {_u}, {_url}, "&cYou have to accept... Muah HAHA!", true)
57 |
58 | # Example add/remove command
59 | command /pack :
60 | trigger:
61 | if arg-1 = "add":
62 | set {_u} to "1748129a-525b-44eb-8fb5-8953d0287508"
63 | set {_url} to raw "https://www.dropbox.com/scl/fi/wd89suog92c8tbdjvp6qy/Faithful-32x-1.20.2.zip?rlkey=9sn4w6d1oa8y4d5k1wqm6dwrg&dl=1"
64 | sendPack(player, {_u}, {_url}, "Testing Faithful", false)
65 |
66 | set {_u} to "1748129a-525b-44eb-8fb5-8953d0287509"
67 | set {_url} to raw "https://www.dropbox.com/scl/fi/mxlzwr339jg0kji65g8tg/Default-Dark-Mode-1.20.2-2023.9.0.zip?rlkey=nl1ygihkei47jjhkorjmg01fr&dl=1"
68 | sendPack(player, {_u}, {_url}, "Testing Dark Mode", false)
69 |
70 | else if arg-1 = "remove":
71 | set {_p} to new ClientboundResourcePackPopPacket(Optional.empty())
72 | player.getHandle().c.b({_p})
73 |
74 | on tab complete of "pack":
75 | set tab completions for position 1 to "add" and "remove"
76 |
77 |
--------------------------------------------------------------------------------
/snippets/display/Display-Bush.sk:
--------------------------------------------------------------------------------
1 |
2 | # Display Bush
3 | # By: ShaneBee
4 |
5 | # This script is just a fun way of using Display Entities.
6 |
7 | # Requires Minecraft 1.19.4+ and SkBee 2.8.1+
8 |
9 | # Create custom item
10 | on load:
11 | # Minecraft 1.20.4 and below
12 | set {-bush::item::1} to player head with nbt from "{CustomModelData:12255,SkullOwner:{Id:[I;-1291184209,-1164161754,-1260656384,-1770925678],Properties:{textures:[{Value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzA5ZWMwZDY0NWQwZDVhYTI3MTAwYTg4NmFiNzY0ZjI1ZjdmOWQwYTYwMzQ5ODEzYzQ2N2NmZTBkZGZiZDhlYyJ9fX0=""}]}}}"
13 |
14 | # Minecraft 1.20.5 and above
15 | set {-bush::item::1} to player head with nbt from "{""minecraft:custom_model_data"":12255,""minecraft:profile"":{id:[I;-1291184209,-1164161754,-1260656384,-1770925678],properties:[{name:""textures"",value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzA5ZWMwZDY0NWQwZDVhYTI3MTAwYTg4NmFiNzY0ZjI1ZjdmOWQwYTYwMzQ5ODEzYzQ2N2NmZTBkZGZiZDhlYyJ9fX0=""}]}}"
16 |
17 | #! COMMAND !#
18 | # Give yourself the bush item
19 | command /bush :
20 | trigger:
21 | give player 1 of {-bush::item::%{_b}%}
22 |
23 | #! FUNCTIONS !#
24 | # Place a bush
25 | function placeBush(b: block):
26 | spawn item display at location 0.5 above {_b}
27 | set {_e} to last spawned entity
28 | set display item of {_e} to {-bush::item::1}
29 | set display scale of {_e} to vector(0,0,0)
30 | set display translation of {_e} to vector(0,-1,0)
31 | wait 1 tick
32 | set interpolation duration of {_e} to 15
33 | set interpolation start of {_e} to -1
34 | set display scale of {_e} to vector(2.01,2,2.01)
35 | set display translation of {_e} to vector(0,0,0)
36 | set block above {_b} to light[level=0]
37 | loop 15 times:
38 | set block state tag "level" of block above {_b} to loop-number
39 | wait 1 tick
40 | set block at {_b} to green wool
41 | set int array tag "custom;bushEntity" of nbt of {_b} to uuid int array of {_e}
42 |
43 | # Used when a bush is broken
44 | function breakBush(b: block):
45 | set {_n} to nbt of {_b}
46 | set {_e} to uuid tag "custom;bushEntity" of {_n}
47 | set {_e} to {_e} parsed as entity
48 |
49 | set interpolation start of {_e} to -1
50 | set interpolation duration of {_e} to 10
51 | set display scale of {_e} to vector(0,0,0)
52 | set display translation of {_e} to vector(0,-1,0)
53 | loop 10 times:
54 | set block data tag "level" of block above {_b} to (16 - loop-number)
55 | wait 1 tick
56 | set block above {_b} to air
57 | drop 1 of {-bush::item::1} at location 0.45 below {_b} without velocity
58 | set velocity of last dropped item to vector(0,0.2,0)
59 | kill {_e}
60 |
61 | #! EVENT HANDLERS !#
62 | on place of player wall head:
63 | if custom model data of player's tool = 12255:
64 | cancel event
65 |
66 | on place of player head:
67 | if custom model data of player's tool = 12255:
68 | if past event-block is not air:
69 | cancel event
70 | stop
71 | if block above event-block is not air:
72 | cancel event
73 | stop
74 | loop 15 times:
75 | set block data tag "rotation" of event-block to loop-number
76 | wait 1 tick
77 | set block data tag "rotation" of event-block to 0
78 | placeBush(block at event-block)
79 |
80 | on break of green wool:
81 | set {_n} to nbt of event-block
82 | if {_n} has tag "custom;bushEntity":
83 | clear drops
84 | breakBush(event-block)
85 |
--------------------------------------------------------------------------------
/snippets/inventory/Backpack.sk:
--------------------------------------------------------------------------------
1 | # Backpack
2 | # By: ShaneBee
3 |
4 | # This little script provides the player with a simple little backpack
5 | # Do note this snippet is not intended to be production ready it is merely an example
6 | # Last tested on Paper/MC 1.21.8, Skript 2.12.1 and SkBee 3.12.2 and works as expected
7 | # Requirements: SkBee 3.6.0+
8 |
9 | #! FUNCTIONS !#
10 | # Open the backpack to the player
11 | function openBackpack(p: player):
12 | set {-backpack::%uuid of {_p}%::slot} to index of current hotbar slot of {_p}
13 | set {_n} to custom nbt of tool of {_p}
14 | set {_g} to chest inventory with 3 rows named "&bBackpack"
15 | set {_items::*} to compound list tag "Backpack;Items" of {_n}
16 | loop {_items::*}:
17 | set {_s} to byte tag "Slot" of loop-value
18 | set {_i} to nbt item from loop-value
19 | set slot {_s} of {_g} to {_i}
20 | open {_g} to {_p}
21 | wait 1 tick
22 | seeBarrier({_p})
23 |
24 | # Save backpack to item
25 | function saveBackpack(p: player):
26 | set {_n} to custom nbt of tool of {_p}
27 | loop items in current inventory of {_p}:
28 | set {_s} to index of loop-slot
29 | set {_i} to full nbt of loop-slot
30 | set byte tag "Slot" of {_i} to {_s}
31 | add {_i} to {_items::*}
32 | set {_size} to size of {_items::*}
33 | set compound list tag "Backpack;Items" of {_n} to {_items::*}
34 | set lore of tool of {_p} to "&7Items: &b%{_size}%&f/&b27"
35 |
36 | # Make the player see their held item as a barrier
37 | function seeBarrier(p: player):
38 | set {_i} to 1 of barrier
39 | hide tooltip of {_i}
40 | make {_p} see hand slot of {_p} as {_i}
41 |
42 |
43 | #! EVENT LISTENERS !#
44 | # handle saving when the inventory is closed
45 | on inventory close:
46 | if {-backpack::%uuid of player%::slot} is set:
47 | delete {-backpack::%uuid of player%::slot}
48 | saveBackpack(player)
49 |
50 | # Handle backpack clicks while in backpack inventory
51 | on inventory click:
52 | # prevent player putting their backpack in their backpack
53 | if clicked inventory = player's inventory:
54 | if index of clicked slot = {-backpack::%uuid of player%::slot}:
55 | cancel event
56 | wait 1 tick
57 | seeBarrier(player)
58 | # Prevent player clicking number button to move backpack
59 | if all:
60 | name of current inventory of player = "&bBackpack"
61 | click type = number key
62 | hotbar button = {-backpack::%uuid of player%::slot}
63 | then:
64 | cancel event
65 | wait 1 tick
66 | seeBarrier(player)
67 |
68 | # open the backpack (hand only)
69 | on right click:
70 | if custom nbt of player's tool has tag "Backpack":
71 | cancel event
72 | openBackpack(player)
73 | else if custom nbt of player's offhand tool has tag "Backpack":
74 | cancel event
75 |
76 | # delete unwanted variable
77 | on quit:
78 | delete {-backpack::%uuid of player%::slot}
79 |
80 | # create backpack item
81 | on load:
82 | set {-backpack} to player head with nbt from "{""minecraft:custom_data"":{Backpack:[]},""minecraft:profile"":{id:[I;-896627500,-420264509,-1649306860,408140238],name:"""",properties:[{name:""textures"",value:""eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWNlODMzYWE5YTI4YmNmMjA3ZTViMzZhNTkxY2VmMWY5OTdkZDJmNGE0YTIzNmFmNTBkZDA4MWYzYTVkOWM0YyJ9fX0=""}]}}"
83 | set name of {-backpack} to "&bBackpack"
84 | set lore of {-backpack} to "&7Items: &b0&f/&b27"
85 |
86 | # give a backpack
87 | command /backpack:
88 | trigger:
89 | give player 1 of {-backpack}
90 |
--------------------------------------------------------------------------------
/snippets/display/Display-Structure-Placer.sk:
--------------------------------------------------------------------------------
1 | # Structure Placer
2 | # By: ShaneBee
3 |
4 | # This little script allows you to visually structures before placing them
5 | # using block display entities.
6 |
7 | # Requires Minecraft 1.19.4+ and SkBee 2.8.1+
8 |
9 | #! This loads all the available structures to be placed !#
10 | # Minecraft only loads ones that its placed in the world
11 | # But you can type out any other available structure and it'll work
12 | local function update():
13 | loop ...server.getServer().getStructureManager().getStructures().keySet():
14 | set {_a} to "%loop-value%"
15 | set {-structures::%{_a}%} to {_a}
16 |
17 | on load:
18 | wait 1 tick
19 | update()
20 |
21 | #! COMMAND !#
22 | command /structure :
23 | trigger:
24 | if {_s} = "cancel":
25 | delete {-test::%uuid of player%}
26 | else:
27 | set {_l} to exact location of block above target block
28 |
29 | set {_s} to structure named {_s}
30 | set {-test::%uuid of player%} to {_s}
31 | set {-test::%uuid of player%::rotation} to 0
32 | set {_n} to (unix timestamp of now * 1000)
33 | loop blockstates of structure {_s}:
34 | if {-test::%uuid of player%} is not set:
35 | kill {_e::*}
36 | stop
37 | if (unix timestamp of now * 1000) - {_n} > 30:
38 | wait 1 tick
39 | set {_n} to (unix timestamp of now * 1000)
40 | set {_data} to blockstate blockdata of loop-value
41 | if {_data} = air[] or jigsaw[]:
42 | continue
43 | set {_off} to blockstate offset of loop-value
44 | spawn block display at {_l}:
45 | set display blockdata of entity to {_data}
46 | set display translation of entity to {_off}
47 | set display teleport duration of entity to 5
48 | set display brightness of entity to displayBrightness(15,15)
49 | set display scale of entity to vector(1.001,1.001,1.001)
50 | set interpolation start of entity to 0
51 | set interpolation duration of entity to 5
52 | set {_e::%uuid of entity%} to entity
53 |
54 | while {-test::%uuid of player%} is set:
55 | set {_l} to exact location of block above target block
56 | teleport {_e::*} to {_l}
57 | if {-rotate::%uuid of player%} is true:
58 | loop {_e::*}:
59 | set interpolation start of loop-value to 0
60 | set interpolation duration of loop-value to 5
61 | set {_q} to display right rotation of loop-value rotated around vector(0,90,0)
62 | set display right rotation of loop-value to {_q}
63 | set {_rot} to display translation of loop-value
64 | rotate {_rot} around y axis by 90
65 | set display translation of loop-value to {_rot}
66 | delete {-rotate::%uuid of player%}
67 | wait 5 tick
68 | kill {_e::*}
69 |
70 | on left click:
71 | if {-test::%uuid of player%} is set:
72 | if player is not sneaking:
73 | cancel event
74 | set {-rotate::%uuid of player%} to true
75 | add 1 to {-test::%uuid of player%::rotation}
76 |
77 | on right click:
78 | if {-test::%uuid of player%} is set:
79 | cancel event
80 | set {_loc} to exact location of block above target block
81 | set {_s} to {-test::%uuid of player%}
82 | set {_rot} to mod({-test::%uuid of player%::rotation},4)
83 | delete {-test::%uuid of player%}
84 |
85 | if {_rot} = 1:
86 | set structure rotation of {_s} to counterclockwise_90
87 | set {_loc} to location 1 block north of {_loc}
88 | else if {_rot} = 2:
89 | set structure rotation of {_s} to clockwise_180
90 | set {_loc} to location 1 block north of location 1 block west of {_loc}
91 | else if {_rot} = 3:
92 | set structure rotation of {_s} to clockwise_90
93 | set {_loc} to location 1 block west of {_loc}
94 |
95 | place structure {_s} at {_loc}
96 |
97 |
98 | on tab complete of "/structure":
99 | set tab completions for position 1 to {-structures::*}, "cancel"
100 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/mars.sk:
--------------------------------------------------------------------------------
1 | # Mars like planet
2 | # By ShaneBee
3 |
4 | # This snippet shows off a world generator that is meant to resemble a red planet.
5 | # While it may not look much like mars, this inspiration started from mars,
6 | # but grew to show off different things this generator can do
7 |
8 | # Requirements: SkBee, SkNoise, skript-reflect
9 |
10 | on load:
11 | suppress variable save warning
12 | # you'd have to create your own structure for this
13 | # I just made a 5 block radius sphere of red terracotta
14 | set {-structure::red_blob} to structure with id "minecraft:red_blob"
15 | # Wait a tick to make sure generator is properly loaded
16 | # without this the spawn area doesn't generate properly (it's flat)
17 | wait 1 tick
18 | if world("world_mars") is not loaded:
19 | set {_w} to world creator named "world_mars"
20 | set chunk generator of {_w} to chunk generator with id "mars"
21 | set environment option of {_w} to the end
22 | load world from creator {_w}
23 |
24 | #! CREATE NOISE GENERATORS !#
25 | on load:
26 | suppress variable save warning
27 | set {-gen1} to new perlin generator with seed 234
28 | set octaves of {-gen1} to 4
29 | set frequency of {-gen1} to 2
30 | set lacunarity of {-gen1} to 3
31 | set {-gen2} to new perlin generator with seed 234
32 |
33 | #! NOISE EXPRESSIONS !#
34 | expression block noise at %number%, %number%:
35 | get:
36 | set {_x} to expr-1
37 | set {_z} to expr-2
38 | # Continental Layer
39 | set {_value} to value of {-gen1} at ({_x} / 1000), 0, ({_z} / 1000)
40 | set {_cont} to ({_value} + 0.1) * 5
41 |
42 | # Mountain Layer
43 | set {_value} to value of {-gen2} at ({_x} / 5), 0, ({_z} / 5)
44 | set {_mount} to ({_value} + 1) * 15
45 |
46 | return 64 + floor({_cont} * {_mount})
47 |
48 | #! REGISTER GENERATOR !#
49 | register chunk generator with id "mars":
50 | chunk gen:
51 | loop 16 times:
52 | loop 16 times:
53 | set {_x} to (loop-number-1) - 1
54 | set {_z} to (loop-number-2) - 1
55 |
56 | # Let's get the highest point for a block
57 | set {_n} to block noise at ({_x} + (chunkdata chunk x * 16)), ({_z} + (chunkdata chunk z * 16))
58 | # Now we set the blocks from 0 to our noise level filling in our world
59 | set chunkdata blocks within vector({_x}, {_n} - 4, {_z}) and vector({_x}, ({_n} - 1), {_z}) to red_concrete[]
60 | # Now we set the blocks from 0 to our noise level filling in our world
61 | set chunkdata blocks within vector({_x}, 0, {_z}) and vector({_x}, ({_n} - 5), {_z}) to blackstone[]
62 | # Now we set our surface layer
63 | set chunkdata block at vector({_x}, {_n}, {_z}) to red_concrete_powder[]
64 | biome gen:
65 | # Let's give our world a lil mars lookin biome
66 | set chunkdata biome to crimson forest
67 | block pop:
68 | chance of 15%:
69 | set {_x} to random integer between 0 and 15
70 | set {_z} to random integer between 0 and 15
71 | set {_y} to chunkdata highest y at vector({_x}, 1, {_z})
72 | set {_v} to vector({_x}, {_y}, {_z}) + vector(-5,-5,-5)
73 | place chunkdata structure {-structure::red_blob} at {_v}
74 | loop (random integer between 0 and 2) times:
75 | set {_x} to random integer between 0 and 15
76 | set {_z} to random integer between 0 and 15
77 | set {_y} to chunkdata highest y at vector({_x}, 1, {_z})
78 | if chance of 85%:
79 | set chunkdata block at vector({_x}, {_y}, {_z}) to crimson_nylium
80 | populate crimson_fungus_tree at vector({_x}, {_y} + 1, {_z})
81 | else:
82 | set chunkdata block at vector({_x}, {_y}, {_z}) to warped_nylium
83 | populate warped_fungus_tree at vector({_x}, {_y} + 1, {_z})
84 | loop 9 times:
85 | set {_x} to random integer between 0 and 15
86 | set {_z} to random integer between 0 and 15
87 | set {_y} to chunkdata highest y at vector({_x}, 1, {_z})
88 | if chance of 85%:
89 | set chunkdata block at vector({_x}, {_y} + 1, {_z}) to fire_coral_fan[waterlogged=false]
90 | else if chance of 50%:
91 | set chunkdata block at vector({_x}, {_y} + 1, {_z}) to fire_coral[waterlogged=false]
92 | else if chance of 50%:
93 | set chunkdata block at vector({_x}, {_y} + 1, {_z}) to brain_coral_fan[waterlogged=false]
94 | else:
95 | set chunkdata block at vector({_x}, {_y} + 1, {_z}) to brain_coral[waterlogged=false]
96 |
--------------------------------------------------------------------------------
/snippets/other/Conveyor.sk:
--------------------------------------------------------------------------------
1 |
2 | # Conveyors
3 | # By ShaneBee
4 |
5 | # Requires: Skript and SkBee
6 |
7 | # This is HEAVILY a work in progress script. This is not the final product
8 |
9 |
10 | options:
11 | # Speed of the conveyor (seems to break above .45)
12 | speed: 0.20
13 |
14 | function reposition(e: entity, b: block, d: string):
15 | set {_custom} to tag "custom" of nbt compound of {_e}
16 |
17 | teleport {_e} to location -0.5 above {_b}
18 | set tag "direction" of {_custom} to {_d}
19 | set tag "custom" of nbt compound of {_e} to {_custom}
20 |
21 | function getVelocity(e: entity, b: block) :: vector:
22 | set {_nbt} to nbt compound of {_e}
23 | set {_dir} to tag "custom;direction" of {_nbt}
24 |
25 | set {_tag} to block data tag "shape" of {_b}
26 |
27 |
28 | if {_tag} = "ascending_east":
29 | if {_dir} = "east":
30 | set {_vec} to vector({@speed}, {@speed}, 0)
31 | else if {_dir} = "west":
32 | set {_vec} to vector(-{@speed}, -{@speed}, 0)
33 | else if {_tag} = "ascending_west":
34 | if {_dir} = "east":
35 | set {_vec} to vector({@speed}, -{@speed}, 0)
36 | else if {_dir} = "west":
37 | set {_vec} to vector(-{@speed}, {@speed}, 0)
38 | else if {_tag} = "ascending_north":
39 | if {_dir} = "north":
40 | set {_vec} to vector(0, {@speed}, -{@speed})
41 | else if {_dir} = "south":
42 | set {_vec} to vector(0, -{@speed}, {@speed})
43 | else if {_tag} = "ascending_south":
44 | if {_dir} = "north":
45 | set {_vec} to vector(0, -{@speed}, -{@speed})
46 | else if {_dir} = "south":
47 | set {_vec} to vector(0, {@speed}, {@speed})
48 |
49 |
50 | else if {_tag} = "north_south":
51 | if {_dir} = "north":
52 | set {_vec} to vector(0, 0, -{@speed})
53 | else if {_dir} = "south":
54 | set {_vec} to vector(0, 0, {@speed})
55 | else if {_tag} = "east_west":
56 | if {_dir} = "east":
57 | set {_vec} to vector({@speed}, 0, 0)
58 | else if {_dir} = "west":
59 | set {_vec} to vector(-{@speed}, 0, 0)
60 | #! CORNER !#
61 | else if {_tag} = "north_west":
62 | if {_dir} = "east" or "north":
63 | if {_dir} = "east":
64 | reposition({_e}, {_b}, "north")
65 | set {_vec} to vector(0, 0, -{@speed})
66 | else if {_dir} = "south" or "west":
67 | if {_dir} = "south":
68 | reposition({_e}, {_b}, "west")
69 | set {_vec} to vector(-{@speed}, 0, 0)
70 | else if {_tag} = "south_west":
71 | if {_dir} = "north" or "west":
72 | if {_dir} = "north":
73 | reposition({_e}, {_b}, "west")
74 | set {_vec} to vector(-{@speed}, 0, 0)
75 | else if {_dir} = "east" or "south":
76 | if {_dir} = "east":
77 | reposition({_e}, {_b}, "south")
78 | set {_vec} to vector(0, 0, {@speed})
79 | else if {_tag} = "south_east":
80 | if {_dir} = "west" or "south":
81 | if {_dir} = "west":
82 | reposition({_e}, {_b}, "south")
83 | set {_vec} to vector(0, 0, {@speed})
84 | else if {_dir} = "north" or "east":
85 | if {_dir} = "north":
86 | reposition({_e}, {_b}, "east")
87 | set {_vec} to vector({@speed}, 0, 0)
88 | else if {_tag} = "north_east":
89 | if {_dir} = "south" or "east":
90 | if {_dir} = "south":
91 | reposition({_e}, {_b}, "east")
92 | set {_vec} to vector({@speed}, 0, 0)
93 | else if {_dir} = "west" or "north":
94 | if {_dir} = "west":
95 | reposition({_e}, {_b}, "north")
96 | set {_vec} to vector(0, 0, -{@speed})
97 | return {_vec}
98 |
99 | function conveyor(e: entity):
100 | while {_e} is alive:
101 | if block at {_e} = rail:
102 | set velocity of {_e} to getVelocity({_e}, block at {_e})
103 | else if block below {_e} = rail:
104 | set velocity of {_e} to getVelocity({_e}, block below {_e})
105 | else:
106 | exit loop
107 | wait 1 ticks
108 |
109 | command /test :
110 | trigger:
111 | if arg-1 = "reset":
112 | delete all dropped items
113 | stop
114 | set {_l} to location of target block
115 | loop 20 times:
116 | spawn a dropped dirt -0.5 above {_l} with nbt from "{Item:%full nbt compound of player's tool%,PickupDelay:32767,Motion:[0,0,0]}"
117 | set {_e} to last spawned entity
118 | set gravity of {_e} to false
119 |
120 | set {_nbt} to nbt compound of {_e}
121 | set {_c} to tag "custom" of {_nbt}
122 | set tag "direction" of {_c} to arg-1
123 | set tag "custom" of {_nbt} to {_c}
124 |
125 | conveyor({_e})
126 | wait 2 ticks
127 | #kill {_e}
128 |
129 | on tab complete of "test":
130 | set tab completions for position 1 to "north", "south", "east", "west", "reset"
131 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Gamerule-Menu-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Gamerule Menu
2 | # By: ShaneBee
3 |
4 | # This is a dialog that allows you to visual/manage gamerules.
5 | # This one is extremely janky, but it was fun to write.
6 |
7 | # Do note, this is not intended for production, only for educational purposes
8 |
9 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
10 |
11 | on load:
12 | # this is used to sort gamerules alphabetically
13 | suppress variable save warning
14 | loop all gamerules:
15 | set {-gamerules::%loop-value%} to loop-value
16 |
17 | function gamerulesDialog(p: player):
18 | set {_w} to world of {_p}
19 | open multi action dialog to {_p}:
20 | title: "&bGamerules"
21 | columns: 3
22 | body:
23 | add plain message body:
24 | contents: "Select a gamerule"
25 | actions:
26 | loop {-gamerules::*}:
27 | if loop-value.requiredFeatures().isEmpty() = false:
28 | continue
29 | set {_g} to loop-value
30 | set {_value::*} to (gamerule {_g} of (world of {_p}))
31 | set {_value} to {_value::1}.getGameruleValue()
32 | if {_value} = true:
33 | set {_c} to "&a"
34 | else if {_value} = false:
35 | set {_c} to "&c"
36 | else:
37 | set {_c} to "&b"
38 |
39 | add dynamic action button:
40 | label: {_c} + "%loop-value%"
41 | id: "custom:open_gamerule_menu"
42 | additions: nbt from "{gamerule:%loop-value%}"
43 |
44 |
45 | function gameruleDialog(g: gamerule, p: player):
46 | open multi action dialog to {_p}:
47 | title: "&bGamerule"
48 | columns: 1
49 | body:
50 | add plain message body:
51 | contents: "Gamerule: %{_g}%"
52 | inputs:
53 | set {_value::*} to (gamerule {_g} of (world of {_p}))
54 | set {_value} to {_value::1}.getGameruleValue()
55 | if "%{_g}.getType()%" contains "Boolean":
56 | set {_color} to "&a" if {_value} = true else "&c"
57 | add boolean input:
58 | label: "Enabled"
59 | key: "value"
60 | initial: {_value}
61 | else:
62 | add number range input:
63 | label: "Value"
64 | key: "value"
65 | start: 0
66 | end: 100
67 | step: 1
68 | initial: {_value}
69 |
70 | actions:
71 | add dynamic action button:
72 | label: "Set"
73 | id: "gamerule_set"
74 | additions: nbt from "{gamerule:%{_g}%}"
75 | add dynamic action button:
76 | label: "Back"
77 | id: "custom:open_gamerules_menu"
78 |
79 | function gameruleConfirm(g: gamerule, v: object, p: player):
80 | if {_v} is set:
81 | open multi action dialog to {_p}:
82 | title: "Gamerule Confirmation"
83 | columns: 1
84 | body:
85 | add plain message body:
86 | contents: "Gamerule: %{_g}%"
87 | add plain message body:
88 | contents: "Value Set: %{_v}%"
89 | actions:
90 | add static action button:
91 | label: "Exit"
92 | add dynamic action button:
93 | label: "Gamerules"
94 | id: "custom:open_gamerules_menu"
95 | else:
96 | open multi action dialog to {_p}:
97 | title: "Gamerule Confirmation"
98 | columns: 1
99 | body:
100 | add plain message body:
101 | contents: "Gamerule: %{_g}%"
102 | add plain message body:
103 | contents: "&cFailed to set value!"
104 | actions:
105 | add static action button:
106 | label: "Exit"
107 | add dynamic action button:
108 | label: "Gamerules"
109 | id: "custom:open_gamerules_menu"
110 |
111 |
112 | command /gm []:
113 | trigger:
114 | if arg-1 is not set:
115 | gamerulesDialog(player)
116 | else:
117 | gameruleDialog(arg-1, player)
118 |
119 | on dynamic button click:
120 | set {_key} to "%event-namespacedkey%"
121 | if {_key} = "custom:open_gamerules_menu":
122 | gamerulesDialog(player)
123 | else if {_key} = "custom:open_gamerule_menu":
124 | set {_n} to event-nbt
125 | set {_gamerule} to (string tag "gamerule" of {_n}) parsed as gamerule
126 | gameruleDialog({_gamerule}, player)
127 | else if {_key} contains "gamerule_set":
128 | set {_n} to event-nbt
129 | set {_gamerule} to string tag "gamerule" of {_n} parsed as gamerule
130 | if tag type of tag "value" of {_n} is byte tag:
131 | set {_value} to (boolean tag "value" of {_n})
132 | set gamerule {_gamerule} of world of player to (boolean tag "value" of {_n})
133 | else if tag type of tag "value" of {_n} is float tag:
134 | set {_value} to (float tag "value" of {_n}).intValue()
135 |
136 | if {_value} is set:
137 | set gamerule {_gamerule} of world of player to {_value}
138 | gameruleConfirm({_gamerule}, {_value}, player)
139 | else:
140 | gameruleConfirm({_gamerule}, {_}, player)
141 |
--------------------------------------------------------------------------------
/snippets/command/Debug-Command-Functions.sk:
--------------------------------------------------------------------------------
1 |
2 | # Debug Command and Functions
3 | # By: ShaneBee
4 |
5 | # Requires: SkBee
6 |
7 | # This simple script allows you to debug blocks/items/entities
8 | # Includes and easy to use command as well as some functions you can use elsewhere
9 |
10 | # COMMAND
11 |
12 | # Handy little debug command to get info about your tool, target block or target entity
13 | command /debug :
14 | trigger:
15 | set {_p} to "&7[&cDEBUG&7]%nl%"
16 | if arg-1 = "hand" or "tool":
17 | set {_i} to player's tool
18 | if {_i} != air:
19 | send formatted "T: &7[&dDEBUG&7] &bTool"
20 | else:
21 | send formatted "T: &7[&dDEBUG&7] &bTool"
22 | else if arg-1 = "block":
23 | set {_b} to target block of player
24 | if {_i} != air:
25 | send formatted "T: &7[&dDEBUG&7] &bTarget Block"
26 | else:
27 | send formatted "T: &7[&dDEBUG&7] &bTarget Block"
28 | else if arg-1 = "entity":
29 | set {_e} to target entity of player
30 | if {_e} is set:
31 | send formatted "T: &7[&dDEBUG&7] &bTarget Entity"
32 | else:
33 | send formatted "T: &7[&dDEBUG&7] &bTarget Entity"
34 |
35 | on tab complete of "/debug":
36 | set tab completions for position 1 to "hand", "block" and "entity"
37 |
38 |
39 | # FUNCTIONS
40 | # Some handly little functions used for debugging
41 |
42 | # Location to String function
43 | # This function returns a location as an easy to use String
44 | # loc = the location to stringify
45 | # block = if false, will include yaw/pitch
46 | # pretty = whether it returns with colors
47 | # split = characters to split this string at into new lines (usually spaces)
48 | function locToString(loc: location, block: boolean=true, pretty: boolean=true, split: string = "") :: string:
49 | set {_n} to locToNBT({_loc}, {_block})
50 | if {_pretty} = true:
51 | return "&bLocation&r%pretty nbt of {_n} with split {_split}%"
52 | return "Location%{_n}%"
53 |
54 | # Location to NBT compound
55 | # This function returns a location as a serialized NBT compound
56 | # loc = the location to serialize
57 | # block = if true will not include yaw/pitch
58 | function locToNBT(loc: location, block: boolean) :: nbt compound:
59 | set {_n} to nbt compound of "{}"
60 | set tag "world" of {_n} to "%world of {_loc}%"
61 | set tag "x" of {_n} to x coord of {_loc}
62 | set tag "y" of {_n} to y coord of {_loc}
63 | set tag "z" of {_n} to z coord of {_loc}
64 | if {_block} = false:
65 | set tag "pitch" of {_n} to 0.0
66 | set tag "yaw" of {_n} to yaw of {_loc}
67 | return {_n}
68 |
69 | # Block to String
70 | # This function returns the a block as a string full of handy information
71 | # b = the block to stringify
72 | # pretty = if the string should be colored
73 | # split = characters to split this string at into new lines (usually spaces)
74 | function blockToString(b: block, pretty: boolean = true, split: string = "") :: string:
75 | set {_n} to nbt compound of "{}"
76 | set tag "alias" of {_n} to "%{_b}%"
77 | set tag "data" of {_n} to "%block data of {_b}%"
78 | set tag "pos" of {_n} to locToNBT(({_b} offset by vector(-0.5, -0.5, -0.5)), true)
79 | set {_nbt} to nbt compound copy of {_b}
80 | delete tag "x" of {_nbt}
81 | delete tag "y" of {_nbt}
82 | delete tag "z" of {_nbt}
83 | delete tag "id" of {_nbt}
84 | set tag "nbt" of {_n} to {_nbt}
85 | if {_pretty} = true:
86 | return "&bBlock&r%pretty nbt of {_n} with split {_split}%"
87 | return "Block%{_n}%"
88 |
89 | # Item to String
90 | # This functions returns an item as a string full of handy information
91 | # i = item to stringify
92 | # pretty = if the string should be colored
93 | # split = characters to split this string at into new lines (usually spaces)
94 | function itemToString(i: itemtype, pretty: boolean = true, split: string = "") :: string:
95 | set {_nbt} to nbt compound of "{}"
96 | set tag "alias" of {_nbt} to "%{_i}%"
97 | set tag "nbt" of {_nbt} to nbt compound of {_i}
98 | if {_pretty} = true:
99 | return "&bItem&r%pretty nbt of {_nbt} with split {_split}%"
100 | return "Item%{_nbt}%"
101 |
102 | # Entity to String
103 | # This functions returns an entity as a string full of handy information
104 | # e = entity to stringify
105 | # pretty = if the string should be colored
106 | # split = characters to split this string at into new lines (usually spaces)
107 | function entityToString(e: entity, pretty: boolean = true, split: string = "") :: string:
108 | set {_n} to nbt compound of "{}"
109 | set tag "type" of {_n} to "%{_e}%"
110 | set tag "pos" of {_n} to locToNBT({_e}, false)
111 | set tag "id" of {_n} to "%tag ""UUID"" of nbt compound of {_e}%"
112 | if {_pretty} = true:
113 | return "&bEntity&r%pretty nbt of {_n} with split {_split}%"
114 | return "Entity%{_n}%"
115 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Shop-Menu-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Shop Menu
2 | # By: ShaneBee
3 |
4 | # This is a shop menu dialog scrip.
5 | # It was made to easy change to meet your needs
6 |
7 | # Do note, this is not intended for production, only for educational purposes
8 |
9 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
10 |
11 | function registerShopItem(group: string, i: itemtype, price: number, name: string = ""):
12 | set {-shop::%{_group}%} to {_group}
13 | set {-shop::%{_group}%::%{_i}%} to {_i}
14 | set {-shop::%{_group}%::%{_i}%::price} to {_price}
15 | if length of {_name} > 0:
16 | set {-shop::%{_group}%::%{_i}%::name} to {_name}
17 |
18 | on load:
19 | # Natural
20 | delete {-shop::*}
21 | registerShopItem("natural", dirt, 1)
22 | registerShopItem("natural", gravel, 5)
23 | registerShopItem("natural", grass block, 20)
24 |
25 | # Logs
26 | loop tag values of item tag "minecraft:logs":
27 | registerShopItem("logs", loop-value, 10)
28 |
29 | # Wool
30 | loop tag values of item tag "minecraft:wool":
31 | registerShopItem("wool", loop-value, 3)
32 |
33 | # Spawn Eggs
34 | loop tag values of item tag "paper:spawn_eggs":
35 | registerShopItem("spawn eggs", loop-value, 5000)
36 |
37 | # Minerals
38 | registerShopItem("mineral", gold ingot, 25)
39 | registerShopItem("mineral", iron ingot, 50)
40 | registerShopItem("mineral", diamond, 100)
41 | registerShopItem("mineral", emerald, 500)
42 |
43 | # Tools
44 | registerShopItem("tools", iron axe, 100)
45 | registerShopItem("tools", iron pickaxe, 100)
46 | registerShopItem("tools", diamond axe, 500)
47 | registerShopItem("tools", diamond pickaxe, 500)
48 |
49 | function openItemMenu(player: player, group: string, itemstring: string):
50 | set {_item} to {-shop::%{_group}%::%{_itemstring}%}
51 | if {-shop::%{_group}%::%{_itemstring}%::name} is set:
52 | set {_itemname} to {-shop::%{_group}%::%{_itemstring}%::name}
53 | else:
54 | set {_itemname} to translate component of {_item}
55 | set {_price} to {-shop::%{_group}%::%{_itemstring}%::price}
56 | open multi action dialog to {_player}:
57 | title: "Shop"
58 | columns: 1
59 | body:
60 | add plain message body:
61 | contents: "Shopping for " + {_itemname}
62 | add plain message body:
63 | contents: "&7Price per: &b$%{_price}%"
64 | add item body:
65 | item: {_item}
66 | inputs:
67 | add number range input:
68 | key: "amount"
69 | label: "Amount"
70 | start: 1
71 | end: max stack size of {_item}
72 | step: 1
73 | initial: 1
74 | actions:
75 | set {_n} to empty nbt compound
76 | set string tag "group" of {_n} to {_group}
77 | set string tag "item" of {_n} to {_itemstring}
78 | add dynamic action button:
79 | label: "Buy"
80 | id: "shop:buy_item"
81 | additions: {_n}
82 | add dynamic action button:
83 | label: "&eBack"
84 | id: "shop:group_menu"
85 | additions: {_n}
86 |
87 | function confirmBuy(player: player, item: itemtype, price: number, nbt: nbtcompound):
88 | open confirmation dialog to {_player}:
89 | title: "Shop"
90 | body:
91 | set {_name} to translate component of {_item}
92 | add plain message body:
93 | contents: "Do you want to buy %{_name}% for &b$%{_price}%?"
94 | actions:
95 | add dynamic action button:
96 | label: "&aCONFIRM"
97 | id: "shop:confirm_buy"
98 | additions: {_nbt}
99 | add dynamic action button:
100 | label: "&cCANCEL"
101 | id: "shop:open_shop_menu"
102 |
103 | function cantAfford(player: player, item: itemtype, price: number):
104 | open notice dialog to {_player}:
105 | title: "Shop"
106 | body:
107 | set {_name} to translate component of {_item}
108 | add plain message body:
109 | contents: "You dont have enough money to buy %{_name}%"
110 | add plain message body:
111 | contents: "You need &b$%{_price}% &rbut you only have &e%balance of {_player}%"
112 | action:
113 | add dynamic action button:
114 | label: "&eShop Menu"
115 | id: "shop:open_shop_menu"
116 |
117 |
118 | function openGroupMenu(player: player, group: string):
119 | open multi action dialog to {_player}:
120 | title: "Shop"
121 | body:
122 | add plain message body:
123 | contents: (proper case {_group}) + " Shop"
124 | actions:
125 | loop {-shop::%{_group}%::*}:
126 | if {-shop::%{_group}%::%loop-index%::name} is set:
127 | set {_t} to {-shop::%{_group}%::%loop-index%::name}
128 | else:
129 | set {_t} to translate component of loop-value
130 | set {_price} to {-shop::%{_group}%::%loop-index%::price}
131 | set {_lines::*} to tooltip lines of loop-value
132 | set {_lines} to merge components {_lines::*} with new line
133 | set {_n} to empty nbt compound
134 | set string tag "group" of {_n} to {_group}
135 | set string tag "item" of {_n} to loop-index
136 | add dynamic action button:
137 | label: "%{_t}% &b$%{_price}%"
138 | id: "shop:item_button"
139 | tooltip: {_lines}
140 | additions: {_n}
141 | add dynamic action button:
142 | label: "&eBack"
143 | id: "shop:open_shop_menu"
144 |
145 | function openShopMenu(player: player):
146 | open multi action dialog to {_player}:
147 | title: "Shop"
148 | body:
149 | add plain message body:
150 | contents: "Select a shop:"
151 | actions:
152 | loop {-shop::*}:
153 | add dynamic action button:
154 | label: proper case loop-value
155 | id: "shop:group_menu"
156 | additions: nbt from "{group:""%loop-value%""}"
157 |
158 | command /shop:
159 | trigger:
160 | openShopMenu(player)
161 |
162 | on dynamic button click:
163 | set {_key} to "%event-namespacedkey%"
164 | if {_key} = "shop:open_shop_menu":
165 | openShopMenu(player)
166 | else if {_key} = "shop:group_menu":
167 | set {_group} to string tag "group" of event-nbt
168 | openGroupMenu(player, {_group})
169 | else if {_key} = "shop:item_button":
170 | set {_group} to string tag "group" of event-nbt
171 | set {_item} to string tag "item" of event-nbt
172 | openItemMenu(player, {_group}, {_item})
173 | else if {_key} = "shop:buy_item":
174 | set {_group} to string tag "group" of event-nbt
175 | set {_item} to string tag "item" of event-nbt
176 | set {_amount} to float tag "amount" of event-nbt
177 | set {_item2} to {-shop::%{_group}%::%{_item}%}
178 | set {_price} to {-shop::%{_group}%::%{_item}%::price} * {_amount}
179 | if balance of player >= {_price}:
180 | confirmBuy(player, {_item2}, {_price}, event-nbt)
181 | else:
182 | cantAfford(player, {_item2}, {_price})
183 | else if {_key} = "shop:confirm_buy":
184 | set {_group} to string tag "group" of event-nbt
185 | set {_item} to string tag "item" of event-nbt
186 | set {_amount} to float tag "amount" of event-nbt
187 | set {_item2} to {-shop::%{_group}%::%{_item}%}
188 | set {_price} to {-shop::%{_group}%::%{_item}%::price} * {_amount}
189 | give player {_amount} of {_item2}
190 | remove {_price} from balance of player
191 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/vanilla-vanilla-decor.sk:
--------------------------------------------------------------------------------
1 | # Vanilla World with Vanilla Decor
2 | # By ShaneBee
3 |
4 | # This snippet shows off a world generator that may look somewhat close to vanilla Minecraft
5 | # with vanilla decor
6 |
7 | # Requirements: SkBee, SkNoise, Skript-Reflect
8 |
9 | on load:
10 | # Wait a tick to make sure generator is properly loaded
11 | # without this the spawn area doesn't generate properly (it's flat)
12 | wait 1 tick
13 | if world("world_vanilla_like") is not loaded:
14 | send "&bLoading world_vanilla_like"
15 | set {_w} to world creator named "world_vanilla_like"
16 | set chunk generator of {_w} to chunk generator with id "test"
17 | load world from creator {_w}
18 | send "&aLoaded world_vanilla_like"
19 |
20 | #! CREATE NOISE GENERATORS !#
21 | on load:
22 | suppress variable save warning
23 | set {-gen1} to new perlin generator with seed 234
24 | set octaves of {-gen1} to 4
25 | set frequency of {-gen1} to 2
26 | set lacunarity of {-gen1} to 3
27 | set {-gen2} to new perlin generator with seed 234
28 |
29 | set {-gen3} to new perlin generator with seed 999
30 | set {-gen4} to new simplex generator with seed 888
31 | set octaves of {-gen4} to 10
32 | set frequency of {-gen4} to 10
33 | set lacunarity of {-gen4} to 2
34 |
35 | #! NOISE EXPRESSIONS !#
36 | expression block noise at %number%, %number%:
37 | get:
38 | set {_x} to expr-1
39 | set {_z} to expr-2
40 | # Continental Layer
41 | set {_value} to value of {-gen1} at ({_x} / 1000), 0, ({_z} / 1000)
42 | set {_cont} to ({_value} + 0.1) * 5
43 |
44 | # Mountain Layer
45 | set {_value} to value of {-gen2} at ({_x} / 5), 0, ({_z} / 5)
46 | set {_mount} to ({_value} + 1) * 15
47 |
48 | return 64 + floor({_cont} * {_mount})
49 |
50 | expression biome noise at %vector%:
51 | get:
52 | set {_v} to expr-1
53 | set {_x} to x of {_v}
54 | set {_y} to y of {_v}
55 | set {_z} to z of {_v}
56 | return value of {-gen3} at ({_x} / 30), {_y}, ({_z} / 30)
57 |
58 | expression temperature noise at %vector%:
59 | get:
60 | set {_v} to expr-1
61 | set {_x} to x of {_v}
62 | set {_y} to y of {_v}
63 | set {_z} to z of {_v}
64 | set {_temp} to (value of {-gen4} at ({_x} / 8000), {_y}, ({_z} / 8000)) + 1
65 | return {_temp}
66 |
67 | expression calculated biome at %vector%:
68 | return type: biome
69 | get:
70 | set {_v} to expr-1
71 | set {_x} to x of {_v}
72 | set {_y} to y of {_v} #currently not using
73 | set {_z} to z of {_v}
74 | set {_temp} to temperature noise at vector({_x}, 1, {_z})
75 | set {_block} to block noise at {_x}, {_z}
76 | set {_biomeNoise} to biome noise at vector({_x}, 1, {_z})
77 |
78 | # CAVES
79 | if {_y} < {_block} - 4:
80 | if all:
81 | {_y} < -10
82 | {_temp} > 1
83 | then:
84 | set {_biome} to deep dark
85 | else if {_temp} > 1.2:
86 | set {_biome} to lush caves
87 | # BEACHES
88 | else if {_block} = 63 or 64:
89 | if {_temp} > 1.4:
90 | set {_biome} to river
91 | else if {_temp} > 0.8:
92 | set {_biome} to beach
93 | else:
94 | set {_biome} to snowy beach
95 |
96 | # OCEAN
97 | else if {_block} < 63:
98 | if {_temp} > 1.2:
99 | set {_biome} to warm ocean
100 | else if {_temp} > 1.05:
101 | set {_biome} to lukewarm ocean
102 | else if {_temp} > 0.8:
103 | set {_biome} to ocean
104 | else:
105 | set {_biome} to frozen ocean
106 | else:
107 | if {_temp} > 1.2:
108 | if {_biomeNoise} > 0.6:
109 | set {_biome} to badlands
110 | else if {_biomeNoise} > -0.5:
111 | set {_biome} to desert
112 | else:
113 | set {_biome} to savanna
114 | else if {_temp} > 1.05:
115 | if {_biomeNoise} > 0.6:
116 | set {_biome} to jungle
117 | else if {_biomeNoise} > 0.3:
118 | set {_biome} to bamboo jungle
119 | else if {_biomeNoise} > -0.2:
120 | set {_biome} to sparse jungle
121 | else if {_biomeNoise} > -0.6:
122 | set {_biome} to swamp
123 | else:
124 | set {_biome} to mangrove swamp
125 | else if {_temp} > 0.8:
126 | if {_biomeNoise} > 0.5:
127 | set {_biome} to flower forest
128 | else if {_biomeNoise} > 0.25:
129 | set {_biome} to windswept forest
130 | else if {_biomeNoise} > 0.15:
131 | set {_biome} to cherry grove
132 | else if {_biomeNoise} > -0.15:
133 | set {_biome} to old growth spruce taiga
134 | else if {_biomeNoise} > -0.25:
135 | set {_biome} to taiga
136 | else if {_biomeNoise} > -0.35:
137 | set {_biome} to old growth birch forest
138 | else if {_biomeNoise} > -0.45:
139 | set {_biome} to sunflower plains
140 | else:
141 | set {_biome} to plains
142 | else:
143 | if {_biomeNoise} > 0:
144 | set {_biome} to snowy taiga
145 | else:
146 | set {_biome} to snowy slopes
147 |
148 | return {_biome} ? plains
149 |
150 | #! REGISTER GENERATOR !#
151 | register chunk generator with id "test":
152 | vanilla decor: true
153 | vanilla caves: true
154 | vanilla structures: true
155 | vanilla mobs: true
156 | height gen:
157 | set {_x} to x coord of event-location
158 | set {_z} to z coord of event-location
159 | set {_n} to block noise at {_x}, {_z}
160 | set chunkdata height to {_n} + 1
161 | chunk gen:
162 | loop 16 times:
163 | loop 16 times:
164 | set {_x} to (loop-number-1) - 1
165 | set {_z} to (loop-number-2) - 1
166 | set {_n} to block noise at ({_x} + (16 * chunkdata chunk x)), ({_z} + (16 * chunkdata chunk z))
167 |
168 | set {_top} to {_n} if {_n} > 64 else 64
169 |
170 | # Fill stone
171 | set chunkdata blocks between vector({_x},-64,{_z}) and vector(({_x}),({_n}),({_z})) to stone[]
172 |
173 |
174 | # Place surface
175 | loop integers between {_n} and {_top}:
176 | set {_y} to loop-number-3
177 | set {_biome} to calculated biome at vector({_x} + (16 * chunkdata chunk x), {_y}, {_z} + (16 * chunkdata chunk z))
178 |
179 | # Surface
180 | if {_y} = {_n}:
181 | if {_y} > 64:
182 | if {_biome} = desert, badlands or beach:
183 | set {_data} to sand[]
184 | else if all:
185 | {_biome} = mangrove swamp
186 | chance of 45%
187 | then:
188 | set {_data} to mud[]
189 | else:
190 | set {_data} to grass_block[]
191 | else:
192 | set {_data} to sand[]
193 |
194 | # Water
195 | else if all:
196 | {_y} > {_n}
197 | {_y} < 64
198 | then:
199 | set {_data} to water[]
200 |
201 | if {_data} is set:
202 | set chunkdata block at vector({_x}, {_y}, {_z}) to {_data}
203 | if {_data} is grass_block[] or mud[]:
204 | set {_below} to dirt[]
205 | else if {_data} is sand[]:
206 | set {_below} to sandstone[]
207 | if {_below} is set:
208 | loop 3 times:
209 | set {_yy} to loop-number-4
210 | set chunkdata block at vector({_x}, {_y} - {_yy}, {_z}) to {_below}
211 | delete {_data}
212 | delete {_below}
213 | biome gen:
214 | set {_l} to event-location
215 | set {_x} to x coord of {_l}
216 | set {_y} to y coord of {_l}
217 | set {_z} to z coord of {_l}
218 |
219 | set {_biome} to calculated biome at vector({_x}, {_y}, {_z})
220 | set chunkdata biome to {_biome} ? plains
221 |
222 |
--------------------------------------------------------------------------------
/snippets/dialog/dynamic/Email-Multi-Action-Dialog.sk:
--------------------------------------------------------------------------------
1 | # Email System
2 | # By: ShaneBee
3 |
4 | # This is a pretty complex email system.
5 | # This allows players to send emails to each other.
6 | # They have the option to read, delete, mark unread, reply.
7 |
8 | # Do note, this is not intended for production, only for educational purposes
9 |
10 | # Requirements: SkBee, SkNMS 1.3.0+, Paper 1.21.6+
11 |
12 | function openEmailMenu(p: player):
13 | open multi action dialog to {_p}:
14 | title: "Email"
15 | columns: 1
16 | body:
17 | if size of {emails::%uuid of {_p}%::*} = 0:
18 | add plain message body:
19 | contents: "&cYou have no emails!"
20 | else:
21 | add plain message body:
22 | contents: "Your emails:"
23 | actions:
24 | loop reversed indexes of {emails::%uuid of {_p}%::*}:
25 | set {_n} to {emails::%uuid of {_p}%::%loop-value%}
26 | set {_from} to offlineplayer(uuid tag "from" of {_n})
27 | set {_id} to loop-value
28 | set {_date} to unix date of ({_id} parsed as number)
29 | set {_tooltip} to string tag "email_subject" of {_n}
30 |
31 | set {_u} to " "
32 | if {_n} has tag "read":
33 | set {_c} to raw ""
34 | else:
35 | set {_c} to raw "<#68FAA6>"
36 | if boolean tag "email_urgent" of {_n} = true:
37 | set {_u} to raw "<#F99803>ℹ"
38 | set {_c} to raw "<#4EF903>"
39 |
40 | add dynamic action button:
41 | label: mini message from "%{_u}% %{_c}%From: %{_from}% Date: %{_date}%"
42 | tooltip: "Subject: " + {_tooltip}
43 | id: "email:open_email"
44 | additions: nbt from "{id:""%{_id}%""}"
45 | width: 275
46 | add dynamic action button:
47 | label: "&cDelete All"
48 | id: "email:delete_all"
49 | add dynamic action button:
50 | label: "&bCreate Email"
51 | id: "email:create_email"
52 | add static action button:
53 | label: "&eExit"
54 |
55 | function openEmail(player: player, id: string):
56 | set {_n} to {emails::%uuid of {_player}%::%{_id}%}
57 | set boolean tag "read" of {emails::%uuid of {_player}%::%{_id}%} to true
58 | set {_fromUUID} to uuid tag "from" of {_n}
59 | set {_from} to offlineplayer({_fromUUID})
60 | set {_subject} to string tag "email_subject" of {_n}
61 | set {_body} to string tag "email_body" of {_n}
62 | open multi action dialog to {_player}:
63 | title: "Email"
64 | columns: 1
65 | body:
66 | add plain message body:
67 | contents: mini message from "You got an email from %{_from}%:"
68 | add plain message body:
69 | contents: mini message from "Subject: ""%{_subject}%"""
70 | add plain message body:
71 | contents: """%{_body}%"""
72 | actions:
73 | # REPLY
74 | set {_reply} to empty nbt compound
75 | set uuid tag "from" of {_reply} to (uuid of {_player})
76 | set uuid tag "to" of {_reply} to {_fromUUID}
77 | add dynamic action button:
78 | label: "Reply"
79 | id: "email:reply"
80 | additions: {_reply}
81 |
82 | set {_idNBT} to empty nbt compound
83 | set string tag "id" of {_idNBT} to {_id}
84 |
85 | # MARK UNREAD
86 | add dynamic action button:
87 | label: "&bMark Unread"
88 | id: "email:mark_unread"
89 | additions: {_idNBT}
90 |
91 | # DELETE
92 | add dynamic action button:
93 | label: "&cDelete"
94 | id: "email:delete"
95 | additions: {_idNBT}
96 |
97 | # EMAILS
98 | add dynamic action button:
99 | label: "Emails"
100 | id: "email:open_emails"
101 |
102 | # EXIT
103 | add static action button:
104 | label: "&eExit"
105 |
106 | function createEmail(from: player):
107 | open multi action dialog to {_from}:
108 | title: "Email"
109 | body:
110 | add plain message body:
111 | contents: "Enter a player's name:"
112 | inputs:
113 | add text input:
114 | label: "Player Name:"
115 | key: "to"
116 | actions:
117 | add dynamic action button:
118 | label: "Create"
119 | id: "email:create_email_to"
120 |
121 | function noPlayer(player: player, to: offlineplayer):
122 | open multi action dialog to {_player}:
123 | title: "Email"
124 | columns: 1
125 | body:
126 | if {_player} = {_to}:
127 | add plain message body:
128 | contents: "&cYou cannot email yourself"
129 | else:
130 | add plain message body:
131 | contents: "&cNo player by the name &e%{_to}%"
132 | actions:
133 | add dynamic action button:
134 | label: "Emails"
135 | id: "email:open_emails"
136 | add static action button:
137 | label: "Exit"
138 |
139 | function writeEmail(from: player, to: offlineplayer):
140 | open multi action dialog to {_from}:
141 | title: "Email"
142 | body:
143 | add plain message body:
144 | contents: "Send an email to %{_to}%"
145 | inputs:
146 | add text input:
147 | label: "Subject"
148 | key: "email_subject"
149 | add text input:
150 | label: "Body:"
151 | key: "email_body"
152 | max_length: 256
153 | multiline_max_lines: 20
154 | multiline_height: 100
155 | add boolean input:
156 | label: "Urgent?"
157 | key: "email_urgent"
158 | actions:
159 | set {_n} to empty nbt compound
160 | set uuid tag "to" of {_n} to uuid of {_to}
161 | set uuid tag "from" of {_n} to uuid of {_from}
162 | add dynamic action button:
163 | label: "Send"
164 | id: "email:send_email"
165 | additions: {_n}
166 |
167 | function sendEmail(from: player, email: nbt compound):
168 | set {_fromuuid} to uuid of {_from}
169 |
170 | set {_id} to unix timestamp of now
171 | set {_to} to uuid tag "to" of {_email}
172 | set {emails::%{_to}%::%{_id}%} to {_email}
173 | set {_p} to offlineplayer({_to})
174 | if {_p} is online:
175 | send "&7[&bEmail&7] &rYou received a new email from %{_from}%... &bOPEN EMAILS!" to {_p}
176 |
177 | command /email [] []:
178 | trigger:
179 | if arg-1 = "send":
180 | if any:
181 | player = arg-2
182 | arg-2 has not played before
183 | then:
184 | noPlayer(player, arg-2)
185 | else:
186 | writeEmail(player, arg-2)
187 | else:
188 | openEmailMenu(player)
189 |
190 | on tab complete of "email":
191 | set tab completions for position 1 to "open", "send"
192 |
193 | on dynamic button click:
194 | set {_key} to "%event-namespacedkey%"
195 | if {_key} = "email:send_email":
196 | set {_n} to event-nbt
197 | sendEmail(player, {_n})
198 | else if {_key} = "email:create_email":
199 | createEmail(player)
200 | else if {_key} = "email:create_email_to":
201 | set {_n} to event-nbt
202 | set {_to} to offlineplayer(string tag "to" of {_n})
203 | if all:
204 | {_to} has played before
205 | player != {_to}
206 | then:
207 | writeEmail(player, {_to})
208 | else:
209 | noPlayer(player, {_to})
210 | else if {_key} = "email:reply":
211 | set {_n} to event-nbt
212 | set {_to} to offlineplayer(uuid tag "to" of {_n})
213 | writeEmail(player, {_to})
214 | else if {_key} = "email:open_email":
215 | set {_id} to string tag "id" of event-nbt
216 | openEmail(player, {_id})
217 | else if {_key} = "email:open_emails":
218 | openEmailMenu(player)
219 | else if {_key} = "email:delete":
220 | set {_id} to string tag "id" of event-nbt
221 | delete {emails::%uuid of player%::%{_id}%}
222 | openEmailMenu(player)
223 | else if {_key} = "email:mark_unread":
224 | set {_id} to string tag "id" of event-nbt
225 | delete tag "read" of {emails::%uuid of player%::%{_id}%}
226 | openEmailMenu(player)
227 | else if {_key} = "email:delete_all":
228 | delete {emails::%uuid of player%::*}
229 | openEmailMenu(player)
230 |
--------------------------------------------------------------------------------
/snippets/chunkgenerator/vanilla-simple-decor.sk:
--------------------------------------------------------------------------------
1 | # Vanilla World with Simple Decor
2 | # By ShaneBee
3 |
4 | # This snippet shows off a world generator that may look somewhat close to vanilla Minecraft
5 | # but with simple decor
6 |
7 | # Requirements: SkBee, SkNoise, Skript-Reflect
8 |
9 | on load:
10 | # Wait a tick to make sure generator is properly loaded
11 | # without this the spawn area doesn't generate properly (it's flat)
12 | wait 1 tick
13 | if world("world_vanilla_like") is not loaded:
14 | send "&bLoading world_vanilla_like"
15 | set {_w} to world creator named "world_vanilla_like"
16 | set chunk generator of {_w} to chunk generator with id "test"
17 | load world from creator {_w}
18 | send "&aLoaded world_vanilla_like"
19 | suppress variable save warning
20 | # Obviously use whatever structure you want
21 | # You can find this one in the structures directory
22 | set {-structure::stone_blob} to structure with id "minecraft:stone_blob"
23 |
24 | #! CREATE NOISE GENERATORS !#
25 | on load:
26 | suppress variable save warning
27 | set {-gen1} to new perlin generator with seed 234
28 | set octaves of {-gen1} to 4
29 | set frequency of {-gen1} to 2
30 | set lacunarity of {-gen1} to 3
31 | set {-gen2} to new perlin generator with seed 234
32 |
33 | set {-gen3} to new perlin generator with seed 999
34 | set {-gen4} to new simplex generator with seed 888
35 | set octaves of {-gen4} to 10
36 | set frequency of {-gen4} to 10
37 | set lacunarity of {-gen4} to 2
38 |
39 | #! NOISE EXPRESSIONS !#
40 | expression block noise at %number%, %number%:
41 | get:
42 | set {_x} to expr-1
43 | set {_z} to expr-2
44 | # Continental Layer
45 | set {_value} to value of {-gen1} at ({_x} / 1000), 0, ({_z} / 1000)
46 | set {_cont} to ({_value} + 0.1) * 5
47 |
48 | # Mountain Layer
49 | set {_value} to value of {-gen2} at ({_x} / 5), 0, ({_z} / 5)
50 | set {_mount} to ({_value} + 1) * 15
51 |
52 | return 64 + floor({_cont} * {_mount})
53 |
54 | expression biome noise at %vector%:
55 | get:
56 | set {_v} to expr-1
57 | set {_x} to x of {_v}
58 | set {_y} to y of {_v}
59 | set {_z} to z of {_v}
60 | return value of {-gen3} at ({_x} / 30), {_y}, ({_z} / 30)
61 |
62 | expression temperature noise at %vector%:
63 | get:
64 | set {_v} to expr-1
65 | set {_x} to x of {_v}
66 | set {_y} to y of {_v}
67 | set {_z} to z of {_v}
68 | set {_temp} to (value of {-gen4} at ({_x} / 8000), {_y}, ({_z} / 8000)) + 1
69 | return {_temp}
70 |
71 | expression calculated biome at %vector%:
72 | return type: biome
73 | get:
74 | set {_v} to expr-1
75 | set {_x} to x of {_v}
76 | set {_y} to y of {_v} #currently not using
77 | set {_z} to z of {_v}
78 | set {_temp} to temperature noise at vector({_x}, 1, {_z})
79 | set {_block} to block noise at {_x}, {_z}
80 | set {_biomeNoise} to biome noise at vector({_x}, 1, {_z})
81 |
82 | # CAVES
83 | if {_y} < {_block} - 4:
84 | if all:
85 | {_y} < -10
86 | {_temp} > 1
87 | then:
88 | set {_biome} to deep dark
89 | else if {_temp} > 1.2:
90 | set {_biome} to lush caves
91 | # BEACHES
92 | else if {_block} = 63 or 64:
93 | if {_temp} > 1.4:
94 | set {_biome} to river
95 | else if {_temp} > 0.8:
96 | set {_biome} to beach
97 | else:
98 | set {_biome} to snowy beach
99 |
100 | # OCEAN
101 | else if {_block} < 63:
102 | if {_temp} > 1.2:
103 | set {_biome} to warm ocean
104 | else if {_temp} > 1.05:
105 | set {_biome} to lukewarm ocean
106 | else if {_temp} > 0.8:
107 | set {_biome} to ocean
108 | else:
109 | set {_biome} to frozen ocean
110 | else:
111 | if {_temp} > 1.2:
112 | if {_biomeNoise} > 0.6:
113 | set {_biome} to badlands
114 | else if {_biomeNoise} > -0.5:
115 | set {_biome} to desert
116 | else:
117 | set {_biome} to savanna
118 | else if {_temp} > 1.05:
119 | if {_biomeNoise} > 0.6:
120 | set {_biome} to jungle
121 | else if {_biomeNoise} > 0.3:
122 | set {_biome} to bamboo jungle
123 | else if {_biomeNoise} > -0.2:
124 | set {_biome} to sparse jungle
125 | else if {_biomeNoise} > -0.6:
126 | set {_biome} to swamp
127 | else:
128 | set {_biome} to mangrove swamp
129 | else if {_temp} > 0.8:
130 | if {_biomeNoise} > 0.5:
131 | set {_biome} to flower forest
132 | else if {_biomeNoise} > 0.25:
133 | set {_biome} to windswept forest
134 | else if {_biomeNoise} > 0.15:
135 | set {_biome} to cherry grove
136 | else if {_biomeNoise} > -0.15:
137 | set {_biome} to old growth spruce taiga
138 | else if {_biomeNoise} > -0.25:
139 | set {_biome} to taiga
140 | else if {_biomeNoise} > -0.35:
141 | set {_biome} to old growth birch forest
142 | else if {_biomeNoise} > -0.45:
143 | set {_biome} to sunflower plains
144 | else:
145 | set {_biome} to plains
146 | else:
147 | if {_biomeNoise} > 0:
148 | set {_biome} to snowy taiga
149 | else:
150 | set {_biome} to snowy slopes
151 |
152 | return {_biome} ? plains
153 |
154 | #! REGISTER GENERATOR !#
155 | register chunk generator with id "test":
156 | vanilla decor: false
157 | vanilla caves: true
158 | vanilla structures: false
159 | vanilla mobs: false
160 | height gen:
161 | set {_x} to x coord of event-location
162 | set {_z} to z coord of event-location
163 | set {_n} to block noise at {_x}, {_z}
164 | set chunkdata height to {_n} + 1
165 | chunk gen:
166 | loop 16 times:
167 | loop 16 times:
168 | set {_x} to (loop-number-1) - 1
169 | set {_z} to (loop-number-2) - 1
170 | set {_n} to block noise at ({_x} + (16 * chunkdata chunk x)), ({_z} + (16 * chunkdata chunk z))
171 |
172 | set {_top} to {_n} if {_n} > 64 else 64
173 |
174 | # Fill stone
175 | set chunkdata blocks between vector({_x},-64,{_z}) and vector(({_x}),({_n}),({_z})) to stone[]
176 |
177 |
178 | # Place surface
179 | loop integers between {_n} and {_top}:
180 | set {_y} to loop-number-3
181 | set {_biome} to calculated biome at vector({_x} + (16 * chunkdata chunk x), {_y}, {_z} + (16 * chunkdata chunk z))
182 |
183 | # Surface
184 | if {_y} = {_n}:
185 | if {_y} > 64:
186 | if {_biome} = desert, badlands or beach:
187 | set {_data} to sand[]
188 | else if all:
189 | {_biome} = mangrove swamp
190 | chance of 45%
191 | then:
192 | set {_data} to mud[]
193 | else:
194 | set {_data} to grass_block[]
195 | else:
196 | set {_data} to sand[]
197 |
198 | # Water
199 | else if all:
200 | {_y} > {_n}
201 | {_y} < 64
202 | then:
203 | set {_data} to water[]
204 |
205 | if {_data} is set:
206 | set chunkdata block at vector({_x}, {_y}, {_z}) to {_data}
207 | if {_data} is grass_block[] or mud[]:
208 | set {_below} to dirt[]
209 | else if {_data} is sand[]:
210 | set {_below} to sandstone[]
211 | if {_below} is set:
212 | loop 3 times:
213 | set {_yy} to loop-number-4
214 | set chunkdata block at vector({_x}, {_y} - {_yy}, {_z}) to {_below}
215 | delete {_data}
216 | delete {_below}
217 | biome gen:
218 | set {_l} to event-location
219 | set {_x} to x coord of {_l}
220 | set {_y} to y coord of {_l}
221 | set {_z} to z coord of {_l}
222 |
223 | set {_biome} to calculated biome at vector({_x}, {_y}, {_z})
224 | set chunkdata biome to {_biome} ? plains
225 |
226 | block pop:
227 | # We start off by getting the x/z of a random block in the chunk
228 | set {_x} to (random integer between 0 and 15)
229 | set {_z} to (random integer between 0 and 15)
230 |
231 | # We will grab the highest Y so we can determine where to place our structure
232 | set {_y} to chunkdata highest y at vector({_x}, 0, {_z}) + 1
233 |
234 | # We can now use this data to get the biome of the block where we want to place a structure
235 | set {_biome} to chunk data biome at vector({_x}, {_y}, {_z})
236 |
237 | # We can now place a structure at this location
238 | # We can change the structure based on which biome we have here
239 | if {_biome} = desert:
240 | if chance of 25%:
241 | # Example of populating a structure in a desert biome
242 | place chunkdata structure {-structure::stone_blob} at vector({_x}, {_y}, {_z})
243 | else:
244 | loop 3 times:
245 | set chunkdata block at vector({_x}, {_y}, {_z}) to cactus
246 | add 1 to {_y}
247 | else if "%{_biome}%" does not contain "ocean":
248 | # Example of populating in all biomes that are not desert
249 | populate cherry tree at vector({_x}, {_y}, {_z})
250 |
--------------------------------------------------------------------------------
/snippets/player/Server-Stats.sk:
--------------------------------------------------------------------------------
1 | # Bee Stats
2 | # By: ShaneBee
3 |
4 | # This little stat system can show you some useful info about your server
5 | # This can be used to help debug/find performance issues
6 |
7 | #! PERMISSIONS !#
8 | # I recommend not giving perms to too many players
9 | # While I have tried my best to boost performance of this,
10 | # it may still cause issues, use sparingly
11 | #
12 | # "beestats.sidebar" = Player will see the sidebar
13 | # "beestats.rambar" = Player will see the ram bar
14 | # "beestats.biomebar" = Player will see the biome bar
15 |
16 | # Requirements:
17 | # - Skript 2.7+
18 | # - SkBee 3.4.0+
19 | # - Skript-Reflect 2.4+
20 | # - NMS-API [Optional, used for custom biomes] (found at https://github.com/ShaneBeee/NMS-API)
21 |
22 | #! MANAGE CHUNK COUNTS !#
23 | function updateChunks(w: world):
24 | wait 1 tick
25 | set {-chunks::%{_w}%} to size of loaded chunks of {_w}
26 |
27 | on chunk load:
28 | updateChunks(world of event-chunk)
29 |
30 | on chunk unload:
31 | updateChunks(world of event-chunk)
32 |
33 | on load:
34 | set {-grad} to -1
35 | set {-srv} to server.getServer()
36 | loop all worlds:
37 | updateChunks(loop-world)
38 |
39 | on load:
40 | parse if server platform = "Paper":
41 | locally suppress variable save warning
42 | async run 0 ticks later repeating every tick:
43 | set {-at} to {-srv}.getAverageTickTime()
44 | if {-at} > 15:
45 | set {-lagging} to true
46 | else if {-at} < 8:
47 | set {-lagging} to false
48 |
49 | set {_p} to {-at}
50 | if {_p} > 40:
51 | set {_p} to 40
52 | set {_p} to {_p} / 40
53 |
54 | set {-statsboard::avgtick} to mini message from "%{-at}%"
55 |
56 | add 0.025 to {-grad}
57 | if {-grad} > 1:
58 | set {-grad} to -1
59 | set {_grad} to {-grad}
60 | # Silly off thread thing
61 | if {_grad} > 1:
62 | set {_grad} to -1
63 | set {-statsboard::title} to mini message from "---[SERVER STATS]---"
64 |
65 | every second:
66 | parse if server platform = "Paper":
67 | set {_t::*} to tps
68 | loop {_t::*}:
69 | if loop-value > 18:
70 | set {_tps::%loop-index%} to "&a%loop-value%"
71 | else if loop-value > 15:
72 | set {_tps::%loop-index%} to "&e%loop-value%"
73 | else:
74 | set {_tps::%loop-index%} to "&c%loop-value%"
75 | set {-statsboard::tps} to join {_tps::*} using "&7, "
76 |
77 | every 5 tick:
78 | set {_e::*} to all entities
79 | async run 0 ticks later:
80 | set {-statsboard::entities::all} to size of {_e::*}
81 | set {-statsboard::entities::tick} to size of {_e::*} where [input is ticking]
82 | set {-statsboard::mobs::all} to size of {_e::*} where [input is a mob]
83 | set {-statsboard::mobs::tick} to size of (({_e::*} where [input is a mob]) where [input is ticking])
84 | set {-statsboard::enemies::all} to size of {_e::*} where [input is an enemy]
85 | set {-statsboard::enemies::tick} to size of (({_e::*} where [input is an enemy]) where [input is ticking])
86 | set {-statsboard::displays::all} to size of {_e::*} where [input is a display]
87 | set {-statsboard::displays::tick} to size of (({_e::*} where [input is a display]) where [input is ticking])
88 | set {-statsboard::villagers::all} to size of {_e::*} where [input is a villager]
89 | set {-statsboard::villagers::tick} to size of (({_e::*} where [input is a villager]) where [input is ticking])
90 | set {-statsboard::falling::all} to size of {_e::*} where ["%input%" contains "falling"]
91 | set {-statsboard::falling::tick} to size of (({_e::*} where ["%input%" contains "falling"]) where [input is ticking])
92 | set {-statsboard::drops::all} to size of {_e::*} where [input is a dropped item]
93 | set {-statsboard::drops::tick} to size of (({_e::*} where [input is a dropped item]) where [input is ticking])
94 |
95 | function updateBoard():
96 | parse if server platform = "Paper":
97 | set {_n} to (unix timestamp of now * 1000)
98 | async run 0 ticks later repeating every 1 ticks:
99 | # Slow it down during sprinting
100 | if (unix timestamp of now * 1000) - {_n} > 45:
101 | set {_n} to (unix timestamp of now * 1000)
102 | if {-boards} is not set:
103 | stop current task
104 | stop
105 | loop all players:
106 | if loop-player doesn't have permission "beestats.sidebar":
107 | continue
108 | set {_p} to loop-player
109 | set title of {_p}'s scoreboard to {-statsboard::title}
110 | set line 15 of {_p}'s scoreboard to "<##11C3D8>Loaded Chunks:"
111 | set line 14 of {_p}'s scoreboard to "&7- &bWorld: <##78D811>%{-chunks::%world ""world""%}%"
112 | set line 13 of {_p}'s scoreboard to "&7- &bNether: <##D85C11>%{-chunks::%world ""world_nether""%}%"
113 | set line 12 of {_p}'s scoreboard to "<##11C3D8>Average Tick:"
114 | set line 11 of {_p}'s scoreboard to "&7- %{-statsboard::avgtick}%&7ms"
115 | set line 10 of {_p}'s scoreboard to "<##11C3D8>TPS:"
116 | set line 9 of {_p}'s scoreboard to "&7- <##11D875>%{-statsboard::tps}%"
117 | set line 8 of {_p}'s scoreboard to "<##11C3D8>Entities: &7(<##11D875>ticking&7/<##11D875>total&7)"
118 | set line 7 of {_p}'s scoreboard to "&7- &bAll: <##11D875>%{-statsboard::entities::tick}%&7/<##11D875>%{-statsboard::entities::all}%"
119 | set line 6 of {_p}'s scoreboard to "&7- &bMobs: <##11D875>%{-statsboard::mobs::tick}%&7/<##11D875>%{-statsboard::mobs::all}%"
120 | set line 5 of {_p}'s scoreboard to "&7- &bEnemies: <##11D875>%{-statsboard::enemies::tick}%&7/<##11D875>%{-statsboard::enemies::all}%"
121 | set line 4 of {_p}'s scoreboard to "&7- &bDisplay: <##11D875>%{-statsboard::displays::tick}%&7/<##11D875>%{-statsboard::displays::all}%"
122 | set line 3 of {_p}'s scoreboard to "&7- &bVillagers: <##11D875>%{-statsboard::villagers::tick}%&7/<##11D875>%{-statsboard::villagers::all}%"
123 | set line 2 of {_p}'s scoreboard to "&7- &bFalling: <##11D875>%{-statsboard::falling::tick}%&7/<##11D875>%{-statsboard::falling::all}%"
124 | set line 1 of {_p}'s scoreboard to "&7- &bDropped: <##11D875>%{-statsboard::drops::tick}%&7/<##11D875>%{-statsboard::drops::all}%"
125 | else:
126 | set title of scoreboard of {_p} to "&7[&cUnavailable&7]"
127 | set line 1 of scoreboard of {_p} to "&7Stats board requires Paper"
128 |
129 | on unload:
130 | delete {-boards}
131 | clear scoreboard of all players
132 | stop all tasks
133 |
134 | on load:
135 | set {-biomebar} to true
136 | wait 5 ticks
137 | set {-boards} to true
138 | updateBoard()
139 |
140 | command /stats []:
141 | trigger:
142 | if arg-1 = "sidebar":
143 | if {-boards} is not set:
144 | set {-boards} to true
145 | updateBoard()
146 | else:
147 | delete {-boards}
148 | wait 1 tick
149 | clear scoreboard of all players
150 | else if arg-1 = "rambar":
151 | ramBar()
152 | else if arg-1 = "biomebar":
153 | if {-biomebar} is not set:
154 | set {-biomebar} to true
155 | else:
156 | delete {-biomebar}
157 | send action bar "" to player
158 | else:
159 | send "&7[&bStats&7] &cInvalid option &r'&7/stats &r'"
160 |
161 | on tab complete of "/stats":
162 | set tab completions for position 1 to "sidebar", "rambar" and "biomebar"
163 |
164 | #! SHOW BIOME BAR !#
165 | # NMS-API adds the ability to see custom biomes (from datapacks)
166 | # Without said API, you will only see vanilla biomes
167 |
168 | on load:
169 | parse if class "com.shanebeestudios.nms.api.world.WorldApi" exists:
170 | set {-worldapi} to class "com.shanebeestudios.nms.api.world.WorldApi"
171 |
172 | every 5 tick:
173 | if {-biomebar} is set:
174 | loop all players:
175 | if loop-player does not have permission "beestats.biomebar":
176 | continue
177 | if loop-player's tool is a debug stick:
178 | continue
179 | if {-worldapi} is set:
180 | set {_b} to try {-worldapi}.getBiome(location of loop-player)
181 | if the last java error is set:
182 | # This means the API failed, so lets get rid of it
183 | delete {-worldapi}
184 | else:
185 | set {_b} to namespaced key of biome at loop-player
186 | set {_b} to "%{_b}%"
187 | replace "minecraft:" with "&bminecraft&r:&e" in {_b}
188 | replace "wythers:" with "&awythers&r:&e" in {_b}
189 | replace "skbee:" with "<##FFA533>skbee&r:&e" in {_b}
190 | replace "terralith:" with "<##D01ED8>terralith&r:&e" in {_b}
191 | send action bar "&7Biome: %{_b}%" to loop-player
192 |
193 | #! RAM BAR !#
194 | import:
195 | java.lang.Runtime
196 |
197 | on load:
198 | wait 2 ticks
199 | if {-bar} is not set:
200 | ramBar()
201 |
202 | on unload:
203 | delete bossbar with id "ram"
204 | delete {-bar}
205 |
206 | on join:
207 | if player has permission "beestats.rambar":
208 | add player to {-bar}
209 |
210 | function ramBar():
211 | if {-bar} is not set:
212 | set {_run} to Runtime.getRuntime()
213 | set {_max} to {_run}.maxMemory() / 1024 / 1024
214 | set {-bar} to boss bar with id "ram" with title "FILL IN" with color blue with style solid_bar
215 | add (all players where [input has permission "beestats.rambar"]) to {-bar}
216 | async run 0 ticks later repeating every 10 ticks:
217 | if {-bar} is not set:
218 | stop current task
219 | set {_free} to {_run}.freeMemory() / 1024 / 1024
220 | set {_used} to floor({_max} - {_free})
221 | set bar title of {-bar} to "&7Ram: &b%{_used}%&7mb / &b%{_max}%&7mb"
222 | set {_pro} to ({_used} / {_max}) * 100
223 | set bar progress of {-bar} to {_pro} ? 0
224 | if {_pro} > 90:
225 | set bar color of {-bar} to red
226 | else if {_pro} > 75:
227 | set bar color of {-bar} to yellow
228 | else:
229 | set bar color of {-bar} to green
230 | else:
231 | delete boss bar with id "ram"
232 | delete {-bar}
233 |
--------------------------------------------------------------------------------