Shoot entities with a bow

Discussion in 'Archived: Plugin Requests' started by chakyl, Dec 7, 2012.

  1. Offline

    chakyl

    Plugin category: Fun, Mechanics

    Suggested name: EntityBow

    What I want: This plugin request is a little complex, but I know it will be a somewhat popular idea. Basically, when bows have a certain enchantment, they can shoot certain entities from their bow. I don't know much Java, but I know this is very possible with if/else statements. To make this request easier to understand, these are the enchants and what they do.

    If a bow has...

    Infinity II:
    • Entity: Enderpearl
    • Effect: Same effect as enderpearl
    • Item: Enderpearl
    Infinity III:
    • Entity: Snowball
    • Effect: Slowness II for 10 seconds
    • Item: Snowball
    Infinity IV:
    • Entity: Fire Charge
    • Effect: Sets the place/person it hits on fire with no arrow damage
    • Item: Fire Charge
    Infinity V:
    • Entity: Egg
    • Effect: Creates an explosion upon impact, with no arrow damage (Although a direct hit will cause the person to get damaged by the explosion)
    • Item: Egg
    • Config: Block damage: true/false
    Unbreaking X:
    • Effect: Allows the unlimited use of entity bows, as long as they have one item
    • Example: A bow with Infinity IV and Unbreaking X allows you to shoot fire charges as many times as you want, as long as you have one fire charge in your inventory.
    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions:
    ebow.I: Allows the use of the bow with the enchant Infinity II
    ebow.II: Allows the use of the bow with the enchant Infinity III
    ebow.IV: Allows the use of the bow with the enchant Infinity IV
    ebow.V: Allows the use of the bow with the enchant Infinity V
    ebow.X: Allows the use of the bow with the enchant unbreaking X
    ebow.*: All permissions

    If they don't have the permissions, the bows act normally.

    It would also be great if it was posted on BukkitDev, since I'm sure a lot of people would like it.

    Bump

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

    drtshock

    Do you want it to actually shoot the entity or just have the same effect as the entity?
     
  3. Offline

    chakyl

    Shooting the entity would be preferred.
     
  4. Offline

    chasechocolate

    For any devs who might be interested, I think you would have to listen for PlayerInteractEvent, check if the item in hand is a bow, get enchantments, etc. As far as I am aware, there is no event that listens for when they let the arrow shoot from their bow.
     
  5. Offline

    zRations

    Actually, a more simple method would be to use bukkits ProjectileLaunchEvent. Check if the player has a certain enchanted bow in hand and add the velocity of that entity to the same of a arrow when shot from a bow. Then you can check where the entity lands and add a effect to that area.
     
  6. Offline

    teunie75

    Or the entityshootbowevent :p
     
  7. Offline

    CeramicTitan

    This is probably the easiest option
     
  8. Offline

    Woobie

    Code:
        @EventHandler
        public void onArrowShoot(EntityShootBowEvent e)
        {
            if(e.getEntity() instanceof Player)
            {
                Player p = (Player) e.getEntity();
                ItemStack item1 = new ItemStack(Material.BOW);
                if(item1.containsEnchantment(Enchantment.ARROW_INFINITE))
                {
                    e.setCancelled(true);
                    EnderPearl pearl = p.launchProjectile(EnderPearl.class);
                    pearl.setShooter(p);
                }
            }
        }
    With all the logic in the world, this should work.

    EDIT: Forgot to actually check if player used that bow to shoot, but you get the idea :D
     
  9. Offline

    chakyl

    Would you be interested in doing this? You seem to know what you're doing.
     
  10. Offline

    Woobie

    Sure, can't do this today though, busy with other plugins :)
     
  11. Offline

    chakyl

    Fair enough!
     
  12. Offline

    chakyl

    I don't mean to sound pushy, but any luck?
     
  13. Offline

    WarmakerT

    Infinity II, III, IV and V don't exist. The same goes for Unbreaking on bows.
     
  14. Offline

    drtshock

    unsafe enchants..
     
    chasechocolate and WarmakerT like this.
  15. Offline

    chakyl

    That's the point, I don't want everyone running around with them, but I do want them to be obtainable through shops. Is it impossible to do this on the development side of things?
     
  16. Offline

    drtshock

    Yes it's possible. I don't have time though. :\
     
  17. Offline

    Cybermaxke

    I am already using them into my new plugin, for containing custom ids, durability, eat effects, fight effects, ect ;)
     
  18. Offline

    chakyl

    Bump?
     

Share This Page