Added auto restart for Dominate if startup errored.
Added extra check for <= 1 players in Dom game to shutdown. Added 5 second delay to Dom kick after game finish.
This commit is contained in:
parent
a75ced170c
commit
95210de788
@ -49,6 +49,7 @@ import mineplex.minecraft.game.core.mechanics.PistonJump;
|
|||||||
import mineplex.minecraft.game.core.mechanics.Weapon;
|
import mineplex.minecraft.game.core.mechanics.Weapon;
|
||||||
import nautilus.game.core.util.NullChunkGenerator;
|
import nautilus.game.core.util.NullChunkGenerator;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -82,6 +83,8 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
|
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||||
@ -146,6 +149,19 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
|
|||||||
new ClassCombatPurchaseShop(shopManager, ClientManager, DonationManager, "Skill Shop");
|
new ClassCombatPurchaseShop(shopManager, ClientManager, DonationManager, "Skill Shop");
|
||||||
new ClassCombatCustomBuildShop(shopManager, ClientManager, DonationManager, "Class Setup");
|
new ClassCombatCustomBuildShop(shopManager, ClientManager, DonationManager, "Class Setup");
|
||||||
}
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
System.out.println("Exception during startup. Restarting in 15 seconds.");
|
||||||
|
|
||||||
|
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Bukkit.shutdown();
|
||||||
|
}
|
||||||
|
}, 300L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract String GetServerName();
|
protected abstract String GetServerName();
|
||||||
|
|
||||||
|
@ -1088,7 +1088,7 @@ public abstract class GameEngine<GameType extends IGame<ArenaType, PlayerType>,
|
|||||||
GameType game = GetGameForPlayer(player);
|
GameType game = GetGameForPlayer(player);
|
||||||
PlayerType gamePlayer = game.GetPlayer(player);
|
PlayerType gamePlayer = game.GetPlayer(player);
|
||||||
|
|
||||||
if (ActiveGames.contains(game) || GamesInSetup.contains(game))
|
if (game.IsActive() || GamesInSetup.contains(game))
|
||||||
{
|
{
|
||||||
GamePlayerQuitEvent<GameType, PlayerType> customEvent = new GamePlayerQuitEvent<GameType, PlayerType>(game, gamePlayer);
|
GamePlayerQuitEvent<GameType, PlayerType> customEvent = new GamePlayerQuitEvent<GameType, PlayerType>(game, gamePlayer);
|
||||||
Plugin.getServer().getPluginManager().callEvent(customEvent);
|
Plugin.getServer().getPluginManager().callEvent(customEvent);
|
||||||
@ -1109,7 +1109,7 @@ public abstract class GameEngine<GameType extends IGame<ArenaType, PlayerType>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!online)
|
if (!online || Bukkit.getOnlinePlayers().length <= 1)
|
||||||
Plugin.getServer().shutdown();
|
Plugin.getServer().shutdown();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -526,12 +526,18 @@ public abstract class TeamGameEngine<GameType extends ITeamGame<ArenaType, Playe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onGameFinished(TeamGameFinishedEvent<GameType, PlayerTeamType, PlayerType> event)
|
public void onGameFinished(final TeamGameFinishedEvent<GameType, PlayerTeamType, PlayerType> event)
|
||||||
|
{
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new GenericRunnable<GameType>(event.GetGame())
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
{
|
{
|
||||||
for (PlayerType player : event.GetGame().GetPlayers())
|
for (PlayerType player : event.GetGame().GetPlayers())
|
||||||
{
|
{
|
||||||
Portal.SendPlayerToServer(player.GetPlayer(), "Lobby");
|
Portal.SendPlayerToServer(player.GetPlayer(), "Lobby");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, 100L);
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new GenericRunnable<GameType>(event.GetGame())
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new GenericRunnable<GameType>(event.GetGame())
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user