Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent event) {//onPlayerInteract method.
- Player player = event.getPlayer(); //Get player
- if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.MUSHROOM_SOUP && player.getHealth()!=20) {
- player.setHealth(player.getHealth()+3);
- event.getPlayer().getItemInHand().setType(Material.BOWL);
- }
- if (event.getClickedBlock().getState() instanceof Sign){
- Sign sign = (Sign) event.getClickedBlock().getState();
- if(sign.getLine(0).equalsIgnoreCase("[kit]")) {
- if(sign.getLine(1).equalsIgnoreCase("Standard")){
- player.sendMessage("You have revieved: "+ChatColor.RED+"Standard");
- PlayerInventory inventory = player.getInventory(); // The player's inventory
- Enchantment prot = new EnchantmentWrapper(0);
- Enchantment s = new EnchantmentWrapper(16);
- ItemStack diamondsword = new ItemStack(Material.DIAMOND_SWORD, 1);
- ItemStack ironchestplate = new ItemStack(Material.IRON_CHESTPLATE, 1);
- ironchestplate.addEnchantment(prot, 1);
- ItemStack ironleggings = new ItemStack(Material.IRON_LEGGINGS, 1);
- ironleggings.addEnchantment(prot, 1);
- ItemStack ironboots = new ItemStack(Material.IRON_BOOTS, 1);
- ironboots.addEnchantment(prot, 1);
- ItemStack ironhelmet = new ItemStack(Material.IRON_HELMET, 1);
- ironhelmet.addEnchantment(prot, 2);
- ItemStack food = new ItemStack(Material.GRILLED_PORK, 32);
- diamondsword.addEnchantment(s, 1);
- Kit="Standard";
- //If player has: food, diamondsword, and iron armour, do this:
- if(!(inventory.contains(food) && inventory.contains(diamondsword) && inventory.getHelmet().equals(ironhelmet) && inventory.getChestplate().equals(ironchestplate) && inventory.getLeggings().equals(ironleggings) && inventory.getBoots().equals(ironboots))){
- inventory.setHelmet(ironhelmet);
- inventory.setChestplate(ironchestplate);
- inventory.setLeggings(ironleggings);
- inventory.setBoots(ironboots);
- inventory.addItem(food, diamondsword);
- player.updateInventory();
- }else{
- player.sendMessage("You already have kit "+Kit);
- }//End of else statement
- //End of if line 1 contains standard.
- }else if(sign.getLine(1).equalsIgnoreCase("Archer")){
- player.sendMessage("You have revieved: "+ChatColor.RED+"Standard");
- Enchantment ff = new EnchantmentWrapper(2);
- //ItemStack chainhelmet = new ItemStack(302, 1);
- //ItemStack chainplate = new ItemStack(302, 1);
- //ItemStack chainleggings = new ItemStack(302, 1);
- ItemStack chainboots = new ItemStack(305,1);
- chainboots.addEnchantment(ff,5);
- }else{
- player.sendMessage("You already have kit "+Kit);
- }
- //End of if line 0 contains map.
- }
- }//End of if sign check.
- }//End of onPlayerInteract Method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement