Moved files into Mineplex.core

Removed references to Core project.
This commit is contained in:
Jonathan Williams 2014-03-09 00:50:13 -08:00
parent f6bda4a75f
commit f51a6747fd
22 changed files with 779 additions and 226 deletions

Binary file not shown.

View File

@ -0,0 +1,30 @@
package mineplex.bungee.groupManager;
import java.util.concurrent.TimeUnit;
import mineplex.bungee.playerCount.PlayerCountRepository;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
public class GroupManager implements Listener, Runnable
{
private Plugin _plugin;
private GroupRepository _repository;
public GroupManager(Plugin plugin)
{
_plugin = plugin;
_plugin.getProxy().getScheduler().schedule(_plugin, this, 3L, 3L, TimeUnit.SECONDS);
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_repository = new GroupRepository();
_repository.initialize();
}
@Override
public void run()
{
}
}

View File

@ -0,0 +1,194 @@
package mineplex.bungee.groupManager;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class GroupRepository
{
private Connection _connection = null;
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh";
private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS Groups (id INT NOT NULL AUTO_INCREMENT, address VARCHAR(256), updated LONG, players INT, maxPlayers INT, ram INT, maxRam INT, PRIMARY KEY (id));";
private static String INSERT_PLAYER_COUNT = "INSERT INTO BungeeServers(address, updated, players, maxPlayers, ram, maxRam) values(?, now(), ?, ?, ?, ?);";
private static String UPDATE_PLAYER_COUNT = "UPDATE BungeeServers SET updated = now(), players = ?, maxPlayers = ?, ram = ?, maxRam = ? WHERE id = ?;";
private static String RETRIEVE_ID = "SELECT id FROM BungeeServers WHERE address = ?;";
private static String RETRIEVE_PLAYER_COUNT = "SELECT SUM(players) AS playerCount, SUM(maxPlayers) AS maxPlayerCount FROM BungeeServers WHERE TIME_TO_SEC(TIMEDIFF(now(), BungeeServers.updated)) < 10;";
private int _id = -1;
private String _address;
private int _maxPlayers = 0;
public void initialize()
{
ResultSet resultSet = null;
PreparedStatement preparedStatement = null;
PreparedStatement preparedStatementRetrieve = null;
PreparedStatement preparedStatementInsert = null;
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
// Create table
preparedStatement = _connection.prepareStatement(CREATE_TABLE);
preparedStatement.execute();
// Retrieve id
preparedStatementRetrieve = _connection.prepareStatement(RETRIEVE_ID);
preparedStatementRetrieve.setString(1, _address);
resultSet = preparedStatementRetrieve.executeQuery();
while (resultSet.next())
{
_id = resultSet.getInt("id");
}
// Insert if not there
if (_id == -1)
{
preparedStatementInsert = _connection.prepareStatement(INSERT_PLAYER_COUNT, Statement.RETURN_GENERATED_KEYS);
preparedStatementInsert.setString(1, _address);
preparedStatementInsert.setInt(2, 0);
preparedStatementInsert.setInt(3, _maxPlayers);
preparedStatementInsert.setInt(4, (int) ((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) / 1048576));
preparedStatementInsert.setInt(5, (int) (Runtime.getRuntime().maxMemory() / 1048576));
int affectedRows = preparedStatementInsert.executeUpdate();
if (affectedRows == 0)
{
throw new SQLException("Creating bungee server failed, no rows affected.");
}
resultSet.close();
resultSet = preparedStatementInsert.getGeneratedKeys();
if (resultSet.next())
{
_id = resultSet.getInt(1);
System.out.println("id = " + _id);
}
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
if (preparedStatementRetrieve != null)
{
try
{
preparedStatementRetrieve.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
if (preparedStatementInsert != null)
{
try
{
preparedStatementInsert.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
if (resultSet != null)
{
try
{
resultSet.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
public boolean updatePlayerCountInDatabase(int players)
{
PreparedStatement preparedStatement = null;
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_PLAYER_COUNT, Statement.RETURN_GENERATED_KEYS);
preparedStatement.setInt(1, players);
preparedStatement.setInt(2, _maxPlayers);
preparedStatement.setInt(3, (int) ((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) / 1048576));
preparedStatement.setInt(4, (int) (Runtime.getRuntime().maxMemory() / 1048576));
preparedStatement.setInt(5, _id);
int affectedRows = preparedStatement.executeUpdate();
if (affectedRows == 0)
{
throw new SQLException("Updating bungee server player count failed, no rows affected.");
}
return true;
}
catch (Exception exception)
{
exception.printStackTrace();
try
{
Thread.sleep(10);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
return updatePlayerCountInDatabase(players);
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
}

View File

@ -0,0 +1,28 @@
package mineplex.bungee.playerStats;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.event.EventHandler;
public class PlayerStats implements Listener
{
private Plugin _plugin;
private PlayerStatsRepository _repository;
public PlayerStats(Plugin plugin)
{
_plugin = plugin;
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_repository = new PlayerStatsRepository();
_repository.initialize();
}
@EventHandler
public void playerConnect(PostLoginEvent event)
{
_repository.addPlayer(event.getPlayer().getName());
}
}

View File

@ -0,0 +1,104 @@
package mineplex.bungee.playerStats;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class PlayerStatsRepository
{
private Connection _connection = null;
private String _connectionString = "jdbc:mysql://sqlstats.mineplex.com:3306/PlayerStats?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh";
private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS DailyUnique (id INT NOT NULL AUTO_INCREMENT, day VARCHAR(100), playerName VARCHAR(20), PRIMARY KEY (id), UNIQUE KEY unique_player_per_day (day, playerName));";
private static String INSERT_PLAYER = "INSERT INTO DailyUnique (day, playerName) values(curdate(), ?) ON DUPLICATE KEY UPDATE playerName=playerName;";
public void initialize()
{
PreparedStatement preparedStatement = null;
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
// Create table
preparedStatement = _connection.prepareStatement(CREATE_TABLE);
preparedStatement.execute();
}
catch (Exception exception)
{
exception.printStackTrace();
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
public boolean addPlayer(String playerName)
{
PreparedStatement preparedStatement = null;
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(INSERT_PLAYER, Statement.RETURN_GENERATED_KEYS);
preparedStatement.setString(1, playerName);
int affectedRows = preparedStatement.executeUpdate();
if (affectedRows == 0)
{
throw new SQLException("Adding unique player record failed, no rows affected.");
}
return true;
}
catch (Exception exception)
{
exception.printStackTrace();
try
{
Thread.sleep(10);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
return addPlayer(playerName);
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
}

View File

@ -0,0 +1,101 @@
package mineplex.core.blood;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class Blood extends MiniPlugin
{
private HashMap<Item, Integer> _blood = new HashMap<Item, Integer>();
public Blood(JavaPlugin plugin)
{
super("Blood", plugin);
}
@EventHandler
public void Death(PlayerDeathEvent event)
{
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT, 1f, 1f, Material.INK_SACK, (byte)1, true);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, boolean bloodStep)
{
Effects(loc, particles, velMult, sound, soundVol, soundPitch, type, data, 10, bloodStep);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, int ticks, boolean bloodStep)
{
for (int i = 0 ; i < particles ; i++)
{
Item item = loc.getWorld().dropItem(loc,
ItemStackFactory.Instance.CreateStack(type, data));
item.setVelocity(new Vector((Math.random() - 0.5)*velMult,Math.random()*velMult,(Math.random() - 0.5)*velMult));
_blood.put(item, ticks);
}
if (bloodStep)
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 55);
loc.getWorld().playSound(loc, sound, soundVol, soundPitch);
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
HashSet<Item> expire = new HashSet<Item>();
for (Item cur : _blood.keySet())
if (cur.getTicksLived() > _blood.get(cur) || !cur.isValid())
expire.add(cur);
for (Item cur : expire)
{
cur.remove();
_blood.remove(cur);
}
}
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (event.isCancelled())
return;
if (_blood.containsKey(event.getItem()))
event.setCancelled(true);
}
@EventHandler
public void HopperPickup(InventoryPickupItemEvent event)
{
if (event.isCancelled())
return;
if (_blood.containsKey(event.getItem()))
event.setCancelled(true);
}
}

View File

@ -1,4 +1,4 @@
package me.chiss.Core.MemoryFix;
package mineplex.core.memory;
import java.util.Iterator;

View File

@ -9,7 +9,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,6 +1,5 @@
package mineplex.hub;
import me.chiss.Core.MemoryFix.MemoryFix;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.blockrestore.BlockRestore;
@ -11,6 +10,7 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.memory.MemoryFix;
import mineplex.core.message.MessageManager;
import mineplex.core.monitor.LagMeter;
import mineplex.core.movement.Movement;

View File

@ -0,0 +1,6 @@
package mineplex.servermonitor;
public interface GenericRunnable<T>
{
void run(T t);
}

View File

@ -5,7 +5,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>

View File

@ -8,11 +8,11 @@ import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import me.chiss.Core.Config.Config;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.FileUtil;
import mineplex.core.common.util.UtilServer;
@ -21,12 +21,7 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Loot.LootFactory;
import me.chiss.Core.MemoryFix.MemoryFix;
import me.chiss.Core.Module.ModuleManager;
import me.chiss.Core.Modules.*;
import me.chiss.Core.Plugin.IPlugin;
import me.chiss.Core.Scheduler.Scheduler;
import mineplex.core.memory.MemoryFix;
import mineplex.core.message.MessageManager;
import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
@ -45,7 +40,6 @@ 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;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.minecraft.core.INautilusPlugin;
@ -55,28 +49,20 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
public class Arcade extends JavaPlugin implements INautilusPlugin
{
private String WEB_CONFIG = "webServer";
//Modules
private ModuleManager _moduleManager;
private Config _config;
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private DamageManager _damageManager;
private Utility _utility;
private BlockRegenerate _blockRegenerate;
private BlockRestore _blockRestore;
private Blood _blood;
private ConditionManager _condition;
private Creature _creature;
private Fire _fire;
private Logger _logger;
private LootFactory _lootFactory;
private Observer _observer;
private PetManager _petManager;
private me.chiss.Core.Server.Server _serverModule;
private Spawn _spawn;
private Teleport _teleport;
private ProjectileManager _throw;
@ -94,9 +80,6 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
saveConfig();
//Init Modules
GetModules();
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
CommandCenter.Initialize(this, _clientManager);
@ -112,24 +95,21 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
AntiStack antistack = new AntiStack(this);
GetCreature();
GetSpawn();
GetTeleport();
Creature creature = new Creature(this);
Spawn spawn = new Spawn(this);
Teleport teleport = new Teleport(this, _clientManager, spawn);
new FileUpdater(this, new Portal(this));
new ServerStatusManager(this, new LagMeter(this, _clientManager));
PacketHandler packetHandler = new PacketHandler(this);
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()), disguiseManager);
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager);
Portal portal = new Portal(this);
//Arcade Manager
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), antistack, portal, packetHandler, GetWebServerAddress());
//Unreferenced Modules
Scheduler.Initialize(this);
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, GetWebServerAddress());
Punish punish = new Punish(this, GetWebServerAddress(), _clientManager);
AntiHack.Initialize(this, punish, portal);
@ -144,8 +124,6 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
@Override
public void onDisable()
{
GetModules().onDisable();
for (Player player : UtilServer.getPlayers())
player.kickPlayer("Server Shutdown");
@ -306,164 +284,4 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
{
return GetRealServer().getPluginManager();
}
@Override
public void Log(String moduleName, String data)
{
System.out.println(moduleName + " : " + data);
}
@Override
public ModuleManager GetModules()
{
if (_moduleManager == null)
_moduleManager = new ModuleManager();
return _moduleManager;
}
@Override
public Config GetConfig()
{
if (_config == null)
_config = new Config(this);
return _config;
}
@Override
public Utility GetUtility()
{
if (_utility == null)
_utility = new Utility(this);
return _utility;
}
@Override
public BlockRegenerate GetBlockRegenerate()
{
if (_blockRegenerate == null)
_blockRegenerate = new BlockRegenerate(this);
return _blockRegenerate;
}
@Override
public BlockRestore GetBlockRestore()
{
if (_blockRestore == null)
_blockRestore = new BlockRestore(this);
return _blockRestore;
}
@Override
public Blood GetBlood()
{
if (_blood == null)
_blood = new Blood(this);
return _blood;
}
@Override
public Creature GetCreature()
{
if (_creature == null)
_creature = new Creature(this);
return _creature;
}
@Override
public Fire GetFire()
{
if (_fire == null)
_fire = new Fire(this, _condition, _damageManager);
return _fire;
}
@Override
public Logger GetLogger()
{
if (_logger == null)
_logger = new Logger(this);
return _logger;
}
@Override
public LootFactory GetLoot()
{
if (_lootFactory == null)
_lootFactory = new LootFactory(this);
return _lootFactory;
}
@Override
public Observer GetObserver()
{
if (_observer == null)
_observer = new Observer(this);
return _observer;
}
@Override
public me.chiss.Core.Server.Server GetServer()
{
if (_serverModule == null)
_serverModule = new me.chiss.Core.Server.Server(this, _clientManager);
return _serverModule;
}
@Override
public Spawn GetSpawn()
{
if (_spawn == null)
_spawn = new Spawn(this);
return _spawn;
}
@Override
public Teleport GetTeleport()
{
if (_teleport == null)
_teleport = new Teleport(this, _clientManager, GetSpawn());
return _teleport;
}
@Override
public ProjectileManager GetThrow()
{
if (_throw == null)
_throw = new ProjectileManager(this);
return _throw;
}
@Override
public Location GetSpawnLocation()
{
return null;
}
@Override
public PetManager GetPetManager()
{
return _petManager;
}
@Override
public Energy GetEnergy()
{
return null;
}
}

View File

@ -45,10 +45,10 @@ import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Modules.Blood;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.chat.Chat;
import mineplex.core.common.Rank;
import mineplex.core.common.util.*;
@ -62,6 +62,7 @@ import mineplex.core.explosion.Explosion;
import mineplex.core.portal.Portal;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.teleport.Teleport;
public class ArcadeManager extends MiniPlugin implements IRelation
{
@ -105,7 +106,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
//Games
private Game _game;
public ArcadeManager(Arcade plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, AntiStack antistack, Portal portal, PacketHandler packetHandler, String webAddress)
public ArcadeManager(Arcade plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack, Portal portal, PacketHandler packetHandler, String webAddress)
{
super("Game Manager", plugin);
@ -143,7 +144,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (serverConfig.GameList.contains(GameType.Champions))
{
_skillFactory = new SkillFactory(plugin, damageManager, this, new CombatManager(plugin), conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), plugin.GetTeleport(), new Energy(plugin), webAddress);
_skillFactory = new SkillFactory(plugin, damageManager, this, new CombatManager(plugin), conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), teleport, new Energy(plugin), webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, webAddress);
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, new ItemPackFactory(_plugin));

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.champions.kits;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitAssassin extends Kit
{
private HashMap<Player, ClientClass> _class = new HashMap<Player, ClientClass>();
public KitAssassin(ArcadeManager manager)
{
super(manager, "Assassin", KitAvailability.Free,
new String[]
{
},
new Perk[]
{
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void Deselected(Player player)
{
_class.remove(player);
}
@Override
public void Selected(Player player)
{
_class.put(player, Manager.getClassManager().Get(player));
ClientClass clientClass = _class.get(player);
IPvpClass pvpClass = Manager.getClassManager().GetClass("Assassin");
player.getInventory().clear();
clientClass.SetGameClass(pvpClass);
pvpClass.ApplyArmor(player);
clientClass.ClearDefaults();
Manager.openClassShop(player, Manager.getClassManager().GetClass("Assassin"));
}
@Override
public void GiveItems(Player player)
{
_class.get(player).ResetToDefaults(true, true);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
}
}

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.champions.kits;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitBrute extends Kit
{
private HashMap<Player, ClientClass> _class = new HashMap<Player, ClientClass>();
public KitBrute(ArcadeManager manager)
{
super(manager, "Brute", KitAvailability.Free,
new String[]
{
},
new Perk[]
{
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void Deselected(Player player)
{
_class.remove(player);
}
@Override
public void Selected(Player player)
{
_class.put(player, Manager.getClassManager().Get(player));
ClientClass clientClass = _class.get(player);
IPvpClass pvpClass = Manager.getClassManager().GetClass("Brute");
player.getInventory().clear();
clientClass.SetGameClass(pvpClass);
pvpClass.ApplyArmor(player);
clientClass.ClearDefaults();
Manager.openClassShop(player, Manager.getClassManager().GetClass("Brute"));
}
@Override
public void GiveItems(Player player)
{
_class.get(player).ResetToDefaults(true, true);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
}
}

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.champions.kits;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitMage extends Kit
{
private HashMap<Player, ClientClass> _class = new HashMap<Player, ClientClass>();
public KitMage(ArcadeManager manager)
{
super(manager, "Mage", KitAvailability.Free,
new String[]
{
},
new Perk[]
{
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void Deselected(Player player)
{
_class.remove(player);
}
@Override
public void Selected(Player player)
{
_class.put(player, Manager.getClassManager().Get(player));
ClientClass clientClass = _class.get(player);
IPvpClass pvpClass = Manager.getClassManager().GetClass("Mage");
player.getInventory().clear();
clientClass.SetGameClass(pvpClass);
pvpClass.ApplyArmor(player);
clientClass.ClearDefaults();
Manager.openClassShop(player, Manager.getClassManager().GetClass("Mage"));
}
@Override
public void GiveItems(Player player)
{
_class.get(player).ResetToDefaults(true, true);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS));
}
}

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.champions.kits;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitRanger extends Kit
{
private HashMap<Player, ClientClass> _class = new HashMap<Player, ClientClass>();
public KitRanger(ArcadeManager manager)
{
super(manager, "Ranger", KitAvailability.Free,
new String[]
{
},
new Perk[]
{
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));
}
@Override
public void Deselected(Player player)
{
_class.remove(player);
}
@Override
public void Selected(Player player)
{
_class.put(player, Manager.getClassManager().Get(player));
ClientClass clientClass = _class.get(player);
IPvpClass pvpClass = Manager.getClassManager().GetClass("Ranger");
player.getInventory().clear();
clientClass.SetGameClass(pvpClass);
pvpClass.ApplyArmor(player);
clientClass.ClearDefaults();
Manager.openClassShop(player, Manager.getClassManager().GetClass("Ranger"));
}
@Override
public void GiveItems(Player player)
{
_class.get(player).ResetToDefaults(true, true);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
}
}

View File

@ -9,6 +9,5 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -5,6 +5,7 @@ import java.util.HashSet;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
@ -12,9 +13,8 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.fakeEntity.FakeEntityManager;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.MemoryFix.MemoryFix;
import me.chiss.Core.Module.ModuleManager;
import me.chiss.Core.Modules.*;
import mineplex.core.join.JoinQuit;
import mineplex.core.memory.MemoryFix;
import mineplex.core.message.MessageManager;
import mineplex.core.monitor.LagMeter;
import mineplex.core.movement.Movement;
@ -69,14 +69,12 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
protected PacketHandler PacketHandler;
protected Energy Energy;
private Fire _fire;
private ModuleManager _moduleManager;
protected NpcManager NpcManager;
protected SkillFactory SkillManager;
private Spawn _spawn;
private Teleport _teleport;
private ProjectileManager _throw;
private ServerListener _serverListener;
private Location _spawnLocation;
protected ServerTalker HubConnection;
@ -98,9 +96,7 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
FakeEntityManager.Initialize(this);
ItemStackFactory.Initialize(this, true);
Recharge.Initialize(this);
_moduleManager = new ModuleManager();
Updater updater = new Updater(this);
_creature = new Creature(this);
Energy = new Energy(this);
@ -136,14 +132,6 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
getServer().getScheduler().scheduleSyncRepeatingTask(this, updater, 1, 1);
// _serverListener = new ServerListener(GetWebServerAddress(), getServer().getIp(), getServer().getPort() + 1);
// _serverListener.start();
//HubConnection = new ServerTalker(getConfig().getString(HUB_SERVER));
// HubConnection.start();
//HubConnection.QueuePacket(new ServerReadyPacket(getServer().getIp() + ":" + getServer().getPort()));
ClassShopManager shopManager = new ClassShopManager(this, ClassManager, SkillManager, null);
new ClassCombatShop(shopManager, ClientManager, DonationManager, "Select Class Here");
new ClassCombatPurchaseShop(shopManager, ClientManager, DonationManager, "Skill Shop");
@ -164,13 +152,6 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
}
protected abstract String GetServerName();
@Override
public void onDisable()
{
_moduleManager.onDisable();
_serverListener.Shutdown();
}
public String GetWebServerAddress()
{

View File

@ -4,7 +4,6 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/bukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Game.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>

View File

@ -8,6 +8,5 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Core"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -4,8 +4,6 @@ import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import me.chiss.Core.MemoryFix.MemoryFix;
import me.chiss.Core.Modules.*;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
@ -17,6 +15,8 @@ import mineplex.core.explosion.Explosion;
import mineplex.core.fakeEntity.FakeEntity;
import mineplex.core.fakeEntity.FakeEntityManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.join.JoinQuit;
import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
@ -27,7 +27,6 @@ import mineplex.core.spawn.Spawn;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.teleport.Teleport;
import mineplex.core.updater.Updater;
import nautilus.game.minekart.gp.GPManager;
import nautilus.game.minekart.kart.KartManager;
import nautilus.game.minekart.menu.KartMenu;