File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/main/java/de/kiridevs/ksmpplugin Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ import org .bukkit .event .Listener ;
2
+ import de .kiridevs .ksmpplugin .main .KiriSmpPlugin ;
3
+ import org .bukkit .event .EventHandler ;
4
+ import org .bukkit .event .player .PlayerDeathEvent ;
5
+ import org .bukkit .entity .Player ;
6
+ import org .bukkit .Location ;
7
+ import org .bukkit .Bukkit ;
8
+
9
+ public class DeathMessage implements Listener {
10
+ private static final String MESSAGE_FORMAT = "You died at X=%d, Y=%d, Z=%d" ;
11
+
12
+ private final KiriSmpPlugin plugin ;
13
+
14
+ public DeathMessage (KiriSmpPlugin plugin ) {
15
+ this .plugin = plugin ;
16
+ }
17
+
18
+ @ EventHandler
19
+ public void onPlayerDeath (PlayerDeathEvent deathEvent ) {
20
+ Player player = deathEvent .getPlayer ();
21
+ Location loc = player .getLocation ();
22
+
23
+ player .sendMessage (MESSAGE_FORMAT .formatted (
24
+ (int ) loc .getX (),
25
+ (int ) loc .getY (),
26
+ (int ) loc .getZ ()
27
+ ));
28
+ }
29
+
30
+ public void init (KiriSmpPlugin plugin ) {
31
+ this .plugin .log .info ("features: DragonBuff: Initializing" );
32
+ Bukkit .getPluginManager ().registerEvents (this , this .plugin );
33
+ }
34
+ }
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ private void registerRecipes() {
40
40
public void initFeatures () {
41
41
new DragonBuff (this ).init ();
42
42
new EndCrystalBuff (this ).init ();
43
+ new DeathMessage (this ).init ();
43
44
}
44
45
45
46
@ Override
You can’t perform that action at this time.
0 commit comments