Merge branch 'master' of ssh://198.245.50.91:7999/min/master
This commit is contained in:
commit
ad26c519ba
@ -123,7 +123,10 @@ public class LobbyBalancer extends Plugin implements Listener, Runnable
|
||||
{
|
||||
var27 = var6.substring(1).split("\u0000");
|
||||
|
||||
_lobbyServers.put(name, Integer.parseInt(var27[4]));
|
||||
if (var27[3].contains("Restarting"))
|
||||
_lobbyServers.put(name, 999);
|
||||
else
|
||||
_lobbyServers.put(name, Integer.parseInt(var27[4]));
|
||||
}
|
||||
}
|
||||
catch (SocketTimeoutException e)
|
||||
|
@ -7,33 +7,81 @@ import java.io.IOException;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.updater.event.RestartServerEvent;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class FileUpdater extends MiniPlugin
|
||||
{
|
||||
private Portal _portal;
|
||||
private NautHashMap<String, String> _jarMd5Map = new NautHashMap<String, String>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private boolean _needUpdate;
|
||||
|
||||
public FileUpdater(JavaPlugin plugin)
|
||||
public FileUpdater(JavaPlugin plugin, Portal portal)
|
||||
{
|
||||
super("File Updater", plugin);
|
||||
|
||||
_portal = portal;
|
||||
|
||||
GetPluginMd5s();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void tryToRestart(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOWER)
|
||||
return;
|
||||
|
||||
RestartServerEvent restartEvent = new RestartServerEvent();
|
||||
|
||||
GetPluginManager().callEvent(restartEvent);
|
||||
|
||||
if (!restartEvent.isCancelled())
|
||||
{
|
||||
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_portal.SendAllPlayers("Lobby");
|
||||
}
|
||||
}, 60L);
|
||||
|
||||
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
GetPlugin().getServer().shutdown();
|
||||
}
|
||||
}, 100L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void reflectMotd(ServerListPingEvent event)
|
||||
{
|
||||
if (_needUpdate)
|
||||
{
|
||||
event.setMotd("Restarting soon");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CheckForNewFiles(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_01)
|
||||
return;
|
||||
|
||||
if (_needUpdate)
|
||||
return;
|
||||
|
||||
boolean windows = System.getProperty("os.name").startsWith("Windows");
|
||||
|
||||
File updateDir = new File((windows ? "C:" : File.separator + "home" + File.separator + "mineplex") + File.separator + "update");
|
||||
|
@ -0,0 +1,33 @@
|
||||
package mineplex.core.updater.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class RestartServerEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
}
|
@ -83,7 +83,7 @@ public class Dragon extends MiniPlugin
|
||||
|
||||
if (Dragon == null || !Dragon.isValid())
|
||||
{
|
||||
Spawn();
|
||||
//Spawn();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,11 +70,12 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
|
||||
|
||||
//Main Modules
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
Portal portal = new Portal(this);
|
||||
new HubManager(this, clientManager, donationManager, new DisguiseManager(this, packetHandler));
|
||||
new Stacker(this);
|
||||
new ServerManager(this, clientManager, donationManager, new Portal(this));
|
||||
new ServerManager(this, clientManager, donationManager, portal);
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this);
|
||||
new FileUpdater(this, portal);
|
||||
|
||||
CombatManager combatManager = new CombatManager(this);
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
@ -328,7 +328,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
UtilAction.velocity(player, 1.4, 0.2, 1, true);
|
||||
|
||||
//Sound
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -5,7 +5,13 @@ import java.util.Comparator;
|
||||
public class ServerSorter implements Comparator<ServerInfo>
|
||||
{
|
||||
public int compare(ServerInfo a, ServerInfo b)
|
||||
{
|
||||
{
|
||||
if ((a.MOTD.contains("Restarting")))
|
||||
return 1;
|
||||
|
||||
if ((b.MOTD.contains("Restarting")))
|
||||
return -1;
|
||||
|
||||
if ((a.MOTD.contains("Recruiting") || a.MOTD.contains("Waiting") || a.MOTD.contains("Cup")) && !b.MOTD.contains("Recruiting") && !b.MOTD.contains("Waiting") && !b.MOTD.contains("Cup"))
|
||||
return -1;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop>
|
||||
|
||||
greenCount++;
|
||||
}
|
||||
else if (serverInfo.MOTD.contains("In"))
|
||||
else if (serverInfo.MOTD.contains("In") || serverInfo.MOTD.contains("Restarting"))
|
||||
{
|
||||
if (slot <= 15)
|
||||
slot = 27;
|
||||
@ -77,7 +77,12 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop>
|
||||
lore.add(ChatColor.RESET + "" + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers);
|
||||
lore.add(ChatColor.RESET + "");
|
||||
|
||||
if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers)
|
||||
if (serverInfo.MOTD.contains("Restarting"))
|
||||
{
|
||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Get Ultra to spectate full servers!");
|
||||
status = Material.IRON_BLOCK;
|
||||
}
|
||||
else if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers)
|
||||
{
|
||||
if (!Client.GetRank().Has(Rank.ULTRA))
|
||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Get Ultra to spectate full servers!");
|
||||
|
@ -9,6 +9,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.RestartServerEvent;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -178,6 +179,13 @@ public class GameManager implements Listener
|
||||
if (game.GetCountdown() == 0)
|
||||
game.SetState(GameState.Prepare);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void restartServerCheck(RestartServerEvent event)
|
||||
{
|
||||
if (Manager.GetGame() != null && Manager.GetGame().GetState() != GameState.Recruit)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void KitRegister(GameStateChangeEvent event)
|
||||
|
@ -75,6 +75,7 @@ import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.condition.*;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.updater.event.RestartServerEvent;
|
||||
import me.chiss.Core.Events.ServerSaveEvent;
|
||||
import nautilus.game.core.arena.ArenaManager;
|
||||
import nautilus.game.core.arena.IArena;
|
||||
@ -435,7 +436,14 @@ public abstract class GameEngine<GameType extends IGame<ArenaType, PlayerType>,
|
||||
{
|
||||
return PlayerGameMap.containsKey(playerName);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void restartServerCheck(RestartServerEvent event)
|
||||
{
|
||||
if (ActiveGames.size() > 0 || GamesInSetup.size() > 0)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void MessageMOTD(ServerListPingEvent event)
|
||||
{
|
||||
|
@ -44,6 +44,7 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.updater.event.RestartServerEvent;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -118,6 +119,13 @@ public class GPManager extends MiniPlugin
|
||||
return _kartSelect.get(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void restartServerCheck(RestartServerEvent event)
|
||||
{
|
||||
if (_live.size() > 0 || _results.size() > 0)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void Motd(ServerListPingEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user