hotfixes; reworked player join event
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
42db4ba100
Commit
4dd63fb45e
@ -36,7 +36,10 @@ public class PlayerJoinListener implements Listener {
|
||||
player.setFoodLevel(20);
|
||||
player.getInventory().clear();
|
||||
|
||||
if (Fight.getPlayerTeam(player) == null) {
|
||||
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
|
||||
if (fightTeam == null) {
|
||||
|
||||
//TEXT COMPONENTS
|
||||
TextComponent publicList = new TextComponent("public");
|
||||
@ -46,10 +49,10 @@ public class PlayerJoinListener implements Listener {
|
||||
publicList.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist public"));
|
||||
|
||||
TextComponent privateList = new TextComponent("private");
|
||||
publicList.setColor(ChatColor.GOLD);
|
||||
publicList.setBold(true);
|
||||
publicList.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§ePrivate Liste...").create()));
|
||||
publicList.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist 0"));
|
||||
privateList.setColor(ChatColor.GOLD);
|
||||
privateList.setBold(true);
|
||||
privateList.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§ePrivate Liste...").create()));
|
||||
privateList.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ak schemlist 0"));
|
||||
//TEXT COMPONENTS
|
||||
|
||||
if(!Fight.getRedTeam().hasTeamLeader()) {
|
||||
@ -68,35 +71,6 @@ public class PlayerJoinListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
|
||||
if(fightTeam != null) {
|
||||
FightPlayer fightPlayer = fightTeam.getFightPlayer(player);
|
||||
|
||||
if(instance.getFightState() == FightState.SETUP) {
|
||||
if(fightTeam == Fight.redTeam) {
|
||||
player.teleport(Config.TeamRedSpawn);
|
||||
} else
|
||||
player.teleport(Config.TeamBlueSpawn);
|
||||
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
if(fightPlayer.isLeader()) SetupItems.giveSetupItems(player);
|
||||
if(fightPlayer.isOut()) {
|
||||
fightPlayer.setOut(false);
|
||||
Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE);
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightPlayer.getPlayer().getName() + " §aist dem Kampf wieder beigetreten!");
|
||||
} else
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightPlayer.getPlayer().getName() + " §aist dem Kampf beigetreten!");
|
||||
} else {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
if(fightTeam == Fight.redTeam)
|
||||
player.teleport(Config.TeamRedSpawn);
|
||||
else
|
||||
player.teleport(Config.TeamBlueSpawn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(Fight.getRedTeam().hasTeamLeader() && Fight.getBlueTeam().hasTeamLeader()) {
|
||||
Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE);
|
||||
Countdown countdown = new Countdown(Config.SetupDuration, new FinishSetupOver());
|
||||
|
@ -38,25 +38,33 @@ public class PlayerQuitListener implements Listener {
|
||||
fightTeam.removePlayer(player);
|
||||
if(!fightTeam.getPlayers().isEmpty()) {
|
||||
fightTeam.setLeader(fightTeam.getPlayers().get(0));
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightTeam.getPlayers().get(0).getPlayer().getDisplayName() + " §aist nun Leader von Team " + fightTeam.getName() == Fight.getRedTeam().getName() ?
|
||||
Config.TeamRedPrefix + Config.TeamRedName : Config.TeamBluePrefix + Config.TeamBlueName + "§a!");
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightTeam.getLeader().getPlayer().getDisplayName() + " §aist nun Leader von Team " + (fightTeam.getName() == Fight.getRedTeam().getName() ?
|
||||
Config.TeamRedPrefix + Config.TeamRedName : Config.TeamBluePrefix + Config.TeamBlueName + "§a!"));
|
||||
} else {
|
||||
for(Player players : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if(Fight.getPlayerTeam(players) != null) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Es gibt keine Spieler mehr die den Leader ersetzen können! \n Server stoppt...");
|
||||
Bukkit.shutdown();
|
||||
} else {
|
||||
if(Fight.getPlayerTeam(players) == null) {
|
||||
if(fightTeam.getLeader() == null) {
|
||||
FightPlayer fightPlayer = new FightPlayer(players, false);
|
||||
fightTeam.setLeader(fightPlayer);
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + players.getDisplayName() + " §aist nun Leader von Team " + fightTeam.getName() == Fight.getRedTeam().getName() ?
|
||||
Config.TeamRedPrefix + Config.TeamRedName : Config.TeamBluePrefix + Config.TeamBlueName + "§a!");
|
||||
}
|
||||
}
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §6" + fightTeam.getLeader().getPlayer().getDisplayName() + " §aist nun Leader von Team " + (fightTeam.getName() == Fight.getRedTeam().getName() ?
|
||||
Config.TeamRedPrefix + Config.TeamRedName : Config.TeamBluePrefix + Config.TeamBlueName + "§a!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(fightTeam.allPlayersOut() && FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
||||
if(fightTeam.getLeader() == null) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Es gibt keine Spieler mehr die den Leader ersetzen können! \n Server stoppt...");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
}
|
||||
} else if(fightState == FightState.PRE_RUNNING || fightState == FightState.RUNNING) {
|
||||
fightTeam.getFightPlayer(player).setOut(true);
|
||||
if(!Config.AllDead && !Config.CaptainDead)
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Spieler §6" + player.getName() + " §chat den Kampf verlassen!");
|
||||
}
|
||||
}
|
||||
|
||||
if(fightTeam.getPlayers().isEmpty() && FightSystem.getPlugin().getFightState() == FightState.SETUP) {
|
||||
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cAlle Spieler aus dem Team " + fightTeam.getName() + " §chaben den Kampf verlassen!");
|
||||
Countdown countdown = new Countdown(30, new FinishNoPlayersOnline());
|
||||
countdown.startTimer(FightSystem.getPlugin());
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren