Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.bladianyt.keys;
- import me.bladianyt.core.Core;
- import me.bladianyt.keys.config.KeyConfig;
- import org.bukkit.Material;
- import org.bukkit.configuration.Configuration;
- import org.bukkit.inventory.ItemStack;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * Created by BladianYT. By seeing this you have agreed to not copy
- * or use the code, which are you viewing unless you have been granted permission
- * by the developer.
- */
- public class KeyManager {
- private static KeyManager instance;
- public static KeyManager getInstance() {
- return instance;
- }
- public KeyManager() {
- instance = this;
- }
- public static KeyList getKeyInterfaces() {
- return keyInterfaces;
- }
- private static KeyList keyInterfaces = new KeyList();
- public static void loadKeys() {
- Configuration configuration = KeyConfig.getKeyConfig();
- for (String keyLines : configuration.getKeys(false)) {
- Material material = Material.getMaterial(configuration.getString(keyLines + "material"));
- String name = configuration.getString(keyLines + "name");
- List<ItemStack> itemStacks = new ArrayList<ItemStack>();
- for (String itemLines : configuration.getConfigurationSection(keyLines + "items").getKeys(false)) {
- ItemStack itemStack = new ItemStack(Material.getMaterial(itemLines), 1);
- itemStacks.add(itemStack);
- }
- KeyInterface keyInterface = new KeyInterface(name, material, itemStacks);
- keyInterfaces.add(keyInterface);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement