Advertisement
Guest User

Untitled

a guest
Nov 12th, 2014
141
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //At the top of the code:
  2. public static Economy econ = null;
  3. public static Permission perms = null;
  4.  
  5. public void onEnable() {
  6. if (!setupEconomy() ) {
  7. getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
  8. getServer().getPluginManager().disablePlugin(this);
  9. return;
  10. }
  11. getConfig().options().copyDefaults(true);
  12. Bukkit.getServer().getPluginManager().registerEvents(this, this);
  13. settings.setup(this);
  14. }
  15.  
  16. private boolean setupEconomy() {
  17. if (getServer().getPluginManager().getPlugin("Vault") == null) {
  18. return false;
  19. }
  20. RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
  21. if (rsp == null) {
  22. return false;
  23. }
  24. Economy econ = rsp.getProvider();
  25. return econ !=null;
  26. }
  27.  
  28. //The vote shop inventory:
  29. public static Inventory voteShop() {
  30. Inventory i = Bukkit.createInventory(null, 9, "Vote Shop");
  31. ItemStack air = new ItemStack(Material.AIR, 1);
  32. List<String> l = new ArrayList<String>();
  33.  
  34. ItemStack bow = new ItemStack(Material.BOW, 1);
  35. ItemMeta bowmeta = bow.getItemMeta();
  36. bowmeta.setDisplayName(ChatColor.GOLD+"Teleportation Bow");
  37. bowmeta.setLore(Arrays.asList(ChatColor.GREEN+"20 Points"));
  38. bow.setItemMeta(bowmeta);
  39.  
  40. ItemStack wardrobe = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
  41. ItemMeta wardrobemeta = wardrobe.getItemMeta();
  42. wardrobemeta.setDisplayName(ChatColor.GOLD+"Wardrobe");
  43. wardrobemeta.setLore(Arrays.asList(ChatColor.GREEN+"10 Points"));
  44. wardrobe.setItemMeta(wardrobemeta);
  45. {
  46. i.setItem(2, bow);
  47. i.setItem(3, wardrobe);
  48. }
  49. return i;
  50. }
  51.  
  52.  
  53. //In my interact event:
  54. @SuppressWarnings("deprecation")
  55. @EventHandler
  56. public void clickEvent(PlayerInteractEvent e) {
  57. Player p = e.getPlayer();
  58. Action a = e.getAction();
  59. PlayerInventory pi = p.getInventory();
  60. if (!p.hasPermission("hub.hub")) {
  61. return;
  62. }
  63. if (h.getType() == Material.NETHER_STAR) {
  64. p.sendMessage(""+ChatColor.DARK_AQUA+ChatColor.BOLD+">> "+ChatColor.GOLD+ChatColor.BOLD+"Opening Shop...");
  65. p.openInventory(voteShop());
  66. ItemStack nstar = new ItemStack(Material.NETHER_STAR);
  67. ItemMeta nstarmeta = nstar.getItemMeta();
  68. nstarmeta.setDisplayName(ChatColor.GOLD+"Your Vote Points:");
  69. nstarmeta.setLore(Arrays.asList(ChatColor.GREEN+""+econ.getBalance(p.getName())));
  70. voteShop().setItem(0, nstar);
  71. }
  72. }
  73. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement