Hidden Lore

0 Downloads

Hidden Lore

Hidden Lore is a plugin which allows plugin authors to utilize hidden lore on ItemStacks. Hidden Lore works by using ProtocolLib to remove hidden lore before it is sent to the client. This means that authors only have to use the Bukkit API, and do not have to mess around with building against CraftBukkit. All hidden lore is stored along side normal lore, so in the event that this plugin or ProtocolLib breaks, no data is lost and dependent plugins will continue to work.

Sample Use Cases

  • Avoid storing an "item id" visible in your lore and an associated record in a database. Save yourself the trouble and overhead of external storage. Data is destroyed and cloned along with the item stack.
  • Separate data storage and display. Store a "uses-left: 3" value in the hidden lore and "Uses Left: 3" in the visible. Easily recalculate the visible lore without messing with regular expressions. Allow users to change the "Uses Left:" to whatever language they please without having to keep track of language history.

How it Works

ProtocolLib intercepts the item data before it is sent to the client. The line "==HIDDEN-LORE==" and all lines after it are stripped away. The item data then continues onto the client as usual. No black magic (outside of intercepting data) is performed. This means that you can access the hidden lore through Bukkit API methods in the event of failure of this plugin.

How to Use

Add a softdepend for "HiddenLore". All API methods are static and are located in the HiddenLoreAPI class. Javadocs are available here. Use of the provided API is optional. As long as you use the correct sentinel, you can write your implementation as you see fit.

Important Caveats

  • Due to limitations of the client, players in creative mode will be able to see all hidden lore.
  • Items whose lore is not exactly the same cannot stack. It is your responsibility as a plugin author to make sure players have a way to differentiate items so players do not become confused.
  • I highly recommend that you do not hide sensitive data in the lore. If this plugin is not able to be updated in time, hidden lore will become visible to the players. This plugin is best used for cosmetic purposes only.

Permissions and Configuration

  • hiddenlore.reveal - Grant this permission to always reveal hidden lore.