SteamWar/FightSystem
Archiviert
13
1

Limit JoinAnytime to variable teams
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-06-25 20:07:41 +02:00
Ursprung cbb0dcf8eb
Commit 5e4190ea75
3 geänderte Dateien mit 15 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -307,7 +307,9 @@ public class FightTeam {
if(player.isOnline()){ if(player.isOnline()){
FightSystem.getTechHider().reloadChunks(player, chunksToReload, true); FightSystem.getTechHider().reloadChunks(player, chunksToReload, true);
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
if(ArenaMode.VariableTeams.contains(Config.mode))
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
} }
} }

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.HotbarKit; import de.steamwar.fightsystem.fight.HotbarKit;
import de.steamwar.fightsystem.fight.JoinRequest; import de.steamwar.fightsystem.fight.JoinRequest;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
@ -35,6 +36,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
public class JoinRequestListener implements Listener { public class JoinRequestListener implements Listener {
@ -48,12 +50,21 @@ public class JoinRequestListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onJoin(PlayerJoinEvent event) { public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
FightPlayer fp = Fight.getFightPlayer(player);
if (!Config.ArenaLeaveable && !Fight.fighting(player)) { if (!Config.ArenaLeaveable && (fp == null || !fp.isLiving())) {
HotbarKit.SPECTATOR_KIT.loadToPlayer(player); HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
} }
} }
@EventHandler
public void handlePlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
if(Fight.fighting(player)) {
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
}
}
@EventHandler @EventHandler
public void onLeave(PlayerQuitEvent event) { public void onLeave(PlayerQuitEvent event) {
JoinRequest request = JoinRequest.get(event.getPlayer()); JoinRequest request = JoinRequest.get(event.getPlayer());

Datei anzeigen

@ -25,7 +25,6 @@ import de.steamwar.fightsystem.FightSystem;
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.fight.HotbarKit;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.BountifulWrapper; import de.steamwar.fightsystem.utils.BountifulWrapper;
@ -77,7 +76,6 @@ public class Permanent implements Listener {
FightTeam team = Fight.getPlayerTeam(player); FightTeam team = Fight.getPlayerTeam(player);
event.setRespawnLocation(team == null ? Config.SpecSpawn : team.getSpawn()); event.setRespawnLocation(team == null ? Config.SpecSpawn : team.getSpawn());
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
} }
} }
@ -103,7 +101,6 @@ public class Permanent implements Listener {
player.teleport(Config.SpecSpawn); player.teleport(Config.SpecSpawn);
} else if(fp != null && !fp.isLiving()) { } else if(fp != null && !fp.isLiving()) {
Fight.setPlayerGamemode(player, GameMode.SPECTATOR); Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
player.teleport(fp.getTeam().getSpawn()); player.teleport(fp.getTeam().getSpawn());
} }
} }