SteamWar/FightSystem
Archiviert
13
1

join anytime #359

Zusammengeführt
Lixfel hat 9 Commits von joinAnytime nach master 2023-06-25 20:11:51 +02:00 zusammengeführt
3 geänderte Dateien mit 15 neuen und 5 gelöschten Zeilen
Nur Änderungen aus Commit 5e4190ea75 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -307,6 +307,8 @@ public class FightTeam {
if(player.isOnline()){
FightSystem.getTechHider().reloadChunks(player, chunksToReload, true);
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.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.fight.HotbarKit;
import de.steamwar.fightsystem.fight.JoinRequest;
import de.steamwar.fightsystem.states.FightState;
@ -35,6 +36,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
public class JoinRequestListener implements Listener {
@ -48,8 +50,17 @@ public class JoinRequestListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onJoin(PlayerJoinEvent event) {
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);
}
}
@EventHandler
public void handlePlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
if(Fight.fighting(player)) {
HotbarKit.SPECTATOR_KIT.loadToPlayer(player);
}
}

Datei anzeigen

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