moved Deathmessage to own class
All checks were successful
Gitea Actions Demo / Build-Gradle (push) Successful in 4m52s

This commit is contained in:
Your Name
2025-07-30 01:27:43 +02:00
parent 37570c6c4a
commit 232b7a395c

View File

@@ -0,0 +1,35 @@
//GPT'd
package de.hessj.environmentex;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class DeathLoc implements Listener {
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Location deathLoc = player.getLocation();
new BukkitRunnable() {
@Override
public void run() {
if (!player.isOnline())
return;
player.spigot().respawn();
String coords = String.format("Todeskoordinaten: %d %d %d",
deathLoc.getBlockX(),
deathLoc.getBlockY(),
deathLoc.getBlockZ());
player.sendMessage(coords);
}
}.runTaskLater(App.main, 1L);
}
}