Skip to content
Maximvdw edited this page Nov 5, 2014 · 2 revisions

Resource Manager

Introduction

Spigot offers a resource section where plugin developers can upload their plugins for Bukkit, BungeeCord, Spigot or something else Minecraft related.

The SpigotSite API offers a great way to get these resources, download them and even edit them.

Usage

All actions involving spigot resources require the Resource manager.

ResourceManager resourceManager SpigotSite.getAPI().getResourceManager();

Resource Categories

Spigot has a few resource categories. Despite them not changing that often they are not embedded in the API since they can be changed in the future. Examples of these categories are:

  • Premium
  • Bukkit
  • BungeeCord
  • ...

Getting the resource categories

To get a list of all resource categories you can use the following method.

List<ResourceCategory> categories = resourceManager.getResourceCategories();

This will return a list with resource categories including the amount of resources inside that category but will not fetch a list of all resources inside it

Getting a resource category by id

To get a specific resource category by its identifier you can use the following method:

ResourceCategory category resourceManager.getResourceCategoryById(2);

This will first fetch a list of all resources before returning the actual resource category.

Getting the resources inside a category

To get all resources inside a category you first have to get a recent instance of the resource category. Keep in mind this call can take several seconds depending on the amount of plugins inside the category.

List<Resource> resources = resourceManager.getResourcesByCategory(category);

Resources by a user

You can get the resources made by a specific user. The method returns a list with resources and can be called with a user instance or user identifier.

List<Resource> resources = resourceManager.getResourcesByUser(1);

Purchased resources

You can get the resources a user bought. This method requires an authenticated user since the information of bought resources is private.

List<Resource> resources = resourceManager.getPurchasedResources(user);