Lixfel
0d33e8c508
# Conflicts: # FightSystem_Main/src/de/steamwar/fightsystem/utils/WaterRemover.java
56 Zeilen
1.4 KiB
Java
56 Zeilen
1.4 KiB
Java
package de.steamwar.fightsystem;
|
|
|
|
import de.steamwar.sql.EventFight;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
public class IFightSystem {
|
|
private IFightSystem(){}
|
|
|
|
private static Plugin plugin;
|
|
private static String prefix;
|
|
private static EventFight eventFight;
|
|
private static Player eventLeiter;
|
|
|
|
public static void init(Plugin plugin, String prefix){
|
|
IFightSystem.plugin = plugin;
|
|
IFightSystem.prefix = prefix;
|
|
}
|
|
static void setEventFight(EventFight ef){
|
|
eventFight = ef;
|
|
}
|
|
static void setEventLeiter(Player el){
|
|
eventLeiter = el;
|
|
}
|
|
|
|
public static Plugin getPlugin(){
|
|
return plugin;
|
|
}
|
|
public static String getPrefix(){
|
|
return prefix;
|
|
}
|
|
public static EventFight getEventFight(){
|
|
return eventFight;
|
|
}
|
|
public static Player getEventLeiter(){
|
|
return eventLeiter;
|
|
}
|
|
public static void shutdown(String reason){
|
|
if(reason != null)
|
|
Bukkit.broadcastMessage(reason);
|
|
//Staggered kick to prevent lobby overloading
|
|
kickNext();
|
|
}
|
|
|
|
private static void kickNext(){
|
|
if(Bukkit.getOnlinePlayers().isEmpty()){
|
|
Bukkit.shutdown();
|
|
return;
|
|
}
|
|
|
|
Bukkit.getOnlinePlayers().iterator().next().kickPlayer(null);
|
|
Bukkit.getScheduler().runTaskLater(plugin, IFightSystem::kickNext, 10);
|
|
}
|
|
}
|