Advertisement
Guest User

Untitled

a guest
May 23rd, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1.     @EventHandler
  2.     public void onPermShop(InventoryClickEvent event) {
  3.                 if (event.getInventory().getName().equals("Teleport")) {
  4.                     Player p = (Player) event.getWhoClicked();
  5.                     event.setCancelled(true);
  6.                     p.updateInventory();
  7.                     ItemStack item = event.getCurrentItem();
  8.                     if (item != null && item.getType() != Material.AIR && item.hasItemMeta()) {
  9.                         String itemname = item.getItemMeta().getDisplayName();
  10.                         String Permission = plugin.getConfig().getString("shop." + itemname + ".Permission");
  11.                        
  12.                         if (plugin.getConfig().contains("shop." + itemname)) {
  13.                            
  14.                             if (!p.hasPermission(Permission)) {
  15.                                
  16.                                 if (plugin.payMoney(p, plugin.getConfig().getInt("shop." + itemname + ".Price"))) {
  17.                                     String player = p.getName();
  18.                                     String world = null;
  19.                                     PermShop.permission.playerAdd(world, player, Permission);
  20.                                     p.sendMessage(ChatColor.GREEN + "Permission bought successfully.");
  21.                                     plugin.closeInv(p);
  22.                                 }
  23.                                
  24.                             } else {
  25.                                 p.sendMessage(ChatColor.RED + "Error: You have this permission node already.");
  26.                             }
  27.                            
  28.                            
  29.                            
  30.                            
  31.                         }
  32.                        
  33.                        
  34.                     }
  35.                 }
  36.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement