Mineplex2018-withcommit/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java

210 lines
9.4 KiB
Java
Raw Normal View History

2013-08-27 17:14:08 +02:00
package mineplex.hub;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileCache;
import mineplex.core.CustomTagFix;
import mineplex.core.TablistFix;
2013-08-27 17:14:08 +02:00
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
2015-04-01 07:56:13 +02:00
import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
2013-08-27 17:14:08 +02:00
import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.elo.EloManager;
import mineplex.core.energy.Energy;
import mineplex.core.friend.FriendManager;
2015-03-16 03:39:33 +01:00
import mineplex.core.give.Give;
import mineplex.core.giveaway.GiveawayManager;
2015-10-23 21:07:53 +02:00
import mineplex.core.globalpacket.GlobalPacketManager;
import mineplex.core.hologram.HologramManager;
import mineplex.core.ignore.IgnoreManager;
import mineplex.core.inventory.InventoryManager;
2013-08-27 17:14:08 +02:00
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.memory.MemoryFix;
2013-08-27 17:14:08 +02:00
import mineplex.core.message.MessageManager;
import mineplex.core.monitor.LagMeter;
import mineplex.core.movement.Movement;
2013-08-27 17:14:08 +02:00
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.party.PartyManager;
import mineplex.core.personalServer.PersonalServerManager;
import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager;
2013-08-27 17:14:08 +02:00
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
import mineplex.core.projectile.ProjectileManager;
2013-08-27 17:14:08 +02:00
import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge;
2015-03-17 11:59:24 +01:00
import mineplex.core.resourcepack.ResUnloadCheck;
import mineplex.core.resourcepack.ResPackManager;
import mineplex.core.serverConfig.ServerConfiguration;
import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
2013-08-27 17:14:08 +02:00
import mineplex.core.teleport.Teleport;
2015-10-10 04:14:10 +02:00
import mineplex.core.titangiveaway.TitanGiveawayManager;
import mineplex.core.updater.FileUpdater;
2013-08-27 17:14:08 +02:00
import mineplex.core.updater.Updater;
2015-08-02 11:24:34 +02:00
import mineplex.core.velocity.VelocityFix;
2015-03-13 01:34:45 +01:00
import mineplex.core.visibility.VisibilityManager;
import mineplex.hub.modules.StackerManager;
import mineplex.hub.queue.QueueManager;
2013-08-27 17:14:08 +02:00
import mineplex.hub.server.ServerManager;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
2013-08-27 17:14:08 +02:00
public class Hub extends JavaPlugin implements IRelation
2013-08-27 17:14:08 +02:00
{
private String WEB_CONFIG = "webServer";
@Override
public void onEnable()
{
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
2013-08-27 17:14:08 +02:00
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
saveConfig();
String webServerAddress = getConfig().getString(WEB_CONFIG);
2015-01-23 08:18:38 +01:00
//Logger.initialize(this);
2015-08-02 11:24:34 +02:00
//Velocity Fix
new VelocityFix(this);
2013-08-27 17:14:08 +02:00
//Static Modules
CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
CommandCenter.Instance.setClientManager(clientManager);
2015-10-14 04:24:15 +02:00
// new ProfileCacheManager(this);
2013-08-27 17:14:08 +02:00
ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this);
VisibilityManager.Initialize(this); Give.Initialize(this);
Punish punish = new Punish(this, webServerAddress, clientManager);
BlockRestore blockRestore = new BlockRestore(this);
DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress);
new ServerConfiguration(this, clientManager);
//Other Modules
PacketHandler packetHandler = new PacketHandler(this);
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
preferenceManager.GiveItem = true;
Creature creature = new Creature(this);
NpcManager npcManager = new NpcManager(this, creature);
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress);
PollManager pollManager = new PollManager(this, clientManager, donationManager);
2013-08-27 17:14:08 +02:00
//Main Modules
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
2015-11-09 09:27:42 +01:00
GiveawayManager giveawayManager = new GiveawayManager(this, clientManager, serverStatusManager);
2015-10-10 04:14:10 +02:00
new TitanGiveawayManager(this, clientManager, serverStatusManager);
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
2015-02-24 01:03:51 +01:00
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager);
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
2015-04-01 07:56:13 +02:00
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
Chat chat = new Chat(this, clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
new MemoryFix(this);
2015-01-23 08:18:38 +01:00
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new CustomTagFix(this, packetHandler);
new TablistFix(this);
2015-03-17 11:59:24 +01:00
new ResPackManager(new ResUnloadCheck()
{
public boolean canSendUnload(Player player)
{
return true;
}
});
2015-10-23 21:07:53 +02:00
new GlobalPacketManager(this, clientManager, serverStatusManager);
//new Replay(this, packetHandler);
2015-04-01 07:56:13 +02:00
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
CombatManager combatManager = new CombatManager(this);
ProjectileManager throwManager = new ProjectileManager(this);
SkillConditionManager conditionManager = new SkillConditionManager(this);
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, conditionManager);
Fire fire = new Fire(this, conditionManager, damage);
Teleport teleport = new Teleport(this);
Energy energy = new Energy(this);
2014-08-06 03:07:49 +02:00
energy.setEnabled(false);
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress);
2014-11-15 09:31:56 +01:00
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress);
2014-11-20 08:01:46 +01:00
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"));
2013-08-27 17:14:08 +02:00
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
}
@Override
public void onDisable()
{
2013-11-07 05:25:46 +01:00
2013-08-27 17:14:08 +02:00
}
@Override
public boolean canHurt(Player a, Player b)
{
return false;
}
@Override
public boolean canHurt(String a, String b)
{
return false;
}
@Override
public boolean isSafe(Player a)
{
return true;
}
2013-08-27 17:14:08 +02:00
}