Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.broken.cheststorage.inventoryholders.InventoryHolder;
- import org.broken.cheststorage.inventoryholders.InventoryHolderDefultchest;
- import org.broken.cheststorage.inventoryholders.InventoryHolderStorageUnit;
- import org.bukkit.Location;
- import org.bukkit.entity.Player;
- import java.util.HashMap;
- import java.util.Map;
- public class ClassInstance {
- public static Map<Class<?>, InventoryHolder> classes = new HashMap<>();
- public static InventoryHolder setInventoryHolder(String containerType, Location location, Player player) {
- if (containerType.equals("bigchest") && !classes.containsKey(InventoryHolderStorageUnit.class)) {
- classes.put(InventoryHolderStorageUnit.class, new InventoryHolderStorageUnit(location, player));
- return new InventoryHolderDefultchest(location, player);
- } else if (!containerType.equals("hopper") && !classes.containsKey(InventoryHolderDefultchest.class)) {
- classes.put(InventoryHolderDefultchest.class, new InventoryHolderDefultchest(location, player));
- System.out.println("test" + classes.keySet() + classes.get(InventoryHolderDefultchest.class));
- return new InventoryHolderDefultchest(location, player);
- } else
- return getInventoryHolder(containerType);
- }
- public static InventoryHolder getInventoryHolder(String containerType) {
- if (containerType.equals("bigchest")) {
- return classes.get(InventoryHolderStorageUnit.class);
- } else if (!containerType.equals("hopper")) {
- return classes.get(InventoryHolderDefultchest.class);
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement