Force Respawn

Hello, do you know the plugin Instant Respawn? or nodeathscreen?
I want to remove the death screen, because i want to create a ghost when you die.
but only for a time, and i can do it when they respawn but it’s more beautiful without death screen.
i know i have to send a package to client, but i don’t know how to create this.

Do i have to import anything?

thx for help

Well, if you prevent the player from actually dying and put them in a custom state of death handled by the plugin, that would make life much easier on you.

the player can dye by a lot of ways in my server, if i have to prevent ALL it will be too long.
any other ways?

What? Just cancel the player death event or whatever.

the PlayerDeathEvent is not cancellable. i can’t i have to prevent all damage who can kill

Then watch the damage events and if the player is about to die, cancel the event and throw them in your mode.

You can use this method to force a player to repsawn when they’re at the death screen.

Thx for this answer it works but not a lot, i had to put a scheduler to respawn, but after a little moment (3-4 second) i die again or the server crash
here it’s the error when i die after a while

here my part of code

	    public void onPlayerDeath(DestructEntityEvent.Death e) {
	    	Living p = e.getTargetEntity();
	    	if(p instanceof Player){
	    		this.getDeathClass().setLastDeath((Player) p, e.getCause()); 
	    		String cause = this.getDeathClass().getLastDeath((Player) p); // get causes
	    		this.getDeathClass().mourir((Player) p, cause); // logs
	    		 Scheduler scheduler = game.getScheduler();
					Builder taskBuilder = scheduler.createTaskBuilder();
					taskBuilder.execute(new Runnable() {
					    public void run() {
					    	((Player) p).respawnPlayer();
					}).async().delay(1000, TimeUnit.MILLISECONDS).name("Ressourcepack retardee").submit(this);

i tried to remove the .async()
same result without error but in the log i died two times for the same reason

You definitely don’t want to do that asynchronous.
I just tested your code and noticed that after respawn the player input didn’t work. I’ve identified the issue in spongecommon so a fix will be out soon.

Fixed the issue

1 Like