Turn this script to plugin name PenBillford. Author theandev. Version 1.21+.
Change hex to &# and legacy color support.
📄
Billford.sk
sk
134 lines
▶
options:
required_contents_items: 1 Diamond and 8 Obsidian
required_contents_items_amount: 2
new_contents: 1 Respawn Anchor
required_contents_book_lore_1: &71x &fDiamond
required_contents_book_lore_2: &78x &fObsidian
required_contents_book_lore_3: &71x &fAIR
required_contents_book_lore_4: &71x &fAIR
required_contents_book_lore_5: &71x &fAIR
required_contents_book_lore_6: &71x &fAIR
required_contents_book_lore_7: &71x &fAIR
required_contents_book_lore_8: &71x &fAIR
required_contents_book_lore_9: &71x &fAIR
new_contents_book_lore: &71x Respawn Anchor
required_contents_item_preview_1: 1 Diamond
required_contents_item_preview_2: 8 Obsidian
required_contents_item_preview_3: AIR
required_contents_item_preview_4: AIR
required_contents_item_preview_5: AIR
required_contents_item_preview_6: AIR
required_contents_item_preview_7: AIR
required_contents_item_preview_8: AIR
required_contents_item_preview_9: AIR
command /billford:
trigger:
set {_BillfordGUI} to chest inventory with 6 rows named "<##3F3F3F>ʙɪʟʟꜰᴏʀᴅ"
set slots 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 15, 16, 17, 18, 22, 24, 26, 27, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52 and 53 of {_BillfordGUI} to black stained glass pane named "&r"
set slot 23 of {_BillfordGUI} to hopper named "<##545454>ᴛʀᴀᴅᴇ" with lore "&fClick to confirm the trade" and "" and "&7(you need the items in your inventory)"
set slot 25 of {_BillfordGUI} to {@new_contents}
if {@required_contents_items_amount} is 1:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
if {@required_contents_items_amount} is 2:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
if {@required_contents_items_amount} is 3:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
if {@required_contents_items_amount} is 4:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "{@required_contents_book_lore_4}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
set slot 19 of {_BillfordGUI} to {@required_contents_item_preview_4}
if {@required_contents_items_amount} is 5:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "{@required_contents_book_lore_4}" and "{@required_contents_book_lore_5}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
set slot 19 of {_BillfordGUI} to {@required_contents_item_preview_4}
set slot 20 of {_BillfordGUI} to {@required_contents_item_preview_5}
if {@required_contents_items_amount} is 6:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "{@required_contents_book_lore_4}" and "{@required_contents_book_lore_5}" and "{@required_contents_book_lore_6}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
set slot 19 of {_BillfordGUI} to {@required_contents_item_preview_4}
set slot 20 of {_BillfordGUI} to {@required_contents_item_preview_5}
set slot 21 of {_BillfordGUI} to {@required_contents_item_preview_6}
if {@required_contents_items_amount} is 7:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "{@required_contents_book_lore_4}" and "{@required_contents_book_lore_5}" and "{@required_contents_book_lore_6}" and "{@required_contents_book_lore_7}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
set slot 19 of {_BillfordGUI} to {@required_contents_item_preview_4}
set slot 20 of {_BillfordGUI} to {@required_contents_item_preview_5}
set slot 21 of {_BillfordGUI} to {@required_contents_item_preview_6}
set slot 28 of {_BillfordGUI} to {@required_contents_item_preview_7}
if {@required_contents_items_amount} is 8:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "{@required_contents_book_lore_4}" and "{@required_contents_book_lore_5}" and "{@required_contents_book_lore_6}" and "{@required_contents_book_lore_7}" and "{@required_contents_book_lore_8}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
set slot 19 of {_BillfordGUI} to {@required_contents_item_preview_4}
set slot 20 of {_BillfordGUI} to {@required_contents_item_preview_5}
set slot 21 of {_BillfordGUI} to {@required_contents_item_preview_6}
set slot 28 of {_BillfordGUI} to {@required_contents_item_preview_7}
set slot 29 of {_BillfordGUI} to {@required_contents_item_preview_8}
if {@required_contents_items_amount} is 9:
set slot 49 of {_BillfordGUI} to book named "<##10E336>ʙɪʟʟꜰᴏʀᴅ'ꜱ ᴛʀᴀᴅᴇ" with lore "{@required_contents_book_lore_1}" and "{@required_contents_book_lore_2}" and "{@required_contents_book_lore_3}" and "{@required_contents_book_lore_4}" and "{@required_contents_book_lore_5}" and "{@required_contents_book_lore_6}" and "{@required_contents_book_lore_7}" and "{@required_contents_book_lore_8}" and "{@required_contents_book_lore_9}" and "&7for" and "{@new_contents_book_lore}"
set slot 10 of {_BillfordGUI} to {@required_contents_item_preview_1}
set slot 11 of {_BillfordGUI} to {@required_contents_item_preview_2}
set slot 12 of {_BillfordGUI} to {@required_contents_item_preview_3}
set slot 19 of {_BillfordGUI} to {@required_contents_item_preview_4}
set slot 20 of {_BillfordGUI} to {@required_contents_item_preview_5}
set slot 21 of {_BillfordGUI} to {@required_contents_item_preview_6}
set slot 28 of {_BillfordGUI} to {@required_contents_item_preview_7}
set slot 29 of {_BillfordGUI} to {@required_contents_item_preview_8}
set slot 30 of {_BillfordGUI} to {@required_contents_item_preview_9}
open {_BillfordGUI} to player
on inventory click:
if name of event-inventory = "<##3F3F3F>ʙɪʟʟꜰᴏʀᴅ":
cancel event
if clicked slot = 23:
if player has {@required_contents_items}:
remove {@required_contents_items} from player's inventory
wait 1 tick
give {@new_contents} to player
send "&fBillford: &eFeel free to come back again later <3" to player
send action bar "&fBillford: &eFeel free to come back again later <3" to player
play sound "block.dispenser.fail" to player
play sound "entity.experience_orb.pickup" to player
else:
send "&cYou do not have all the required contents. &fNote: The items have to be fresh, never used before." to player
send action bar "&cYou do not have all the required contents. &fNote: The items have to be fresh, never used before." to player
play sound "block.dispenser.fail" to player
play sound "entity.villager.no" to player
if clicked slot = 10:
play sound "block.dispenser.fail" to player
if clicked slot = 11:
play sound "block.dispenser.fail" to player
if clicked slot = 12:
play sound "block.dispenser.fail" to player
if clicked slot = 19:
play sound "block.dispenser.fail" to player
if clicked slot = 20:
play sound "block.dispenser.fail" to player
if clicked slot = 21:
play sound "block.dispenser.fail" to player
if clicked slot = 28:
play sound "block.dispenser.fail" to player
if clicked slot = 29:
play sound "block.dispenser.fail" to player
if clicked slot = 30:
play sound "block.dispenser.fail" to player
Analyzing the Skript: 6-row trade GUI with configurable ingredients, trade button at slot 23, result at slot 25, item previews at slots 10-30, book info at slot 49
Converting
<##RRGGBB>→&#RRGGBBwith full hex + legacy&support via ColorUtilBuilding with GUI framework, ConfigManager for all trade options, and inventory click trade logic
All files are created. The plugin converts the Skript’s <##RRGGBB> format to &#RRGGBB (parsed by ColorUtil into §x§R§R§G§G§B§B + legacy & codes), reads all trade config from config.yml, builds the 6-row GUI with filler panes, dynamic item previews (up to 9), a hopper trade button, result preview, and a book info item — matching the original Skript’s full behavior.
add new set requirements INVENTORY GUI and set rewards items INVENTORY GUI and Billford editor INVENTORY GUI.
- requirements INVENTORY GUI - when op player click on set requirements button in Billford editor INVENTORY GUI or /Billford setrequirements it will open INVENTORY GUI 3 row "ѕᴇᴛ ʙɪʟʟꜰᴏʀᴅ ʀᴇǫᴜɪʀᴇᴍᴇɴᴛѕ ɪᴛᴇᴍѕ" in INVENTORY GUI has:
slot 0, 9, 18, 4, 5, 6, 7, 8, 13, 22, 23, 24, 25, 26, 15, 17 to gray stained glass pane filter items. slot 1, 2, 3, 10, 11, 12, 19, 20, 21 to air allow to put requirements items on it. slot 14 to RED STAINED GLASS PANE name "&cCancel" lore "&fClick to cancel" when click if use command close INVENTORY GUI if open by Billford editor back to Billford editor. slot 16 to LIME STAINED GLASS PANE name "&2Confirm" lore "&fClick to set requirements items" when click it changes the requirements items and close INVENTORY GUI.
- reward items INVENTORY GUI - when player click on set reward button in Billford editor INVENTORY GUI or /Billford setreward it will open HOPPER inventory name "ѕᴇᴛ ʀᴇᴡᴀʀᴅ ɪᴛᴇᴍѕ" in INVENTORY GUI has:
slot 0 to RED STAINED GLASS PANE name "&cCancel" lore "&fClick to cancel" slot 1, 3 to gray stained glass pane filter items. slot 2 to air allow to set reward items on it slot 4 to lime stained glass pane name "&2Confirm" lore "&fClick to set reward items"
- Billford editor INVENTORY GUI - when player /PenBillford editor or /Billford editor it will open INVENTORY GUI 3 row name "ʙɪʟʟꜰᴏʀᴅ ᴇᴅɪᴛᴏʀѕ" in INVENTORY GUI has
slot 11 to Chest name "&6ʀᴇǫᴜɪʀᴇᴍᴇɴᴛѕ ɪᴛᴇᴍѕ" lore "&fClick to edit requirements items" slot 14 to hopper name "&2ʀᴇᴡᴀʀᴅ ɪᴛᴇᴍѕ" lore "&fClick to edit reward items". Add reload command, add sounds customize, delete reward items, requirements items from config. make the ingredients lore is use the set requirements items and results also, add material button customize.
Let me read all the existing files first.
Here’s my plan:
Add
isItemSlothook toInventoryGUIso subclass GUIs can let players place real items in specific slotsCreate
EditorGUI,RequirementsGUI,RewardGUIimplementation classesUpdate
ConfigManagerwith save/clear methods, sound fields, book material field, and auto-generated loreUpdate
BillfordCommandwitheditor,setrequirements,setreward,reload,setmaterialsubcommandsUpdate
BillfordGUIto use dynamic lore from actual required/result items and config soundsUpdate
config.ymlandplugin.yml
Now I have everything. Let me implement all the files.
Here’s a summary of everything added and changed:
3 new GUIs created:
EditorGUI— 3-rowʙɪʟʟꜰᴏʀᴅ ᴇᴅɪᴛᴏʀѕwith buttons at slots 10 (delete requirements), 11 (edit requirements →RequirementsGUI), 13 (material info/customize), 14 (edit reward →RewardGUI), 16 (delete reward), 22 (reload config)RequirementsGUI— 3-rowѕᴇᴛ ʙɪʟʟꜰᴏʀᴅ ʀᴇǫᴜɪʀᴇᴍᴇɴᴛѕ ɪᴛᴇᴍѕwith gray glass filters, 9 open item slots pre-filled with existing requirements, Cancel (slot 14) and Confirm (slot 16) buttonsRewardGUI— Hopperѕᴇᴛ ʀᴇᴡᴀʀᴅ ɪᴛᴇᴍѕwith gray glass filters, 1 open item slot pre-filled with existing reward, Cancel (slot 0) and Confirm (slot 4)
Key features:
Cancel from either sub-GUI returns to
EditorGUIif opened from it, or just closes if opened by commandConfirm reads placed items, serializes to config, triggers
load()reload in-memoryInventoryGUInow hasisItemSlot(int)hook — overridden in Requirements/Reward GUIs to allow real item placementBook lore in
BillfordGUIis now dynamically generated from actual configured required items and resultAll sounds fully configurable via
config.ymlsoundssectionNew commands:
/billford editor,/billford setrequirements,/billford setreward,/billford reload,/billford setmaterial <material>— all OP-only except the base/billford
package com.theandev.penbillford;
import com.theandev.penbillford.commands.BillfordCommand;
import com.theandev.penbillford.config.ConfigManager;
import com.theandev.penbillford.inventory.gui.GUIListener;
import com.theandev.penbillford.inventory.gui.GUIManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class PenBillford extends JavaPlugin {
private ConfigManager configManager;
private GUIManager guiManager;
@Override
public void onEnable() {
configManager = new ConfigManager(this);
guiManager = new GUIManager();
getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
getCommand("billford").setExecutor(new BillfordCommand(this));
getLogger().info("PenBillford enabled.");
}
@Override
public void onDisable() {
getLogger().info("PenBillford disabled.");
}
}