[Request] Get inventory before player Die ...

Discussion in 'Plugin Development' started by BioBG, Apr 13, 2014.

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

    BioBG

    Hello!

    Can u help me with plugin i need to my server.

    Can someone give me a simple code, how can i get the player inventory before Die and store it in sql table.

    Best regards
    BioBG
    Tnx!

    Code:java
    1. public class info extends JavaPlugin implements Listener {
    2.  
    3. public info plugin;
    4. protected static Logger log;
    5.  
    6. public void log(String msg){
    7. this.getLogger().info(msg);
    8. }
    9.  
    10. Commands cmd;
    11. public void onEnable() {
    12. getServer().getPluginManager().registerEvents(this, this);
    13. plugin = this;
    14. }
    15.  
    16. @EventHandler
    17. public void onPlayerDeath(PlayerDeathEvent event) {
    18. Player player = (Player) event.getEntity();
    19. if (player.getKiller() instanceof Player) {
    20.  
    21. // the code
    22.  
    23. }
    24.  
    25.  
    26.  
    27.  
    28. public void onDisable() {
    29.  
    30. log.info("Plugin has been Disabled!");
    31. }
    32. }
    33.  


    Can i modified this code ?

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

    Onlineids

    Wrong section, and try to serialize the inventory
     
  3. Offline

    Jade

    Moved to a more appropriate section, I guess?
     
  4. Offline

    RawCode

    if you read apidocs carefully you will notice - death event trigger BEFORE player die
     
  5. Offline

    leet4044

    getInventory().getContents() ??
     
Thread Status:
Not open for further replies.

Share This Page