Explorar el Código

fix giving items on respawn

RedstoneFuture hace 3 años
padre
commit
6e6194af36

+ 8 - 5
missilewars-plugin/src/main/java/de/butzlabben/missilewars/listener/GameListener.java

@@ -241,15 +241,21 @@ public class GameListener extends GameBoundListener {
         if (!isInGameWorld(e.getPlayer().getLocation()))
             return;
 
-        Team t = Objects.requireNonNull(getGame().getPlayer(e.getPlayer())).getTeam();
+        Game game = getGame();
+        Player player = e.getPlayer();
+
+        Team t = Objects.requireNonNull(getGame().getPlayer(player)).getTeam();
         if (t != null) {
             e.setRespawnLocation(t.getSpawn());
             FallProtectionConfiguration fallProtection = getGame().getArena().getFallProtection();
             if (fallProtection.isEnabled())
-                new RespawnGoldBlock(e.getPlayer(), fallProtection.getDuration(), fallProtection.isMessageOnlyOnStart(), getGame());
+                new RespawnGoldBlock(player, fallProtection.getDuration(), fallProtection.isMessageOnlyOnStart(), getGame());
         } else {
             e.setRespawnLocation(getGame().getArena().getSpectatorSpawn());
         }
+
+        game.sendGameItems(player, true);
+        game.setPlayerAttributes(player);
     }
 
     @EventHandler
@@ -279,9 +285,6 @@ public class GameListener extends GameBoundListener {
             return;
         }
 
-        game.sendGameItems(p, true);
-        game.setPlayerAttributes(p);
-
         // check the death cause for choice the death message
         if (p.getLastDamageCause() != null) {