Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. package me.bladianyt.keys;
  2.  
  3. import me.bladianyt.core.Core;
  4. import me.bladianyt.keys.config.KeyConfig;
  5. import org.bukkit.Material;
  6. import org.bukkit.configuration.Configuration;
  7. import org.bukkit.inventory.ItemStack;
  8.  
  9. import java.util.ArrayList;
  10. import java.util.List;
  11.  
  12. /**
  13. * Created by BladianYT. By seeing this you have agreed to not copy
  14. * or use the code, which are you viewing unless you have been granted permission
  15. * by the developer.
  16. */
  17.  
  18. public class KeyManager {
  19.  
  20. private static KeyManager instance;
  21.  
  22. public static KeyManager getInstance() {
  23. return instance;
  24. }
  25.  
  26. public KeyManager() {
  27. instance = this;
  28. }
  29.  
  30. public static KeyList getKeyInterfaces() {
  31. return keyInterfaces;
  32. }
  33.  
  34. private static KeyList keyInterfaces = new KeyList();
  35.  
  36. public static void loadKeys() {
  37.  
  38. Configuration configuration = KeyConfig.getKeyConfig();
  39. for (String keyLines : configuration.getKeys(false)) {
  40. Material material = Material.getMaterial(configuration.getString(keyLines + "material"));
  41. String name = configuration.getString(keyLines + "name");
  42. List<ItemStack> itemStacks = new ArrayList<ItemStack>();
  43. for (String itemLines : configuration.getConfigurationSection(keyLines + "items").getKeys(false)) {
  44. ItemStack itemStack = new ItemStack(Material.getMaterial(itemLines), 1);
  45. itemStacks.add(itemStack);
  46. }
  47. KeyInterface keyInterface = new KeyInterface(name, material, itemStacks);
  48. keyInterfaces.add(keyInterface);
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement