FaceDaCoder

enchant

Jul 12th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. if(sender instanceof Player) { //required as we are enchanting items in players hand
  2.             Player player = (Player) sender; //type casting to a player from sender in the listener
  3.             if(player.isOp() || player.hasPermission("godItem.use")) { //checks to see if player has op or permission
  4.                 if(cmd.getName().equalsIgnoreCase("gup")) {
  5.                     ItemMeta meta = player.getItemInHand().getItemMeta();
  6.                     meta.setDisplayName("God Weapon"); //set's display name in item meta to God Weapon
  7.                     player.getItemInHand().setItemMeta(meta); //Save new item meta
  8.                     for(Enchantment enc : Enchantment.values()) {
  9.                         player.getItemInHand().addUnsafeEnchantment(enc, 127); //Give item in hand every enchant at level 127
  10.                     }
  11.                     /*-[Changelog codesector 1]-*/
  12.                     playerText(player, "You have made a god item, do not share these.", ChatColor.RED);
  13.                 }
Advertisement
Add Comment
Please, Sign In to add comment