Removed unused global stuff in Mineplexer.

Did some edits in GroupManager...need to pick that up.

Changed TimeUtil to pop last entry when stopping.
Fixed WorldUtil's dimension thing for UHC.
Fixed Exception with AntihackRepository and no static lock object on _connection

Work on Elo manager.
Work on Queue.

Added checking for player to server transfer records.

Added option for rejoin time in TeamGame (UHC...yay)
This commit is contained in:
Jonathan Williams 2014-05-27 02:10:29 -07:00
parent 6d19c80af2
commit 0634ee5543
25 changed files with 313 additions and 484 deletions

View File

@ -152,6 +152,32 @@
</jar>
<copy file="../bin/ServerMonitor.jar" todir="../../Testing/ServerMonitor/"/>
</target>
<target name ="Queuer" description="Queuer">
<jar jarfile="../bin/Queuer.jar">
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
</fileset>
<fileset dir="../Mineplex.Queuer/bin">
<include name="**/*.class"/>
</fileset>
<zipfileset src="../Libraries/mysql.zip" />
<manifest>
<attribute name="Main-Class"
value="mineplex.queuer.Queuer"/>
</manifest>
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
<zipfileset src="../Libraries/httpmime-4.2.jar" />
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
</jar>
<copy file="../bin/Queuer.jar" todir="../../Testing/Queuer/"/>
</target>
<target name ="ServerStatifier" description="ServerStatifier">
<jar jarfile="../bin/ServerStatifier.jar">
<fileset dir="../Mineplex.ServerStatifier/bin">

Binary file not shown.

View File

@ -1,33 +0,0 @@
package mineplex.bungee.globalServer;
import java.net.ServerSocket;
import net.md_5.bungee.api.plugin.Plugin;
public class GlobalServer
{
public GlobalServer(final Plugin plugin)
{
new Thread(new Runnable()
{
public void run()
{
ServerSocket serverSocket = null;
try
{
serverSocket = new ServerSocket(4444);
while (true)
{
new GlobalServerMultiThread(plugin, serverSocket.accept()).start();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}).start();
}
}

View File

@ -1,95 +0,0 @@
package mineplex.bungee.globalServer;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
public class GlobalServerMultiThread extends Thread
{
private Plugin _plugin;
private Socket _socket = null;
public GlobalServerMultiThread(Plugin plugin, Socket socket)
{
super("GlobalServerMultiThread");
_plugin = plugin;
_socket = socket;
}
public void run()
{
DataInputStream socketInputStream = null;
DataOutputStream socketOutputStream = null;
try
{
socketInputStream = new DataInputStream(_socket.getInputStream());
socketOutputStream = new DataOutputStream(new BufferedOutputStream(_socket.getOutputStream(), 5120));
int id = socketInputStream.readShort();
if (id == 71)
{
System.out.println("Received packet 71");
Packet71FindPlayerServer packet = new Packet71FindPlayerServer();
packet.parseStream(socketInputStream);
System.out.println("Looking for player: " + packet.getPlayerName());
ProxiedPlayer player = _plugin.getProxy().getPlayer(packet.getPlayerName());
if (player != null)
{
Packet91PlayerServerResponse responsePacket = new Packet91PlayerServerResponse(player.getName(), player.getServer().getInfo().getName());
socketOutputStream.writeShort(91);
responsePacket.write(socketOutputStream);
}
socketOutputStream.close();
socketOutputStream = null;
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
if (socketInputStream != null)
socketInputStream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
try
{
if (socketOutputStream != null)
socketOutputStream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
try
{
if (_socket != null)
_socket.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
}

View File

@ -1,60 +0,0 @@
package mineplex.bungee.globalServer;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class GlobalServerRepository
{
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/BungeeServers";
private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh";
private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS BungeeServers (id INT NOT NULL AUTO_INCREMENT, address VARCHAR(256), updated LONG, players INT, maxPlayers INT, ram INT, maxRam INT, PRIMARY KEY (id));";
public void initialize()
{
Connection connection = null;
PreparedStatement preparedStatement = null;
try
{
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();
}
}
if (connection != null)
{
try
{
connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
}

View File

@ -1,43 +0,0 @@
package mineplex.bungee.globalServer;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public abstract class Packet
{
public abstract void parseStream(DataInputStream inputStream) throws IOException;
public abstract void write(DataOutputStream dataOutput) throws IOException;
protected String readString(DataInputStream dataInputStream, int maxLength) throws IOException
{
short length = dataInputStream.readShort();
if (length > maxLength)
{
throw new IOException("Received string length longer than maximum allowed (" + length + " > " + maxLength + ")");
}
else if (length < 0)
{
throw new IOException("Received string length is less than zero! Weird string!");
}
else
{
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < length; i++)
{
stringBuilder.append(dataInputStream.readChar());
}
return stringBuilder.toString();
}
}
protected void writeString(String string, DataOutputStream dataOutputStream) throws IOException
{
dataOutputStream.writeShort(string.length());
dataOutputStream.writeChars(string);
}
}

View File

@ -1,27 +0,0 @@
package mineplex.bungee.globalServer;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet71FindPlayerServer extends Packet
{
private String _playerName;
@Override
public void parseStream(DataInputStream inputStream) throws IOException
{
_playerName = readString(inputStream, 16);
}
@Override
public void write(DataOutputStream dataOutput) throws IOException
{
writeString(_playerName, dataOutput);
}
public String getPlayerName()
{
return _playerName;
}
}

View File

@ -1,31 +0,0 @@
package mineplex.bungee.globalServer;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class Packet91PlayerServerResponse extends Packet
{
private String _playerName;
private String _serverName;
public Packet91PlayerServerResponse(String playerName, String serverName)
{
_playerName = playerName;
_serverName = serverName;
}
@Override
public void parseStream(DataInputStream inputStream) throws IOException
{
_playerName = readString(inputStream, 16);
_serverName = readString(inputStream, 24);
}
@Override
public void write(DataOutputStream dataOutput) throws IOException
{
writeString(_playerName, dataOutput);
writeString(_serverName, dataOutput);
}
}

View File

@ -2,7 +2,6 @@ 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;

View File

@ -14,7 +14,7 @@ public class GroupRepository
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 CREATE_GROUPS_TABLE = "CREATE TABLE IF NOT EXISTS groups (id INT NOT NULL AUTO_INCREMENT, name 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 = ?;";
@ -37,7 +37,7 @@ public class GroupRepository
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
// Create table
preparedStatement = _connection.prepareStatement(CREATE_TABLE);
preparedStatement = _connection.prepareStatement(CREATE_GROUPS_TABLE);
preparedStatement.execute();

View File

@ -20,7 +20,7 @@ public class TimeUtil
}
}
public static void stop(String title)
public static void stop()
{
synchronized(_timingLock)
{
@ -30,12 +30,8 @@ public class TimeUtil
{
Entry<String, Long> entry = iterator.next();
if (entry.getKey().equalsIgnoreCase(title))
{
System.out.println(title + " took " + (System.currentTimeMillis() - entry.getValue()) + "ms");
iterator.remove();
break;
}
System.out.println(entry.getKey()+ " took " + (System.currentTimeMillis() - entry.getValue()) + "ms");
iterator.remove();
}
Collections.reverse(_timingList);

View File

@ -63,7 +63,7 @@ public class WorldUtil
converter.convert(name, new ConvertProgressUpdater(server.getServer()));
}
int dimension = 10;
int dimension = server.getWorlds().size() + 1;
boolean used = false;
do
{
@ -79,6 +79,8 @@ public class WorldUtil
} while(used);
boolean hardcore = false;
System.out.println("Loaded world with dimension : " + dimension);
WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator);
boolean containsWorld = false;

View File

@ -12,6 +12,8 @@ import org.bukkit.entity.Player;
public class AntiHackRepository
{
private static Object _connectionLock = new Object();
private String _serverName;
private static Connection _connection;
@ -69,42 +71,45 @@ public class AntiHackRepository
{
PreparedStatement preparedStatement = null;
try
synchronized (_connectionLock)
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_PLAYER_OFFENSES);
preparedStatement.setString(1, player.getName());
preparedStatement.setString(2, motd);
preparedStatement.setString(3, game);
preparedStatement.setString(4, map);
preparedStatement.setString(5, _serverName);
preparedStatement.setString(6, report);
preparedStatement.setString(7, ((CraftPlayer)player).getHandle().ping + "ms");
preparedStatement.execute();
}
catch (Exception exception)
{
exception.printStackTrace();
Logger.Instance.log(exception);
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_PLAYER_OFFENSES);
preparedStatement.setString(1, player.getName());
preparedStatement.setString(2, motd);
preparedStatement.setString(3, game);
preparedStatement.setString(4, map);
preparedStatement.setString(5, _serverName);
preparedStatement.setString(6, report);
preparedStatement.setString(7, ((CraftPlayer)player).getHandle().ping + "ms");
preparedStatement.execute();
}
catch (Exception exception)
{
exception.printStackTrace();
Logger.Instance.log(exception);
}
finally
{
if (preparedStatement != null)
{
try
{
preparedStatement.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
}
}).start();

View File

@ -48,7 +48,7 @@ public class EloManager extends MiniPlugin
public int getElo(UUID uuid, String gameType)
{
int elo = -1;
int elo = 1000;
if (_playerElos.containsKey(uuid.toString()))
{
@ -64,13 +64,25 @@ public class EloManager extends MiniPlugin
public EloTeam getNewRatings(EloTeam teamA, EloTeam teamB, GameResult result)
{
EloTeam newTeam = new EloTeam();
int newTotal = _ratingSystem.getNewRating(teamA.TotalElo, teamB.TotalElo, result);
System.out.println("Old " + result + " Team Rating:" + teamA.TotalElo);
int newTotal = _ratingSystem.getNewRating(teamA.TotalElo / teamA.getPlayers().size(), teamB.TotalElo / teamB.getPlayers().size(), result) * teamA.getPlayers().size();
System.out.println("New " + result + " Team Rating:" + newTotal);
for (EloPlayer player : teamA.getPlayers())
{
EloPlayer newPlayer = new EloPlayer();
newPlayer.UniqueId = player.UniqueId;
newPlayer.Rating = player.Rating + (player.Rating / teamA.TotalElo) * (newTotal - teamA.TotalElo);
newPlayer.Rating = (int)(player.Rating + ((double)player.Rating / (double)teamA.TotalElo) * (newTotal - teamA.TotalElo));
System.out.println("Old:");
player.printInfo();
System.out.println("New:");
newPlayer.printInfo();
newTeam.addPlayer(newPlayer);
}

View File

@ -4,4 +4,9 @@ public class EloPlayer
{
public String UniqueId;
public int Rating;
public void printInfo()
{
System.out.println(UniqueId + "'s elo is " + Rating);
}
}

View File

@ -4,21 +4,30 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class Portal extends MiniPlugin
{
private HashSet<String> _connectingPlayers = new HashSet<String>();
private PortalRepository _repository= new PortalRepository();
public Portal(JavaPlugin plugin)
{
super("Portal", plugin);
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
_repository.initialize(plugin.getConfig().getBoolean("serverstatus.us"));
}
public void SendAllPlayers(String serverName)
@ -69,4 +78,31 @@ public class Portal extends MiniPlugin
}
}, 20L);
}
@EventHandler
public void checkForServerTransfers(UpdateEvent event)
{
if (event.getType() != UpdateType.TWOSEC || Bukkit.getOnlinePlayers().length == 0)
return;
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
final List<Entry<String, String>> entries = _repository.retrieveServerTransfers();
Bukkit.getScheduler().runTask(GetPlugin(), new Runnable()
{
public void run()
{
for (Entry<String, String> entry : entries)
{
if (GetPlugin().getServer().getPlayer(entry.getKey()) != null)
SendPlayerToServer(GetPlugin().getServer().getPlayer(entry.getKey()), entry.getValue());
}
}
});
}
});
}
}

View File

@ -108,13 +108,8 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
else
player.closeInventory();
}
private void BuildSquareAt(int slot, ShopItem item, IButton button)
{
BuildSquareAt(slot, item, new ItemPackage(item, 0, false, -1), button);
}
private void BuildSquareAt(int slot, ShopItem item, ISalesPackage middleItem, IButton button)
private void BuildSquareAt(int slot, ShopItem item, IButton button)
{
AddButton(slot, item, button);
AddButton(slot + 1, item, button);

View File

@ -14,6 +14,7 @@ public enum UpdateType
SLOWEST(32000),
SLOWER(16000),
SLOW(4000),
TWOSEC(2000),
SEC(1000),
FAST(500),
FASTER(250),

View File

@ -9,6 +9,7 @@ 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.itemstack.ItemStackFactory;
import mineplex.core.logger.Logger;
@ -31,6 +32,7 @@ import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.hub.modules.StackerManager;
import mineplex.hub.party.PartyManager;
import mineplex.hub.queue.QueueManager;
import mineplex.hub.server.ServerManager;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
@ -64,7 +66,7 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
Logger.initialize(this);
//Core Modules
CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
//Static Modules
CommandCenter.Initialize(this, clientManager);
@ -74,7 +76,7 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
Portal portal = new Portal(this);
AntiHack.Initialize(this, punish, portal);
DonationManager donationManager = new DonationManager(this, GetWebServerAddress());
DonationManager donationManager = new DonationManager(this, GetWebServerAddress());
//Other Modules
@ -88,7 +90,10 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
PartyManager partyManager = new PartyManager(this, clientManager);
HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress()), portal, partyManager);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager));
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this), partyManager);
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
new Chat(this, clientManager, serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal);

View File

@ -42,6 +42,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.logger.Logger;
import mineplex.core.portal.Portal;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.ShopBase;
import mineplex.core.status.ServerStatusData;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.updater.UpdateType;
@ -50,6 +51,8 @@ import mineplex.hub.HubManager;
import mineplex.hub.modules.StackerManager;
import mineplex.hub.party.Party;
import mineplex.hub.party.PartyManager;
import mineplex.hub.queue.QueueManager;
import mineplex.hub.queue.ui.QueueShop;
import mineplex.hub.server.ui.LobbyShop;
import mineplex.hub.server.ui.QuickShop;
import mineplex.hub.server.ui.ServerNpcShop;
@ -63,6 +66,7 @@ public class ServerManager extends MiniPlugin
private ServerStatusManager _statusManager;
private HubManager _hubManager;
private StackerManager _stackerManager;
private QueueManager _queueManager;
private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>();
private NautHashMap<String, String> _serverKeyTagMap = new NautHashMap<String, String>();
@ -71,6 +75,7 @@ public class ServerManager extends MiniPlugin
private NautHashMap<String, Long> _serverUpdate = new NautHashMap<String, Long>();
private NautHashMap<Vector, String> _serverPortalLocations = new NautHashMap<Vector, String>();
private QueueShop _domShop;
private QuickShop _quickShop;
private LobbyShop _lobbyShop;
@ -78,7 +83,7 @@ public class ServerManager extends MiniPlugin
private boolean _retrieving = false;
private long _lastRetrieve = 0;
public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, StackerManager stackerManager)
public ServerManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Portal portal, PartyManager partyManager, ServerStatusManager statusManager, HubManager hubManager, StackerManager stackerManager, QueueManager queueManager)
{
super("Server Manager", plugin);
@ -89,6 +94,7 @@ public class ServerManager extends MiniPlugin
_statusManager = statusManager;
_hubManager = hubManager;
_stackerManager = stackerManager;
_queueManager = queueManager;
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
@ -97,6 +103,7 @@ public class ServerManager extends MiniPlugin
new ServerManagerUpdater(this);
_quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu");
_lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu");
_domShop = new QueueShop(_queueManager, clientManager, donationManager, "Dominate");
}
@EventHandler(priority = EventPriority.LOW)
@ -167,6 +174,18 @@ public class ServerManager extends MiniPlugin
}
}
@EventHandler
public void checkQueuePrompts(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player player : _queueManager.findPlayersNeedingPrompt())
{
_domShop.attemptShopOpen(player);
}
}
@EventHandler(priority = EventPriority.LOW)
public void playerJoin(PlayerJoinEvent event)
{
@ -608,9 +627,10 @@ public class ServerManager extends MiniPlugin
return _serverNpcShopMap.get("Super Smash Mobs");
}
public ServerNpcShop getDominateShop()
@SuppressWarnings("rawtypes")
public ShopBase getDominateShop()
{
return _serverNpcShopMap.get("Dominate");
return _domShop;
}
public ServerNpcShop getBridgesShop()

View File

@ -5,107 +5,118 @@ import java.util.List;
public class PacketPlayOutSpawnEntityLiving extends Packet
{
public int a;
public int b;
public int c;
public int d;
public int e;
public int f;
public int g;
public int h;
public byte i;
public byte j;
public byte k;
public DataWatcher l;
public List m;
public PacketPlayOutSpawnEntityLiving() {}
public PacketPlayOutSpawnEntityLiving(EntityLiving paramEntityLiving)
{
this.a = paramEntityLiving.getId();
this.b = ((byte)EntityTypes.a(paramEntityLiving));
this.c = paramEntityLiving.as.a(paramEntityLiving.locX);
this.d = MathHelper.floor(paramEntityLiving.locY * 32.0D);
this.e = paramEntityLiving.as.a(paramEntityLiving.locZ);
this.i = ((byte)(int)(paramEntityLiving.yaw * 256.0F / 360.0F));
this.j = ((byte)(int)(paramEntityLiving.pitch * 256.0F / 360.0F));
this.k = ((byte)(int)(paramEntityLiving.aP * 256.0F / 360.0F));
public int b;
public int c;
public int d;
public int e;
public int f;
public int g;
public int h;
public byte i;
public byte j;
public byte k;
public DataWatcher l;
public List m;
double d1 = 3.9D;
double d2 = paramEntityLiving.motX;
double d3 = paramEntityLiving.motY;
double d4 = paramEntityLiving.motZ;
if (d2 < -d1) {
d2 = -d1;
}
if (d3 < -d1) {
d3 = -d1;
}
if (d4 < -d1) {
d4 = -d1;
}
if (d2 > d1) {
d2 = d1;
}
if (d3 > d1) {
d3 = d1;
}
if (d4 > d1) {
d4 = d1;
}
this.f = ((int)(d2 * 8000.0D));
this.g = ((int)(d3 * 8000.0D));
this.h = ((int)(d4 * 8000.0D));
this.l = paramEntityLiving.getDataWatcher();
}
public void a(PacketDataSerializer paramPacketDataSerializer)
{
this.a = paramPacketDataSerializer.a();
this.b = (paramPacketDataSerializer.readByte() & 0xFF);
this.c = paramPacketDataSerializer.readInt();
this.d = paramPacketDataSerializer.readInt();
this.e = paramPacketDataSerializer.readInt();
this.i = paramPacketDataSerializer.readByte();
this.j = paramPacketDataSerializer.readByte();
this.k = paramPacketDataSerializer.readByte();
this.f = paramPacketDataSerializer.readShort();
this.g = paramPacketDataSerializer.readShort();
this.h = paramPacketDataSerializer.readShort();
this.m = DataWatcher.b(paramPacketDataSerializer);
}
public void b(PacketDataSerializer paramPacketDataSerializer)
{
paramPacketDataSerializer.b(this.a);
paramPacketDataSerializer.writeByte(this.b & 0xFF);
paramPacketDataSerializer.writeInt(this.c);
paramPacketDataSerializer.writeInt(this.d);
paramPacketDataSerializer.writeInt(this.e);
paramPacketDataSerializer.writeByte(this.i);
paramPacketDataSerializer.writeByte(this.j);
paramPacketDataSerializer.writeByte(this.k);
paramPacketDataSerializer.writeShort(this.f);
paramPacketDataSerializer.writeShort(this.g);
paramPacketDataSerializer.writeShort(this.h);
this.l.a(paramPacketDataSerializer);
}
public void a(PacketPlayOutListener paramPacketPlayOutListener)
{
paramPacketPlayOutListener.a(this);
}
public String b()
{
return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf(this.c / 32.0F), Float.valueOf(this.d / 32.0F), Float.valueOf(this.e / 32.0F), Float.valueOf(this.f / 8000.0F), Float.valueOf(this.g / 8000.0F), Float.valueOf(this.h / 8000.0F) });
}
public PacketPlayOutSpawnEntityLiving()
{
}
@Override
public void handle(PacketListener arg0)
{
}
public PacketPlayOutSpawnEntityLiving(EntityLiving paramEntityLiving)
{
this.a = paramEntityLiving.getId();
this.b = ((byte) EntityTypes.a(paramEntityLiving));
this.c = paramEntityLiving.as.a(paramEntityLiving.locX);
this.d = MathHelper.floor(paramEntityLiving.locY * 32.0D);
this.e = paramEntityLiving.as.a(paramEntityLiving.locZ);
this.i = ((byte) (int) (paramEntityLiving.yaw * 256.0F / 360.0F));
this.j = ((byte) (int) (paramEntityLiving.pitch * 256.0F / 360.0F));
this.k = ((byte) (int) (paramEntityLiving.aP * 256.0F / 360.0F));
double d1 = 3.9D;
double d2 = paramEntityLiving.motX;
double d3 = paramEntityLiving.motY;
double d4 = paramEntityLiving.motZ;
if (d2 < -d1)
{
d2 = -d1;
}
if (d3 < -d1)
{
d3 = -d1;
}
if (d4 < -d1)
{
d4 = -d1;
}
if (d2 > d1)
{
d2 = d1;
}
if (d3 > d1)
{
d3 = d1;
}
if (d4 > d1)
{
d4 = d1;
}
this.f = ((int) (d2 * 8000.0D));
this.g = ((int) (d3 * 8000.0D));
this.h = ((int) (d4 * 8000.0D));
this.l = paramEntityLiving.getDataWatcher();
}
public void a(PacketDataSerializer paramPacketDataSerializer)
{
this.a = paramPacketDataSerializer.a();
this.b = (paramPacketDataSerializer.readByte() & 0xFF);
this.c = paramPacketDataSerializer.readInt();
this.d = paramPacketDataSerializer.readInt();
this.e = paramPacketDataSerializer.readInt();
this.i = paramPacketDataSerializer.readByte();
this.j = paramPacketDataSerializer.readByte();
this.k = paramPacketDataSerializer.readByte();
this.f = paramPacketDataSerializer.readShort();
this.g = paramPacketDataSerializer.readShort();
this.h = paramPacketDataSerializer.readShort();
this.m = DataWatcher.b(paramPacketDataSerializer);
}
public void b(PacketDataSerializer paramPacketDataSerializer)
{
paramPacketDataSerializer.b(this.a);
paramPacketDataSerializer.writeByte(this.b & 0xFF);
paramPacketDataSerializer.writeInt(this.c);
paramPacketDataSerializer.writeInt(this.d);
paramPacketDataSerializer.writeInt(this.e);
paramPacketDataSerializer.writeByte(this.i);
paramPacketDataSerializer.writeByte(this.j);
paramPacketDataSerializer.writeByte(this.k);
paramPacketDataSerializer.writeShort(this.f);
paramPacketDataSerializer.writeShort(this.g);
paramPacketDataSerializer.writeShort(this.h);
this.l.a(paramPacketDataSerializer);
}
public void a(PacketPlayOutListener paramPacketPlayOutListener)
{
paramPacketPlayOutListener.a(this);
}
public String b()
{
return String.format(
"id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f",
new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf(this.c / 32.0F),
Float.valueOf(this.d / 32.0F), Float.valueOf(this.e / 32.0F), Float.valueOf(this.f / 8000.0F),
Float.valueOf(this.g / 8000.0F), Float.valueOf(this.h / 8000.0F) });
}
@Override
public void handle(PacketListener arg0)
{
}
}

View File

@ -13,6 +13,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
@ -25,6 +26,8 @@ public abstract class TeamGame extends Game
protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
protected NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
protected long RejoinTime = 180000;
public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{
super(manager, gameType, kits, gameDesc);
@ -61,7 +64,7 @@ public abstract class TeamGame extends Game
GetLocationStore().put(player.getName(), player.getLocation());
//Announcement
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! 3 minutes to rejoin.");
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin.");
}
}
@ -109,7 +112,7 @@ public abstract class TeamGame extends Game
{
String name = rejoinIterator.next();
if (!UtilTime.elapsed(_rejoinTime.get(name), 180000))
if (!UtilTime.elapsed(_rejoinTime.get(name), RejoinTime))
continue;
rejoinIterator.remove();

View File

@ -87,10 +87,10 @@ public class UHC extends TeamGame
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
private int _borders = 1000;
private int _borders = 1250;
private boolean _borderShrink = true;
private int _borderShrinkSize = 1000;
private int _borderShrinkSize = 1250;
private int _gameMinutes = 0;
private long _lastMinute = System.currentTimeMillis();
@ -136,6 +136,7 @@ public class UHC extends TeamGame
this.DeathOut = true;
this.QuitOut = false;
RejoinTime = 1800000;
this.CreatureAllow = true;
@ -154,6 +155,8 @@ public class UHC extends TeamGame
this.CompassEnabled = false;
this.WorldBoundaryKill = false;
WorldTimeSet = -1;
CraftRecipes();

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Iterator;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.util.TimeUtil;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
@ -94,39 +95,39 @@ public class GameCreationManager implements Listener
HandlerList.unregisterAll(game);
System.out.println("GameCreationManager - DEBUG - Attempting Removal - " + game.GetName() + " - " + UtilTime.now());
TimeUtil.start("GameCreationManager - Attempting Removal - " + game.GetName());
//Cleaned
if (game.WorldData == null)
if (game.WorldData == null || game.WorldData.World == null)
{
gameIterator.remove();
continue;
}
if (game.WorldData.World == null)
else
{
gameIterator.remove();
continue;
}
//Kick Players
if (UtilTime.elapsed(game.GetStateTime(), 10000))
{
for (Player player : game.WorldData.World.getPlayers())
player.kickPlayer("Dead World");
if (UtilTime.elapsed(game.GetStateTime(), 10000))
{
TimeUtil.start("GameCreationManager - Kick Players - " + game.GetName());
for (Player player : game.WorldData.World.getPlayers())
player.kickPlayer("Dead World");
TimeUtil.stop();
}
System.out.println("GameCreationManager - DEBUG - Kick Players - " + UtilTime.now());
}
//Clean
if (game.WorldData.World.getPlayers().isEmpty())
{
game.WorldData.Uninitialize();
game.WorldData = null;
gameIterator.remove();
System.out.println("GameCreationManager - DEBUG - Uninit World - " + UtilTime.now());
//Clean
if (game.WorldData.World.getPlayers().isEmpty())
{
TimeUtil.start("GameCreationManager - Uninit World - " + game.GetName());
game.WorldData.Uninitialize();
game.WorldData = null;
gameIterator.remove();
TimeUtil.stop();
};
}
TimeUtil.stop();
}
}

View File

@ -171,8 +171,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener
AddPlayerToScoreboards(otherPlayer, null);
}
}
public Collection<Scoreboard> GetScoreboards()
{
@ -301,10 +299,10 @@ public class GameLobbyManager implements IPacketRunnable, Listener
if (game.GetTeamList().size() > 10 && game.GetType() == GameType.UHC)
{
WriteTeamLine("Season", 0, 159, (byte)15);
WriteTeamLine("5", 1, 159, (byte)4);
WriteTeamLine("7", 1, 159, (byte)4);
WriteKitLine("Season", 0, 159, (byte)15);
WriteKitLine("5", 1, 159, (byte)4);
WriteKitLine("7", 1, 159, (byte)4);
CreateScoreboards();
return;