1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Keep inventory for 1 user

Discussion in 'Development' started by xXNiceAssassinlo YT, Jun 25, 2018.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    how do I enable keep inventory for only 1 player?

    If possible
     
  2. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    You could fork WorldProtect and add a permission for game-save-inv.
     
  3. abdullah

    abdullah Spider

    Messages:
    14
    GitHub:
    x3boodx
    you can save his inventory in config at onMove event and if he died you give him his items again
     
  4. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Do you mean:
    PHP:
    if ($player->getName() == "Steve"){
    //keep inventory
    }
     
  5. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    I think keep inv function is only in death event
     
    KHAV likes this.
  6. KHAV

    KHAV Baby Zombie

    Messages:
    152
    GitHub:
    xkhhv
    Yeah you right but he should put that code i posted in death event
     
  7. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    If you were to save the inventory, I'd just do it on Inventory events, so it isn't running a player check every time any player moves.
    Since you haven't mentioned whether you found a solution or not: PlayerDeathEvent setKeepInventory function.
     
  8. byyEmirhanWSD

    byyEmirhanWSD Witch

    Messages:
    50
    GitHub:
    EmirhanWSD
    PHP:
    public function death(PlayerDeathEvent $e) {
      if(
    $e->getPlayer()->getName() == "name") {
          
    $e->setKeepInventory(true);

      }

    }
     
  9. Primus

    Primus Zombie Pigman

    Messages:
    749
    All of your solutions involve configs and move event :confused:
     
  10. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    You'll be better off doing as I suggested. WorldProtect with game-save-inv set to 'true' saves survival inventory data to player dat files.
     
    corytortoise likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.