If you inventory.clear() on Respawn is it just the inventory that the player had on his body as a standard game start or will it delete his body inventory too?
on RespawnEvent
-
- English
- angriff
- Thread is marked as Resolved.
-
-
Basically what I am trying to do is reset or change the Respawn vs the Spawn first time inventory. I guess I have to find a different way and remove it one by one since this does not work. Or do I have to clear and and then set it as an attribute.. not sure. I will try something different.
@EventMethod
public void onPlayerRespawn(PlayerRespawnEvent event){
// Inventory inventory = player.getInventory();
event.getPlayer().getInventory().clear();
} -
Basically your approach is correct. However, unfortunately the "PlayerRespawnEvent" is called before the inventory of the player is changed (i.e. set back to the spawn inventory), so any changes you've done to the inventory will be overridden...
We will add a new "setKeepInventory()" setting to the respawn event with the next update, so if you call it and set it to true, the player will keep his inventory (so you can change the inventory within the event) -
Thanks Red ..I was thinking something that was going on and was going to put a timer to delay the command but I thought I would see if there was something else. It will be nice to change the initial spawning with the respawn for a couple of reasons. One is you put a few things in an initial spawn for a new player and some guy found a work around some of my restriction with committing suicide all day long to get the specialized items. The other is no need for 400 stone axes in all the chests in the game.
-
What about the person that is trying multiplayer for the first time and finds themselves stuck in a well!... asking for a friend... I swear this didn't happen to me! This is why we need 400 stone axes in every chest
-
What about the person that is trying multiplayer for the first time and finds themselves stuck in a well!... asking for a friend... I swear this didn't happen to me! This is why we need 400 stone axes in every chest
A stone axe will not help you on my server. You just better send an ingame email to the Admin.
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!