-
Notifications
You must be signed in to change notification settings - Fork 14
Genesis API
Genesis provides a flexible and accessible public API that allows developers to interact with shops, items, conditions, and shop metadata dynamically.
This guide explains how to access and use the Genesis API in your own plugins.
If using Maven, you must shade Genesis manually or link it via plugin.yml using depend: or softdepend:.
# plugin.yml
depend: [Genesis]Genesis does not provide a public Maven repo at this time.
Genesis exposes a singleton API class via:
GenesisAPI api = GenesisAPI.get();From here, you can access shop managers, utilities, and various helper functions.
Shop shop = api.getShop("WeekShop");Returns a Shop object or null if the shop doesn't exist.
ShopItem item = shop.getItem("Monday");You can also get an item by its inventory location (slot index):
ShopItem item = shop.getItem(11);boolean visible = item.canBeDisplayedTo(player);Returns true if the item passes all condition checks for the specified player.
String message = api.getVariables().replaceVariables(player, "&7Hello %player%!");This replaces placeholders in the message string for a given player.
ItemStack stack = item.createMenuItem(player);This returns the actual visual item (including ItemData, placeholders, etc.) shown in the menu for a player.
// Open shop for a player
api.openShop(player, "WeekShop");
// Check if a shop exists
boolean exists = api.hasShop("DailyShop");
// Get all registered shop names
Set<String> allShops = api.getShopHandler().getShops().keySet();public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) return false;
Player player = (Player) sender;
GenesisAPI.get().openShop(player, "WeekShop");
return true;
}- Genesis does not throw errors when shops or items are missing β always check for
null. - You can reload all shops programmatically with:
GenesisAPI.get().getShopHandler().reloadShops();
If you need hooks or events added, or you want to expose something new in the API, contact the plugin author.
Last updated: June 2025