mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 18:49:39 +00:00
progress on linked items
This commit is contained in:
1 parent
fb87e2a72c
commit
44e5c8b4c5
8 files changed
+546
-109
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package noppes.npcs.controllers;
|
||||
|
||||
import noppes.npcs.controllers.data.LinkedItem;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
//TODO: load this data from somewhere, use in GUIs, create script wrapper
|
||||
public class LinkedItemController {
|
||||
private static LinkedItemController Instance;
|
||||
private final HashMap<String, LinkedItem> linkedItems = new HashMap<>();
|
||||
|
||||
private LinkedItemController() {
|
||||
}
|
||||
|
||||
public static LinkedItemController Instance() {
|
||||
if (Instance == null) {
|
||||
Instance = new LinkedItemController();
|
||||
}
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void add(LinkedItem linkedItem) {
|
||||
if (linkedItem != null) {
|
||||
String name = linkedItem.getName();
|
||||
if (name != null && !name.isEmpty()) {
|
||||
this.linkedItems.put(name.toLowerCase(), linkedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedItem get(String name) {
|
||||
return name != null && !name.isEmpty() ? this.linkedItems.get(name.toLowerCase()) : null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user