Skip to content

ContentAPI is a Paper plugin for fixing custom item conflicts.

License

Notifications You must be signed in to change notification settings

1e99/contentapi

Repository files navigation

ContentAPI

ContentAPI is a Paper plugin for fixing custom item conflicts.

Installation

  1. Add the ContentAPI JitPack dependency:
repositories {
    maven { url "https://jitpack.io"  }
}

dependencies {
    compileOnly "com.github.c-128:contentapi:latest_commit"
}
  1. Add the plugin as a dependency in your paper-plugin.yaml:
dependencies:
  server:
    ContentAPI:
      load: 'BEFORE'
      required: true
      join-classpath: true

Usage

RegisteredServiceProvider<ContentAPI> serviceProvider = servicesManager.getRegistration(ContentAPI.class);
if (serviceProvider == null) {
    // ContentAPI is not loaded
    return;
}

ContentAPI api = serviceProvider.getProvider();
ContentRegistry<ItemStack> itemRegistry = api.getItemRegistry();

// Register a custom item
itemRegistry.register(Key.key("example", "example_item"), item -> {
    // Here you can check if the ItemStack is your custom item.
    // Here you can for example check for a NBT tag or similar metadata.
    ItemMeta meta = item.getItemMeta();
    if (meta == null) {
        return false;
    }
    
    if (meta.getCustomModelData() != 1) {
        return false;
    }

    return true;
});

// You can also check if an ItemStack is a custom item, registered by another plugin.
// If so, you can deal with it accordingly.
ItemStack stack = new ItemStack(Material.AIR);
boolean isCustom = itemRegistry.isCustomContent(stack);

Support

This plugin integrates with Oraxen by default. I plan on adding more plugins later.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

ContentAPI is a Paper plugin for fixing custom item conflicts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages