Other available versions. Ordered by newest to oldest versions:
Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.
#Please contact eult on discord if you need help
options:
#verison
version: 0.2
# PERMISSIONS
# whether or not the permission should be required to use
permission-required: false
# what permission is required to open any shulker box
permission: BMS.use
# message to send when a user doesn't have the required permission node to unlock shulker boxes
permission-message: &cYou do not have permission to this. &7&o(Missing node 'BMS.use')
# how the message should be displayed to the player
permission-message-format: actionbar # accepted entries are 'actionbar', 'title', 'message' (using any other will effectively disable this)
# MISCELLANEOUS
# breaking the spawner without silk touch destroy the spawner
break-with-silk-touch: false
# maximum upgrade for the spawners
max-upgrade: 5
# items will go into the hopper if there is one under the spawner
spawner-hoppers: true
# hoppersabove filled with coal will automatically fuel spawners
fill-with-hoppers: true
# this determines what size chest is appropriate for storing chest
# keep in mind max is 6
size-of-spawner-chest: 1
# fuel doubles the amount of items you get from the spawner
# this is the maximum amount of fuel you can put in a spawner
max-fuel: 512
#----------------------------------------------------------------
#--------------------------
# Events (Interacting)
#--------------------------
import:
org.bukkit.loot.LootTable
org.bukkit.loot.LootContext
java.util.Random
#When a spawner spawns mobs
# Calculate loot, experience, and item drops
# Handle upgrades and fuel if applicable
On spawner Spawn:
cancel event
# Creates a loottable to get the item drops from the spawners
set {_lootContext} to new LootContext.Builder((event-entity).getLocation())
set {_lootContext} to {_lootContext}.killer(player)
set {_lootContext} to {_lootContext}.lootedEntity(event-entity)
set {_lootContext} to {_lootContext}.build()
set {_items} to (event-entity).getLootTable().populateLoot(new Random(), {_lootContext})
set {_block} to event-block
set {_xp} to random integer between 1 and 5
add {_xp} to int tag "custom;experience" of nbt of {_block}
set {_upgrade} to int tag "custom;upgrade" of nbt of {_block}
set {_fuel} to int tag "custom;fuel" of nbt of {_block}
# "...{_items}" is what you get from spawner
if {_upgrade} is set:
if {_upgrade} > 10:
set {_upgrade} to 10
parse if {@spawner-hoppers} is true:
if block under event-block is hopper:
if block under event-block's inventory has space for ...{_items}:
if ...{_items} is set:
give ...{_items} to block under event-block's inventory
if {_fuel} > 0:
block under event-block's inventory has space for ...{_items}
give ...{_items} to block under event-block's inventory
remove 1 from int tag "custom;fuel" of nbt of {_block}
wait tick
set int tag "Delay" of nbt compound of event-block to 450 - ({_upgrade} * 30)
stop
# Simple addition by Zabrid which makes it so hoppers above the
# spawner if they're filled with coal, will fuel the spawner
parse if {@fill-with-hoppers} is true:
if block to the right of {_block} is hopper[facing=east]:
if block to the right of {_block}'s inventory contains coal:
set {_hopper} to block to the right of {_block}
if block to the left of {_block} is hopper[facing=west]:
if block to the left of {_block}'s inventory contains coal:
set {_hopper} to block to the left of {_block}
if block behind {_block} is hopper[facing=south]:
if block behind {_block}'s inventory contains coal:
set {_hopper} to block behind {_block}
if block in front {_block} is hopper[facing=north]:
if block in front {_block}'s inventory contains coal:
set {_hopper} to block in front {_block}
if block above {_block} is hopper:
block above {_block} is hopper
if block above {_block}'s inventory contains coal:
set {_hopper} to block above {_block}
if {_hopper} is set:
if {_fuel} is less than {@max-fuel}:
set {_requiredamount} to {@max-fuel} - {_fuel}
# If the amount of coal in the inventory is not enough to
# fill the spawner completely, just use all of the coal it can
if {_hopper}'s inventory does not contain {_requiredamount} of coal:
set {_requiredamount} to amount of coal in {_hopper}'s inventory
remove {_requiredamount} of coal from {_hopper}'s inventory
add {_requiredamount} to int tag "custom;fuel" of nbt of {_block}
# Creates a fake GUI to check if there is a place for
# the item in the spawner and if there is not, then it won't be added
set {_gui} to a new chest inventory with {@size-of-spawner-chest} row
set {_items::*} to compound list tag "custom;BlockEntityTag;Items" of nbt of {_block}
loop {_items::*}:
set {_slot} to byte tag "slot" of loop-value
set {_item} to compound tag "item" of loop-value
set {_item} to item from nbt {_item}
{_slot} and {_item} are set
set slot {_slot} of {_gui} to {_item}
if {_gui} has space for ...{_items}:
add ...{_items} to {_gui}
if {_fuel} > 0:
{_gui} has space for ...{_items}
add ...{_items} to {_gui}
remove 1 from int tag "custom;fuel" of nbt of {_block}
loop items within {_gui}:
set {_slot} to index of loop-slot
set {_item} to full nbt of loop-item
add nbt from "{slot:%{_slot}%b,item:%{_item}%}" to {_nbt::*}
# Since NBT is much more efficient, items are saved there
set compound list tag "custom;BlockEntityTag;Items" of nbt of {_block} to {_nbt::*}
wait tick
set int tag "Delay" of nbt compound of event-block to 450 - ({_upgrade} * 30)
# When a player breaks a mob spawner
# Check permissions, upgrade levels, and item drops
on break of mob spawner:
if {@permission-required} is true:
if player doesn't have permission "{@permission}":
parse if "{@permission-message-format}" is "actionbar":
send action bar "{@permission-message}" to player
else parse if "{@permission-message-format}" is "title":
reset title of player
send title "&4&lAUTHORIZATION" with subtitle "{@permission-message}" to player for 0.5 seconds with fadein 0 seconds with fadeout a second
else parse if "{@permission-message-format}" is "message":
send "{@permission-message}" to player
cancel event
stop
if {@break-with-silk-touch} is true:
if player's tool is not any pickaxe of silk touch:
stop
set {_nbt} to nbt compound of event-block
set {_i} to int tag "custom;upgrade" of {_nbt}
if {_i} > 1:
remove 1 from int tag "custom;upgrade" of {_nbt}
cancel event
else:
delete int tag "custom;upgrade" of {_nbt}
set {_items::*} to compound list tag "custom;BlockEntityTag;Items" of {_nbt}
set {_gui} to a new chest inventory with {@size-of-spawner-chest} row
loop {_items::*}:
set {_slot} to byte tag "slot" of loop-value
set {_item} to compound tag "item" of loop-value
set {_item} to item from nbt {_item}
{_slot} and {_item} are set
set slot {_slot} of {_gui} to {_item}
loop items within {_gui}:
add loop-value to {_drops::*}
# Drops all the items that was already inside the spawner chest
drop {_drops::*}
set {_id} to string tag "SpawnData;entity;id" of nbt compound of event-block
set {_i} to 1 of spawner
set string tag "BlockEntityTag;SpawnData;entity;id" of nbt compound of {_i} to {_id}
drop {_i}
# Player interactions with spawners
# Upgrade spawners and open main GUI
on rightclick on spawner:
# Just a small quality of life change which makes
# placing hoppers on spawners a lot better
player's tool is not a hopper
if {@permission-required} is true:
if player doesn't have permission "{@permission}":
parse if "{@permission-message-format}" is "actionbar":
send action bar "{@permission-message}" to player
else parse if "{@permission-message-format}" is "title":
reset title of {_player}
send title "&4&lAUTHORIZATION" with subtitle "{@permission-message}" to player for 0.5 seconds with fadein 0 seconds with fadeout a second
else parse if "{@permission-message-format}" is "message":
send "{@permission-message}" to player
cancel event
stop
if player's tool is monster spawner:
set {_nbt} to nbt compound of event-block
set {_idofEventBlock} to string tag "SpawnData;entity;id" of {_nbt}
set {_idofTool} to string tag "BlockEntityTag;SpawnData;entity;id" of nbt compound of player's tool
set {_upgrade} to int tag "custom;upgrade" of {_nbt}
if {_idofEventBlock} != {_idofTool}:
stop
if {@max-upgrade} = {_upgrade}:
stop
if event-block is Monster Spawner:
cancel event
remove 1 of tool from tool
add 1 to int tag "custom;upgrade" of nbt compound of event-block
stop
set metadata value "BS;SpawnerLocation" of player to location of event-block
BSmainGUI(player, location of event-block)
# When a player places a spawner
# Set the spawner type and initial upgrade level
on place of spawner:
if {@permission-required} is true:
if player doesn't have permission "{@permission}":
parse if "{@permission-message-format}" is "actionbar":
send action bar "{@permission-message}" to {_player}
else parse if "{@permission-message-format}" is "title":
reset title of {_player}
send title "&4&lAUTHORIZATION" with subtitle "{@permission-message}" to {_player} for 0.5 seconds with fadein 0 seconds with fadeout a second
else parse if "{@permission-message-format}" is "message":
send "{@permission-message}" to {_player}
cancel event
stop
# Creating spawners in creative does not have this problem,
# but placing them in survival will result in an empty spawner,
# so the block below should fix it
set {_id} to string tag "BlockEntityTag;SpawnData;entity;id" of nbt compound of player's tool
set string tag "SpawnData;entity;id" of nbt compound of event-block to {_id}
set int tag "custom;upgrade" of nbt compound of event-block to 1
# Player interactions with GUIs
# Handle looting, XP collection, and fueling
on inventory click:
if player's current inventory is metadata value "BS;GUI" of player:
cancel event
set {_block} to block at metadata value "BS;SpawnerLocation" of player
if event-slot is slot 10 of player's current inventory:
set {_items::*} to compound list tag "custom;BlockEntityTag;Items" of nbt of {_block}
set {_gui} to a new chest inventory with {@size-of-spawner-chest} row with name "&6Spawner"
loop {_items::*}:
set {_slot} to byte tag "slot" of loop-value
set {_item} to compound tag "item" of loop-value
set {_item} to item from nbt {_item}
{_slot} and {_item} are set
set slot {_slot} of {_gui} to {_item}
set (metadata value "BS;spawnerLoot" of player) to {_gui}
open (metadata value "BS;spawnerLoot" of player) to player
stop
if event-slot is slot 11 of player's current inventory:
set {_xp} to int tag "custom;experience" of nbt of {_block}
add {_xp}/2 to player's experience
set int tag "custom;experience" of nbt of {_block} to 0
if event-slot is slot 15 of player's current inventory:
set {_fuel} to int tag "custom;fuel" of nbt of {_block}
if click action is not right mouse button:
if player has 1 coal:
if {_fuel} <= {@max-fuel} - 1:
add 1 to int tag "custom;fuel" of nbt of {_block}
remove 1 coal from player
else:
set {_coalAmount} to amount of coal in player's inventory
set {_requiredamount} to {@max-fuel} - {_fuel}
if {_requiredamount} >= {_coalAmount}:
remove {_coalAmount} of coal from player
add {_coalAmount} to int tag "custom;fuel" of nbt of {_block}
else:
remove {_requiredamount} of coal from player
add {_requiredamount} to int tag "custom;fuel" of nbt of {_block}
BSmainGUI(player, metadata value "BS;SpawnerLocation" of player)
if player's current inventory is metadata value "BS;spawnerLoot" of player:
cancel event
if the player has space for event-item:
give player event-item
set clicked slot to air
set {_block} to block at metadata value "BS;SpawnerLocation" of player
loop items within player's current inventory:
set {_slot} to index of loop-slot
set {_item} to full nbt of loop-item
add nbt from "{slot:%{_slot}%b,item:%{_item}%}" to {_nbt::*}
set compound list tag "custom;BlockEntityTag;Items" of nbt of {_block} to {_nbt::*}
#--------------------------
# FUNCTIONS
#--------------------------
# Function to set up the main GUI interface
function BSmainGUI(player: player, location: location):
set metadata value "BS;GUI" of {_player} to chest inventory with 3 rows with name "&6Spawner"
set {_block} to block at {_location}
add "&7This is where Loot spawners will be located." to {_lore::*}
add "&7You can get the loot by clicking here." to {_lore::*}
if {@spawner-hoppers} is true:
if block under {_block} is hopper:
add "" to {_lore::*}
add "&eSince there is a hopper under the spawner this will" to {_lore::*}
add "&eensure that the items drop into the hopper." to {_lore::*}
delete {_lore::*}
add "&7You will receive twice as much" to {_lore::*}
add "&7loot from the fuel as each" to {_lore::*}
add "&7fuel costing one coal." to {_lore::*}
add "" to {_lore::*}
add "&e&nFill automatically by right-clicking" to {_lore::*}
if {@fill-with-hoppers} is true:
if any:
block to the left of {_block} is hopper[facing=west]
block in front {_block} is hopper[facing=north]
block to the right of {_block} is hopper[facing=east]
block behind {_block} is hopper[facing=south]
then:
add "" to {_lore::*}
add "&eSince there is a hopper above/right/left/infront/behind" to {_lore::*}
add "ðe spawner it will make any coal from" to {_lore::*}
add "ðat hopper fuel in this spawner" to {_lore::*}
set {_fuel} to int tag "custom;fuel" of nbt of {_block}
set slot 15 of metadata value "BS;GUI" of {_player} to blast furnace named "&aFuel &6%{_fuel}%" with lore {_lore::*} with all flags hidden
set slot 10 of metadata value "BS;GUI" of {_player} to Minecart with chest named "&aLoots" with lore {_lore::*} with all flags hidden
set {_xp} to int tag "custom;experience" of nbt of {_block}
set slot 11 of metadata value "BS;GUI" of {_player} to XP bottle named "&aXP &6%{_xp}/2%" with lore "&7Here is all the experience that spawner drop." , "&7To grab all the XP, click here." with all flags hidden
set {_upgrade} to int tag "custom;upgrade" of nbt of {_block}
set slot 13 of metadata value "BS;GUI" of {_player} to spawner named "&aSpawner Level &6%{_upgrade}%" with lore "&7Upgrade your spawner by right-clicking" , "&7using another spawner of the same type." , "&7To downgrade, break the spawner." with all flags hidden
open (metadata value "BS;GUI" of {_player}) to {_player}