@@ -49,18 +49,21 @@ private void onDeath(PlayerDeathEvent event) {
4949
5050 @ EventHandler
5151 private void onDismount (EntityDismountEvent event ) {
52- if (event .getEntity () instanceof Player player ) {
53- player .setGameMode (GameMode .SURVIVAL );
54- if (event .getDismounted () instanceof EnderDragon ) {
55- game .dismountWithTeam (GameUserManager .getGameUser (player ));
56- player .getInventory ().addItem (ItemBuilder .of (Material .FIREWORK_ROCKET ).build ());
57- player .getInventory ().setChestplate (ItemBuilder .of (Material .ELYTRA ).build ());
58- player .setGliding (true );
59- }
60- if (event .getDismounted () instanceof Player ) {
61- player .getInventory ().addItem (ItemBuilder .of (Material .FIREWORK_ROCKET ).build ());
62- player .getInventory ().setChestplate (ItemBuilder .of (Material .ELYTRA ).build ());
63- player .setGliding (true );
52+ if (game .getPhase () instanceof InGamePhase ) {
53+ if (event .getEntity () instanceof Player player ) {
54+ if (game .getDeadPlayers ().contains (player .getName ())) return ;
55+ if (event .getDismounted () instanceof EnderDragon ) {
56+ game .dismountWithTeam (GameUserManager .getGameUser (player ));
57+ player .getInventory ().addItem (ItemBuilder .of (Material .FIREWORK_ROCKET ).build ());
58+ player .getInventory ().setChestplate (ItemBuilder .of (Material .ELYTRA ).build ());
59+ player .setGliding (true );
60+ }
61+ if (event .getDismounted () instanceof Player ) {
62+ player .getInventory ().addItem (ItemBuilder .of (Material .FIREWORK_ROCKET ).build ());
63+ player .getInventory ().setChestplate (ItemBuilder .of (Material .ELYTRA ).build ());
64+ player .setGliding (true );
65+ }
66+ player .setGameMode (GameMode .SURVIVAL );
6467 }
6568 }
6669 }
0 commit comments