Item Defender - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki

Intro

When making a minecraft server, it is best to assume that not all your players are knowledgeable about the backend work that is done to make everything run smoothly. Because of this some players may try and use custom items you have made in crafting recipes that will destroy the custom item. After that it would be safe to assume that they would come to you asking for help to give them back their item. But from your perspective this could be a player who is lying to you to get their hands on a valuable item for free. To prevent this from happening, the item defender system was created.

What you can do

This system may negatively interact with other plugins that add custom crafting recipes in the game. To prevent this conflict you have the ability to disable some of the item defenders features.

There are two options, one is via the main configuration file and the other is via the developer api.

Configuration

If you go into the main configuration file there should be a section titled: item-defender. If such a section does not exist you can either create it yourself or delete the main configuration file and let the plugin generate a new one. The section should look like this:

#The item defender will ensure that custom items are not used in unintended ways that could destroy the item#
item-defender:
  enabled: true #if false the item defender system will not function at all
  close-inventories: true #if true not only will the system disable interaction with the inventory but also close it

The comments explain each function of the options and you can you can use them as you please.

Developer API

This next part explains the second option using the developer api, if you are not proficient at Java please disregard this section.

To get the instance of the ItemDefender first add InnovativeItems as a dependency to your plugin, to do that you can follow the steps shown on the first developer API page.

Once InnovativeItems is added as a dependency you can access the InnovativeItemsAPI class. That class has a static method called getItemDefender() that you can use to get the instance of the item defender. Once you have the instance of the ItemDefender class you can use the getBlacklistedInventories() instance method to get a mutable set of all the types of inventories the defender prevents custom items to be interacted with. You can add and remove any type you like.

Final Thoughts

The item defender system was built not only to help you as a server owner but also as a safeguard to prevent players from harming themselves. This system is by no means ever a finished product and if there are interactions in the game that the item defender does not prevent, please report them on the support discord here.