SteamWar/FightSystem
Archiviert
13
1
Dieser Commit ist enthalten in:
Lixfel 2019-09-18 06:51:20 +02:00
Ursprung 3e5d0499b2
Commit 79bec4177f
7 geänderte Dateien mit 22 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -178,6 +178,8 @@ public class FightSystem extends JavaPlugin {
private static void loadKits(FightTeam team){ private static void loadKits(FightTeam team){
for(FightPlayer allFightPlayers : team.getPlayers()) { for(FightPlayer allFightPlayers : team.getPlayers()) {
if(allFightPlayers.getPlayer() == null)
continue;
allFightPlayers.getPlayer().getInventory().clear(); allFightPlayers.getPlayer().getInventory().clear();
allFightPlayers.getKit().loadToPlayer(allFightPlayers.getPlayer()); allFightPlayers.getKit().loadToPlayer(allFightPlayers.getPlayer());
} }
@ -232,4 +234,11 @@ public class FightSystem extends JavaPlugin {
public static boolean isEntern() { public static boolean isEntern() {
return entern; return entern;
} }
public static void shutdown(String reason){
if(reason != null)
Bukkit.broadcastMessage(reason);
Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(null));
Bukkit.shutdown();
}
} }

Datei anzeigen

@ -1,7 +1,7 @@
package de.steamwar.fightsystem.countdown; package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.utils.Config; import de.steamwar.fightsystem.utils.Config;
import org.bukkit.Bukkit;
import org.bukkit.Sound; import org.bukkit.Sound;
public class SpectateOverCountdown extends Countdown { public class SpectateOverCountdown extends Countdown {
@ -17,6 +17,6 @@ public class SpectateOverCountdown extends Countdown {
@Override @Override
public void countdownFinished() { public void countdownFinished() {
Bukkit.shutdown(); FightSystem.shutdown(null);
} }
} }

Datei anzeigen

@ -164,8 +164,7 @@ public class FightTeam {
setLeader(players.iterator().next()); setLeader(players.iterator().next());
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §e" + leader.getPlayer().getName() + " §aist nun Leader von Team " + getName() + "§a!"); Bukkit.broadcastMessage(FightSystem.PREFIX + "§aDer Spieler §e" + leader.getPlayer().getName() + " §aist nun Leader von Team " + getName() + "§a!");
}else if(!Config.event()){ }else if(!Config.event()){
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cTeam " + getName() + " §chat keine Spieler mehr.\n Arena schließt..."); FightSystem.shutdown(FightSystem.PREFIX + "§cTeam " + getName() + " §chat keine Spieler mehr.\n Arena schließt...");
Bukkit.shutdown();
}else{ }else{
setLeader(null); setLeader(null);
} }

Datei anzeigen

@ -45,7 +45,7 @@ public class KitManager {
if(!new File(KITS_PATH).exists()) { if(!new File(KITS_PATH).exists()) {
saveAllKits(); saveAllKits();
Bukkit.getLogger().log(Level.INFO, "kits.data erstellt!"); Bukkit.getLogger().log(Level.INFO, "kits.data erstellt!");
Bukkit.shutdown(); FightSystem.shutdown(null);
return; return;
} }

Datei anzeigen

@ -1,12 +1,11 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.utils.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.commands.GUI; import de.steamwar.fightsystem.commands.GUI;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightState; import de.steamwar.fightsystem.fight.FightState;
import org.bukkit.Bukkit; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.utils.Config;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -49,8 +48,7 @@ public class HotbarGUIListener extends BasicListener {
fightTeam.setReady(false); fightTeam.setReady(false);
break; break;
case "§4Abbrechen": case "§4Abbrechen":
Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team von §a" + fightTeam.getLeader().getPlayer().getName() + " §6hat den Kampf abgebrochen! \n Server stoppt..."); FightSystem.shutdown(FightSystem.PREFIX + "§6Das Team von §a" + fightTeam.getLeader().getPlayer().getName() + " §6hat den Kampf abgebrochen! \n Server stoppt...");
Bukkit.shutdown();
break; break;
case "§eKit wählen": case "§eKit wählen":
GUI.kitSelection(player); GUI.kitSelection(player);

Datei anzeigen

@ -38,7 +38,7 @@ public class TestListener extends BasicListener {
@EventHandler @EventHandler
public void handlePlayerQuit(PlayerQuitEvent event){ public void handlePlayerQuit(PlayerQuitEvent event){
if(Bukkit.getOnlinePlayers().isEmpty()) if(Bukkit.getOnlinePlayers().isEmpty())
Bukkit.shutdown(); FightSystem.shutdown(null);
} }
@Override @Override

Datei anzeigen

@ -106,11 +106,11 @@ public class Config {
if(!new File(Bukkit.getWorldContainer().getPath() + '/' + Bukkit.getWorlds().get(0).getName() + "/config.yml").exists()) { if(!new File(Bukkit.getWorldContainer().getPath() + '/' + Bukkit.getWorlds().get(0).getName() + "/config.yml").exists()) {
FightSystem.getPlugin().saveDefaultConfig(); FightSystem.getPlugin().saveDefaultConfig();
System.out.println(FightSystem.PREFIX + "config.yml erstellt und geladen!"); System.out.println(FightSystem.PREFIX + "config.yml erstellt und geladen!");
Bukkit.shutdown(); FightSystem.shutdown(null);
} }
if(!new File("plugins/" + FightSystem.getPlugin().getName() + "/config.yml").exists()) { if(!new File("plugins/" + FightSystem.getPlugin().getName() + "/config.yml").exists()) {
System.out.println(FightSystem.PREFIX + "config.yml fehlt!"); System.out.println(FightSystem.PREFIX + "config.yml fehlt!");
Bukkit.shutdown(); FightSystem.shutdown(null);
} }
FileConfiguration config = FightSystem.getPlugin().getConfig(); FileConfiguration config = FightSystem.getPlugin().getConfig();
YamlConfiguration worldconfig = YamlConfiguration.loadConfiguration(new File(Bukkit.getWorldContainer().getPath() + '/' + Bukkit.getWorlds().get(0).getName() + "/config.yml")); YamlConfiguration worldconfig = YamlConfiguration.loadConfiguration(new File(Bukkit.getWorldContainer().getPath() + '/' + Bukkit.getWorlds().get(0).getName() + "/config.yml"));
@ -244,7 +244,7 @@ public class Config {
EventFight eventFight = EventFight.get(EventKampfID); EventFight eventFight = EventFight.get(EventKampfID);
if(eventFight == null){ if(eventFight == null){
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight"); Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
Bukkit.shutdown(); FightSystem.shutdown(null);
return; return;
} }
@ -253,7 +253,7 @@ public class Config {
if(team1 == null || team2 == null){ if(team1 == null || team2 == null){
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team"); Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
Bukkit.shutdown(); FightSystem.shutdown(null);
return; return;
} }