2013-08-27 17:14:08 +02:00
|
|
|
package mineplex.hub;
|
|
|
|
|
2014-08-23 08:49:48 +02:00
|
|
|
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
|
|
|
|
2014-08-18 00:30:35 +02:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.account.CoreClientManager;
|
2013-10-17 09:37:57 +02:00
|
|
|
import mineplex.core.antihack.AntiHack;
|
2014-06-01 09:47:11 +02:00
|
|
|
import mineplex.core.antistack.AntiStack;
|
2013-08-31 11:36:31 +02:00
|
|
|
import mineplex.core.blockrestore.BlockRestore;
|
2013-09-04 20:35:59 +02:00
|
|
|
import mineplex.core.chat.Chat;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.command.CommandCenter;
|
2014-08-22 20:30:41 +02:00
|
|
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.creature.Creature;
|
|
|
|
import mineplex.core.disguise.DisguiseManager;
|
|
|
|
import mineplex.core.donation.DonationManager;
|
2014-05-27 11:10:29 +02:00
|
|
|
import mineplex.core.elo.EloManager;
|
2013-08-31 11:36:31 +02:00
|
|
|
import mineplex.core.energy.Energy;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.itemstack.ItemStackFactory;
|
2014-04-30 09:31:22 +02:00
|
|
|
import mineplex.core.logger.Logger;
|
2014-03-09 09:50:13 +01:00
|
|
|
import mineplex.core.memory.MemoryFix;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.message.MessageManager;
|
2013-09-18 00:50:23 +02:00
|
|
|
import mineplex.core.monitor.LagMeter;
|
2013-08-31 11:36:31 +02:00
|
|
|
import mineplex.core.movement.Movement;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.npc.NpcManager;
|
|
|
|
import mineplex.core.packethandler.PacketHandler;
|
2014-08-07 09:33:24 +02:00
|
|
|
import mineplex.core.pet.PetManager;
|
2014-07-02 03:31:17 +02:00
|
|
|
import mineplex.core.playerTracker.PlayerTracker;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.portal.Portal;
|
2014-05-30 09:25:48 +02:00
|
|
|
import mineplex.core.preferences.PreferencesManager;
|
2013-08-31 11:36:31 +02:00
|
|
|
import mineplex.core.projectile.ProjectileManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.punish.Punish;
|
|
|
|
import mineplex.core.recharge.Recharge;
|
2013-08-28 01:03:04 +02:00
|
|
|
import mineplex.core.spawn.Spawn;
|
2013-09-18 00:50:23 +02:00
|
|
|
import mineplex.core.status.ServerStatusManager;
|
2013-09-03 20:34:28 +02:00
|
|
|
import mineplex.core.task.TaskManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.teleport.Teleport;
|
2013-09-01 05:28:35 +02:00
|
|
|
import mineplex.core.updater.FileUpdater;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.core.updater.Updater;
|
2013-09-27 21:40:09 +02:00
|
|
|
import mineplex.hub.modules.StackerManager;
|
2013-09-09 10:28:35 +02:00
|
|
|
import mineplex.hub.party.PartyManager;
|
2014-08-18 00:30:35 +02:00
|
|
|
import mineplex.hub.poll.PollManager;
|
2014-05-27 11:10:29 +02:00
|
|
|
import mineplex.hub.queue.QueueManager;
|
2013-08-27 17:14:08 +02:00
|
|
|
import mineplex.hub.server.ServerManager;
|
2013-08-31 11:36:31 +02:00
|
|
|
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
|
|
|
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
|
|
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
2014-04-25 09:44:14 +02:00
|
|
|
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
2013-08-31 11:36:31 +02:00
|
|
|
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.damage.DamageManager;
|
|
|
|
import mineplex.minecraft.game.core.fire.Fire;
|
2013-08-27 17:14:08 +02:00
|
|
|
|
2014-07-01 19:23:22 +02:00
|
|
|
public class Hub extends JavaPlugin implements IRelation
|
2013-08-27 17:14:08 +02:00
|
|
|
{
|
|
|
|
private String WEB_CONFIG = "webServer";
|
2014-08-27 06:22:35 +02:00
|
|
|
|
|
|
|
@Override
|
2013-11-21 21:08:58 +01:00
|
|
|
public void onEnable()
|
2014-08-08 23:35:37 +02:00
|
|
|
{
|
2014-02-21 22:32:14 +01:00
|
|
|
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();
|
2014-08-01 23:56:29 +02:00
|
|
|
|
2014-07-01 19:23:22 +02:00
|
|
|
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
2014-08-25 01:26:01 +02:00
|
|
|
|
2014-07-01 19:23:22 +02:00
|
|
|
Logger.initialize(this);
|
2014-08-27 06:22:35 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Static Modules
|
2014-08-09 04:16:37 +02:00
|
|
|
CommandCenter.Initialize(this);
|
2014-07-01 19:23:22 +02:00
|
|
|
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
|
|
|
CommandCenter.Instance.setClientManager(clientManager);
|
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
ItemStackFactory.Initialize(this, false);
|
|
|
|
Recharge.Initialize(this);
|
2014-07-15 07:58:36 +02:00
|
|
|
Punish punish = new Punish(this, webServerAddress, clientManager);
|
2014-07-08 21:44:17 +02:00
|
|
|
|
2014-07-15 07:58:36 +02:00
|
|
|
DonationManager donationManager = new DonationManager(this, webServerAddress);
|
2013-09-18 00:50:23 +02:00
|
|
|
|
2014-04-26 11:47:04 +02:00
|
|
|
//Other Modules
|
2014-05-30 22:34:55 +02:00
|
|
|
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
|
|
|
|
preferenceManager.GiveItem = true;
|
|
|
|
new MessageManager(this, clientManager, preferenceManager);
|
2014-07-04 23:23:11 +02:00
|
|
|
Creature creature = new Creature(this);
|
2013-08-31 11:36:31 +02:00
|
|
|
NpcManager npcManager = new NpcManager(this, creature);
|
2014-07-01 19:23:22 +02:00
|
|
|
PetManager petManager = new PetManager(this, clientManager, donationManager, creature, webServerAddress);
|
2014-06-01 09:47:11 +02:00
|
|
|
new AntiStack(this);
|
2014-08-18 00:30:35 +02:00
|
|
|
PollManager pollManager = new PollManager(this, donationManager);
|
2014-08-01 23:56:29 +02:00
|
|
|
|
2013-08-27 17:14:08 +02:00
|
|
|
//Main Modules
|
2014-07-08 21:44:17 +02:00
|
|
|
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
|
2014-07-15 07:58:36 +02:00
|
|
|
PacketHandler packetHandler = new PacketHandler(this);
|
2014-07-19 22:56:03 +02:00
|
|
|
//new FriendManager(this, packetHandler);
|
2014-05-30 09:25:48 +02:00
|
|
|
PartyManager partyManager = new PartyManager(this, clientManager, preferenceManager);
|
2014-07-15 07:58:36 +02:00
|
|
|
Portal portal = new Portal(this, serverStatusManager.getCurrentServerName());
|
2014-07-08 21:44:17 +02:00
|
|
|
AntiHack.Initialize(this, punish, portal);
|
2014-08-18 00:30:35 +02:00
|
|
|
HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), new DisguiseManager(this, packetHandler), new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager);
|
2014-07-15 07:58:36 +02:00
|
|
|
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
|
2014-08-18 00:30:35 +02:00
|
|
|
|
2014-05-27 11:10:29 +02:00
|
|
|
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this), partyManager);
|
2014-08-01 23:56:29 +02:00
|
|
|
|
2014-05-27 11:10:29 +02:00
|
|
|
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
|
2014-05-30 09:33:55 +02:00
|
|
|
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
|
2013-11-07 05:25:46 +01:00
|
|
|
new MemoryFix(this);
|
2013-09-02 10:09:28 +02:00
|
|
|
new FileUpdater(this, portal);
|
2013-08-31 11:36:31 +02:00
|
|
|
|
|
|
|
CombatManager combatManager = new CombatManager(this);
|
|
|
|
BlockRestore blockRestore = new BlockRestore(this);
|
|
|
|
ProjectileManager throwManager = new ProjectileManager(this);
|
|
|
|
SkillConditionManager conditionManager = new SkillConditionManager(this);
|
|
|
|
|
|
|
|
DamageManager damage = new DamageManager(this, combatManager, npcManager, new DisguiseManager(this, packetHandler));
|
|
|
|
Fire fire = new Fire(this, conditionManager, damage);
|
|
|
|
Teleport teleport = new Teleport(this, clientManager, new Spawn(this));
|
2014-04-25 09:44:14 +02:00
|
|
|
Energy energy = new Energy(this);
|
2014-08-06 03:07:49 +02:00
|
|
|
energy.setEnabled(false);
|
2013-08-31 11:36:31 +02:00
|
|
|
|
2014-07-01 19:23:22 +02:00
|
|
|
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress);
|
|
|
|
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
|
|
|
|
ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
2014-05-07 07:38:27 +02:00
|
|
|
|
2014-04-25 09:44:14 +02:00
|
|
|
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory);
|
2014-04-26 11:47:04 +02:00
|
|
|
|
2014-04-25 09:44:14 +02:00
|
|
|
new ClassCombatShop(shopManager, clientManager, donationManager, "Brute", classManager.GetClass("Brute"));
|
|
|
|
new ClassCombatShop(shopManager, clientManager, donationManager, "Mage", classManager.GetClass("Mage"));
|
|
|
|
new ClassCombatShop(shopManager, clientManager, donationManager, "Ranger", classManager.GetClass("Ranger"));
|
|
|
|
new ClassCombatShop(shopManager, clientManager, donationManager, "Knight", classManager.GetClass("Knight"));
|
|
|
|
new ClassCombatShop(shopManager, clientManager, donationManager, "Assassin", classManager.GetClass("Assassin"));
|
2014-04-26 11:47:04 +02:00
|
|
|
|
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
|
|
|
}
|
2013-08-31 11:36:31 +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
|
|
|
}
|