ClearDrops after time?

Discussion in 'Plugin Development' started by MCraftGamer35, Nov 16, 2014.

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

    MCraftGamer35

    Timers are generally a pain, especially when you know only little of them.

    I'm trying to code that when a player dies, there items drop, but three seconds after the death, the items clear.

    Code Feeding would be appreciated.
     
  2. Offline

    Skionz

  3. Offline

    MCraftGamer35

  4. Offline

    Marcthecool

    We'll, I develop plugins, but I don't understand what you are trying to do. <Timtower says: no skype> Thanks! image.jpg
     
  5. Offline

    timtower Administrator Administrator Moderator

  6. Offline

    Skionz

    MCraftGamer35 Your going to have to use either a delayed task or create a new thread.
     
  7. Offline

    MCraftGamer35

    Obviously it is the way to learn, because seeing the code will help me know how to do it. timtower
     
  8. Offline

    timtower Administrator Administrator Moderator

    MCraftGamer35 I helped multiple people that will say otherwise.
    Make this in steps, timed messages, listening to the events, combining those too.
     
  9. I disagree. You can look at code and copy paste it, but if it's not explained then you're learning nothing.
     
  10. Offline

    MCraftGamer35

    timtower and Skionz

    Here's my code, it dosen't work, please be considerate and tell me what I did wrong. Btw I did create a int, for 3 seconds, you can't see it here though.

    Code:java
    1. @EventHandler
    2. public void onDeath(final PlayerDeathEvent e){
    3. this.getServer().getScheduler().scheduleAsyncDelayedTask(this, new Runnable() {
    4. public void run(){
    5. if(n != -1){
    6. if(n != 0){
    7. n--;
    8. } else {
    9. Player p = e.getEntity();
    10. p.getDrops.clear());
    11. n--;
    12. }
    13. }
    14. }
    15. }, 0L);
    16. }
    17. }


    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
Thread Status:
Not open for further replies.

Share This Page