item Manager
This commit is contained in:
parent
e34a790837
commit
36f8e3f6f0
1 changed files with 28 additions and 18 deletions
|
@ -5,28 +5,38 @@ import me.unurled.sacredrealms.sr.managers.Manager;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
|
|
||||||
public class ItemManager extends Manager {
|
public class ItemManager extends Manager {
|
||||||
public static final NamespacedKey ID = new NamespacedKey("sr", "ID");
|
public static final NamespacedKey ID = new NamespacedKey("sr", "id");
|
||||||
|
|
||||||
public HashMap<String, Item> items;
|
private final HashMap<String, Item> items;
|
||||||
|
|
||||||
public ItemManager() {
|
public ItemManager() {
|
||||||
super();
|
super();
|
||||||
items = new HashMap<>();
|
items = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(Item item) {
|
/** Register all the items */
|
||||||
items.put(item.getID(), item);
|
private void registerItems() {}
|
||||||
}
|
|
||||||
|
|
||||||
public Item getItem(String id) {
|
/** Load the manager */
|
||||||
return items.get(id);
|
@Override
|
||||||
}
|
public void load() {
|
||||||
|
super.load();
|
||||||
|
registerItems();
|
||||||
|
}
|
||||||
|
|
||||||
public void removeItem(String id) {
|
public void addItem(Item item) {
|
||||||
items.remove(id);
|
items.put(item.getID(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isItem(String id) {
|
public Item getItem(String id) {
|
||||||
return items.containsKey(id);
|
return items.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeItem(String id) {
|
||||||
|
items.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItem(String id) {
|
||||||
|
return items.containsKey(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue