Skip to content

Addon Integration

goflishMC edited this page Jul 1, 2025 · 1 revision

🧩 Addon Integration – How to Build Your Own Genesis Addon

Genesis allows developers to extend its functionality via custom addons. You can register new RewardTypes, PriceTypes, Conditions, and even create custom behaviors for shop items.

This page will walk you through how to build and register your own Genesis Addon.


πŸ—οΈ Addon Structure

A Genesis addon is simply a Bukkit plugin that hooks into Genesis using the provided API and registration system.

Make sure your plugin.yml includes:

depend: [Genesis]

You can use softdepend: if your plugin works without Genesis but adds integration when it's present.


βœ… Registering a Custom Component

Genesis exposes static registration methods on the GenesisAPI class.

Registering a Custom RewardType

GenesisAPI.get().registerRewardType("myreward", new RewardExecutor() {
    @Override
    public void giveReward(Player player, ShopItem item, double multiplier) {
        player.sendMessage("You got a custom reward!");
    }

    @Override
    public boolean isRewardPossible(Player player, ShopItem item) {
        return true;
    }
});

This makes RewardType: myreward usable in any shop item.


Registering a Custom PriceType

GenesisAPI.get().registerPriceType("myprice", new PriceExecutor() {
    @Override
    public boolean payPrice(Player player, ShopItem item, double multiplier) {
        return player.hasPermission("custom.price.free");
    }

    @Override
    public boolean canAfford(Player player, ShopItem item) {
        return player.hasPermission("custom.price.free");
    }
});

Registering a Custom Condition

GenesisAPI.get().registerConditionType("customcondition", new ConditionChecker() {
    @Override
    public boolean isMet(Player player, ShopItem item, String... args) {
        return player.getLevel() > 20;
    }
});

Now you can use:

Condition:
- type:customcondition

Arguments from the config will be passed in as args.


πŸ” Addon Initialization Example

public class MyGenesisAddon extends JavaPlugin {
    @Override
    public void onEnable() {
        if (getServer().getPluginManager().getPlugin("Genesis") != null) {
            registerCustomTypes();
        }
    }

    private void registerCustomTypes() {
        GenesisAPI.get().registerRewardType("shout", (player, item, multiplier) -> {
            Bukkit.broadcastMessage(player.getName() + " made a purchase!");
        });

        GenesisAPI.get().registerConditionType("inNether", (player, item, args) -> {
            return player.getWorld().getName().equalsIgnoreCase("nether");
        });
    }
}

🧠 Advanced Tips

  • You can use Genesis placeholders via GenesisAPI.get().getVariables().replaceVariables(player, str)
  • Combine with PlaceholderAPI or LuckPerms for highly dynamic conditions.
  • Use item attributes (item.getMenuItemBuilder()) to change item visuals on the fly.

πŸ§ͺ Testing Your Addon

  • Create a test shop using your custom types.
  • Use /bs open <shop> to open and verify behavior.
  • Check BugFinder.yml for debug info on config issues.

🧱 Distribution

You can package your addon like any Bukkit plugin and distribute it as a .jar.

Optional: Prefix your plugin name with GenesisAddon- for clarity (e.g., GenesisAddon-Teleportation).


🧠 Inspiration: Addon Ideas

  • RewardType: teleport – Warp players to specific coordinates.
  • PriceType: itemtag – Charge items with a specific NBT tag.
  • ConditionType: biome – Check if player is in a specific biome.
  • RewardType: broadcast – Send global messages.

Last updated: June 2025

Clone this wiki locally