Repository navigation
Integrations
Magnus Jensen edited this page Jan 24, 2026
·
1 revision
This page highlights integrations that can be used with CCM to enhance functionality.
Here is an example proof of concept script, that uses KubeJS to modify the item contents by running a command. It can be further expanded to run on a timer, and pull the item data (modifications) from other sources.
// Visit the wiki for more info - https://kubejs.com/
// This file is an example showcasing how to replace or modify a custom chest menu JSON file via a KubeJS script.
const menuPath = 'saves/New World/serverconfig/customchestmenus/starter_example.json'
function createMenuEntry(resLoc, name, count, slot) {
return {
"name": name,
"slot": slot,
"item": resLoc,
"count": count
}
}
// A map of slot number to item replacement details
// TODO: This can be more advanced taking from a list of items defined elsewhere, and slots can be predefined, this serves as a simple example.
const itemsToReplace = {
10: createMenuEntry('minecraft:diamond_pickaxe','Shiny Diamond Pick', 5, 10 )
}
// We assume only want to change on the first page, if you wanted pages deep you would have to modify this bit.
function replaceMenuItems() {
let menuJson = JsonIO.readJson(menuPath)
const page = menuJson.getAsJsonArray("pages").get(0)
for (let i = 0; i < page.getAsJsonArray("items").size(); i++) {
let itemEntry = page.getAsJsonArray("items").get(i)
// Check if our item slot is in the itemsToReplace map
// This simple PoC only works for replacing items that already is assigned a slot, and not setting new items on unoccupied slots.
// That could definitely work, but this script needs to be tweaked further for that.
if (!itemsToReplace.hasOwnProperty(itemEntry.get("slot"))) {
continue;
}
page.getAsJsonArray("items").set(i, itemsToReplace[itemEntry.get("slot")])
}
menuJson.getAsJsonArray("pages").set(0, page)
JsonIO.write(menuPath, menuJson)
}
PlayerEvents.chat(event => {
// Check if message equals creeper, ignoring case
if (event.message.trim().toLowerCase() == '!cycle_shop') {
replaceMenuItems()
event.server.scheduleInTicks(1, ctx => {
event.server.runCommand("/ccm reload")
})
}
})