2016-04-14 16:24:03 +00:00
|
|
|
package me.mrCookieSlime.Slimefun.api;
|
|
|
|
|
2019-08-30 10:13:45 +00:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
2016-04-14 16:24:03 +00:00
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
2019-08-31 09:36:45 +00:00
|
|
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
2019-08-27 11:28:07 +00:00
|
|
|
|
2019-08-30 10:13:45 +00:00
|
|
|
public final class Soul {
|
2016-04-14 16:24:03 +00:00
|
|
|
|
2019-08-30 10:13:45 +00:00
|
|
|
private Soul() {}
|
|
|
|
|
|
|
|
public static void storeItem(UUID uuid, int slot, ItemStack item) {
|
2019-08-31 09:36:45 +00:00
|
|
|
Map<Integer, ItemStack> items = SlimefunPlugin.getUtilities().soulbound.get(uuid);
|
2019-08-30 10:13:45 +00:00
|
|
|
|
|
|
|
if (items == null) {
|
|
|
|
items = new HashMap<>();
|
2019-08-31 09:36:45 +00:00
|
|
|
SlimefunPlugin.getUtilities().soulbound.put(uuid, items);
|
2019-08-30 10:13:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
items.put(slot, item);
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void retrieveItems(Player p) {
|
2019-08-31 09:36:45 +00:00
|
|
|
Map<Integer, ItemStack> items = SlimefunPlugin.getUtilities().soulbound.get(p.getUniqueId());
|
2019-08-30 10:13:45 +00:00
|
|
|
|
|
|
|
if (items != null) {
|
|
|
|
for (Map.Entry<Integer, ItemStack> entry: items.entrySet()) {
|
|
|
|
p.getInventory().setItem(entry.getKey(), entry.getValue());
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-30 10:13:45 +00:00
|
|
|
|
2019-08-31 09:36:45 +00:00
|
|
|
SlimefunPlugin.getUtilities().soulbound.remove(p.getUniqueId());
|
2016-04-14 16:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|