Added mysql logger.
Hooked it up in a few places. Fixed Asynch crap with AntiHack.
This commit is contained in:
parent
42e9fe879c
commit
7637d94ae0
@ -12,6 +12,7 @@ import mineplex.core.account.repository.token.ClientToken;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.logger.Logger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -119,14 +120,7 @@ public class CoreClientManager implements Listener
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
System.out.println("Error logging '" + event.getName() + "' in.");
|
||||
|
||||
System.out.println(exception.getMessage());
|
||||
|
||||
for (StackTraceElement element : exception.getStackTrace())
|
||||
{
|
||||
System.out.println(element);
|
||||
}
|
||||
Logger.Instance.log(exception);
|
||||
|
||||
event.disallow(Result.KICK_OTHER, "Error retrieving information from web, please retry in a minute.");
|
||||
}
|
||||
@ -171,6 +165,7 @@ public class CoreClientManager implements Listener
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Logger.Instance.log(exception);
|
||||
System.out.println("Error running RetrieveClientInformationEvent" + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class AntiHack extends MiniPlugin
|
||||
{
|
||||
private static Object _antiHackLock = new Object();
|
||||
|
||||
public static AntiHack Instance;
|
||||
|
||||
public Punish Punish;
|
||||
@ -92,19 +94,28 @@ public class AntiHack extends MiniPlugin
|
||||
@EventHandler
|
||||
public void playerMove(PlayerMoveEvent event)
|
||||
{
|
||||
_lastMoveEvent.put(event.getPlayer(), System.currentTimeMillis());
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
_lastMoveEvent.put(event.getPlayer(), System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
_ignore.put(event.getPlayer(), System.currentTimeMillis() + 2000);
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
_ignore.put(event.getPlayer(), System.currentTimeMillis() + 2000);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
_velocityEvent.add(event.getPlayer());
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
_velocityEvent.add(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -112,20 +123,23 @@ public class AntiHack extends MiniPlugin
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!_suspicion.containsKey(player))
|
||||
return;
|
||||
|
||||
//Remove all infractions within last 2 seconds.
|
||||
for (ArrayList<Long> offenseList : _suspicion.get(player).values())
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
Iterator<Long> offenseIterator = offenseList.iterator();
|
||||
|
||||
while (offenseIterator.hasNext())
|
||||
if (!_suspicion.containsKey(player))
|
||||
return;
|
||||
|
||||
//Remove all infractions within last 2 seconds.
|
||||
for (ArrayList<Long> offenseList : _suspicion.get(player).values())
|
||||
{
|
||||
long time = offenseIterator.next();
|
||||
|
||||
if (!UtilTime.elapsed(time, FlightTriggerCancel))
|
||||
offenseIterator.remove();
|
||||
Iterator<Long> offenseIterator = offenseList.iterator();
|
||||
|
||||
while (offenseIterator.hasNext())
|
||||
{
|
||||
long time = offenseIterator.next();
|
||||
|
||||
if (!UtilTime.elapsed(time, FlightTriggerCancel))
|
||||
offenseIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,20 +155,23 @@ public class AntiHack extends MiniPlugin
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_velocityEvent.remove(player))
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
setIgnore(player, 1500);
|
||||
}
|
||||
|
||||
//Initial Move (or Lag) Ignore
|
||||
if (_lastMoveEvent.containsKey(player))
|
||||
{
|
||||
long timeBetweenPackets = System.currentTimeMillis() - _lastMoveEvent.get(player);
|
||||
|
||||
if (timeBetweenPackets > 1000)
|
||||
if (_velocityEvent.remove(player))
|
||||
{
|
||||
setIgnore(player, 1500);
|
||||
}
|
||||
|
||||
//Initial Move (or Lag) Ignore
|
||||
if (_lastMoveEvent.containsKey(player))
|
||||
{
|
||||
long timeBetweenPackets = System.currentTimeMillis() - _lastMoveEvent.get(player);
|
||||
|
||||
if (timeBetweenPackets > 1000)
|
||||
{
|
||||
setIgnore(player, 1500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,12 +181,15 @@ public class AntiHack extends MiniPlugin
|
||||
for (Detector detector : _detectors)
|
||||
detector.Reset(player);
|
||||
|
||||
//Already ignoring for a longer period
|
||||
if (_ignore.containsKey(player) && _ignore.get(player) > System.currentTimeMillis() + time)
|
||||
return;
|
||||
|
||||
//Add Ignore
|
||||
_ignore.put(player, System.currentTimeMillis() + time);
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
//Already ignoring for a longer period
|
||||
if (_ignore.containsKey(player) && _ignore.get(player) > System.currentTimeMillis() + time)
|
||||
return;
|
||||
|
||||
//Add Ignore
|
||||
_ignore.put(player, System.currentTimeMillis() + time);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid(Player player, boolean groundValid)
|
||||
@ -192,15 +212,18 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
public void addSuspicion(Player player, String type)
|
||||
{
|
||||
//Add Offense
|
||||
if (!_suspicion.containsKey(player))
|
||||
_suspicion.put(player, new HashMap<String, ArrayList<Long>>());
|
||||
|
||||
if (!_suspicion.get(player).containsKey(type))
|
||||
_suspicion.get(player).put(type, new ArrayList<Long>());
|
||||
|
||||
_suspicion.get(player).get(type).add(System.currentTimeMillis());
|
||||
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
//Add Offense
|
||||
if (!_suspicion.containsKey(player))
|
||||
_suspicion.put(player, new HashMap<String, ArrayList<Long>>());
|
||||
|
||||
if (!_suspicion.get(player).containsKey(type))
|
||||
_suspicion.get(player).put(type, new ArrayList<Long>());
|
||||
|
||||
_suspicion.get(player).get(type).add(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
for (Player admin : UtilServer.getPlayers())
|
||||
if (admin.isOp() && UtilGear.isMat(admin.getItemInHand(), Material.PAPER))
|
||||
UtilPlayer.message(admin, C.cRed + C.Bold + player.getName() + " suspected for " + type + ".");
|
||||
@ -215,27 +238,30 @@ public class AntiHack extends MiniPlugin
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Player player : _suspicion.keySet())
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
if (!_offense.containsKey(player))
|
||||
_offense.put(player, new HashMap<String, ArrayList<Long>>());
|
||||
|
||||
for (String type : _suspicion.get(player).keySet())
|
||||
for (Player player : _suspicion.keySet())
|
||||
{
|
||||
if (!_offense.get(player).containsKey(type))
|
||||
_offense.get(player).put(type, new ArrayList<Long>());
|
||||
|
||||
Iterator<Long> offenseIterator = _suspicion.get(player).get(type).iterator();
|
||||
|
||||
while (offenseIterator.hasNext())
|
||||
if (!_offense.containsKey(player))
|
||||
_offense.put(player, new HashMap<String, ArrayList<Long>>());
|
||||
|
||||
for (String type : _suspicion.get(player).keySet())
|
||||
{
|
||||
long time = offenseIterator.next();
|
||||
|
||||
//Suspicion turns into Offense
|
||||
if (UtilTime.elapsed(time, FlightTriggerCancel))
|
||||
if (!_offense.get(player).containsKey(type))
|
||||
_offense.get(player).put(type, new ArrayList<Long>());
|
||||
|
||||
Iterator<Long> offenseIterator = _suspicion.get(player).get(type).iterator();
|
||||
|
||||
while (offenseIterator.hasNext())
|
||||
{
|
||||
offenseIterator.remove();
|
||||
_offense.get(player).get(type).add(time);
|
||||
long time = offenseIterator.next();
|
||||
|
||||
//Suspicion turns into Offense
|
||||
if (UtilTime.elapsed(time, FlightTriggerCancel))
|
||||
{
|
||||
offenseIterator.remove();
|
||||
_offense.get(player).get(type).add(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,41 +274,44 @@ public class AntiHack extends MiniPlugin
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
for (Player player : _offense.keySet())
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
String out = "";
|
||||
int total = 0;
|
||||
|
||||
for (String type : _offense.get(player).keySet())
|
||||
for (Player player : _offense.keySet())
|
||||
{
|
||||
//Remove Old Offenses
|
||||
Iterator<Long> offenseIterator = _suspicion.get(player).get(type).iterator();
|
||||
while (offenseIterator.hasNext())
|
||||
{
|
||||
long time = offenseIterator.next();
|
||||
|
||||
if (UtilTime.elapsed(time, 300000))
|
||||
offenseIterator.remove();
|
||||
}
|
||||
|
||||
//Count
|
||||
int count = _offense.get(player).get(type).size();
|
||||
total += count;
|
||||
|
||||
out += count + " " + type + ", ";
|
||||
}
|
||||
|
||||
if (out.length() > 0)
|
||||
out = out.substring(0, out.length() - 2);
|
||||
|
||||
String severity = "";
|
||||
if (total > 6) severity = "Extreme";
|
||||
else if (total > 4) severity = "High";
|
||||
else if (total > 2) severity = "Medium";
|
||||
else severity = "Low";
|
||||
String out = "";
|
||||
int total = 0;
|
||||
|
||||
//Send Report
|
||||
sendReport(player, out, severity);
|
||||
for (String type : _offense.get(player).keySet())
|
||||
{
|
||||
//Remove Old Offenses
|
||||
Iterator<Long> offenseIterator = _suspicion.get(player).get(type).iterator();
|
||||
while (offenseIterator.hasNext())
|
||||
{
|
||||
long time = offenseIterator.next();
|
||||
|
||||
if (UtilTime.elapsed(time, 300000))
|
||||
offenseIterator.remove();
|
||||
}
|
||||
|
||||
//Count
|
||||
int count = _offense.get(player).get(type).size();
|
||||
total += count;
|
||||
|
||||
out += count + " " + type + ", ";
|
||||
}
|
||||
|
||||
if (out.length() > 0)
|
||||
out = out.substring(0, out.length() - 2);
|
||||
|
||||
String severity = "";
|
||||
if (total > 6) severity = "Extreme";
|
||||
else if (total > 4) severity = "High";
|
||||
else if (total > 2) severity = "Medium";
|
||||
else severity = "Low";
|
||||
|
||||
//Send Report
|
||||
sendReport(player, out, severity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,15 +351,19 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
private void ResetAll(Player player)
|
||||
{
|
||||
_ignore.remove(player);
|
||||
_velocityEvent.remove(player);
|
||||
_lastMoveEvent.remove(player);
|
||||
|
||||
_offense.remove(player);
|
||||
_suspicion.remove(player);
|
||||
|
||||
for (Detector detector : _detectors)
|
||||
detector.Reset(player);
|
||||
synchronized (_antiHackLock)
|
||||
{
|
||||
_ignore.remove(player);
|
||||
_velocityEvent.remove(player);
|
||||
_lastMoveEvent.remove(player);
|
||||
|
||||
|
||||
_offense.remove(player);
|
||||
_suspicion.remove(player);
|
||||
|
||||
for (Detector detector : _detectors)
|
||||
detector.Reset(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -5,6 +5,8 @@ import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import mineplex.core.logger.Logger;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -41,6 +43,7 @@ public class AntiHackRepository
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
Logger.Instance.log(exception);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -87,6 +90,7 @@ public class AntiHackRepository
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
Logger.Instance.log(exception);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -70,6 +70,15 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
||||
setupConfigValues();
|
||||
|
||||
_repository = new ChatRepository(plugin.getConfig().getString("chat.connectionurl"));
|
||||
|
||||
try
|
||||
{
|
||||
trustCert();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupConfigValues()
|
||||
@ -207,6 +216,12 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
||||
JSONObject message = buildJsonChatObject(filtertype, dname, plyrname, msg, _serverName, 1);
|
||||
String response = getResponseFromTwoHat(message, filtertype);
|
||||
|
||||
if (response == null)
|
||||
{
|
||||
System.out.println("[ERROR] Unable to filter chat message...thanks a lot TwoHat.");
|
||||
return;
|
||||
}
|
||||
|
||||
int risk = Integer.parseInt(((JSONObject) JSONValue.parse(response)).get("risk").toString());
|
||||
|
||||
if (risk >= 5)
|
||||
@ -220,7 +235,7 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
||||
JSONArray hashindex = parseHashes(response);
|
||||
String newmessage = hasher(hashindex, msg);
|
||||
String badmessage = (new StringBuilder().append(newmessage)).toString();
|
||||
|
||||
|
||||
if (newmessage.contains("*"))
|
||||
{
|
||||
filteredMessage = badmessage;
|
||||
@ -339,12 +354,12 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
||||
HttpsURLConnection connection = null;
|
||||
DataOutputStream outputStream = null;
|
||||
BufferedReader bufferedReader = null;
|
||||
InputStreamReader inputStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
trustCert();
|
||||
|
||||
URL obj = new URL(url);
|
||||
|
||||
connection = (HttpsURLConnection) obj.openConnection();
|
||||
|
||||
// add request header con.setRequestMethod("POST");
|
||||
@ -361,8 +376,8 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(),
|
||||
Charset.forName("UTF-8")));
|
||||
inputStream = new InputStreamReader(connection.getInputStream(), Charset.forName("UTF-8"));
|
||||
bufferedReader = new BufferedReader(inputStream);
|
||||
String inputLine;
|
||||
response = new StringBuffer();
|
||||
|
||||
@ -416,9 +431,25 @@ public class Chat extends MiniClientPlugin<ChatClient>
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (inputStream != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
inputStream.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String pmresponse = response.toString();
|
||||
String pmresponse = null;
|
||||
|
||||
if (response != null)
|
||||
pmresponse = response.toString();
|
||||
|
||||
return pmresponse;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
package mineplex.core.chat.repository;
|
||||
|
||||
public class ChatEvent
|
||||
{
|
||||
public String id;
|
||||
public String message;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package mineplex.core.chat.repository;
|
||||
|
||||
public class ChatMessage
|
||||
{
|
||||
public String PlayerName;
|
||||
public String Message;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package mineplex.core.chat.repository;
|
||||
|
||||
public class ChatSubmitToken
|
||||
{
|
||||
public String player_display_name;
|
||||
public String player;
|
||||
public String text;
|
||||
public String server;
|
||||
public String room;
|
||||
public String language = "en";
|
||||
public String rule;
|
||||
}
|
60
Plugins/Mineplex.Core/src/mineplex/core/logger/Logger.java
Normal file
60
Plugins/Mineplex.Core/src/mineplex/core/logger/Logger.java
Normal file
@ -0,0 +1,60 @@
|
||||
package mineplex.core.logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Logger
|
||||
{
|
||||
public static Logger Instance;
|
||||
|
||||
private LoggerRepository _repository;
|
||||
|
||||
public static void initialize(JavaPlugin plugin)
|
||||
{
|
||||
Instance = new Logger(plugin);
|
||||
}
|
||||
|
||||
public Logger(JavaPlugin plugin)
|
||||
{
|
||||
setupConfigValues(plugin);
|
||||
|
||||
_repository = new LoggerRepository(plugin.getConfig().getString("log.connectionurl"), plugin.getConfig().getString("serverstatus.name"));
|
||||
}
|
||||
|
||||
private void setupConfigValues(JavaPlugin plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.getConfig().addDefault("log.connectionurl", "jdbc:mysql://sqlstats.mineplex.com:3306/Mineplex");
|
||||
plugin.getConfig().set("log.connectionurl", plugin.getConfig().getString("log.connectionurl"));
|
||||
plugin.saveConfig();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void log(String message)
|
||||
{
|
||||
_repository.saveLog(message);
|
||||
}
|
||||
|
||||
public void log(Exception exception)
|
||||
{
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
messages.add("[Exception Start]" + exception.getMessage());
|
||||
|
||||
for (StackTraceElement element : exception.getStackTrace())
|
||||
{
|
||||
messages.add(element.toString());
|
||||
}
|
||||
|
||||
messages.add("[Exception End]");
|
||||
|
||||
_repository.saveLog(messages.toArray(new String[0]));
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package mineplex.core.logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class LoggerRepository
|
||||
{
|
||||
private static Object _connectionLock = new Object();
|
||||
|
||||
private String _connectionString;
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
private static String CREATE_LOG_TABLE = "CREATE TABLE IF NOT EXISTS errorLog (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(256), message VARCHAR(256), date LONG, PRIMARY KEY (id));";
|
||||
private static String INSERT_LOG = "INSERT INTO errorLog (server, message, date) VALUES (?, ?, now());";
|
||||
|
||||
private Connection _connection = null;
|
||||
private String _serverName;
|
||||
|
||||
public LoggerRepository(String connectionUrl, String serverName)
|
||||
{
|
||||
_connectionString = connectionUrl;
|
||||
_serverName = serverName;
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try
|
||||
{
|
||||
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
||||
|
||||
// Create table
|
||||
preparedStatement = _connection.prepareStatement(CREATE_LOG_TABLE);
|
||||
preparedStatement.execute();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (preparedStatement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
preparedStatement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void saveLog(String...message)
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try
|
||||
{
|
||||
synchronized (_connectionLock)
|
||||
{
|
||||
if (_connection.isClosed())
|
||||
{
|
||||
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
||||
}
|
||||
|
||||
preparedStatement = _connection.prepareStatement(INSERT_LOG);
|
||||
|
||||
for (String msg : message)
|
||||
{
|
||||
preparedStatement.setString(1, _serverName);
|
||||
preparedStatement.setString(2, msg.substring(0, Math.min(257, msg.length())));
|
||||
preparedStatement.addBatch();
|
||||
}
|
||||
|
||||
preparedStatement.executeBatch();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (preparedStatement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
preparedStatement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.memory.MemoryFix;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.monitor.LagMeter;
|
||||
@ -60,6 +61,8 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
Logger.initialize(this);
|
||||
|
||||
//Core Modules
|
||||
CoreClientManager clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
|
||||
|
||||
|
@ -54,6 +54,7 @@ import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
@ -372,16 +373,10 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.log(ex);
|
||||
System.out.println("[HubManager] Player Join exception");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
/*
|
||||
if (Bukkit.getOnlinePlayers().length == 1)
|
||||
{
|
||||
new Dragon(this).Spawn();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* XXX TOURNEY
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.map.Map;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
@ -35,6 +36,7 @@ public class MapManager extends MiniPlugin
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.log(ex);
|
||||
System.out.println("[MapManager] Player Join exception");
|
||||
throw ex;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class WorldManager extends MiniPlugin
|
||||
@EventHandler
|
||||
public void BorderUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.party.commands.PartyCommand;
|
||||
@ -61,7 +62,7 @@ public class PartyManager extends MiniPlugin
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println("[PartyManager] Player Join exception");
|
||||
Logger.Instance.log(ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.status.ServerStatusData;
|
||||
@ -158,12 +159,8 @@ public class ServerManager extends MiniPlugin
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Logger.Instance.log(exception);
|
||||
exception.printStackTrace();
|
||||
|
||||
for (ServerInfo serverInfo : serverList)
|
||||
{
|
||||
System.out.println(F.main("ServerManager", ChatColor.YELLOW + serverInfo.Name + ": " + serverInfo.MOTD + " " + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(F.main("Server Portal", "There are currently no joinable servers!"));
|
||||
@ -528,6 +525,7 @@ public class ServerManager extends MiniPlugin
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Instance.log(e);
|
||||
System.out.println("ServerManager - Error parsing servers file : " + e.getMessage());
|
||||
}
|
||||
finally
|
||||
@ -619,11 +617,6 @@ public class ServerManager extends MiniPlugin
|
||||
{
|
||||
return _serverNpcShopMap.get("The Bridges");
|
||||
}
|
||||
|
||||
public ServerNpcShop getMinekartShop()
|
||||
{
|
||||
return _serverNpcShopMap.get("Minekart");
|
||||
}
|
||||
|
||||
public ServerNpcShop getSurvivalGamesShop()
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -50,6 +51,7 @@ public class ServerManagerUpdater implements Listener
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.log(ex);
|
||||
System.out.println("ServerManagerUpdater: Error parsing ServerManager dat md5's");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -107,6 +109,7 @@ public class ServerManagerUpdater implements Listener
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.log(ex);
|
||||
System.out.println("ServerManagerUpdater: Error parsing dat md5's");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -164,6 +167,7 @@ public class ServerManagerUpdater implements Listener
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Instance.log(ex);
|
||||
System.out.println("ServerManagerUpdater: Error updating dats");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -171,7 +175,6 @@ public class ServerManagerUpdater implements Listener
|
||||
|
||||
getCurrentMd5s();
|
||||
_plugin.LoadServers();
|
||||
System.out.println("ServerManagerUpdater: Updated with new dat file.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
package mineplex.hub.server.ui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class SelectMKButton implements IButton
|
||||
{
|
||||
private ServerGameMenu _menu;
|
||||
|
||||
public SelectMKButton(ServerGameMenu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
_menu.OpenMK(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
ClickedLeft(player);
|
||||
}
|
||||
}
|
@ -63,15 +63,8 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ChatColor.RESET + "weapon and fight to survive against",
|
||||
ChatColor.RESET + "the Hunters!",
|
||||
}));
|
||||
this.setItem(6, ItemStackFactory.Instance.CreateStack(Material.SADDLE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "MineKart " + C.cGray + "Racing", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Pick your Kart and race against other",
|
||||
ChatColor.RESET + "players on exciting tracks, complete",
|
||||
ChatColor.RESET + "with weapons, drifting and more!",
|
||||
}));
|
||||
|
||||
this.setItem(7, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Champions " + C.cGray + "Team Game", new String[]
|
||||
this.setItem(6, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Champions " + C.cGray + "Team Game", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Customize one of five exciting champions",
|
||||
@ -84,8 +77,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ButtonMap.put(3, new SelectSGButton(this));
|
||||
ButtonMap.put(4, new SelectBRButton(this));
|
||||
ButtonMap.put(5, new SelectBHButton(this));
|
||||
ButtonMap.put(6, new SelectMKButton(this));
|
||||
ButtonMap.put(7, new SelectDOMButton(this));
|
||||
ButtonMap.put(6, new SelectDOMButton(this));
|
||||
}
|
||||
|
||||
private void createTurfFortsCycle()
|
||||
@ -356,11 +348,6 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
Plugin.getBridgesShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public void OpenMK(Player player)
|
||||
{
|
||||
Plugin.getMinekartShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public void OpenBH(Player player)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.hub.server.ServerInfo;
|
||||
@ -51,12 +52,8 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Logger.Instance.log(exception);
|
||||
exception.printStackTrace();
|
||||
|
||||
for (ServerInfo serverInfo : serverList)
|
||||
{
|
||||
System.out.println(F.main("ServerNpcPage", ChatColor.YELLOW + serverInfo.Name + ": " + serverInfo.MOTD + " " + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers));
|
||||
}
|
||||
}
|
||||
|
||||
int slot = 10;
|
||||
|
@ -20,6 +20,7 @@ import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.memory.MemoryFix;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.monitor.LagMeter;
|
||||
@ -65,6 +66,8 @@ public class Arcade extends JavaPlugin implements INautilusPlugin
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
Logger.initialize(this);
|
||||
|
||||
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
|
||||
|
||||
CommandCenter.Initialize(this, _clientManager);
|
||||
|
Loading…
Reference in New Issue
Block a user