SteamWar/FightSystem
Archiviert
13
1

Fix player despawn

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-11-02 12:13:57 +01:00
Ursprung d9dede725b
Commit 5b12e10b98
2 geänderte Dateien mit 9 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -55,22 +55,6 @@ public class EventRecordListener extends BasicListener {
super(Config.recording() ? EnumSet.allOf(FightState.class) : EnumSet.noneOf(FightState.class)); super(Config.recording() ? EnumSet.allOf(FightState.class) : EnumSet.noneOf(FightState.class));
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent e){
if(isNotSent(e.getPlayer()))
return;
RecordSystem.playerJoins(e.getPlayer());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLeave(PlayerQuitEvent e) {
if(isNotSent(e.getPlayer()))
return;
RecordSystem.entityDespawns(e.getPlayer());
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent e){ public void onPlayerMove(PlayerMoveEvent e){
if(isNotSent(e.getPlayer())) if(isNotSent(e.getPlayer()))

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.fightsystem.countdown.SWSound;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.record.RecordSystem;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
@ -89,6 +90,8 @@ public class PlayerStateListener extends BasicListener{
Fight.setPlayerGamemode(player, GameMode.SPECTATOR); Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
player.teleport(fightTeam.getSpawn()); player.teleport(fightTeam.getSpawn());
Fight.playSound(Countdown.getSound(SWSound.ENTITY_WITHER_DEATH), 100.0F, 1.0F); Fight.playSound(Countdown.getSound(SWSound.ENTITY_WITHER_DEATH), 100.0F, 1.0F);
if(Config.recording())
RecordSystem.entityDespawns(player);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -103,11 +106,17 @@ public class PlayerStateListener extends BasicListener{
FightState fightState = FightSystem.getFightState(); FightState fightState = FightSystem.getFightState();
if(fightState.setup()){ if(fightState.setup()){
fightTeam.removePlayer(player); fightTeam.removePlayer(player);
if(Config.recording())
RecordSystem.entityDespawns(player);
}else if(fightState.ingame()){ }else if(fightState.ingame()){
FightPlayer fightPlayer = fightTeam.getFightPlayer(player); FightPlayer fightPlayer = fightTeam.getFightPlayer(player);
if(fightPlayer.isLiving()) { if(fightPlayer.isLiving()) {
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §chat den Kampf verlassen!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler " + fightTeam.getPrefix() + player.getName() + " §chat den Kampf verlassen!");
fightTeam.getFightPlayer(player).setOut(); fightTeam.getFightPlayer(player).setOut();
if(Config.recording())
RecordSystem.entityDespawns(player);
} }
} }