Allow plugins to choose a hub type when restarting

Clans Hubs will send to Clans Hubs, Clans will send to Clans Hubs, and
all other plugins will send to the normal Hub
This commit is contained in:
cnr 2017-02-25 00:35:46 -06:00
parent 9ece8c9959
commit 7de556e3d8
7 changed files with 33 additions and 24 deletions

View File

@ -6,10 +6,6 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Properties;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Intent;
import mineplex.core.updater.command.BuildVersionCommand;
import mineplex.core.updater.command.RestartServerCommand;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
@ -24,7 +20,11 @@ import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Intent;
import mineplex.core.portal.Portal;
import mineplex.core.updater.command.BuildVersionCommand;
import mineplex.core.updater.command.RestartServerCommand;
import mineplex.core.updater.event.RestartServerEvent;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.Region;
@ -38,19 +38,21 @@ public class FileUpdater extends MiniPlugin
private String _serverName;
private Region _region;
private final GenericServer _transferHub;
private boolean _needUpdate;
private boolean _enabled = true;
private Properties _buildProperties;
public FileUpdater(JavaPlugin plugin, Portal portal, String serverName, Region region)
public FileUpdater(JavaPlugin plugin, Portal portal, String serverName, Region region, GenericServer transferHub)
{
super("File Updater", plugin);
_portal = portal;
_serverName = serverName;
_region = region;
_transferHub = transferHub;
GetPluginMd5s();
@ -81,7 +83,7 @@ public class FileUpdater extends MiniPlugin
for (Player player : Bukkit.getOnlinePlayers())
{
player.sendMessage(F.main("Updater", message));
_portal.sendPlayerToGenericServer(player, GenericServer.HUB, Intent.KICK);
_portal.sendPlayerToGenericServer(player, _transferHub, Intent.KICK);
}
}
}
@ -110,7 +112,7 @@ public class FileUpdater extends MiniPlugin
{
public void run()
{
_portal.sendAllPlayersToGenericServer(GenericServer.HUB, Intent.KICK);
_portal.sendAllPlayersToGenericServer(_transferHub, Intent.KICK);
}
}, 60L);

View File

@ -46,6 +46,7 @@ import mineplex.core.memory.MemoryFix;
import mineplex.core.message.MessageManager;
import mineplex.core.monitor.LagMeter;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.punish.Punish;
@ -131,7 +132,7 @@ public class Clans extends JavaPlugin
Teleport teleport = new Teleport(this, _clientManager);
Portal portal = new Portal();
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.CLANS_HUB);
ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);

View File

@ -39,6 +39,7 @@ import mineplex.core.packethandler.PacketHandler;
import mineplex.core.party.PartyManager;
import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
@ -153,7 +154,7 @@ public class ClansHub extends JavaPlugin
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.CLANS_HUB);
new CustomTagFix(this, packetHandler);
new PacketsInteractionFix(this, packetHandler);
new ResourcePackManager(this, portal);

View File

@ -5,7 +5,6 @@ import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.Constants;
import mineplex.core.CustomTagFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.account.CoreClientManager;
@ -22,6 +21,7 @@ import mineplex.core.chatsnap.SnapshotManager;
import mineplex.core.chatsnap.SnapshotPlugin;
import mineplex.core.chatsnap.SnapshotRepository;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.Constants;
import mineplex.core.common.events.ServerShutdownEvent;
import mineplex.core.creature.Creature;
import mineplex.core.customdata.CustomDataManager;
@ -47,6 +47,7 @@ import mineplex.core.party.PartyManager;
import mineplex.core.personalServer.PersonalServerManager;
import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
@ -182,7 +183,7 @@ public class Hub extends JavaPlugin implements IRelation
Chat chat = new Chat(this, incognito, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
new CustomTagFix(this, packetHandler);
new PacketsInteractionFix(this, packetHandler);
new ResourcePackManager(this, portal);

View File

@ -1,12 +1,21 @@
package mineplex.staffServer;
import java.util.UUID;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.plugin.java.JavaPlugin;
import org.spigotmc.SpigotConfig;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.Constants;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.Constants;
import mineplex.core.common.Rank;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
@ -17,6 +26,7 @@ import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Portal;
import mineplex.core.powerplayclub.PowerPlayClubRepository;
import mineplex.core.preferences.PreferencesManager;
@ -29,13 +39,6 @@ import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.staffServer.customerSupport.CustomerSupport;
import mineplex.staffServer.salespackage.SalesPackageManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
import org.bukkit.plugin.java.JavaPlugin;
import org.spigotmc.SpigotConfig;
import java.util.UUID;
import static mineplex.core.Managers.require;
@ -67,7 +70,7 @@ public class StaffServer extends JavaPlugin
StatsManager statsManager = new StatsManager(this, clientManager);
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(statsManager, clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
require(PacketHandler.class);
require(DisguiseManager.class);

View File

@ -10,12 +10,10 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.spigotmc.SpigotConfig;
import mineplex.core.common.Constants;
import mineplex.core.CustomTagFix;
import mineplex.core.FoodDupeFix;
import mineplex.core.PacketsInteractionFix;
import mineplex.core.TimingsFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
@ -28,6 +26,7 @@ import mineplex.core.chatsnap.SnapshotManager;
import mineplex.core.chatsnap.SnapshotPlugin;
import mineplex.core.chatsnap.SnapshotRepository;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.Constants;
import mineplex.core.common.events.ServerShutdownEvent;
import mineplex.core.common.util.FileUtil;
import mineplex.core.common.util.UtilServer;
@ -55,6 +54,7 @@ import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
@ -138,7 +138,7 @@ public class Arcade extends JavaPlugin
LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager);
Teleport teleport = new Teleport(this, _clientManager);
Portal portal = new Portal();
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
DisguiseManager disguiseManager = require(DisguiseManager.class);

View File

@ -38,6 +38,7 @@ import mineplex.core.monitor.LagMeter;
import mineplex.core.mount.MountManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager;
import mineplex.core.portal.GenericServer;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
@ -102,7 +103,7 @@ public class Hub extends JavaPlugin
Creature creature = new Creature(this);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
Portal portal = new Portal();
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
DisguiseManager disguiseManager = require(DisguiseManager.class);