Removed unused InventorySave/Store classes.

This commit is contained in:
tastybento 2018-08-15 20:30:50 -07:00
parent 68624d2879
commit 5981ffa0d5
2 changed files with 0 additions and 120 deletions

View File

@ -1,68 +0,0 @@
package world.bentobox.bentobox.listeners.protection;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.entity.Player;
/**
* Stashes inventories when required for a player
*
* @author tastybento
*
*/
public class InventorySave {
private static InventorySave instance = new InventorySave();
private HashMap<UUID, InventoryStore> inventories;
/**
* Saves the inventory of a player
*/
public InventorySave() {
inventories = new HashMap<>();
}
/** Save player's inventory
* @param player - the player
*/
public void savePlayerInventory(Player player) {
// Save the player's armor and things
inventories.put(player.getUniqueId(),new InventoryStore(player.getInventory().getContents(), player.getInventory().getArmorContents()));
}
/**
* Clears any saved inventory
* @param player - the player
*/
public void clearSavedInventory(Player player) {
inventories.remove(player.getUniqueId());
}
/**
* Load the player's inventory
*
* @param player - the player
*/
public void loadPlayerInventory(Player player) {
// Get the info for this player
if (inventories.containsKey(player.getUniqueId())) {
InventoryStore inv = inventories.get(player.getUniqueId());
player.getInventory().setContents(inv.getInventory());
player.getInventory().setArmorContents(inv.getArmor());
inventories.remove(player.getUniqueId());
}
}
public static InventorySave getInstance() {
return instance;
}
/**
* Returns whether the player's inventory has been stored to give him back.
*
* @param uuid - UUID UUID of the player
* @return <code>true</code> if the inventory is stored, <code>false</code> otherwise
*/
public static boolean isStored(UUID uuid) {
return instance.inventories.containsKey(uuid);
}
}

View File

@ -1,52 +0,0 @@
package world.bentobox.bentobox.listeners.protection;
import org.bukkit.inventory.ItemStack;
/**
* Where the inventory data is stored
*
* @author tastybento
*/
public class InventoryStore {
private ItemStack[] inventory;
private ItemStack[] armor;
/**
* @param inventory - item stack array
* @param armor - armor item stack array
*/
public InventoryStore(ItemStack[] inventory, ItemStack[] armor) {
this.inventory = inventory;
this.armor = armor;
}
/**
* @return the inventory
*/
public ItemStack[] getInventory() {
return inventory;
}
/**
* @param inventory
* the inventory to set
*/
public void setInventory(ItemStack[] inventory) {
this.inventory = inventory;
}
/**
* @return the armor
*/
public ItemStack[] getArmor() {
return armor;
}
/**
* @param armor
* the armor to set
*/
public void setArmor(ItemStack[] armor) {
this.armor = armor;
}
}