diff --git a/.gitignore b/.gitignore
index 626bd858f..c1fc8b034 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,14 @@ zBench
zMyst
zSotanna
zSotanna2
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.fdt
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.fdx
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.fnm
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.frq
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.nrm
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.prx
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.tii
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/_0.tis
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments.gen
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/segments_1
+/.recommenders/index/http___download_eclipse_org_recommenders_models_mars_/write.lock
diff --git a/Art/Carl.png b/Art/Carl.png
new file mode 100644
index 000000000..5d4fe6d36
Binary files /dev/null and b/Art/Carl.png differ
diff --git a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml
index 150c21bc3..370ba8bd7 100644
--- a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml
+++ b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml
@@ -20,6 +20,7 @@
+
\ No newline at end of file
diff --git a/Plugins/.idea/artifacts/Mineplex_Hub_test.xml b/Plugins/.idea/artifacts/Mineplex_Hub_test.xml
index d164c4c6a..0527ee7d4 100644
--- a/Plugins/.idea/artifacts/Mineplex_Hub_test.xml
+++ b/Plugins/.idea/artifacts/Mineplex_Hub_test.xml
@@ -1,5 +1,5 @@
-
+
$PROJECT_DIR$/../Testing/Hub/plugins
diff --git a/Plugins/.idea/artifacts/Mineplex_Votifier_jar.xml b/Plugins/.idea/artifacts/Mineplex_Votifier_jar.xml
new file mode 100644
index 000000000..372114469
--- /dev/null
+++ b/Plugins/.idea/artifacts/Mineplex_Votifier_jar.xml
@@ -0,0 +1,24 @@
+
+
+ $PROJECT_DIR$/out/artifacts/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml
index bd35e0f52..37717d4dc 100644
--- a/Plugins/.idea/compiler.xml
+++ b/Plugins/.idea/compiler.xml
@@ -4,6 +4,7 @@
+
diff --git a/Plugins/.idea/libraries/bukkit.xml b/Plugins/.idea/libraries/bukkit.xml
deleted file mode 100644
index 8053b86f3..000000000
--- a/Plugins/.idea/libraries/bukkit.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml
index bf0ac4bae..bcc0470f4 100644
--- a/Plugins/.idea/modules.xml
+++ b/Plugins/.idea/modules.xml
@@ -17,6 +17,7 @@
+
diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml
index 4c3d6b432..3359861d8 100644
--- a/Plugins/BuildFiles/common.xml
+++ b/Plugins/BuildFiles/common.xml
@@ -86,6 +86,9 @@
+
+
+
@@ -152,6 +155,9 @@
+
+
+
@@ -198,6 +204,9 @@
+
+
+
@@ -234,6 +243,9 @@
+
+
+
@@ -440,6 +452,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Plugins/Libraries/BungeeCord.jar b/Plugins/Libraries/BungeeCord.jar
index a408f8656..45383e430 100644
Binary files a/Plugins/Libraries/BungeeCord.jar and b/Plugins/Libraries/BungeeCord.jar differ
diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java
index fa7f5c43c..75cf934cf 100644
--- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java
+++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java
@@ -1,5 +1,6 @@
package mineplex.bungee.motd;
+import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -7,9 +8,13 @@ import java.util.Random;
import java.util.concurrent.TimeUnit;
import mineplex.serverdata.Region;
+import mineplex.serverdata.data.BungeeServer;
import mineplex.serverdata.data.DataRepository;
import mineplex.serverdata.redis.RedisDataRepository;
+import mineplex.serverdata.servers.ConnectionData;
import mineplex.serverdata.servers.ServerManager;
+import mineplex.serverdata.servers.ConnectionData.ConnectionType;
+import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
@@ -20,7 +25,9 @@ public class MotdManager implements Listener, Runnable
private Plugin _plugin;
private DataRepository _repository;
-
+ private DataRepository _secondRepository;
+ private Region _region;
+
private Random _random = new Random();
private String _firstLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r";
private List _motdLines;
@@ -28,6 +35,7 @@ public class MotdManager implements Listener, Runnable
public MotdManager(Plugin plugin)
{
_plugin = plugin;
+ _region = !new File("eu.dat").exists() ? Region.US : Region.EU;
_plugin.getProxy().getScheduler().schedule(_plugin, this, 5L, 30L, TimeUnit.SECONDS);
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
@@ -38,12 +46,21 @@ public class MotdManager implements Listener, Runnable
if (new File("updateMOTD.dat").exists())
{
- List lines = new ArrayList();
- lines.add(" §f§l◄ §6§lNEW §f§l▬ §c§lSSM/SG/SW Teams§f§l ▬ §c§lMPS Update §f§l►");
- //lines.add(" §d§lRank Sale §a§l40% Off");
- //lines.add(" §f§l◄§c§lMAINTENANCE§f§l►");
+ if (_region == Region.US)
+ _secondRepository = new RedisDataRepository(new ConnectionData("10.81.1.156", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionType.SLAVE, "ServerStatus"),
+ Region.ALL, GlobalMotd.class, "globalMotd");
+ else
+ _secondRepository = new RedisDataRepository(new ConnectionData("10.33.53.16", 6379, ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionType.SLAVE, "ServerStatus"),
+ Region.ALL, GlobalMotd.class, "globalMotd");
- updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);
+ //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
+ //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
+ String motdLine = " §b§l◄§f§lNEW GAME§b§l► §f§l◄§b§lEVOLUTION§f§l► §b§l◄§f§lNEW GAME§b§l►";
+ //String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►";
+ //String motdLine = " §d§lRank Sale §a§l40% Off");
+ //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
+
+ updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", motdLine);
System.out.println("Updated Bungee MOTD");
}
}
@@ -68,7 +85,7 @@ public class MotdManager implements Listener, Runnable
GlobalMotd motd = _repository.getElement("MainMotd");
if (motd != null)
- {
+ {
_motdLines = motd.getMotd();
_firstLine = motd.getHeadline();
}
@@ -78,9 +95,14 @@ public class MotdManager implements Listener, Runnable
* Update the main {@link GlobalMotd} determining the MOTD for Bungee instances.
* @param motdLines - the lines to update the MOTD to.
*/
- public void updateMainMotd(String headline, List motdLines)
+ public void updateMainMotd(String headline, String motdLine)
{
+ List motdLines = new ArrayList();
+
+ motdLines.add(motdLine);
+
_repository.addElement(new GlobalMotd("MainMotd", headline, motdLines));
+ _secondRepository.addElement(new GlobalMotd("MainMotd", headline, motdLines));
}
public List getMotdLines()
diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java
index 63bab7330..fcae65a57 100644
--- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java
+++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerStats/PlayerStats.java
@@ -1,6 +1,5 @@
package mineplex.bungee.playerStats;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@@ -17,9 +16,8 @@ import net.md_5.bungee.event.EventHandler;
public class PlayerStats implements Listener, Runnable
{
private Plugin _plugin;
- private PlayerStatsRepository _repository;
+ private PlayerStatsRepository _repository;
- private PlayerCache _playerCache = new PlayerCache();
private HashSet _retrievingPlayerInfo = new HashSet();
public PlayerStats(Plugin plugin)
@@ -52,7 +50,7 @@ public class PlayerStats implements Listener, Runnable
boolean addOrUpdatePlayer = false;
- playerInfo = _playerCache.getPlayer(uuid);
+ playerInfo = PlayerCache.getInstance().getPlayer(uuid);
if (playerInfo == null)
{
@@ -80,11 +78,11 @@ public class PlayerStats implements Listener, Runnable
}
else
playerInfo = updatedPlayerInfo;
-
- _playerCache.addPlayer(playerInfo);
}
playerInfo.setSessionId(_repository.updatePlayerStats(playerInfo.getId(), ipInfo.id));
+ playerInfo.updateLoginTime();
+ PlayerCache.getInstance().addPlayer(playerInfo);
}
finally
{
@@ -105,13 +103,13 @@ public class PlayerStats implements Listener, Runnable
PlayerInfo playerInfo = null;
- playerInfo = _playerCache.getPlayer(uuid);
+ playerInfo = PlayerCache.getInstance().getPlayer(uuid);
int timeout = 5;
while (playerInfo == null && _retrievingPlayerInfo.contains(uuid) && timeout <= 5)
{
- playerInfo = _playerCache.getPlayer(uuid);
+ playerInfo = PlayerCache.getInstance().getPlayer(uuid);
if (playerInfo != null)
break;
@@ -130,6 +128,7 @@ public class PlayerStats implements Listener, Runnable
timeout++;
}
+ System.out.println(playerInfo.getName() + ":" + playerInfo.getSessionId());
_repository.updatePlayerSession(playerInfo.getSessionId());
}
});
@@ -138,6 +137,6 @@ public class PlayerStats implements Listener, Runnable
@Override
public void run()
{
- _playerCache.clean();
+ PlayerCache.getInstance().clean();
}
}
diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java
new file mode 100644
index 000000000..8e56dab88
--- /dev/null
+++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerJoinHandler.java
@@ -0,0 +1,27 @@
+package mineplex.bungee.playerTracker;
+
+import mineplex.serverdata.commands.CommandCallback;
+import mineplex.serverdata.commands.PlayerJoinCommand;
+import mineplex.serverdata.commands.ServerCommand;
+
+public class PlayerJoinHandler implements CommandCallback
+{
+ private PlayerTracker _playerTracker;
+
+ public PlayerJoinHandler(PlayerTracker playerTracker)
+ {
+ _playerTracker = playerTracker;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run(ServerCommand command)
+ {
+ if (command instanceof PlayerJoinCommand)
+ {
+ PlayerJoinCommand joinCommand = (PlayerJoinCommand)command;
+
+ _playerTracker.kickPlayerIfOnline(joinCommand.getUuid());
+ }
+ }
+}
diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java
index 24e40892c..707dc3eb8 100644
--- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java
+++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/playerTracker/PlayerTracker.java
@@ -1,19 +1,25 @@
package mineplex.bungee.playerTracker;
import java.io.File;
+import java.util.HashSet;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
import mineplex.serverdata.Region;
+import mineplex.serverdata.commands.ServerCommandManager;
import mineplex.serverdata.data.DataRepository;
import mineplex.serverdata.data.PlayerStatus;
import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ServerManager;
+import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
+import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.ServerConnectedEvent;
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 PlayerTracker implements Listener
+public class PlayerTracker implements Listener, Runnable
{
// Default period before status expiry (8 hours)
private static final int DEFAULT_STATUS_TIMEOUT = 60 * 60 * 8;
@@ -21,6 +27,8 @@ public class PlayerTracker implements Listener
// Repository storing player status' across network.
private DataRepository _repository;
+ private HashSet _onlineUUIDs = new HashSet();
+
private Plugin _plugin;
public PlayerTracker(Plugin plugin)
@@ -28,11 +36,14 @@ public class PlayerTracker implements Listener
_plugin = plugin;
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
+ _plugin.getProxy().getScheduler().schedule(_plugin, this, 1L, 1L, TimeUnit.MINUTES);
Region region = !new File("eu.dat").exists() ? Region.US : Region.EU;
_repository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
region, PlayerStatus.class, "playerStatus");
+ ServerCommandManager.getInstance().registerCommandType("PlayerJoinCommand", mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this));
+
System.out.println("Initialized PlayerTracker.");
}
@@ -56,8 +67,45 @@ public class PlayerTracker implements Listener
{
public void run()
{
- _repository.removeElement(event.getPlayer().getName());
+ _repository.removeElement(event.getPlayer().getName().toLowerCase());
}
});
+
+ _onlineUUIDs.remove(event.getPlayer().getUniqueId());
+ }
+
+ @EventHandler
+ public void playerConnect(final PostLoginEvent event)
+ {
+ _onlineUUIDs.add(event.getPlayer().getUniqueId().toString());
+ }
+
+ @Override
+ public void run()
+ {
+ HashSet onlineUUIDs = new HashSet();
+
+ for (ProxiedPlayer player : _plugin.getProxy().getPlayers())
+ {
+ onlineUUIDs.add(player.getUniqueId().toString());
+ }
+
+ _onlineUUIDs = onlineUUIDs;
+ }
+
+ public boolean isPlayerOnline(String uuid)
+ {
+ return _onlineUUIDs.contains(uuid);
+ }
+
+ public void kickPlayerIfOnline(String uuid)
+ {
+ if (_onlineUUIDs.contains(uuid))
+ {
+ ProxiedPlayer player = _plugin.getProxy().getPlayer(UUID.fromString(uuid));
+
+ if (player != null)
+ player.disconnect("You have logged in from another location.");
+ }
}
}
diff --git a/Plugins/Mineplex.ChestConverter/.externalToolBuilders/ServerMonitor.launch b/Plugins/Mineplex.ChestConverter/.externalToolBuilders/ServerMonitor.launch
index 0c6e0f696..d07871b9a 100644
--- a/Plugins/Mineplex.ChestConverter/.externalToolBuilders/ServerMonitor.launch
+++ b/Plugins/Mineplex.ChestConverter/.externalToolBuilders/ServerMonitor.launch
@@ -10,6 +10,7 @@
+
diff --git a/Plugins/Mineplex.ChestConverter/src/mineplex/chestConverter/ChestConverter.java b/Plugins/Mineplex.ChestConverter/src/mineplex/chestConverter/ChestConverter.java
index 5d7c5d23e..f1fd646d0 100644
--- a/Plugins/Mineplex.ChestConverter/src/mineplex/chestConverter/ChestConverter.java
+++ b/Plugins/Mineplex.ChestConverter/src/mineplex/chestConverter/ChestConverter.java
@@ -1,11 +1,20 @@
package mineplex.chestConverter;
import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map.Entry;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
@@ -18,8 +27,23 @@ public class ChestConverter
private static Logger _logger = Logger.getLogger("Converter");
+ private static String _connectionString = "jdbc:mysql://db.mineplex.com:3306/Account?allowMultiQueries=true";
+ private static String _userName = "MilitaryPolice";
+ private static String _password = "CUPr6Wuw2Rus$qap";
+
+ private static Connection _connection;
+
public static void main (String args[])
{
+ try
+ {
+ Class.forName("com.mysql.jdbc.Driver");
+ }
+ catch (ClassNotFoundException e1)
+ {
+ e1.printStackTrace();
+ }
+
try
{
FileHandler fileHandler = new FileHandler("converter.log", true);
@@ -38,72 +62,138 @@ public class ChestConverter
{
e1.printStackTrace();
}
-
- _repository = new ChestConverterRepository();
- int lastId = 18279475;
- int count = 50000;
- int numOfRowsProcessed = lastId;
- HashMap tasks = _repository.getTaskList();
+ int limit = 50000;
+ HashSet accountStats = new HashSet();
- try
+ while (true)
{
- while (true)
+ accountStats.clear();
+
+ try
{
- long time = System.currentTimeMillis();
- HashMap> playerMap = new HashMap>();
+ Statement statement = null;
-
- List taskList = _repository.getTasks(lastId, count);
-
- if (taskList != null && taskList.size() > 0)
+ try
{
- for (AccountTask task : taskList)
+ if (_connection == null || _connection.isClosed())
+ _connection = DriverManager.getConnection(_connectionString, _userName, _password);
+
+ statement = _connection.createStatement();
+
+ statement.execute("SELECT accountId, statId, value FROM Account.accountStats LIMIT " + limit + ";");
+
+ ResultSet resultSet = statement.getResultSet();
+
+ while (resultSet.next())
{
- if (!playerMap.containsKey(task.UUID))
- playerMap.put(task.UUID, new ArrayList());
+ accountStats.add(new AccountStat(resultSet.getInt(1), resultSet.getInt(2), resultSet.getInt(3)));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ }
+ finally
+ {
+ if (statement != null)
+ {
+ try
+ {
+ statement.close();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ if (accountStats.size() == 0)
+ {
+ System.out.println("No accounts.");
+ return;
+ }
+
+ PreparedStatement updateStatement = null;
+ PreparedStatement insertStatement = null;
+ Statement deleteStatement = null;
+
+ try
+ {
+ if (_connection == null || _connection.isClosed())
+ _connection = DriverManager.getConnection(_connectionString, _userName, _password);
+
+ _connection.setAutoCommit(true);
+ updateStatement = _connection.prepareStatement("UPDATE accountStat SET value = value + ? WHERE accountId = ? AND statId = ? AND value < ?;");
+
+ for (AccountStat stat : accountStats)
+ {
+ updateStatement.setLong(1, stat.value);
+ updateStatement.setInt(2, stat.accountId);
+ updateStatement.setInt(3, stat.statId);
+ updateStatement.setLong(4, stat.value);
- playerMap.get(task.UUID).add(tasks.get(task.Task));
-
- if (task.Id > lastId)
- lastId = task.Id;
+ updateStatement.addBatch();
}
- _repository.incrementClients(playerMap);
- try
+ int[] rowsAffected = updateStatement.executeBatch();
+ _connection.setAutoCommit(false);
+ int i = 0;
+ int count = 0;
+
+ log("Updated rows - " + limit);
+
+ insertStatement = _connection.prepareStatement("INSERT IGNORE accountStat(accountId, statId, value) VALUES (?, ?, ?);");
+
+ for (AccountStat stat : accountStats)
{
- numOfRowsProcessed += count;
- log("Natural sleep. " + count + " took " + (System.currentTimeMillis() - time) / 1000 + " seconds. Count = " + + numOfRowsProcessed);
- Thread.sleep(100);
- }
- catch (InterruptedException e)
+ if (rowsAffected[i] < 1)
+ {
+ insertStatement.setInt(1, stat.accountId);
+ insertStatement.setInt(2, stat.statId);
+ insertStatement.setLong(3, stat.value);
+
+ insertStatement.addBatch();
+ count++;
+ }
+
+ i++;
+ }
+
+ insertStatement.executeBatch();
+ log("Inserted rows - " + count);
+
+ deleteStatement = _connection.createStatement();
+ deleteStatement.executeUpdate("DELETE FROM accountStats LIMIT " + limit + ";");
+
+ _connection.commit();
+
+ log("Deleted rows - " + limit);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ }
+ finally
+ {
+ if (statement != null)
{
- e.printStackTrace();
+ try
+ {
+ statement.close();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
}
}
- else if (numOfRowsProcessed > 17000000)
- {
- System.out.println("Count : " + numOfRowsProcessed);
- _logger.info("Count : " + numOfRowsProcessed);
- break;
- }
- else
- {
- System.out.println("No greater than 17 mil");
- _logger.info("No greater than 17 mil");
- System.out.println("Count : " + numOfRowsProcessed);
- _logger.info("Count : " + numOfRowsProcessed);
- }
}
- }
- catch (Exception e)
- {
- _logger.info(e.getMessage());
- }
- finally
- {
- System.out.println("Count : " + numOfRowsProcessed);
- _logger.info("Count : " + numOfRowsProcessed);
+ catch (Exception e)
+ {
+ _logger.info(e.getMessage());
+ }
}
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java
index 74e648808..8cab61a15 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java
@@ -8,6 +8,7 @@ import mineplex.core.common.util.UtilPlayer;
public enum Rank
{
+ //Staff
LT("LT", ChatColor.DARK_RED),
OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED),
@@ -21,36 +22,48 @@ public enum Rank
MEDIA("Media", ChatColor.BLUE),
EVENT("Event", ChatColor.WHITE),
-
- //Staff ^^
-
+
+ //Media
YOUTUBE("YouTube", ChatColor.RED),
+ YOUTUBE_SMALL("MooTube", ChatColor.DARK_PURPLE),
TWITCH("Twitch", ChatColor.DARK_PURPLE),
- LEGEND("Legend", ChatColor.GREEN),
- HERO("Hero", ChatColor.LIGHT_PURPLE),
- ULTRA("Ultra", ChatColor.AQUA),
+
+ //Player
+ LEGEND("Legend", ChatColor.GREEN, true),
+ HERO("Hero", ChatColor.LIGHT_PURPLE, true),
+ ULTRA("Ultra", ChatColor.AQUA, true),
ALL("", ChatColor.WHITE);
- private ChatColor Color;
+ private ChatColor _color;
+ private boolean _donor;
+
public String Name;
Rank(String name, ChatColor color)
{
- Color = color;
+ _color = color;
Name = name;
+ _donor = false;
}
- public boolean Has(Rank rank)
+ Rank(String name, ChatColor color, boolean donor)
{
- return Has(null, rank, false);
+ _color = color;
+ Name = name;
+ _donor = donor;
}
- public boolean Has(Player player, Rank rank, boolean inform)
+ public boolean has(Rank rank)
{
- return Has(player, rank, null, inform);
+ return has(null, rank, false);
}
- public boolean Has(Player player, Rank rank, Rank[] specific, boolean inform)
+ public boolean has(Player player, Rank rank, boolean inform)
+ {
+ return has(player, rank, null, inform);
+ }
+
+ public boolean has(Player player, Rank rank, Rank[] specific, boolean inform)
{
//Specific Rank
if (specific != null)
@@ -79,7 +92,7 @@ public enum Rank
return false;
}
- public String GetTag(boolean bold, boolean uppercase)
+ public String getTag(boolean bold, boolean uppercase)
{
if (Name.equalsIgnoreCase("ALL"))
return "";
@@ -88,12 +101,17 @@ public enum Rank
if (uppercase)
name = Name.toUpperCase();
- if (bold) return Color + C.Bold + name;
- else return Color + name;
+ if (bold) return _color + C.Bold + name;
+ else return _color + name;
}
- public ChatColor GetColor()
+ public ChatColor getColor()
{
- return Color;
+ return _color;
+ }
+
+ public boolean isDonor()
+ {
+ return _donor;
}
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/structs/ItemContainer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/structs/ItemContainer.java
new file mode 100644
index 000000000..64871529b
--- /dev/null
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/structs/ItemContainer.java
@@ -0,0 +1,24 @@
+package mineplex.core.common.structs;
+
+import org.bukkit.Material;
+
+public class ItemContainer
+{
+ public Material Type;
+ public byte Data;
+ public String Name;
+
+ public ItemContainer(Material type, byte data, String name)
+ {
+ Type = type;
+ Data = data;
+ Name = name;
+ }
+
+ public ItemContainer(int id, byte data, String name)
+ {
+ Type = Material.getMaterial(id);
+ Data = data;
+ Name = name;
+ }
+}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java
index a387ba46a..db1e528f3 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java
@@ -95,15 +95,15 @@ public class F
public static String help(String cmd, String body, Rank rank)
{
- return rank.GetColor() + cmd + " " + C.mBody + body + " " + rank(rank);
+ return rank.getColor() + cmd + " " + C.mBody + body + " " + rank(rank);
}
public static String rank(Rank rank)
{
if (rank == Rank.ALL)
- return rank.GetColor() + "Player";
+ return rank.getColor() + "Player";
- return rank.GetTag(false, false);
+ return rank.getTag(false, false);
}
public static String value(String variable, String value)
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java
index b327bf32e..73ae33c86 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java
@@ -69,6 +69,11 @@ public class MapUtil
{
QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo);
}
+
+ public static void QuickChangeBlockAt(Location location, Material setTo, byte data)
+ {
+ QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo, data);
+ }
public static void QuickChangeBlockAt(Location location, int id, byte data)
{
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
index 56a9b917e..807dbccb5 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java
@@ -5,10 +5,8 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-
-
-
import org.bukkit.Location;
+import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -251,6 +249,25 @@ public class UtilAlg
return bestLoc;
}
+ public static Location findFurthest(Location mid, ArrayList locs)
+ {
+ Location bestLoc = null;
+ double bestDist = 0;
+
+ for (Location loc : locs)
+ {
+ double dist = UtilMath.offset(mid, loc);
+
+ if (bestLoc == null || dist > bestDist)
+ {
+ bestLoc = loc;
+ bestDist = dist;
+ }
+ }
+
+ return bestLoc;
+ }
+
public static boolean isInPyramid(Vector a, Vector b, double angleLimit)
{
return (Math.abs(GetPitch(a) - GetPitch(b)) < angleLimit) && (Math.abs(GetYaw(a) - GetYaw(b)) < angleLimit);
@@ -298,6 +315,42 @@ public class UtilAlg
return bestLoc;
}
+ public static Location getLocationAwayFromOtherLocations(ArrayList locs, ArrayList players)
+ {
+ Location bestLoc = null;
+ double bestDist = 0;
+
+ for (Location loc : locs)
+ {
+ double closest = -1;
+
+ for (Location player : players)
+ {
+ //Different Worlds
+ if (!player.getWorld().equals(loc.getWorld()))
+ continue;
+
+ double dist = UtilMath.offsetSquared(player, loc);
+
+ if (closest == -1 || dist < closest)
+ {
+ closest = dist;
+ }
+ }
+
+ if (closest == -1)
+ continue;
+
+ if (bestLoc == null || closest > bestDist)
+ {
+ bestLoc = loc;
+ bestDist = closest;
+ }
+ }
+
+ return bestLoc;
+ }
+
public static Location getLocationNearPlayers(ArrayList locs, ArrayList players, ArrayList dontOverlap)
{
Location bestLoc = null;
@@ -353,4 +406,21 @@ public class UtilAlg
return bestLoc;
}
+
+ public static Location getNearestCornerLocation(Location near, Block block)
+ {
+ ArrayList corners = new ArrayList();
+
+ corners.add(block.getLocation().clone());
+ corners.add(block.getLocation().clone().add(.999, 0, 0));
+ corners.add(block.getLocation().clone().add(.999, 0, .999));
+ corners.add(block.getLocation().clone().add(0, 0, .999));
+
+ corners.add(block.getLocation().clone().add(0, .999, 0));
+ corners.add(block.getLocation().clone().add(.999, .999, 0));
+ corners.add(block.getLocation().clone().add(.999, .999, .999));
+ corners.add(block.getLocation().clone().add(0, .999, .999));
+
+ return UtilAlg.findClosest(near, corners);
+ }
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
index d87d16fa5..1cc2d5416 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java
@@ -4,26 +4,32 @@ import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+
+import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.EntityBat;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R4.EntityLiving;
+import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
import net.minecraft.server.v1_7_R4.Navigation;
+import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_7_R4.PathfinderGoal;
import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
+import net.minecraft.server.v1_7_R4.WorldServer;
import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
-import org.bukkit.block.BlockFace;
+import org.bukkit.block.Block;
+import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
+import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Creature;
@@ -32,8 +38,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
-import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
+import org.bukkit.util.Vector;
public class UtilEnt
{
@@ -491,10 +496,14 @@ public class UtilEnt
public static boolean isGrounded(Entity ent)
{
- if (ent instanceof CraftEntity)
- return ((CraftEntity)ent).getHandle().onGround;
-
- return UtilBlock.solid(ent.getLocation().getBlock().getRelative(BlockFace.DOWN));
+ AxisAlignedBB box = ((CraftEntity)ent).getHandle().boundingBox;
+ Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c);
+ Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
+
+ for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){
+ if(UtilBlock.solid(b)) return true;
+ }
+ return false;
}
public static void PlayDamageSound(LivingEntity damagee)
@@ -582,6 +591,36 @@ public class UtilEnt
return false;
}
+ public static boolean CreatureLook(Entity ent, Entity target)
+ {
+ return CreatureLook(ent, target instanceof LivingEntity ? ((LivingEntity) target).getEyeLocation() : target.getLocation());
+ }
+
+ public static boolean CreatureLook(Entity ent, Location target)
+ {
+ Vector vec = UtilAlg.getTrajectory(ent.getLocation(), target);
+
+ return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec));
+ }
+
+ public static boolean CreatureLook(Entity ent, float pitch, float yaw)
+ {
+ if (!(ent instanceof LivingEntity))
+ return false;
+
+ EntityLiving ec = ((CraftLivingEntity) ent).getHandle();
+ Location loc = ent.getLocation();
+
+ ec.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), yaw, pitch);
+ ec.al = true;
+
+ EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.world).tracker.trackedEntities.get(ec.getId());
+
+ entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, (byte) (ec.yaw * 256.0F / 360.0F)));
+
+ return true;
+ }
+
public static void CreatureMove(Entity ent, Location target, float speed)
{
if (!(ent instanceof Creature))
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java
index 7b9a8479f..c07b7b3b4 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java
@@ -1,5 +1,7 @@
package mineplex.core.common.util;
+import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
+
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
@@ -8,6 +10,7 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
import org.bukkit.entity.Firework;
+import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector;
@@ -68,5 +71,29 @@ public class UtilFirework
public static void playFirework(Location loc, Type type, Color color, boolean flicker, boolean trail)
{
playFirework(loc, FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build());
+ }
+
+ public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail)
+ {
+ Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class);
+ FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build();
+
+ FireworkMeta data = (FireworkMeta) firework.getFireworkMeta();
+ data.clearEffects();
+ data.setPower(1);
+ data.addEffect(effect);
+ firework.setFireworkMeta(data);
+
+ ((CraftFirework) firework).getHandle().expectedLifespan = 1;
+
+ PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId());
+
+ for (Player viewing : UtilServer.getPlayers())
+ {
+ if (player == viewing)
+ continue;
+
+ UtilPlayer.sendPacket(viewing, packet);
+ }
}
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java
index cdd967e05..1c874c58b 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilItem.java
@@ -4,22 +4,24 @@ import java.util.AbstractMap;
import java.util.LinkedList;
import java.util.Map.Entry;
+import mineplex.core.common.structs.ItemContainer;
+
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class UtilItem
{
- public static LinkedList> matchItem(Player caller, String items, boolean inform)
+ public static LinkedList matchItem(Player caller, String items, boolean inform)
{
- LinkedList> matchList = new LinkedList>();
+ LinkedList matchList = new LinkedList();
String failList = "";
//Mass Search
for (String cur : items.split(","))
{
- Entry match = searchItem(caller, cur, inform);
+ ItemContainer match = searchItem(caller, cur, inform);
if (match != null)
matchList.add(match);
@@ -40,21 +42,27 @@ public class UtilItem
return matchList;
}
- public static Entry searchItem(Player caller, String args, boolean inform)
+ public static ItemContainer searchItem(Player caller, String args, boolean inform)
{
- LinkedList> matchList = new LinkedList>();
+ LinkedList matchList = new LinkedList();
for (Material cur : Material.values())
{
+ String[] arg = args.split(":");
+
+ //Get Selected Name
+ String name = null;
+ if (arg.length > 2)
+ name = arg[2].replaceAll("_", " ");
+
//By Name
if (cur.toString().equalsIgnoreCase(args))
- return new AbstractMap.SimpleEntry(cur, (byte)0);
+ return new ItemContainer(cur, (byte)0, name);
if (cur.toString().toLowerCase().contains(args.toLowerCase()))
- matchList.add(new AbstractMap.SimpleEntry(cur, (byte)0));
+ matchList.add(new ItemContainer(cur, (byte)0, name));
- //By ID:Data
- String[] arg = args.split(":");
+ //By ID:Data:Name
//ID
int id = 0;
@@ -82,8 +90,8 @@ public class UtilItem
{
continue;
}
-
- return new AbstractMap.SimpleEntry(cur, data);
+
+ return new ItemContainer(cur, data, name);
}
//No / Non-Unique
@@ -102,8 +110,9 @@ public class UtilItem
if (matchList.size() > 0)
{
String matchString = "";
- for (Entry cur : matchList)
- matchString += F.elem(cur.getKey().toString()) + ", ";
+ for (ItemContainer cur : matchList)
+ matchString += F.elem(cur.Type.toString()) + ", ";
+
if (matchString.length() > 1)
matchString = matchString.substring(0 , matchString.length() - 2);
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java
index c3513308c..72ce23304 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilMath.java
@@ -85,5 +85,11 @@ public class UtilMath
return Math.random() * d;
}
+
+ public static T randomElement(T[] array) {
+ if (array.length == 0)
+ return null;
+ return array[random.nextInt(array.length)];
+ }
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
index 322a55134..321f16789 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java
@@ -6,20 +6,23 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
+import net.minecraft.server.v1_7_R4.EntityPlayer;
+import net.minecraft.server.v1_7_R4.Packet;
+import net.minecraft.server.v1_7_R4.PlayerConnection;
+
import org.bukkit.ChatColor;
-import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.InventoryView;
import org.bukkit.util.Vector;
-import net.minecraft.server.v1_7_R4.Packet;
-import net.minecraft.server.v1_7_R4.PlayerConnection;
-
public class UtilPlayer
{
private static boolean hasIntersection(Vector3D p1, Vector3D p2, Vector3D min, Vector3D max)
@@ -608,7 +611,19 @@ public class UtilPlayer
return ((CraftPlayer) player).getHandle().spectating;
return false;
}
-
+
+ public static InventoryView swapToInventory(Player player, Inventory inv) {
+
+ EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
+ if (nmsPlayer.activeContainer != nmsPlayer.defaultContainer)
+ {
+ // Do this so that other inventories know their time is over.
+ CraftEventFactory.handleInventoryCloseEvent(nmsPlayer);
+ nmsPlayer.m();
+ }
+ return player.openInventory(inv);
+ }
+
/*
public void setListName(Player player, CoreClient client)
{
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java
index 14925bf49..9b6044b4e 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java
@@ -6,23 +6,23 @@ public class UtilSkull
{
public static byte getSkullData(Entity entity)
{
- if (entity instanceof Skeleton)
- {
- Skeleton sk = ((Skeleton) entity);
- if (sk.getSkeletonType() == Skeleton.SkeletonType.WITHER)
- return 1;
- else return 0;
- }
- else if (entity instanceof Zombie || entity instanceof Giant)
- {
+ if (entity == null)
+ return 0;
+
+ return getSkullData(entity.getType());
+ }
+
+ public static byte getSkullData(EntityType type)
+ {
+ if (type == EntityType.SKELETON)
+ return 0;
+ if (type == EntityType.WITHER)
+ return 1;
+ if (type == EntityType.ZOMBIE || type == EntityType.GIANT)
return 2;
- }
- else if (entity instanceof Creeper)
- {
+ if (type == EntityType.CREEPER)
return 4;
- }
- else
- return 3;
+ return 3;
}
public static boolean isPlayerHead(byte data)
@@ -31,52 +31,54 @@ public class UtilSkull
}
public static String getPlayerHeadName(Entity entity)
+ {
+ return getPlayerHeadName(entity.getType());
+ }
+
+ public static String getPlayerHeadName(EntityType entity)
{
String name = "MHF_Alex";
// order is important for some of these
- if (entity instanceof Blaze)
+ if (entity == EntityType.BLAZE)
name = "MHF_Blaze";
- else if (entity instanceof CaveSpider)
+ else if (entity == EntityType.CAVE_SPIDER)
name = "MHF_CaveSpider";
- else if (entity instanceof Spider)
+ else if (entity == EntityType.SPIDER)
name = "MHF_Spider";
- else if (entity instanceof Chicken)
+ else if (entity == EntityType.CHICKEN)
name = "MHF_Chicken";
- else if (entity instanceof MushroomCow)
+ else if (entity == EntityType.MUSHROOM_COW)
name = "MHF_MushroomCow";
- else if (entity instanceof Cow)
+ else if (entity == EntityType.COW)
name = "MHF_Cow";
- else if (entity instanceof Creeper)
+ else if (entity == EntityType.CREEPER)
name = "MHF_Creeper";
- else if (entity instanceof Enderman)
+ else if (entity == EntityType.ENDERMAN)
name = "MHF_Enderman";
- else if (entity instanceof Ghast)
+ else if (entity == EntityType.GHAST)
name = "MHF_Ghast";
- else if (entity instanceof Golem)
+ else if (entity == EntityType.IRON_GOLEM)
name = "MHF_Golem";
- else if (entity instanceof PigZombie)
+ else if (entity == EntityType.PIG_ZOMBIE)
name = "MHF_PigZombie";
- else if (entity instanceof MagmaCube)
+ else if (entity == EntityType.MAGMA_CUBE)
name = "MHF_LavaSlime";
- else if (entity instanceof Slime)
+ else if (entity == EntityType.SLIME)
name = "MHF_Slime";
- else if (entity instanceof Ocelot)
+ else if (entity == EntityType.OCELOT)
name = "MHF_Ocelot";
- else if (entity instanceof PigZombie)
- name = "MHF_PigZombie";
- else if (entity instanceof Pig)
+ else if (entity == EntityType.PIG)
name = "MHF_Pig";
- else if (entity instanceof Sheep)
- name = "MHF_Pig";
- else if (entity instanceof Squid)
+ else if (entity == EntityType.SHEEP)
+ name = "MHF_Sheep";
+ else if (entity == EntityType.SQUID)
name = "MHF_Squid";
- else if (entity instanceof HumanEntity)
+ else if (entity == EntityType.PLAYER)
name = "MHF_Steve";
- else if (entity instanceof Villager)
+ else if (entity == EntityType.VILLAGER)
name = "MHF_Villager";
return name;
}
-
}
diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java
index 4ae8f94dc..4372b6fba 100644
--- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java
+++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java
@@ -2,6 +2,8 @@ package mineplex.core.common.util;
import java.util.Collection;
+import org.apache.commons.lang.WordUtils;
+
public class UtilText {
public static String listToString(Collection inputList, boolean comma) {
String out = "";
@@ -84,4 +86,13 @@ public class UtilText {
return false;
}
+
+ public static String[] wrap(String text, int lineLength)
+ {
+ return wrap(text, lineLength, true);
+ }
+
+ public static String[] wrap(String text, int lineLength, boolean wrapLongerWords) {
+ return WordUtils.wrap(text, lineLength, "\00D0", wrapLongerWords).split("\00D0");
+ }
}
diff --git a/Plugins/Mineplex.Core/.classpath b/Plugins/Mineplex.Core/.classpath
index 8171cd881..7dba3b7ca 100644
--- a/Plugins/Mineplex.Core/.classpath
+++ b/Plugins/Mineplex.Core/.classpath
@@ -14,5 +14,6 @@
+
diff --git a/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs b/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs
index 7341ab168..d17b6724d 100644
--- a/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs
+++ b/Plugins/Mineplex.Core/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
diff --git a/Plugins/Mineplex.Core/Mineplex.Core.iml b/Plugins/Mineplex.Core/Mineplex.Core.iml
index 1a3abf88d..1714de4b9 100644
--- a/Plugins/Mineplex.Core/Mineplex.Core.iml
+++ b/Plugins/Mineplex.Core/Mineplex.Core.iml
@@ -20,5 +20,6 @@
+
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java b/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java
index 1fd02a703..d6b15a030 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/TablistFix.java
@@ -22,7 +22,7 @@ public class TablistFix extends MiniPlugin
// This is sort of experimental!
@EventHandler(priority = EventPriority.MONITOR)
public void onJoin(PlayerJoinEvent event)
- {
+ {/*
final Player player = event.getPlayer();
runSyncLater(new Runnable()
{
@@ -49,5 +49,6 @@ public class TablistFix extends MiniPlugin
}
}
}, 20L);
+ */
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java b/Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java
deleted file mode 100644
index e6ac95b35..000000000
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/AccountCache.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package mineplex.core.account;
-
-import java.util.UUID;
-
-import mineplex.serverdata.data.Data;
-
-public class AccountCache implements Data
-{
- private UUID _uuid;
- private Integer _id;
-
- public AccountCache(UUID uuid, int id)
- {
- _uuid = uuid;
- _id = id;
- }
-
- public UUID getUUID()
- {
- return _uuid;
- }
-
- public int getId()
- {
- return _id;
- }
-
- @Override
- public String getDataId()
- {
- return _uuid.toString();
- }
-}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java
index df6717c6a..156f18867 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClient.java
@@ -1,12 +1,14 @@
package mineplex.core.account;
import mineplex.core.common.Rank;
+import mineplex.serverdata.Utility;
import org.bukkit.entity.Player;
public class CoreClient
{
private int _accountId = -1;
+ private long _networkSessionLoginTime;
private String _name;
private String _disguisedAs;
private Player _player;
@@ -18,6 +20,7 @@ public class CoreClient
{
_player = player;
_name = player.getName();
+ _networkSessionLoginTime = Utility.currentTimeMillis();
}
public CoreClient(String name)
@@ -58,6 +61,9 @@ public class CoreClient
public Rank GetRank()
{
+ if (_rank == null)
+ _rank = Rank.ALL;
+
return _rank;
}
@@ -65,6 +71,11 @@ public class CoreClient
{
_rank = rank;
}
+
+ public long getNetworkSessionLoginTime()
+ {
+ return _networkSessionLoginTime;
+ }
public String getDisguisedAs()
{
@@ -95,4 +106,9 @@ public class CoreClient
public void setDisguised(boolean disguised) {
this._disguised = disguised;
}
+
+ public void setNetworkSessionLoginTime(long loginTime)
+ {
+ _networkSessionLoginTime = loginTime;
+ }
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java
index f2b2a0016..9fbd04fc0 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java
@@ -2,6 +2,7 @@ package mineplex.core.account;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
@@ -21,10 +22,8 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
-import mineplex.serverdata.Region;
-import mineplex.serverdata.data.BungeeServer;
-import mineplex.serverdata.redis.RedisDataRepository;
-import mineplex.serverdata.servers.ServerManager;
+import mineplex.playerCache.PlayerCache;
+import mineplex.playerCache.PlayerInfo;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
@@ -47,9 +46,9 @@ public class CoreClientManager extends MiniPlugin
private AccountRepository _repository;
private NautHashMap _clientList;
private HashSet _duplicateLoginGlitchPreventionList;
- private RedisDataRepository _accountCacheRepository;
private NautHashMap _loginProcessors = new NautHashMap();
+ private LinkedList _querylessLoginProcessors = new LinkedList();
private Object _clientLock = new Object();
@@ -64,9 +63,6 @@ public class CoreClientManager extends MiniPlugin
_repository = new AccountRepository(plugin, webServer);
_clientList = new NautHashMap();
_duplicateLoginGlitchPreventionList = new HashSet();
-
- _accountCacheRepository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
- Region.ALL, AccountCache.class, "accountCache");
}
public AccountRepository getRepository()
@@ -110,7 +106,7 @@ public class CoreClientManager extends MiniPlugin
{
_clientList.remove(name);
}
-
+
_plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(name));
}
@@ -124,7 +120,14 @@ public class CoreClientManager extends MiniPlugin
if(client.getDisguisedAs().equalsIgnoreCase(name))
return client;
}
- return _clientList.get(name);
+ CoreClient client = _clientList.get(name);
+
+ if (client == null)
+ {
+ client = new CoreClient(name);
+ }
+
+ return client;
}
}
@@ -138,6 +141,16 @@ public class CoreClientManager extends MiniPlugin
return Bukkit.getOnlinePlayers().size() + Math.max(0, _clientsConnecting.get());
}
+ /**
+ * Get the databse account id for a player. Requires the player is online
+ * @param player
+ * @return
+ */
+ public int getAccountId(Player player)
+ {
+ return Get(player).getAccountId();
+ }
+
@EventHandler(priority = EventPriority.LOWEST)
public void AsyncLogin(AsyncPlayerPreLoginEvent event)
{
@@ -173,7 +186,7 @@ public class CoreClientManager extends MiniPlugin
_clientsProcessing.decrementAndGet();
}
- if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().Has(Rank.MODERATOR))
+ if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(Rank.MODERATOR))
{
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
{
@@ -207,7 +220,16 @@ public class CoreClientManager extends MiniPlugin
UUID uuid = loadUUIDFromDB(playerName);
if (uuid == null)
- uuid = UUIDFetcher.getUUIDOf(playerName);
+ {
+ try
+ {
+ uuid = UUIDFetcher.getUUIDOf(playerName);
+ }
+ catch (Exception exception)
+ {
+ System.out.println("Error fetching uuid from mojang : " + exception.getMessage());
+ }
+ }
String response = "";
@@ -224,13 +246,21 @@ public class CoreClientManager extends MiniPlugin
CoreClient client = Add(playerName);
client.SetRank(Rank.valueOf(token.Rank));
- client.setAccountId(_repository.login(_loginProcessors, uuid.toString(), client.GetPlayerName()));
+ client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
// JSON sql response
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
if (client.getAccountId() > 0)
- _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6);
+ {
+ PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid);
+
+ if (playerInfo != null)
+ {
+ playerInfo.setAccountId(client.getAccountId());
+ PlayerCache.getInstance().addPlayer(playerInfo);
+ }
+ }
}
catch (Exception exception)
{
@@ -264,7 +294,7 @@ public class CoreClientManager extends MiniPlugin
{
public void run()
{
- client.setAccountId(_repository.login(_loginProcessors, uuid.toString(), client.GetPlayerName()));
+ client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
_clientLoginLock.remove(client.GetPlayerName());
}
});
@@ -274,7 +304,7 @@ public class CoreClientManager extends MiniPlugin
TimingManager.stop(client.GetPlayerName() + " GetClient.");
token = gson.fromJson(response, ClientToken.class);
-
+
client.SetRank(Rank.valueOf(token.Rank));
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
@@ -301,17 +331,15 @@ public class CoreClientManager extends MiniPlugin
TimingManager.stop(client.GetPlayerName() + " LoadClient Total.");
- System.out.println(client.GetPlayerName() + "'s account id = " + client.getAccountId());
-
if (client.getAccountId() > 0)
{
- try
+ PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid);
+
+ if (playerInfo != null)
{
- _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6);
- }
- catch (Exception e)
- {
- e.printStackTrace();
+ client.setNetworkSessionLoginTime(playerInfo.getLoginTime());
+ playerInfo.setAccountId(client.getAccountId());
+ PlayerCache.getInstance().addPlayer(playerInfo);
}
}
@@ -342,7 +370,7 @@ public class CoreClientManager extends MiniPlugin
// Reserved Slot Check
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{
- if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false))
+ if (client.GetRank().has(event.getPlayer(), Rank.ULTRA, false))
{
event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);
@@ -454,7 +482,7 @@ public class CoreClientManager extends MiniPlugin
callback.run(matchedName);
return;
}
-
+
callback.run(matchedName);
}
}, caller, playerName, true);
@@ -485,7 +513,9 @@ public class CoreClientManager extends MiniPlugin
clientIterator.remove();
if (clientPlayer != null)
+ {
_plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(clientPlayer.getName()));
+ }
}
}
}
@@ -507,6 +537,11 @@ public class CoreClientManager extends MiniPlugin
{
_loginProcessors.put(processor.getName(), processor);
}
+
+ public void addStoredProcedureLoginProcessor(IQuerylessLoginProcessor processor)
+ {
+ _querylessLoginProcessors.add(processor);
+ }
public boolean hasRank(Player player, Rank rank)
{
@@ -514,11 +549,6 @@ public class CoreClientManager extends MiniPlugin
if (client == null)
return false;
- return client.GetRank().Has(rank);
- }
-
- public int getCachedClientAccountId(UUID uuid)
- {
- return _accountCacheRepository.getElement(uuid.toString()).getId();
+ return client.GetRank().has(rank);
}
}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/IQuerylessLoginProcessor.java b/Plugins/Mineplex.Core/src/mineplex/core/account/IQuerylessLoginProcessor.java
new file mode 100644
index 000000000..7c69bb1c1
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/IQuerylessLoginProcessor.java
@@ -0,0 +1,6 @@
+package mineplex.core.account;
+
+public interface IQuerylessLoginProcessor
+{
+ public void processLogin(String playerName, int accountId);
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
index 21f0ee4c9..d0dfbcd93 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java
@@ -29,7 +29,7 @@ public class UpdateRank extends CommandBase
if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
{
- F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.GetTag(true, true)) + "s are only permitted to set ranks on test servers!");
+ F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.getTag(true, true)) + "s are only permitted to set ranks on test servers!");
return;
}
@@ -60,9 +60,9 @@ public class UpdateRank extends CommandBase
final Rank rank = tempRank;
- if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.JNR_DEV || rank == Rank.DEVELOPER)
+ if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
{
- if (!testServer && rank.Has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
+ if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
{
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
return;
@@ -122,4 +122,4 @@ public class UpdateRank extends CommandBase
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java
index 60f756748..cd64cbdfa 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java
@@ -6,6 +6,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
@@ -14,6 +15,7 @@ import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.ILoginProcessor;
+import mineplex.core.account.IQuerylessLoginProcessor;
import mineplex.core.account.repository.token.LoginToken;
import mineplex.core.account.repository.token.RankUpdateToken;
import mineplex.core.common.Rank;
@@ -55,7 +57,7 @@ public class AccountRepository extends RepositoryBase
//executeUpdate(CREATE_ACCOUNT_TABLE);
}
- public int login(NautHashMap loginProcessors, String uuid, String name)
+ public int login(NautHashMap loginProcessors, LinkedList querylessLoginProcessors, String uuid, String name)
{
int accountId = -1;
try (
@@ -145,6 +147,11 @@ public class AccountRepository extends RepositoryBase
loginProcessor.processLoginResultSet(name, accountId, statement.getResultSet());
statement.getMoreResults();
}
+
+ for (IQuerylessLoginProcessor loginProcessor : querylessLoginProcessors)
+ {
+ loginProcessor.processLogin(name, accountId);
+ }
}
catch (Exception exception)
{
@@ -186,7 +193,7 @@ public class AccountRepository extends RepositoryBase
}, new ColumnVarChar("name", 100, name));
if (uuids.size() > 0)
- return uuids.get(uuids.size() - 1);
+ return uuids.get(0);
else
return null;
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
index 64d6215aa..ab821003d 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java
@@ -662,11 +662,53 @@ public enum Achievement
new int[]{20},
AchievementCategory.BOMB_LOBBERS),
- BOMB_LOBBERS_SNIPER("Sniper", 10000,
+ BOMB_LOBBERS_SNIPER("Sniper", 1000,
new String[]{"Bomb Lobbers.Direct Hit"},
new String[]{"Get 50 direct hits"},
new int[]{50},
- AchievementCategory.BOMB_LOBBERS)
+ AchievementCategory.BOMB_LOBBERS),
+
+ EVOLUTION_WINS("Expert Evolver", 1200,
+ new String[]{"Evolution.Wins"},
+ new String[]{"Win 20 games of Evolution"},
+ new int[]{20},
+ AchievementCategory.EVOLUTION),
+
+ EVOLUTION_NO_DEATHS("Perfect Game", 2000,
+ new String[]{"Evolution.NoDeaths"},
+ new String[]{"Win a game without dying"},
+ new int[]{1},
+ AchievementCategory.EVOLUTION),
+
+ EVOLUTION_STEALTH("Stealth Mastah", 1000,
+ new String[]{"Evolution.Stealth"},
+ new String[]{"Win without taking any", "damage while evolving"},
+ new int[]{1},
+ AchievementCategory.EVOLUTION),
+
+ EVOLUTION_RAMPAGE("Rampage", 800,
+ new String[]{"Evolution.Rampage"},
+ new String[]{"Get 3 kills within 5 seconds", "of each other"},
+ new int[]{1},
+ AchievementCategory.EVOLUTION),
+
+ EVOLUTION_MELEE("Melee Monster", 1000,
+ new String[]{"Evolution.MeleeOnly"},
+ new String[]{"Win without using any abilities"},
+ new int[]{1},
+ AchievementCategory.EVOLUTION),
+
+ EVOLUTION_SKILLS("Ability Assassin", 1000,
+ new String[]{"Evolution.AbilityOnly"},
+ new String[]{"Win without any melee attacks"},
+ new int[]{1},
+ AchievementCategory.EVOLUTION),
+
+ EVOLUTION_EVOLVEKILL("No Evolve 5 U", 800,
+ new String[]{"Evolution.EvolveKill"},
+ new String[]{"Kill 25 people while they", "Are trying to evolve"},
+ new int[]{25},
+ AchievementCategory.EVOLUTION)
;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java
index 9c9491ad5..5b81e40ea 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java
@@ -2,9 +2,6 @@ package mineplex.core.achievement;
import java.util.List;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@@ -12,10 +9,14 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+
public enum AchievementCategory
{
GLOBAL("Global", null,
- new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME },
+ new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null,
+ new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
BRIDGES("The Bridges", null,
@@ -28,7 +29,7 @@ public enum AchievementCategory
SKYWARS("Skywars",null,
new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
- Material.FEATHER, 5, GameCategory.SURVIVAL, "Destructor Kit"),
+ Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit"),
UHC("Ultra Hardcore", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@@ -122,7 +123,11 @@ public enum AchievementCategory
BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
- Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit");
+ Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"),
+
+ EVOLUTION("Evolution", null,
+ new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
+ Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit");
private String _name;
private String[] _statsToPull;
@@ -202,7 +207,7 @@ public enum AchievementCategory
String displayName = _statDisplays[i].getDisplayName();
// Skip showing Losses, Kills, Deaths for other players
- if (!clientManager.Get(player).GetRank().Has(Rank.MODERATOR) && !player.equals(target) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played")))
+ if (!clientManager.Get(player).GetRank().has(Rank.MODERATOR) && !player.equals(target) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played")))
continue;
int statNumber = 0;
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java
index 485f5a124..6c736e5be 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementManager.java
@@ -137,15 +137,6 @@ public class AchievementManager extends MiniPlugin
_log.remove(event.getPlayer().getName());
}
- @EventHandler
- public void playerJoin(PlayerJoinEvent event)
- {
- if (_giveInterfaceItem)
- {
- giveInterfaceItem(event.getPlayer());
- }
- }
-
public void clearLog(Player player)
{
_log.remove(player.getName());
@@ -161,22 +152,7 @@ public class AchievementManager extends MiniPlugin
_giveInterfaceItem = giveInterfaceItem;
}
- public void giveInterfaceItem(Player player)
- {
- if (!UtilGear.isMat(player.getInventory().getItem(_interfaceSlot), Material.SKULL_ITEM))
- {
- ItemStack item = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3, 1, ChatColor.RESET + C.cGreen + "/stats");
- SkullMeta meta = ((SkullMeta) item.getItemMeta());
- meta.setOwner(player.getName());
- item.setItemMeta(meta);
-
- player.getInventory().setItem(_interfaceSlot, item);
-
- UtilInv.Update(player);
- }
- }
-
- @EventHandler
+ /*@EventHandler
public void openShop(PlayerInteractEvent event)
{
if (!_shopEnabled)
@@ -188,7 +164,7 @@ public class AchievementManager extends MiniPlugin
openShop(event.getPlayer());
}
- }
+ }*/
public boolean hasCategory(Player player, Achievement[] required)
{
@@ -211,15 +187,15 @@ public class AchievementManager extends MiniPlugin
if (sender.getName().equalsIgnoreCase("B2_mp"))
return 101;
- if (rank.Has(Rank.MODERATOR))
+ if (rank.has(Rank.MODERATOR))
level = Math.max(level, 5);
- if (rank.Has(Rank.SNR_MODERATOR))
+ if (rank.has(Rank.SNR_MODERATOR))
level = Math.max(level, 15);
- if (rank.Has(Rank.JNR_DEV))
+ if (rank.has(Rank.JNR_DEV))
level = Math.max(level, 25);
- if (rank.Has(Rank.ADMIN))
+ if (rank.has(Rank.ADMIN))
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
- if (rank.Has(Rank.OWNER))
+ if (rank.has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (sender.getName().equalsIgnoreCase("Phinary"))
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java
index 147b33d59..d7d3fabb3 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java
@@ -17,7 +17,7 @@ public class StatsCommand extends CommandBase
@Override
public void Execute(Player caller, String[] args)
{
- if (args == null || args.length == 0)
+ if (args.length == 0)
{
Plugin.openShop(caller);
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java
index 2ab5e498f..68d43a09e 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java
@@ -57,11 +57,10 @@ public class AchievementMainPage extends ShopPageBase lore = new ArrayList();
lore.add(" ");
- category.addStats(getClientManager(), _statsManager, lore, category == AchievementCategory.GLOBAL ? 5 : 2,
+ category.addStats(getClientManager(), _statsManager, lore, category == AchievementCategory.GLOBAL ? 10 : 2,
getPlayer(), _target);
lore.add(" ");
addAchievements(category, lore, 9);
- lore.add(" ");
lore.add(ChatColor.RESET + "Click for more details!");
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(),
@@ -100,5 +99,8 @@ public class AchievementMainPage extends ShopPageBase 0)
+ lore.add(" ");
}
}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
index 37ff11c9b..7719eca3f 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java
@@ -259,7 +259,7 @@ public class AntiHack extends MiniPlugin
//Inform
for (Player admin : UtilServer.getPlayers())
- if (_clientManager.Get(admin).GetRank().Has(Rank.MODERATOR) && _preferences.Get(admin).ShowMacReports)
+ if (_clientManager.Get(admin).GetRank().has(Rank.MODERATOR) && _preferences.Get(admin).ShowMacReports)
{
UtilPlayer.message(admin, "#" + total + ": " + C.cRed + C.Bold + player.getName() + " suspected for " + type + ".");
}
@@ -335,7 +335,7 @@ public class AntiHack extends MiniPlugin
boolean handled = false;
for (Player staff : UtilServer.getPlayers())
{
- if (_clientManager.Get(staff).GetRank().Has(Rank.MODERATOR))
+ if (_clientManager.Get(staff).GetRank().has(Rank.MODERATOR))
{
UtilPlayer.message(staff, C.cAqua + C.Scramble + "A" + ChatColor.RESET + C.cRed + C.Bold + " MAC > " + ChatColor.RESET + C.cYellow + report);
UtilPlayer.message(staff, C.cAqua + C.Scramble + "A" + ChatColor.RESET + C.cRed + C.Bold + " MAC > " + ChatColor.RESET + C.cGold + player.getName() + C.cYellow + " has extreme violation. Please investigate.");
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java
index 6848257d9..8d21d1f13 100644
--- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java
+++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java
@@ -13,7 +13,7 @@ public class AntiHackRepository
{
private String _serverName;
- private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack_Kick_Log (id INT NOT NULL AUTO_INCREMENT, updated LONG, playerName VARCHAR(256), motd VARCHAR(56), gameType VARCHAR(56), map VARCHAR(256), serverName VARCHAR(256), report VARCHAR(256), ping VARCHAR(25), PRIMARY KEY (id));";
+ //private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS AntiHack_Kick_Log (id INT NOT NULL AUTO_INCREMENT, updated LONG, playerName VARCHAR(256), motd VARCHAR(56), gameType VARCHAR(56), map VARCHAR(256), serverName VARCHAR(256), report VARCHAR(256), ping VARCHAR(25), PRIMARY KEY (id));";
private static String UPDATE_PLAYER_OFFENSES = "INSERT INTO AntiHack_Kick_Log (updated, playerName, motd, gameType, map, serverName, report, ping) VALUES (now(), ?, ?, ?, ?, ?, ?, ?);";
public AntiHackRepository(String serverName)
@@ -23,32 +23,6 @@ public class AntiHackRepository
public void initialize()
{
- PreparedStatement preparedStatement = null;
-
- try (Connection connection = DBPool.STATS_MINEPLEX.getConnection())
- {
- // 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 void saveOffense(final Player player, final String motd, final String game, final String map, final String report)
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java
new file mode 100644
index 000000000..bb6d8c9f3
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusAmount.java
@@ -0,0 +1,159 @@
+package mineplex.core.bonuses;
+
+import java.util.List;
+
+import org.bukkit.ChatColor;
+
+import mineplex.core.common.util.C;
+
+public class BonusAmount
+{
+ private int _gems;
+ private int _coins;
+ private int _gold;
+ private int _bonusGems;
+ private int _bonusCoins;
+ private int _bonusGold;
+ private int _experience;
+ private int _bonusExperience;
+ private int _tickets;
+
+ public BonusAmount()
+ {
+
+ }
+
+ public int getGems()
+ {
+ return _gems;
+ }
+
+ public void setGems(int gems)
+ {
+ _gems = gems;
+ }
+
+ public int getCoins()
+ {
+ return _coins;
+ }
+
+ public void setCoins(int coins)
+ {
+ _coins = coins;
+ }
+
+ public int getGold()
+ {
+ return _gold;
+ }
+
+ public void setGold(int gold)
+ {
+ _gold = gold;
+ }
+
+ public int getBonusGems()
+ {
+ return _bonusGems;
+ }
+
+ public void setBonusGems(int bonusGems)
+ {
+ _bonusGems = bonusGems;
+ }
+
+ public int getBonusCoins()
+ {
+ return _bonusCoins;
+ }
+
+ public void setBonusCoins(int bonusCoins)
+ {
+ _bonusCoins = bonusCoins;
+ }
+
+ public int getBonusGold()
+ {
+ return _bonusGold;
+ }
+
+ public void setBonusGold(int bonusGold)
+ {
+ _bonusGold = bonusGold;
+ }
+
+ public int getTotalGems()
+ {
+ return getGems() + getBonusGems();
+ }
+
+ public int getTotalCoins()
+ {
+ return getCoins() + getBonusCoins();
+ }
+
+ public int getTotalGold()
+ {
+ return getGold() + getBonusGold();
+ }
+
+ public int getExperience()
+ {
+ return _experience;
+ }
+
+ public void setExperience(int experience)
+ {
+ _experience = experience;
+ }
+
+ public int getBonusExperience()
+ {
+ return _bonusExperience;
+ }
+
+ public void setBonusExperience(int bonusExperience)
+ {
+ _bonusExperience = bonusExperience;
+ }
+
+ public int getTotalExperience()
+ {
+ return getExperience() + getBonusExperience();
+ }
+
+ public int getTickets()
+ {
+ return _tickets;
+ }
+
+ public void setTickets(int tickets)
+ {
+ _tickets = tickets;
+ }
+
+ public boolean isGreaterThanZero()
+ {
+ return _bonusCoins > 0 || _coins > 0 || _bonusGems > 0 || _gems > 0 || _gold > 0 || _bonusGold > 0;
+ }
+
+ public void addLore(List lore)
+ {
+ lore.add(C.cYellow + "Rewards");
+ addLore(lore, getTickets(), 0, "Carl Spin Ticket" + (getTickets() > 1 ? "s" : ""));
+ addLore(lore, getCoins(), getBonusCoins(), "Coins");
+ addLore(lore, getGems(), getBonusGems(), "Gems");
+ addLore(lore, getGold(), getBonusGold(), "Gold");
+ addLore(lore, getExperience(), getBonusExperience(), "Experience");
+ }
+
+ private void addLore(List lore, int amount, int bonus, String suffix)
+ {
+ if (amount > 0)
+ lore.add(" " + C.cWhite + amount + " " + suffix);
+
+// if (bonus > 0)
+// lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + bonus + " " + suffix);
+ }
+}
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java
new file mode 100644
index 000000000..346f58b1c
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusClientData.java
@@ -0,0 +1,127 @@
+package mineplex.core.bonuses;
+
+import java.sql.Date;
+import java.sql.Timestamp;
+
+import mineplex.core.hologram.Hologram;
+import mineplex.database.tables.records.BonusRecord;
+
+public class BonusClientData
+{
+ private Hologram _hologram;
+
+ private int _accountId;
+ private Timestamp _dailyTime;
+ private Date _rankTime;
+ private Date _voteTime;
+ private int _dailyStreak;
+ private int _maxDailyStreak;
+ private int _voteStreak;
+ private int _maxVoteStreak;
+ private int _tickets;
+
+ public BonusClientData()
+ {
+ _accountId = -1;
+ }
+
+ public void setAccountId(Integer value)
+ {
+ _accountId = value;
+ }
+
+ public Integer getAccountId()
+ {
+ return _accountId;
+ }
+
+ public void setDailyTime(Timestamp value)
+ {
+ _dailyTime = value;
+ }
+
+ public Timestamp getDailyTime()
+ {
+ return _dailyTime;
+ }
+
+ public void setRankTime(Date value)
+ {
+ _rankTime = value;
+ }
+
+ public Date getRankTime()
+ {
+ return _rankTime;
+ }
+
+ public void setVoteTime(Date value)
+ {
+ _voteTime = value;
+ }
+
+ public Date getVoteTime()
+ {
+ return _voteTime;
+ }
+
+ public void setDailyStreak(Integer value)
+ {
+ _dailyStreak = value;
+ }
+
+ public Integer getDailyStreak()
+ {
+ return _dailyStreak;
+ }
+
+ public void setMaxDailyStreak(Integer value)
+ {
+ _maxDailyStreak = value;
+ }
+
+ public Integer getMaxDailyStreak()
+ {
+ return _maxDailyStreak;
+ }
+
+ public void setVoteStreak(Integer value)
+ {
+ _voteStreak = value;
+ }
+
+ public Integer getVoteStreak()
+ {
+ return _voteStreak;
+ }
+
+ public void setMaxVoteStreak(Integer value)
+ {
+ _maxVoteStreak = value;
+ }
+
+ public Integer getMaxVoteStreak()
+ {
+ return _maxVoteStreak;
+ }
+
+ public void setTickets(Integer value)
+ {
+ _tickets = value;
+ }
+
+ public Integer getTickets()
+ {
+ return _tickets;
+ }
+
+ public Hologram getHologram()
+ {
+ return _hologram;
+ }
+
+ public void setHologram(Hologram hologram)
+ {
+ _hologram = hologram;
+ }
+}
\ No newline at end of file
diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java
new file mode 100644
index 000000000..1276e2f00
--- /dev/null
+++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java
@@ -0,0 +1,1157 @@
+package mineplex.core.bonuses;
+
+import java.sql.Date;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.TimeZone;
+
+import mineplex.core.MiniClientPlugin;
+import mineplex.core.account.CoreClient;
+import mineplex.core.account.CoreClientManager;
+import mineplex.core.account.ILoginProcessor;
+import mineplex.core.account.IQuerylessLoginProcessor;
+import mineplex.core.account.event.ClientUnloadEvent;
+import mineplex.core.bonuses.redis.VoteHandler;
+import mineplex.core.bonuses.redis.VotifierCommand;
+import mineplex.core.common.Rank;
+import mineplex.core.common.util.C;
+import mineplex.core.common.util.Callback;
+import mineplex.core.common.util.F;
+import mineplex.core.common.util.UtilParticle;
+import mineplex.core.common.util.UtilPlayer;
+import mineplex.core.common.util.UtilServer;
+import mineplex.core.common.util.UtilParticle.ParticleType;
+import mineplex.core.common.util.UtilParticle.ViewDist;
+import mineplex.core.database.DBPool;
+import mineplex.core.donation.DonationManager;
+import mineplex.core.hologram.Hologram;
+import mineplex.core.hologram.HologramManager;
+import mineplex.core.inventory.InventoryManager;
+import mineplex.core.npc.Npc;
+import mineplex.core.npc.NpcManager;
+import mineplex.core.pet.PetManager;
+import mineplex.core.recharge.Recharge;
+import mineplex.core.reward.RewardManager;
+import mineplex.core.stats.StatsManager;
+import mineplex.core.updater.UpdateType;
+import mineplex.core.updater.event.UpdateEvent;
+import mineplex.database.Tables;
+import mineplex.core.bonuses.animations.AnimationCarl;
+import mineplex.core.bonuses.commands.AnimationCommand;
+import mineplex.core.bonuses.commands.GuiCommand;
+import mineplex.core.bonuses.commands.TicketCommand;
+import mineplex.core.bonuses.event.CarlSpinnerEvent;
+import mineplex.core.bonuses.gui.BonusGui;
+import mineplex.database.tables.records.BonusRecord;
+import mineplex.core.bonuses.gui.SpinGui;
+import mineplex.core.poll.PollManager;
+import mineplex.serverdata.commands.ServerCommandManager;
+
+import org.jooq.DSLContext;
+import org.jooq.SQLDialect;
+import org.jooq.impl.DSL;
+import org.bukkit.Bukkit;
+import org.bukkit.Sound;
+import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import net.minecraft.server.v1_7_R4.DataWatcher;
+import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
+
+public class BonusManager extends MiniClientPlugin implements ILoginProcessor
+{
+
+ public static final TimeZone TIMEZONE = TimeZone.getTimeZone("UTC");
+
+ private static long timeOffSet = 0;
+
+ private ArrayList