Shrink worldborder when player dies

Discussion in 'Plugin Development' started by zJanny, Sep 30, 2019.

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

    zJanny

    Hello,
    How to i shrink the worldborder when a player dies automaticly?
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    zJanny

    I read this.
    But i dont know how to do it with playerdeath or player respawn event
     
  4. Offline

    timtower Administrator Administrator Moderator

    Get the border when somebody does, get the old size, set that size-1
     
    Sir_Jonn likes this.
  5. Offline

    zJanny

    This wont work, i cant use it on the event
     
  6. Offline

    timtower Administrator Administrator Moderator

    And why not?
     
  7. Offline

    zJanny

    Can you send me an example of this or how to do it? I dont get it
     
  8. Offline

    timtower Administrator Administrator Moderator

    Start by listening to the event.
     
  9. Offline

    zJanny

    I alreay have it
    Code:
    @EventHandler
              public void onPlayerDeath(PlayerDeathEvent e) {     
     
  10. Offline

    timtower Administrator Administrator Moderator

    @zJanny In there, get the worldborder.
     
  11. Offline

    zJanny

    With
    double getSize()?
     
  12. Offline

    timtower Administrator Administrator Moderator

    @zJanny You need to get the worldborder object first.
     
  13. Offline

    zJanny

    How do i get this object?
     
  14. Offline

    timtower Administrator Administrator Moderator

    See the first link I posted.
     
  15. Offline

    zJanny

    I dont find anything how to get the Object
     
  16. Offline

    timtower Administrator Administrator Moderator

  17. Offline

    zJanny

    p.getPlayer().getWorld().getWorldBorder();
    right?

    I think i got it p.getPlayer().getWorld().getWorldBorder().setSize(-25);
    I testing it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 2, 2019
  18. Offline

    timtower Administrator Administrator Moderator

    It is an absolute value, not relative.
     
  19. Offline

    zJanny

    I now have this code: p.getPlayer().getWorld().getWorldBorder().getSize();
    but i cant set the size after getSize() "Cannot invoke setSize(int) on the primitive type double"
     
    Last edited: Oct 2, 2019
  20. @zJanny
    1. What is p?
    2. What exactly are you typing?
     
  21. Offline

    zJanny

    p is the player

    Can someone please send me the code how i can shrink the world border 25 blocks on the Player death event?
    I really dont know unterstand it

    Ive got it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 2, 2019
  22. Offline

    timtower Administrator Administrator Moderator

    @zJanny You need to get the size.
    Decrease it.
    Set it again.
     
  23. Offline

    zJanny

    Okay i got this now, but now could you please help me how to make a /chestlock command?
     
  24. Offline

    timtower Administrator Administrator Moderator

    Make a new thread for that.
     
Thread Status:
Not open for further replies.

Share This Page