Lore Help!

Discussion in 'Plugin Development' started by Peter_Higgs, Mar 24, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Peter_Higgs

    hey guys I have been working on a throwing knife plugin for a friend and I have given a stick and a blaze rod custom names and lore. I set up an event handler to fire a snowball when ONLY the stick or blaze rod with custom names are interacted with. Here is my code

    Code:java
    1. package me.OmDalvi.ThrowingKnives;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Effect;
    9. import org.bukkit.Material;
    10. import org.bukkit.enchantments.Enchantment;
    11. import org.bukkit.entity.*;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.event.block.Action;
    15. import org.bukkit.event.player.PlayerInteractEvent;
    16. import org.bukkit.inventory.ItemStack;
    17. import org.bukkit.inventory.ShapedRecipe;
    18. import org.bukkit.inventory.meta.ItemMeta;
    19. import org.bukkit.plugin.java.JavaPlugin;
    20.  
    21. public class Main extends JavaPlugin implements Listener {
    22.  
    23. ItemStack knive = new ItemStack(Material.STICK, 16);
    24. ItemStack fireKnive = new ItemStack(Material.BLAZE_ROD, 16);
    25.  
    26. @Override
    27. public void onEnable(){
    28.  
    29. //Meta Data
    30. ItemMeta fireKniveMeta = fireKnive.getItemMeta();
    31. //lore
    32. List<String> Firelore = new ArrayList<String>();
    33. Firelore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
    34. Firelore.add(ChatColor.GREEN +"Boom, Boom, Fia Powa!!!");
    35. Firelore.add(ChatColor.BLUE +"+ ∞ damage");
    36. fireKniveMeta.setLore(Firelore);
    37. //lore end
    38. //rename
    39. fireKniveMeta.setDisplayName(ChatColor.RED +"Throwing" +ChatColor.BLUE +"Knive");
    40. //rename ends
    41. //enchants
    42. fireKniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
    43. fireKniveMeta.addEnchant(Enchantment.FIRE_ASPECT, 100, true);
    44. fireKniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
    45. fireKniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 100, true);
    46. //enchants end
    47. knive.setItemMeta(fireKniveMeta);
    48. //Meta Data end
    49. //Recipe
    50. ShapedRecipe fireKniveRecipe = new ShapedRecipe(knive);
    51. fireKniveRecipe.shape("###","#I#","#S#");
    52. fireKniveRecipe.setIngredient('I', Material.IRON_INGOT);
    53. fireKniveRecipe.setIngredient('S', Material.BLAZE_ROD);
    54. //Recipe End
    55.  
    56. //Meta Data
    57. ItemMeta kniveMeta = knive.getItemMeta();
    58. //lore
    59. List<String> lore = new ArrayList<String>();
    60. lore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
    61. lore.add(ChatColor.GREEN +":) :) :) :) :) :) :) :) :) :) :)");
    62. lore.add(ChatColor.BLUE +"+ ∞ damage");
    63. kniveMeta.setLore(lore);
    64. //lore end
    65. //rename
    66. kniveMeta.setDisplayName(ChatColor.AQUA +"Throwing" +ChatColor.BLUE +"Knive");
    67. //rename ends
    68. //enchants
    69. kniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
    70. kniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
    71. kniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 100, true);
    72. //enchants end
    73. knive.setItemMeta(kniveMeta);
    74. //Meta Data end
    75. //Recipe
    76. ShapedRecipe kniveRecipe = new ShapedRecipe(knive);
    77. kniveRecipe.shape("###","#I#","#S#");
    78. kniveRecipe.setIngredient('I', Material.IRON_INGOT);
    79. kniveRecipe.setIngredient('S', Material.STICK);
    80. //Recipe End
    81. Bukkit.getServer().addRecipe(kniveRecipe);
    82.  
    83. //Events
    84. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    85. //Events end
    86.  
    87. }
    88.  
    89. @Override
    90. public void onDisable(){
    91. Bukkit.getServer().clearRecipes();
    92. }
    93.  
    94. @EventHandler
    95. public void onPlayerInteract(final PlayerInteractEvent e) {
    96. if(!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
    97. if(e.getItem().getType() == Material.BLAZE_ROD){
    98. Snowball s = e.getPlayer().launchProjectile(Snowball.class);
    99. s.getWorld().playEffect(e.getPlayer().getLocation(), Effect.SMOKE, 10);
    100. }else if(e.getItem().getType() == Material.STICK){
    101. Snowball s = e.getPlayer().launchProjectile(Snowball.class);
    102. s.getWorld().playEffect(e.getPlayer().getLocation(), Effect.SMOKE, 10);
    103. }
    104. }
    105.  
    106. }


    Plz help as my friend wants it done in a week!!

    Bye!
     
  2. Offline

    ZeusAllMighty11

    You didn't indicate your problem?
     
    Peter_Higgs and Venexor like this.
  3. You shouldn't use a global ItemStack. Try creating a separate ItemStack variable for every recipe inside the onEnable() function instead of defining it once as a global.
     
  4. Offline

    Peter_Higgs

    He He He... Sorry I was in a rush but what I am trying to have is the event handler (I think that is what its called) sense the colored text then shoot a snowball

    I also have another problem. I try to upload this to my server but it will not be sensed!!!
    Here is my Plugin.yml
    Code:
    name: ThrowingKnives
    version: 1.4.1
    main:  com.live.Peter_Higgs.Main
      commands:
        beardify:
          description: Puts a spiky beard on the specified players head.
          usage: /<command> [player]
    Main Class
    Code:java
    1. package com.live.ThrowingKnives;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.command.Command;
    10. import org.bukkit.command.CommandSender;
    11. import org.bukkit.enchantments.Enchantment;
    12. import org.bukkit.entity.Player;
    13. import org.bukkit.inventory.ItemStack;
    14. import org.bukkit.inventory.PlayerInventory;
    15. import org.bukkit.inventory.ShapedRecipe;
    16. import org.bukkit.inventory.meta.ItemMeta;
    17. import org.bukkit.plugin.java.JavaPlugin;
    18.  
    19. public class Main extends JavaPlugin{
    20.  
    21. ItemStack knive = new ItemStack(Material.STICK, 16);
    22. ItemStack fireKnive = new ItemStack(Material.BLAZE_ROD, 16);
    23. ItemStack head = new ItemStack(Material.CACTUS);
    24.  
    25. @Override
    26. public void onEnable(){
    27.  
    28. //Meta Data
    29. ItemMeta fireKniveMeta = fireKnive.getItemMeta();
    30. //lore
    31. List<String> fireLore = new ArrayList<String>();
    32. fireLore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
    33. fireLore.add(ChatColor.RED +"Boom, Boom, Fia Powa!!!");
    34. fireLore.add(ChatColor.BLUE +"+ ∞ damage");
    35. fireKniveMeta.setLore(fireLore);
    36. //lore end
    37. //rename
    38. fireKniveMeta.setDisplayName(ChatColor.RED +"Throwing " +ChatColor.BLUE +"Knive");
    39. //rename ends
    40. //enchants
    41. fireKniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
    42. fireKniveMeta.addEnchant(Enchantment.FIRE_ASPECT, 100, true);
    43. fireKniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
    44. fireKniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
    45. //enchants end
    46. fireKnive.setItemMeta(fireKniveMeta);
    47. //Meta Data end
    48. //Recipe
    49. ShapedRecipe fireKniveRecipe = new ShapedRecipe(fireKnive);
    50. fireKniveRecipe.shape("BBB","RIR","PSP");
    51. fireKniveRecipe.setIngredient('P', Material.POWERED_RAIL);
    52. fireKniveRecipe.setIngredient('R', Material.REDSTONE);
    53. fireKniveRecipe.setIngredient('B', Material.BLAZE_POWDER);
    54. fireKniveRecipe.setIngredient('I', Material.IRON_INGOT);
    55. fireKniveRecipe.setIngredient('S', Material.BLAZE_ROD);
    56. //Recipe End
    57.  
    58. //Meta Data
    59. ItemMeta kniveMeta = knive.getItemMeta();
    60. //lore
    61. List<String> lore = new ArrayList<String>();
    62. lore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
    63. lore.add(ChatColor.GREEN +":) :) :) :) :) :) :) :) :) :) :)");
    64. lore.add(ChatColor.BLUE +"+ ∞ damage");
    65. kniveMeta.setLore(lore);
    66. //lore end
    67. //rename
    68. kniveMeta.setDisplayName(ChatColor.AQUA +"Throwing" +ChatColor.BLUE +"Knive");
    69. //rename ends
    70. //enchants
    71. kniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
    72. kniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
    73. kniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
    74. //enchants end
    75. knive.setItemMeta(kniveMeta);
    76. //Meta Data end
    77. //Recipe
    78. ShapedRecipe kniveRecipe = new ShapedRecipe(knive);
    79. kniveRecipe.shape("###","RIR","PSP");
    80. kniveRecipe.setIngredient('P', Material.POWERED_RAIL);
    81. kniveRecipe.setIngredient('R', Material.REDSTONE);
    82. kniveRecipe.setIngredient('I', Material.IRON_INGOT);
    83. kniveRecipe.setIngredient('S', Material.STICK);
    84. //Recipe End
    85. Bukkit.getServer().addRecipe(kniveRecipe);
    86. Bukkit.getServer().addRecipe(fireKniveRecipe);
    87.  
    88. }
    89.  
    90. @Override
    91. public void onDisable(){
    92. Bukkit.getServer().clearRecipes();
    93. }
    94. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    95.  
    96. if(sender instanceof Player){
    97. //beard
    98. if(cmd.getName().equalsIgnoreCase("beardify")){
    99. Player p = (Player)sender;
    100. if(args.length == 1){
    101.  
    102. Player target = (Bukkit.getServer().getPlayer(args[0]));
    103. if (target == null) {
    104. p.sendMessage(args[0] + " is not online!");
    105. return false;
    106. }else{
    107. PlayerInventory TI =target.getInventory();
    108. TI.setHelmet(head);
    109. }
    110.  
    111. }else{
    112. p.sendMessage("Wrong amount of arguments");
    113. }
    114. //beard ends
    115.  
    116.  
    117. }
    118. }
    119. return false;
    120. }
    121.  
    122.  
    123. }

    I had taken out the event handler as the plugin didnt work

    What exactly will this do? I try them all inside onEnable, but then took out as now It wont load!!!

    Maybe if you could copy my code than try it out yourself, then I could know if it works, but till then I am not sure

    I will keep updating my code so if there are any changes I should do (Or shouldn't have done) I can know.

    Code:
    package com.live.ThrowingKnives;
     
    import java.util.ArrayList;
    import java.util.List;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.ShapedRecipe;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Main extends JavaPlugin{
     
        ItemStack knive = new ItemStack(Material.STICK, 16);
        ItemStack fireKnive = new ItemStack(Material.BLAZE_ROD, 16);
        ItemStack head = new ItemStack(Material.CACTUS);
       
        @Override
        public void onEnable(){
       
        //Meta Data   
        ItemMeta fireKniveMeta = fireKnive.getItemMeta();
        //lore
        List<String> fireLore = new ArrayList<String>();
        fireLore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
        fireLore.add(ChatColor.RED +"Boom, Boom, Fia Powa!!!");
        fireLore.add(ChatColor.BLUE +"+ ∞ damage");
        fireKniveMeta.setLore(fireLore);
        //lore end
        //rename
        fireKniveMeta.setDisplayName(ChatColor.RED +"Throwing " +ChatColor.BLUE +"Knive");
        //rename ends
        //enchants
        fireKniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
        fireKniveMeta.addEnchant(Enchantment.FIRE_ASPECT, 100, true);
        fireKniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
        fireKniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
        //enchants end
        fireKnive.setItemMeta(fireKniveMeta);
        //Meta Data end
        //Recipe
        ShapedRecipe fireKniveRecipe = new ShapedRecipe(fireKnive);
        fireKniveRecipe.shape("BBB","RIR","PSP");
        fireKniveRecipe.setIngredient('P', Material.POWERED_RAIL);
        fireKniveRecipe.setIngredient('R', Material.REDSTONE);
        fireKniveRecipe.setIngredient('B', Material.BLAZE_POWDER);
        fireKniveRecipe.setIngredient('I', Material.IRON_INGOT);
        fireKniveRecipe.setIngredient('S', Material.BLAZE_ROD);
        //Recipe End   
               
        //Meta Data   
        ItemMeta kniveMeta = knive.getItemMeta();
        //lore
        List<String> lore = new ArrayList<String>();
        lore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
        lore.add(ChatColor.GREEN +":) :) :) :) :) :) :) :) :) :) :)");
        lore.add(ChatColor.BLUE +"+ ∞ damage");
        kniveMeta.setLore(lore);
        //lore end
        //rename
        kniveMeta.setDisplayName(ChatColor.AQUA +"Throwing" +ChatColor.BLUE +"Knive");
        //rename ends
        //enchants
        kniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
        kniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
        kniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
        //enchants end
        knive.setItemMeta(kniveMeta);
        //Meta Data end
        //Recipe
        ShapedRecipe kniveRecipe = new ShapedRecipe(knive);
        kniveRecipe.shape("###","RIR","PSP");
        kniveRecipe.setIngredient('P', Material.POWERED_RAIL);
        kniveRecipe.setIngredient('R', Material.REDSTONE);
        kniveRecipe.setIngredient('I', Material.IRON_INGOT);
        kniveRecipe.setIngredient('S', Material.STICK);
        //Recipe End
        Bukkit.getServer().addRecipe(kniveRecipe);
        Bukkit.getServer().addRecipe(fireKniveRecipe);
       
        }
       
        @Override
        public void onDisable(){
            Bukkit.getServer().clearRecipes();
        }
        }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  5. Offline

    TwoPointDuck

    Nonono. Go like this:

    Code:
    ItemStack knive;
        ItemStack fireKnive;
        @Override
        public void onEnable(){
            knive = new ItemStack(etc);
            fireKnive = new ItemStack(etc);
        }
    Otherwise they wont load (in your main class)

    EDIT: Sorry for crappy formatting on that code
     
  6. Offline

    Peter_Higgs

    So after i do what u said i would do this right -
    Code:java
    1. public void onPlayerInteractEvent(PlayerInteractEvent e){
    2.  
    3. if(e.getAction().equals(Action.RIGHT_CLICK_AIR)){
    4. //code here
    5. }


    OK so thanks to my looking over my code I found what was wrong with my plugin.yml and now it works.
    Now I need an answer to the main question. HOW TO MAKE A STICK* FIRE A SNOWBALL!!
    Currently my code is
    Code:java
    1. if(e.getAction().equals(Action.RIGHT_CLICK_AIR)){
    2. if(e.getMaterial().equals(fireKnive)){
    3. Player p = e.getPlayer();
    4. }

    for the event handler. Plz help on how to
    A) shoot a snowball from a stick*
    B) take away 1 stick* per shot
    C) have the snowball give potion effects on whoever/whatever it hits
    *Stick or Blaze Rod

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  7. Offline

    TwoPointDuck

    Code:
    Fireball f = p.launchProjectile(Fireball.class);
            ItemStack is = p.getItemInHand();
            int amount = is.getAmount();
            if(p.getItemInHand().getAmount() > 1)p.getItemInHand().setAmount(amount - 1);//remove 1 stick if he has more that 1
            else{is.setType(Material.AIR);}//If he only has 1 stick, it will remove the itemstack he cant have 0 sticks
         
            //NOW: we gotta store the projectile in an arraylist that you put OUTSIDE this method
            ArrayList<Projectile> projectiles = new ArrayList<Projectile>();//THIS SHOULD BE DONE SOMEWHERE ELSE
         
            projectiles.add(f);
        }
        @EventHandler
        public void onEntityDamageByEntity(EntityDamageByEntityEvent event){
            if(!(event.getEntity() instanceof Player))return;
            if(!(event.getDamager() instanceof Projectile))return;
            Player hitplayer = (Player) event.getEntity();
            Projectile p = (Projectile) event.getDamager();
            if(!projectiles.contains(p))return;
            hitplayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20/*1 second = 20*/, 1));
            projectiles.remove(p);
        }
     
  8. Offline

    Peter_Higgs

    Can I make the fire knife cach someone on fire?

    Whenever I add
    ArrayList<Projectile> projectiles = new ArrayList<Projectile>();
    projectiles.add(f);
    it has an error saying that f is not a variable even though I have it set up in the onPlayerInteractEvent.

    Plz help!!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  9. Offline

    AoH_Ruthless

    Peter_Higgs
    f is a variable defined only for that event....
    You need to globalize it to use the same variable across events.
     
  10. Offline

    Peter_Higgs

    how?
     
  11. Offline

    TwoPointDuck


    The ArrayList<Projectile> projectiles; has to be outside of the event, so above lets say the onEnable()

    Then in the onEnable() put projectiles = new ArrayList<Projectile>
     
  12. Offline

    Peter_Higgs

    O.K guys i have done what u have recommended and now the stick still wont fire snowballs!!!
    here is my code-
    Code:java
    1. package com.live.ThrowingKnives;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.List;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.enchantments.Enchantment;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.entity.Projectile;
    12. import org.bukkit.entity.Snowball;
    13. import org.bukkit.event.block.Action;
    14. import org.bukkit.event.player.PlayerInteractEvent;
    15. import org.bukkit.inventory.ItemStack;
    16. import org.bukkit.inventory.ShapedRecipe;
    17. import org.bukkit.inventory.meta.ItemMeta;
    18. import org.bukkit.plugin.java.JavaPlugin;
    19.  
    20. public class Main extends JavaPlugin{
    21.  
    22. ItemStack knive;
    23. ItemStack fireKnive;
    24. ArrayList<Projectile> projectiles;
    25. Snowball s;
    26.  
    27. @Override
    28. public void onEnable(){
    29.  
    30. projectiles = new ArrayList<Projectile>();
    31.  
    32. fireKnive = new ItemStack(Material.BLAZE_ROD, 16);
    33. knive = new ItemStack(Material.STICK, 1);
    34.  
    35. //Meta Data
    36. ItemMeta fireKniveMeta = fireKnive.getItemMeta();
    37. //lore
    38. List<String> fireLore = new ArrayList<String>();
    39. fireLore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
    40. fireLore.add(ChatColor.RED +"Boom, Boom, Fia Powa!!!");
    41. fireLore.add(ChatColor.BLUE +"+ ∞ damage");
    42. fireKniveMeta.setLore(fireLore);
    43. //lore end
    44. //rename
    45. fireKniveMeta.setDisplayName(ChatColor.RED +"Throwing " +ChatColor.BLUE +" Knive");
    46. //rename ends
    47. //enchants
    48. fireKniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
    49. fireKniveMeta.addEnchant(Enchantment.FIRE_ASPECT, 100, true);
    50. fireKniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
    51. fireKniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
    52. //enchants end
    53. fireKnive.setItemMeta(fireKniveMeta);
    54. //Meta Data end
    55. //Recipe
    56. ShapedRecipe fireKniveRecipe = new ShapedRecipe(fireKnive);
    57. fireKniveRecipe.shape("BBB","RIR","PSP");
    58. fireKniveRecipe.setIngredient('P', Material.POWERED_RAIL);
    59. fireKniveRecipe.setIngredient('R', Material.REDSTONE);
    60. fireKniveRecipe.setIngredient('B', Material.BLAZE_POWDER);
    61. fireKniveRecipe.setIngredient('I', Material.IRON_INGOT);
    62. fireKniveRecipe.setIngredient('S', Material.BLAZE_ROD);
    63. //Recipe End
    64.  
    65. //Meta Data
    66. ItemMeta kniveMeta = knive.getItemMeta();
    67. //lore
    68. List<String> lore = new ArrayList<String>();
    69. lore.add(ChatColor.GOLD +"This is a disguised throwing knife.");
    70. lore.add(ChatColor.GREEN +":) :) :) :) :) :) :) :) :) :) :)");
    71. lore.add(ChatColor.BLUE +"+ ∞ damage");
    72. kniveMeta.setLore(lore);
    73. //lore end
    74. //rename
    75. kniveMeta.setDisplayName(ChatColor.AQUA +"Throwing" +ChatColor.BLUE +" Knive");
    76. //rename ends
    77. //enchants
    78. kniveMeta.addEnchant(Enchantment.KNOCKBACK, 100, true);
    79. kniveMeta.addEnchant(Enchantment.LOOT_BONUS_MOBS, 100, true);
    80. kniveMeta.addEnchant(Enchantment.DAMAGE_ALL, 20, true);
    81. //enchants end
    82. knive.setItemMeta(kniveMeta);
    83. //Meta Data end
    84. //Recipe
    85. ShapedRecipe kniveRecipe = new ShapedRecipe(knive);
    86. kniveRecipe.shape("###","RIR","PSP");
    87. kniveRecipe.setIngredient('P', Material.POWERED_RAIL);
    88. kniveRecipe.setIngredient('R', Material.REDSTONE);
    89. kniveRecipe.setIngredient('I', Material.IRON_INGOT);
    90. kniveRecipe.setIngredient('S', Material.STICK);
    91. //Recipe End
    92. Bukkit.getServer().addRecipe(kniveRecipe);
    93. Bukkit.getServer().addRecipe(fireKniveRecipe);
    94.  
    95. }
    96.  
    97. @Override
    98. public void onDisable(){
    99.  
    100. Bukkit.getServer().clearRecipes();
    101. }
    102.  
    103. public void onPlayerInteractEvent(PlayerInteractEvent e){
    104.  
    105. if(e.getAction().equals(Action.RIGHT_CLICK_AIR)){
    106. if(e.getMaterial().equals(fireKnive)){
    107. Player p = e.getPlayer();
    108. fs= p.launchProjectile(Snowball.class);
    109. ItemStack is = p.getItemInHand();
    110. int amount = is.getAmount();
    111. if(p.getItemInHand().getAmount() > 1)p.getItemInHand().setAmount(amount - 1);
    112. else{is.setType(Material.AIR);}
    113. }
    114.  
    115. projectiles.add(s);
    116.  
    117. }
    118.  
    119. }
    120.  
    121. }
     
  13. Offline

    ZodiacTheories

  14. Offline

    Peter_Higgs

    What do u mean
     
Thread Status:
Not open for further replies.

Share This Page