Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onPermShop(InventoryClickEvent event) {
- if (event.getInventory().getName().equals("Teleport")) {
- Player p = (Player) event.getWhoClicked();
- event.setCancelled(true);
- p.updateInventory();
- ItemStack item = event.getCurrentItem();
- if (item != null && item.getType() != Material.AIR && item.hasItemMeta()) {
- String itemname = item.getItemMeta().getDisplayName();
- String Permission = plugin.getConfig().getString("shop." + itemname + ".Permission");
- if (plugin.getConfig().contains("shop." + itemname)) {
- if (!p.hasPermission(Permission)) {
- if (plugin.payMoney(p, plugin.getConfig().getInt("shop." + itemname + ".Price"))) {
- String player = p.getName();
- String world = null;
- PermShop.permission.playerAdd(world, player, Permission);
- p.sendMessage(ChatColor.GREEN + "Permission bought successfully.");
- plugin.closeInv(p);
- }
- } else {
- p.sendMessage(ChatColor.RED + "Error: You have this permission node already.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement