SteamWar/MissileWars
Archiviert
13
0

Add distribute items on team leave

Dieser Commit ist enthalten in:
zOnlyKroks 2021-04-04 14:05:25 +02:00
Ursprung 140b8f65ad
Commit 43a64c77b6
2 geänderte Dateien mit 121 neuen und 113 gelöschten Zeilen

Datei anzeigen

@ -129,7 +129,16 @@ public class MWTeam {
public void leave(Player p) { public void leave(Player p) {
if (!players.contains(p)) return; if (!players.contains(p)) return;
ItemStack[] savedInventory = p.getInventory().getContents();
players.remove(p); players.remove(p);
p.getInventory().clear();
for (ItemStack stack : savedInventory) {
if (stack == null) continue;
if (stack.getType() == Material.AIR) continue;
if (stack.isSimilar(bow)) continue;
givePlayerItem(stack);
}
p.setDisplayName("§7" + p.getName()); p.setDisplayName("§7" + p.getName());
sbteam.removePlayer(p); sbteam.removePlayer(p);
if (players.isEmpty() && MissileWars.getFightState() == FightState.FIGHTING) if (players.isEmpty() && MissileWars.getFightState() == FightState.FIGHTING)

Datei anzeigen

@ -47,5 +47,4 @@ public class ConnectionListener extends BasicListener{
MWTeam.removeInvitations(e.getPlayer()); MWTeam.removeInvitations(e.getPlayer());
MissileWars.leave(e.getPlayer()); MissileWars.leave(e.getPlayer());
} }
} }