How to clear a players inventory?

Discussion in 'Plugin Development' started by gabrielmaennl555, Jun 5, 2014.

Thread Status:
Not open for further replies.
  1. Hello I'm making a KitPVP Plugin for my server and wondering how would i clear a players inventory? thanks!
     
  2. Offline

    fireblast709

  3. Offline

    ever_x

    Code:java
    1.  
    2. player.getInventory().clear();
    3. player.getInventory().update();
    4.  
     
  4. Offline

    MrTheoker

    I think it's player.updateInventory();
     
  5. Offline

    fireblast709

    Feed me more code
     
  6. fireblast709
    PHP:
    ForumUser fireblast709 Bukkit.getForums().getUser(90726753);
    while(
    fireblast709.isHungry())
        
    fireblast709.feed(this);
     
    EpicCraft21, FisheyLP, es359 and 2 others like this.
  7. Offline

    ever_x

    I only fed him because this is ridiculously easy. Just sayin'
     
  8. Offline

    fireblast709

    ever_x thus destroying the process of him taking the initiative to actually read the javadocs.
     
    unforgiven5232 likes this.
  9. Offline

    ever_x

  10. Offline

    Necrodoom

    Thats like saying "Who needs java" for writing bukkit plugins.
    Answer is: EVERYONE SHOULD
     
    es359 and AoH_Ruthless like this.
  11. Offline

    ever_x

    Necrodoom I know, but my point was that by doing the CTRL+SPACE thing in eclipse, he could have looked through and found the two methods. Browsing the JavaDocs for something so simple would just confuse him even more.
     
  12. ever_x If he managed to be confused by browsing the JavaDocs while trying to find out that simple method, he probably isn't ready to be developing plugins. And I would argue that the IDE's suggestions are essentially a less detailed, less accurate version of JavaDocs.
     
  13. Offline

    aFreshKiwi

    Define the inventory;

    PlayerInventory pi = player.getInventory(); // Assumes you've defined player elsewhere

    Clear the inventory;

    pi.Clear();
    pi.setArmorContents(null); // take this out if you want them to keep armor

    // Done
     
  14. Offline

    ever_x

    AdamQpzm Don't worry, he's making a KitPVP plugin. I think we can safely assume he has no idea how to research anything himself (JavaDoc or IDE help), and simply resorts to annoying us with stupid questions on these forums. That in turn causes this very simple thread to turn into a full blown debate, rather than simply giving him the fozzing code and understanding the fact that idiots like him never learn, just feed from us.
     
  15. Offline

    fireblast709

    ever_x that does not justify spoon feeding. Rather teach him how to research, so he can find it himself. That will both speed up his development, fill less threads with spoon feeding & discussions about it. That aside, if someone refuses to learn, he does not deserve to be helped (since this subforum is all about helping with development, if someone wants to be fed, point them to plugin requests)
     
    AdamQpzm likes this.
  16. ever_x If that's truly what you believe, then I don't think that you've thought your actions through at all. You state that the OP will just ask us and will never learn, and that there's not much point in helping him. In that case, spoon-feeding is making the situation worse. If he's fed code, he'll know he can come here at any time and have it done for him. If he's not fed, he'll have two options: give up, or learn for himself. Either way, not feeding him is clearly the better option. Your reasoning is hypocritical.
     
  17. Offline

    ever_x

    AdamQpzm
    Um, isn't that what I said before? My point was that if I help him very quickly, he will go away and realise he can't make plugins. That actually HELPS these forums to become less cluttered. What doesn't help is you having a massive rant about me and my reasoning for what I did.
    'Nuff said
     
  18. ever_x Disagreed. Knowing he'll be given the code means he'll come back. Knowing he has to learn himself, he'll either do that or give up.
     
Thread Status:
Not open for further replies.

Share This Page