.

Discussion in 'Plugin Development' started by elementalgodz11, Nov 20, 2013.

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

    elementalgodz11

  2. Offline

    super292

    elementalgodz11 I remove the item based on velocity. Like if the item is named swag, run swag.remove() when the velocity is equal to zero. Maybe try that? It works for me :)
     
  3. I think you can use PlayerInteractEvent to detect when the player places the block. Then you can remove the empty bucket from the inventory. I think that is what you want.

    elementalgodz11
    So, basically what you want is:
    - The player drops the water bucket;
    - The bucket disappears when thouch the ground, unless someone get it.

    This is right?

    I never worked with velocity, like super292 said, but it seems to be what you want. If you want to give a try to the player, you could set a variable for the max "jumps" the item can do. Then, when the value reaches 0 and the velocity reaches 0, you remove the item.

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

    super292

    Auhmaan elementalgodz11 Exactly, you run a scheduleSyncRepeatingTask and every tick or two test it for zero velocity. Once it tests positive for 0 velocity, remove it
     
  5. elementalgodz11 I made a very quick search to see if there exists an event that listen the velocity of an entity... And failed... xD But the idea from super292 seems to be the best to do that, except that I would change the schedule timer from 1 tick to maybe 10 or more because if you have a huge number of players dropping items, checking the velocity for each item every tick could, maybe, cause lag. I'll continue to search for Listeners to "keep an eye" on an entity velocity.
     
  6. Offline

    sgavster

    Why not if(item.isOnGround()) {?
     
    elementalgodz11 likes this.
Thread Status:
Not open for further replies.

Share This Page