Skip to content
Ntdi edited this page Dec 15, 2022 · 1 revision

Introduction into ArmorManager

NR-Core provides you with a lot of utils, this one is no different! Here we contain methods for saving your inventory and armor and then reloading it to the player. We also provide the ability to turn your inventory into a string and back again!

Storing Armor and Inventory

Say you want to store the player's armor and inventory for a short period of time, (Like a duel) then give it back after!

coolClassNameHere.java

public void doTheDoDo(Player p) {
    ArmorManager.storeAndClearInventory(p);

    ArmorManager.setPlayerConents(p, true);
}

So easy! The first function #storeAndClearInventory(); store's the player's inventory and armor into a hashmap for later use. Then after that #setPlayerContents(); takes those items from the hashmap and give's it back to the player, getting rid of their current items. The true at the second argument tells the code to also remove the player's stored items from memory, if you aren't going to call #setPlayerContents(); again before #storeAndClearInventory();, I'd recommend leaving it at true.

Clone this wiki locally