Throw an Item plugin: I have code already

Discussion in 'Plugin Requests' started by aNeonGamer, Nov 2, 2014.

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

    aNeonGamer

    Hey guys

    2 years later, this plugin needs to be updated. "Throw that item" was a private plugin created by deApollo that throws items when you left click. Can someone put this code into a plugin and add options to change:

    - Speed of which you throw
    - Items that can be thrown?

    @EventHandler
    public void onInteract(PlayerInteractEvent event){
    Action a = event.getAction();
    if(a.equals(Action.LEFT_CLICK_AIR)||a.equals(Action.LEFT_CLICK_BLOCK)){
    Player p = event.getPlayer();
    ItemStack thrown = p.getItemInHand();
    if(thrown==null) return;
    p.getInventory().remove(thrown);
    Item dropped = p.getWorld().dropItem(p.getLocation(), thrown);
    dropped.setVelocity(p.getLocation().getDirection().normalize().multiply(2.5)); //<-- change the 2.5 until you get a good speed
    }
    }

    Thank you!
     
  2. Offline

    Zix

    Working on this now c:
     
  3. aNeonGamer Ouch, how long were you actually using this plugin for? I'm guessing your players weren't the left clicking sort of people?
     
  4. Offline

    mrCookieSlime

    aNeonGamer
    Wait, how did they use a sword then? ^^
     
  5. mrCookieSlime How did they use any left click items (i.e. most of them)? ;)
     
  6. Offline

    mrCookieSlime

    Exactly. However I cant think of any other left click Items besides Swords...

    EDIT: Ignore everything above I totally forgot about Tools 0_0
     
  7. Online

    timtower Administrator Administrator Moderator

    Hoe, snowball, click a door / trapdoor / button / inventory / bow / block
     
  8. Offline

    mrCookieSlime

    left click items...
    Also see my Edit ^^
     
    timtower likes this.
  9. mrCookieSlime To be fair, there aren't that many items per se, just 80% of the basic tools: Swords, Axes, Pickaxes, Spades...

    Edit: Only just saw your edit :p
     
    mrCookieSlime likes this.
  10. Offline

    mrCookieSlime

    Oh yea... But what would Minecraft be without breaking Blocks and fighting :?
    What are you supposed to do in this Gamemode or Server then...
     
    AdamQpzm likes this.
  11. mrCookieSlime *shrugs* Wasn't trying to defend the plugin, just revising my original statement a little.
     
  12. Offline

    mrCookieSlime

    Errr, it actually wasnt meant like that. ^^
    I agree to you, I was just pointing out that without the aspects you have mentioned, Minecraft would be a little *weird*
     
    AdamQpzm likes this.
  13. Offline

    aNeonGamer

    Awesome! Thank you. When will it be done??? My friend didn't believe someone would make this plugin again!! :)))

    I think you are mistaken. When you left click the item you are holding, it is thrown. So, if you left clicked a sword, that sword would be thrown forward.

    EDIT by Timtower: Merged double post
     
  14. Offline

    mrCookieSlime

    aNeonGamer
    Please dont double post. There is an Edit Button right next to the Date.
    And make sure to tag the person you are talking to otherwise he/she might not see your post.

    And why were we mistaken?
    We all understood that you want to throw items with left click. We just cannot understand why this would be useful.
     
  15. Offline

    awesomer3

  16. Offline

    aNeonGamer

    Awesome man thank you so much! Exactly what I needed!
    Request: could you make it so you can configure what blocks can be thrown and how fast/far they can be thrown in a .yml file? This was my main goal. Thanks so much man.
     
  17. Offline

    awesomer3

Thread Status:
Not open for further replies.

Share This Page