Optimized logins dealing with mysql with multiqueries.
Added lazy loading of Pool data and Loaded check before performing anything. Refactored MiniClientPlugin and created MiniDbClientPlugin Renamed RankBenefitManager9000 to BenefitManager Removed /send ability for now.
This commit is contained in:
parent
1198426d8d
commit
3b54789767
@ -7,25 +7,20 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlugin
|
||||
{
|
||||
private static Object _clientDataLock = new Object();
|
||||
|
||||
private NautHashMap<String, DataType> _clientData = new NautHashMap<String, DataType>();
|
||||
|
||||
|
||||
public MiniClientPlugin(String moduleName, JavaPlugin plugin)
|
||||
{
|
||||
super(moduleName, plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void loadPlayer(RetrieveClientInformationEvent event)
|
||||
{
|
||||
loadClientInformation(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UnloadPlayer(ClientUnloadEvent event)
|
||||
{
|
||||
@ -70,6 +65,4 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
|
||||
}
|
||||
|
||||
protected abstract DataType AddPlayer(String player);
|
||||
|
||||
protected abstract void loadClientInformation(RetrieveClientInformationEvent event);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.ILoginProcessor;
|
||||
|
||||
public abstract class MiniDbClientPlugin<DataType extends Object> extends MiniClientPlugin<DataType> implements ILoginProcessor
|
||||
{
|
||||
protected CoreClientManager ClientManager = null;
|
||||
|
||||
public MiniDbClientPlugin(String moduleName, JavaPlugin plugin, CoreClientManager clientManager)
|
||||
{
|
||||
super(moduleName, plugin);
|
||||
|
||||
ClientManager = clientManager;
|
||||
|
||||
clientManager.addStoredProcedureLoginProcessor(this);
|
||||
}
|
||||
|
||||
public abstract void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException;
|
||||
}
|
@ -10,10 +10,8 @@ import java.util.UUID;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.command.UpdateRank;
|
||||
import mineplex.core.account.event.AsyncClientLoadEvent;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.account.repository.AccountRepository;
|
||||
import mineplex.core.account.repository.token.ClientToken;
|
||||
import mineplex.core.common.Rank;
|
||||
@ -41,11 +39,15 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CoreClientManager extends MiniPlugin
|
||||
{
|
||||
private static NautHashMap<String, Object> _clientLoginLock = new NautHashMap<String, Object>();
|
||||
|
||||
private JavaPlugin _plugin;
|
||||
private AccountRepository _repository;
|
||||
private NautHashMap<String, CoreClient> _clientList;
|
||||
private HashSet<String> _duplicateLoginGlitchPreventionList;
|
||||
|
||||
private NautHashMap<String, ILoginProcessor> _loginProcessors = new NautHashMap<String, ILoginProcessor>();
|
||||
|
||||
private Object _clientLock = new Object();
|
||||
|
||||
private static int _connectingClients = 0;
|
||||
@ -187,38 +189,11 @@ public class CoreClientManager extends MiniPlugin
|
||||
client.SetAccountId(token.AccountId);
|
||||
client.SetRank(Rank.valueOf(token.Rank));
|
||||
|
||||
final RetrieveClientInformationEvent clientInformationEvent = new RetrieveClientInformationEvent(client.GetPlayerName(), uuid);
|
||||
clientInformationEvent.incrementProcessingCount();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.login(uuid.toString(), client.GetPlayerName());
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(clientInformationEvent);
|
||||
clientInformationEvent.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
_repository.login(_loginProcessors, uuid.toString(), client.GetPlayerName());
|
||||
|
||||
// JSON sql response
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||
|
||||
// Load client in miniplugins
|
||||
Bukkit.getServer().getPluginManager().callEvent(new AsyncClientLoadEvent(token, client));
|
||||
|
||||
while (clientInformationEvent.processing())
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(1);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
@ -235,40 +210,38 @@ public class CoreClientManager extends MiniPlugin
|
||||
{
|
||||
TimingManager.start(client.GetPlayerName() + " LoadClient Total.");
|
||||
|
||||
_clientLoginLock.put(client.GetPlayerName(), new Object());
|
||||
ClientToken token = null;
|
||||
Gson gson = new Gson();
|
||||
|
||||
final RetrieveClientInformationEvent clientInformationEvent = new RetrieveClientInformationEvent(client.GetPlayerName(), uuid);
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.login(uuid.toString(), client.GetPlayerName());
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(clientInformationEvent);
|
||||
_repository.login(_loginProcessors, uuid.toString(), client.GetPlayerName());
|
||||
_clientLoginLock.remove(client.GetPlayerName());
|
||||
}
|
||||
});
|
||||
|
||||
TimingManager.start(client.GetPlayerName() + " GetClient.");
|
||||
String response = _repository.GetClient(client.GetPlayerName(), uuid, ipAddress);
|
||||
TimingManager.stop(client.GetPlayerName() + " GetClient.");
|
||||
|
||||
token = gson.fromJson(response, ClientToken.class);
|
||||
|
||||
client.SetAccountId(token.AccountId);
|
||||
client.SetRank(Rank.valueOf(token.Rank));
|
||||
|
||||
_repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
||||
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
||||
|
||||
// JSON sql response
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
|
||||
|
||||
// Load client in miniplugins
|
||||
Bukkit.getServer().getPluginManager().callEvent(new AsyncClientLoadEvent(token, client));
|
||||
|
||||
while (clientInformationEvent.processing())
|
||||
while (_clientLoginLock.containsKey(client.GetPlayerName()))
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(1);
|
||||
Thread.sleep(2);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
@ -429,4 +402,9 @@ public class CoreClientManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addStoredProcedureLoginProcessor(ILoginProcessor processor)
|
||||
{
|
||||
_loginProcessors.put(processor.getName(), processor);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package mineplex.core.account;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public interface ILoginProcessor
|
||||
{
|
||||
String getName();
|
||||
|
||||
void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException;
|
||||
|
||||
String getQuery(String uuid, String name);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package mineplex.core.account.event;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.repository.token.ClientToken;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class AsyncClientLoadEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private ClientToken _token;
|
||||
private CoreClient _client;
|
||||
|
||||
public AsyncClientLoadEvent(ClientToken token, CoreClient client)
|
||||
{
|
||||
_token = token;
|
||||
_client = client;
|
||||
}
|
||||
|
||||
public CoreClient GetClient()
|
||||
{
|
||||
return _client;
|
||||
}
|
||||
|
||||
public ClientToken GetClientToken()
|
||||
{
|
||||
return _token;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package mineplex.core.account.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class RetrieveClientInformationEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private String _playerName;
|
||||
private UUID _uuid;
|
||||
private int _processingCount;
|
||||
|
||||
public RetrieveClientInformationEvent(String playerName, UUID uuid)
|
||||
{
|
||||
_playerName = playerName;
|
||||
_uuid = uuid;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
return _uuid;
|
||||
}
|
||||
|
||||
public void incrementProcessingCount()
|
||||
{
|
||||
_processingCount++;
|
||||
}
|
||||
|
||||
public boolean processing()
|
||||
{
|
||||
return _processingCount > 0;
|
||||
}
|
||||
|
||||
public void decreaseProcessingCount()
|
||||
{
|
||||
_processingCount--;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package mineplex.core.account.repository;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -11,10 +12,12 @@ import org.bukkit.Bukkit;
|
||||
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.repository.token.LoginToken;
|
||||
import mineplex.core.account.repository.token.RankUpdateToken;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.database.DatabaseRunnable;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
@ -26,9 +29,10 @@ import mineplex.core.server.remotecall.JsonWebCall;
|
||||
|
||||
public class AccountRepository extends RepositoryBase
|
||||
{
|
||||
private static String _loginString = null;
|
||||
|
||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accounts (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuid), UNIQUE INDEX nameIndex (name), INDEX rankIndex (rank));";
|
||||
private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now()) ON DUPLICATE KEY UPDATE name=VALUES(name), lastLogin=VALUES(lastLogin);";
|
||||
private static String ACCOUNT_LOGIN_UPDATE = "UPDATE accounts SET uuid=?, name=?, lastLogin=now() WHERE uuid = ?;";
|
||||
private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now()) ON DUPLICATE KEY UPDATE name=VALUES(name), lastLogin=VALUES(lastLogin);";
|
||||
private static String UPDATE_ACCOUNT_RANK = "UPDATE accounts SET rank=?, rankPerm=false, rankExpire=now() + INTERVAL 1 MONTH WHERE uuid = ?;";
|
||||
private static String UPDATE_ACCOUNT_RANK_DONOR = "UPDATE accounts SET rank=?, donorRank=?, rankPerm=false, rankExpire=now() + INTERVAL 1 MONTH WHERE uuid = ?;";
|
||||
private static String UPDATE_ACCOUNT_RANK_PERM = "UPDATE accounts SET rank=?, rankPerm=true WHERE uuid = ?;";
|
||||
@ -41,9 +45,34 @@ public class AccountRepository extends RepositoryBase
|
||||
|
||||
public AccountRepository(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true", "root", "tAbechAk3wR7tuTh");
|
||||
|
||||
_webAddress = webAddress;
|
||||
|
||||
Statement statement = null;
|
||||
|
||||
try
|
||||
{
|
||||
statement = getConnection().createStatement();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (statement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,12 +81,110 @@ public class AccountRepository extends RepositoryBase
|
||||
executeUpdate(CREATE_ACCOUNT_TABLE);
|
||||
}
|
||||
|
||||
public void login(String uuid, String name)
|
||||
public void login(NautHashMap<String, ILoginProcessor> loginProcessors, String uuid, String name)
|
||||
{
|
||||
int affectedRows = executeUpdate(ACCOUNT_LOGIN_UPDATE, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("name", 40, name), new ColumnVarChar("uuid", 100, uuid));
|
||||
Statement statement = null;
|
||||
ResultSet resultSet = null;
|
||||
|
||||
if (affectedRows == 0)
|
||||
executeUpdate(ACCOUNT_LOGIN_NEW, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("name", 40, name));
|
||||
try
|
||||
{
|
||||
statement = getConnection().createStatement();
|
||||
|
||||
/*
|
||||
boolean statementStatus = statement.execute(
|
||||
"UPDATE accounts SET name='" + name + "', lastLogin=now() WHERE accounts.uuid = '" + uuid + "';"
|
||||
+ "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"
|
||||
+ "SELECT items.name, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId INNER JOIN accounts ON accounts.id = ai.accountId WHERE accounts.uuid = '" + uuid + "';"
|
||||
+ "SELECT benefit FROM rankBenefits WHERE rankBenefits.uuid = '" + uuid + "';"
|
||||
+ "SELECT stats.name, value FROM accountStats INNER JOIN stats ON stats.id = accountStats.statId INNER JOIN accounts ON accountStats.accountId = accounts.id WHERE accounts.uuid = '" + uuid + "';"
|
||||
+ "SELECT tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource = '" + uuid + "';"
|
||||
+ "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';"
|
||||
);
|
||||
*/
|
||||
if (_loginString == null)
|
||||
{
|
||||
_loginString = "UPDATE accounts SET name='" + name + "', lastLogin=now() WHERE accounts.uuid = '" + uuid + "';";
|
||||
for (ILoginProcessor loginProcessor : loginProcessors.values())
|
||||
{
|
||||
_loginString += loginProcessor.getQuery(uuid, name);
|
||||
System.out.println(loginProcessor.getClass().toString());
|
||||
}
|
||||
}
|
||||
|
||||
statement.execute(_loginString);
|
||||
|
||||
/*
|
||||
while (true)
|
||||
{
|
||||
if (statementStatus)
|
||||
{
|
||||
System.out.println("ResultSet : " + statement.getResultSet().getMetaData().getColumnCount() + " columns:");
|
||||
|
||||
for (int i = 0; i < statement.getResultSet().getMetaData().getColumnCount(); i++)
|
||||
{
|
||||
System.out.println(statement.getResultSet().getMetaData().getColumnName(i + 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (statement.getUpdateCount() == -1)
|
||||
break;
|
||||
|
||||
System.out.println("Update statement : " + statement.getUpdateCount() + " rows affected.");
|
||||
}
|
||||
|
||||
statementStatus = statement.getMoreResults();
|
||||
}
|
||||
|
||||
System.out.println("Done");
|
||||
*/
|
||||
|
||||
boolean accountExists = statement.getUpdateCount() != 0;
|
||||
|
||||
statement.getMoreResults();
|
||||
for (ILoginProcessor loginProcessor : loginProcessors.values())
|
||||
{
|
||||
loginProcessor.processLoginResultSet(name, statement.getResultSet());
|
||||
System.out.println(loginProcessor.getClass().toString());
|
||||
}
|
||||
|
||||
statement.getMoreResults();
|
||||
|
||||
if (!accountExists)
|
||||
{
|
||||
executeUpdate(ACCOUNT_LOGIN_NEW, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("name", 100, name));
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (statement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
statement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (resultSet != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String GetClient(String name, UUID uuid, String ipAddress)
|
||||
|
@ -1,13 +1,13 @@
|
||||
package mineplex.core.benefit;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.benefit.benefits.BenefitBase;
|
||||
import mineplex.core.benefit.benefits.Thanksgiving2014;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
@ -17,17 +17,17 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000 extends MiniClientPlugin<PlayerBenefit>
|
||||
public class BenefitManager extends MiniDbClientPlugin<PlayerBenefit>
|
||||
{
|
||||
private RankBenefitsGiver9000Repository _repository;
|
||||
private BenefitManagerRepository _repository;
|
||||
|
||||
private List<BenefitBase> _benefits = new ArrayList<BenefitBase>();
|
||||
|
||||
public RankBenefitsGiver9000(JavaPlugin plugin, CoreClientManager clientManager, InventoryManager inventoryManager)
|
||||
public BenefitManager(JavaPlugin plugin, CoreClientManager clientManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("RankBenefitsGiver9000", plugin);
|
||||
super("Benefit Manager", plugin, clientManager);
|
||||
|
||||
_repository = new RankBenefitsGiver9000Repository(plugin);
|
||||
_repository = new BenefitManagerRepository(plugin);
|
||||
|
||||
//_benefits.add(new Thanksgiving2014(plugin, _repository, inventoryManager));
|
||||
}
|
||||
@ -71,22 +71,14 @@ public class RankBenefitsGiver9000 extends MiniClientPlugin<PlayerBenefit>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (String benefit : _repository.retrievePlayerBenefits(event.getUniqueId().toString()))
|
||||
{
|
||||
Get(event.getPlayerName()).Benefits.add(benefit);
|
||||
Get(event.getPlayerName()).Loaded = true;
|
||||
}
|
||||
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
Set(playerName, _repository.retrievePlayerBenefitData(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT benefit FROM rankBenefits WHERE rankBenefits.uuid = '" + uuid + "';";
|
||||
}
|
||||
}
|
@ -2,23 +2,19 @@ package mineplex.core.benefit;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class RankBenefitsGiver9000Repository extends RepositoryBase
|
||||
public class BenefitManagerRepository extends RepositoryBase
|
||||
{
|
||||
// private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), benefit VARCHAR(100), PRIMARY KEY (id), INDEX rankUuid (uuid));";
|
||||
|
||||
private static String INSERT_BENEFIT = "INSERT INTO rankBenefits (uuid, benefit) VALUES (?, ?);";
|
||||
private static String RETRIEVE_BENEFITS = "SELECT benefit FROM rankBenefits WHERE uuid = ?;";
|
||||
|
||||
public RankBenefitsGiver9000Repository(JavaPlugin plugin)
|
||||
public BenefitManagerRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
}
|
||||
@ -33,27 +29,21 @@ public class RankBenefitsGiver9000Repository extends RepositoryBase
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
|
||||
public List<String> retrievePlayerBenefits(String uuid)
|
||||
{
|
||||
final List<String> benefits = new ArrayList<String>();
|
||||
|
||||
executeQuery(RETRIEVE_BENEFITS, new ResultSetCallable()
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
benefits.add(resultSet.getString(1));
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid));
|
||||
|
||||
return benefits;
|
||||
}
|
||||
|
||||
public boolean addBenefit(String uuid, String benefit)
|
||||
{
|
||||
return executeUpdate(INSERT_BENEFIT, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("benefit", 100, benefit)) > 0;
|
||||
}
|
||||
|
||||
public PlayerBenefit retrievePlayerBenefitData(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
PlayerBenefit playerBenefit = new PlayerBenefit();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
playerBenefit.Benefits.add(resultSet.getString(1));
|
||||
}
|
||||
|
||||
return playerBenefit;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.benefit.benefits;
|
||||
|
||||
import mineplex.core.benefit.RankBenefitsGiver9000Repository;
|
||||
import mineplex.core.benefit.BenefitManagerRepository;
|
||||
import mineplex.core.common.util.Callback;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -11,9 +11,9 @@ public abstract class BenefitBase
|
||||
{
|
||||
private JavaPlugin _plugin;
|
||||
private String _name;
|
||||
private RankBenefitsGiver9000Repository _repository;
|
||||
private BenefitManagerRepository _repository;
|
||||
|
||||
protected BenefitBase(JavaPlugin plugin, String name, RankBenefitsGiver9000Repository repository)
|
||||
protected BenefitBase(JavaPlugin plugin, String name, BenefitManagerRepository repository)
|
||||
{
|
||||
_plugin = plugin;
|
||||
_name = name;
|
||||
@ -25,7 +25,7 @@ public abstract class BenefitBase
|
||||
return _plugin;
|
||||
}
|
||||
|
||||
public RankBenefitsGiver9000Repository getRepository()
|
||||
public BenefitManagerRepository getRepository()
|
||||
{
|
||||
return _repository;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package mineplex.core.benefit.benefits;
|
||||
|
||||
import mineplex.core.benefit.RankBenefitsGiver9000Repository;
|
||||
import mineplex.core.benefit.BenefitManagerRepository;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -14,7 +14,7 @@ public class Thanksgiving2014 extends BenefitBase
|
||||
{
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
public Thanksgiving2014(JavaPlugin plugin, RankBenefitsGiver9000Repository repository, InventoryManager inventoryManager)
|
||||
public Thanksgiving2014(JavaPlugin plugin, BenefitManagerRepository repository, InventoryManager inventoryManager)
|
||||
{
|
||||
super(plugin, "Thanksgiving2014", repository);
|
||||
|
||||
|
@ -10,6 +10,7 @@ import java.util.Iterator;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.column.Column;
|
||||
import mineplex.core.logger.Logger;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -83,6 +84,7 @@ public abstract class RepositoryBase implements Listener
|
||||
|
||||
protected int executeUpdate(String query, ResultSetCallable callable, Column<?>...columns)
|
||||
{
|
||||
TimingManager.start(getClass().getName());
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
int affectedRows = 0;
|
||||
@ -101,6 +103,8 @@ public abstract class RepositoryBase implements Listener
|
||||
|
||||
affectedRows = preparedStatement.executeUpdate();
|
||||
|
||||
TimingManager.stop(getClass().getName());
|
||||
|
||||
if (callable != null)
|
||||
callable.processResultSet(preparedStatement.getGeneratedKeys());
|
||||
}
|
||||
@ -128,6 +132,8 @@ public abstract class RepositoryBase implements Listener
|
||||
|
||||
protected void executeQuery(PreparedStatement statement, ResultSetCallable callable, Column<?>...columns)
|
||||
{
|
||||
TimingManager.start(getClass().getName());
|
||||
|
||||
ResultSet resultSet = null;
|
||||
|
||||
try
|
||||
@ -138,7 +144,7 @@ public abstract class RepositoryBase implements Listener
|
||||
}
|
||||
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
TimingManager.stop(getClass().getName());
|
||||
callable.processResultSet(resultSet);
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
@ -68,7 +68,7 @@ public class DonationManager extends MiniPlugin
|
||||
synchronized (_donorLock)
|
||||
{
|
||||
_donors.put(token.Name, new Donor(token.DonorToken));
|
||||
_repository.updateGemsAndCoins(uuid, Get(token.Name).GetGems(), Get(token.Name).getCoins());
|
||||
//_repository.updateGemsAndCoins(uuid, Get(token.Name).GetGems(), Get(token.Name).getCoins());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
package mineplex.core.elo;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
public class EloClientData
|
||||
{
|
||||
public NautHashMap<String, Integer> Elos = new NautHashMap<String, Integer>();
|
||||
}
|
@ -1,16 +1,17 @@
|
||||
package mineplex.core.elo;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class EloManager extends MiniPlugin
|
||||
public class EloManager extends MiniDbClientPlugin<EloClientData>
|
||||
{
|
||||
private static Object _playerEloLock = new Object();
|
||||
|
||||
@ -18,51 +19,15 @@ public class EloManager extends MiniPlugin
|
||||
private EloRatingSystem _ratingSystem;
|
||||
private NautHashMap<String, NautHashMap<String, Integer>> _playerElos;
|
||||
|
||||
public EloManager(JavaPlugin plugin)
|
||||
public EloManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||
{
|
||||
super("Elo Rating", plugin);
|
||||
|
||||
setupConfigValues(plugin);
|
||||
|
||||
_repository = new EloRepository(plugin.getConfig().getString("elo.connectionurl"));
|
||||
super("Elo Rating", plugin, clientManager);
|
||||
|
||||
_repository = new EloRepository(plugin);
|
||||
_ratingSystem = new EloRatingSystem(new KFactor(0, 1200, 25), new KFactor(1201, 1600, 20), new KFactor(1601, 2000, 15), new KFactor(2001, 2500, 10));
|
||||
_playerElos = new NautHashMap<String, NautHashMap<String, Integer>>();
|
||||
}
|
||||
|
||||
private void setupConfigValues(JavaPlugin plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
plugin.getConfig().addDefault("elo.connectionurl", "jdbc:mysql://sqlstats.mineplex.com:3306/Mineplex?autoReconnect=true&failOverReadOnly=false&maxReconnects=10");
|
||||
plugin.getConfig().set("elo.connectionurl", plugin.getConfig().getString("elo.connectionurl"));
|
||||
plugin.saveConfig();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void retrievePlayersElos(final RetrieveClientInformationEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
NautHashMap<String, Integer> eloMap = _repository.loadClientInformation(event.getUniqueId());
|
||||
|
||||
synchronized (_playerEloLock)
|
||||
{
|
||||
_playerElos.put(event.getUniqueId().toString(), eloMap);
|
||||
}
|
||||
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public int getElo(UUID uuid, String gameType)
|
||||
{
|
||||
int elo = 1000;
|
||||
@ -135,4 +100,22 @@ public class EloManager extends MiniPlugin
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EloClientData AddPlayer(String player)
|
||||
{
|
||||
return new EloClientData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Set(playerName, _repository.loadClientInformation(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';";
|
||||
}
|
||||
}
|
||||
|
@ -1,172 +1,50 @@
|
||||
package mineplex.core.elo;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class EloRepository
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
public class EloRepository extends RepositoryBase
|
||||
{
|
||||
private String _connectionString;
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
private static String CREATE_ELO_TABLE = "CREATE TABLE IF NOT EXISTS eloRating (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), gameType VARCHAR(256), elo INT, PRIMARY KEY (id), UNIQUE INDEX uuid_gameType_index (uuid, gameType));";
|
||||
private static String INSERT_ELO = "INSERT INTO eloRating (uuid, gameType, elo) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE elo=VALUES(elo);";
|
||||
private static String RETRIEVE_ELO = "SELECT gameType, elo FROM eloRating WHERE uuid = ?;";
|
||||
|
||||
private Connection _connection = null;
|
||||
|
||||
public EloRepository(String connectionUrl)
|
||||
public EloRepository(JavaPlugin plugin)
|
||||
{
|
||||
_connectionString = connectionUrl;
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try
|
||||
{
|
||||
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
||||
|
||||
// Create table
|
||||
preparedStatement = _connection.prepareStatement(CREATE_ELO_TABLE);
|
||||
preparedStatement.execute();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (preparedStatement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
preparedStatement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
executeUpdate(CREATE_ELO_TABLE);
|
||||
}
|
||||
|
||||
public void saveElo(String uuid, String gameType, int elo)
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
int affectedRows = 0;
|
||||
|
||||
try
|
||||
{
|
||||
if (_connection.isClosed())
|
||||
{
|
||||
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
||||
}
|
||||
|
||||
preparedStatement = _connection.prepareStatement(INSERT_ELO);
|
||||
|
||||
preparedStatement.setString(1, uuid);
|
||||
preparedStatement.setString(2, gameType);
|
||||
preparedStatement.setInt(3, elo);
|
||||
|
||||
affectedRows = preparedStatement.executeUpdate();
|
||||
|
||||
if (affectedRows == 0)
|
||||
{
|
||||
System.out.println("Error saving Elo.");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Saved '" + uuid + "' for '" + gameType + "' new elo " + elo);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (preparedStatement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
preparedStatement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
executeUpdate(INSERT_ELO, new ColumnVarChar("uuid", 100, uuid), new ColumnVarChar("gameType", 100, gameType), new ColumnInt("elo", elo));
|
||||
}
|
||||
|
||||
public NautHashMap<String, Integer> loadClientInformation(UUID uuid)
|
||||
public EloClientData loadClientInformation(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
NautHashMap<String, Integer> elos = new NautHashMap<String, Integer>();
|
||||
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement preparedStatement = null;
|
||||
EloClientData clientData = new EloClientData();
|
||||
|
||||
try
|
||||
while (resultSet.next())
|
||||
{
|
||||
if (_connection.isClosed())
|
||||
{
|
||||
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
||||
}
|
||||
|
||||
preparedStatement = _connection.prepareStatement(RETRIEVE_ELO);
|
||||
preparedStatement.setString(1, uuid.toString());
|
||||
|
||||
resultSet = preparedStatement.executeQuery();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
elos.put(resultSet.getString(1), resultSet.getInt(2));
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (preparedStatement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
preparedStatement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (resultSet != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
resultSet.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
clientData.Elos.put(resultSet.getString(1), resultSet.getInt(2));
|
||||
}
|
||||
|
||||
return elos;
|
||||
return clientData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -153,49 +152,8 @@ public class Energy extends MiniClientPlugin<ClientEnergy>
|
||||
Get(player).MaxEnergyMods.remove(reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
public void setEnabled(boolean b)
|
||||
{
|
||||
_enabled = b;
|
||||
}
|
||||
|
||||
/* ENERGY NO LONGER USED ON ATTACK
|
||||
public void AddEnergySwingMod(Player player, String reason, int amount)
|
||||
{
|
||||
Get(player).SwingEnergyMods.put(reason, amount);
|
||||
}
|
||||
|
||||
public void RemoveEnergySwingMod(Player player, String reason)
|
||||
{
|
||||
Get(player).SwingEnergyMods.remove(reason);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void WeaponSwing(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.L))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilGear.isWeapon(player.getItemInHand()))
|
||||
return;
|
||||
|
||||
if (player.hasPotionEffect(PotionEffectType.FAST_DIGGING))
|
||||
return;
|
||||
|
||||
ModifyEnergy(player, -Get(player).SwingEnergy());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
ModifyEnergy((Player)event.getEntity(), -10);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.friend;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@ -11,9 +13,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.ChildJsonMessage;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
@ -31,19 +32,17 @@ import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
public class FriendManager extends MiniDbClientPlugin<FriendData>
|
||||
{
|
||||
private static FriendSorter _friendSorter = new FriendSorter();
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private PreferencesManager _preferenceManager;
|
||||
private FriendRepository _repository;
|
||||
|
||||
public FriendManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences)
|
||||
{
|
||||
super("Friends", plugin);
|
||||
super("Friends", plugin, clientManager);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_preferenceManager = preferences;
|
||||
_repository = new FriendRepository(plugin);
|
||||
}
|
||||
@ -61,20 +60,6 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
return new FriendData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayerName(), _repository.loadClientInformation(event.getUniqueId()));
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateFriends(UpdateEvent event)
|
||||
{
|
||||
@ -262,7 +247,7 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
|
||||
public void showFriends(Player caller)
|
||||
{
|
||||
boolean isStaff = _clientManager.Get(caller).GetRank().Has(Rank.HELPER);
|
||||
boolean isStaff = ClientManager.Get(caller).GetRank().Has(Rank.HELPER);
|
||||
boolean gotAFriend = false;
|
||||
List<FriendStatus> friendStatuses = Get(caller).Friends;
|
||||
Collections.sort(friendStatuses, _friendSorter);
|
||||
@ -379,4 +364,16 @@ public class FriendManager extends MiniClientPlugin<FriendData>
|
||||
|
||||
caller.sendMessage(C.cAqua + C.Strike + "=====================================================");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Set(playerName, _repository.loadClientInformation(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource = '" + uuid + "';";
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package mineplex.core.friend.data;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -16,16 +15,11 @@ import mineplex.core.friend.FriendStatusType;
|
||||
public class FriendRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS accountFriend (id INT NOT NULL AUTO_INCREMENT, uuidSource VARCHAR(100), uuidTarget VARCHAR(100), status VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuidSource, uuidTarget));";
|
||||
private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource IN ";
|
||||
private static String RETRIEVE_FRIEND_RECORDS = "SELECT tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource = ?;";
|
||||
private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, serverName, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget LEFT JOIN playerMap ON tA.name = playerName WHERE uuidSource = ?;";
|
||||
private static String ADD_FRIEND_RECORD = "INSERT INTO accountFriend (uuidSource, uuidTarget, status) SELECT fA.uuid AS uuidSource, tA.uuid AS uuidTarget, ? FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;";
|
||||
private static String UPDATE_MUTUAL_RECORD = "UPDATE accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid SET aF.status = ? WHERE tA.name = ? AND fA.name = ?;";
|
||||
private static String DELETE_FRIEND_RECORD = "DELETE aF FROM accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid WHERE fA.name = ? AND tA.name = ?;";
|
||||
|
||||
|
||||
// Not mutual, need to drop accountFriend to recreate with constraint.
|
||||
// On add record need to check for a reverse uuidsource/uuidtarget and set mutual
|
||||
|
||||
public FriendRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10", "root", "tAbechAk3wR7tuTh");
|
||||
@ -109,27 +103,21 @@ public class FriendRepository extends RepositoryBase
|
||||
return friends;
|
||||
}
|
||||
|
||||
public FriendData loadClientInformation(final UUID uniqueId)
|
||||
public FriendData loadClientInformation(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final FriendData friendData = new FriendData();
|
||||
FriendData friendData = new FriendData();
|
||||
|
||||
executeQuery(RETRIEVE_FRIEND_RECORDS, new ResultSetCallable()
|
||||
while (resultSet.next())
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
FriendStatus friend = new FriendStatus();
|
||||
|
||||
friend.Name = resultSet.getString(1);
|
||||
friend.Status = Enum.valueOf(FriendStatusType.class, resultSet.getString(2));
|
||||
friend.ServerName = resultSet.getString(3);
|
||||
friend.LastSeenOnline = resultSet.getTimestamp(5).getTime() - resultSet.getTimestamp(4).getTime();
|
||||
|
||||
friendData.Friends.add(friend);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuidSource", 100, uniqueId.toString()));
|
||||
FriendStatus friend = new FriendStatus();
|
||||
|
||||
friend.Name = resultSet.getString(1);
|
||||
friend.Status = Enum.valueOf(FriendStatusType.class, resultSet.getString(2));
|
||||
friend.ServerName = resultSet.getString(3);
|
||||
friend.LastSeenOnline = resultSet.getTimestamp(5).getTime() - resultSet.getTimestamp(4).getTime();
|
||||
|
||||
friendData.Friends.add(friend);
|
||||
}
|
||||
|
||||
return friendData;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.inventory;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -7,8 +9,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.inventory.command.GiveItemCommand;
|
||||
@ -16,7 +18,7 @@ import mineplex.core.inventory.data.Category;
|
||||
import mineplex.core.inventory.data.InventoryRepository;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
|
||||
public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
{
|
||||
private static Object _inventoryLock = new Object();
|
||||
|
||||
@ -25,9 +27,9 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
private NautHashMap<String, Item> _items = new NautHashMap<String, Item>();
|
||||
private NautHashMap<String, Category> _categories = new NautHashMap<String, Category>();
|
||||
|
||||
public InventoryManager(JavaPlugin plugin)
|
||||
public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||
{
|
||||
super("Inventory Manager", plugin);
|
||||
super("Inventory Manager", plugin, clientManager);
|
||||
|
||||
_repository = new InventoryRepository(plugin);
|
||||
|
||||
@ -169,23 +171,21 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
return new ClientInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayerName(), _repository.loadClientInformation(event.getUniqueId().toString()));
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
addCommand(new GiveItemCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Set(playerName, _repository.loadClientInformation(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT items.name, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId INNER JOIN accounts ON accounts.id = ai.accountId WHERE accounts.uuid = '" + uuid + "';";
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ public class InventoryRepository extends RepositoryBase
|
||||
private static String RETRIEVE_CATEGORIES = "SELECT id, name FROM itemCategories;";
|
||||
|
||||
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.uuid = ? ON DUPLICATE KEY UPDATE count=count + VALUES(count);";
|
||||
private static String RETRIEVE_CLIENT_INVENTORY = "SELECT items.name, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId INNER JOIN accounts ON accounts.id = ai.accountId WHERE accounts.uuid = ?;";
|
||||
|
||||
public InventoryRepository(JavaPlugin plugin)
|
||||
{
|
||||
@ -98,20 +97,14 @@ public class InventoryRepository extends RepositoryBase
|
||||
return executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("itemid", itemId), new ColumnInt("count", count), new ColumnVarChar("uuid", 100, uuid)) > 0;
|
||||
}
|
||||
|
||||
public ClientInventory loadClientInformation(String uuid)
|
||||
public ClientInventory loadClientInformation(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final ClientInventory clientInventory = new ClientInventory();
|
||||
|
||||
executeQuery(RETRIEVE_CLIENT_INVENTORY, new ResultSetCallable()
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
clientInventory.addItem(new ClientItem(new Item(resultSet.getString(1), resultSet.getString(2)), resultSet.getInt(3)));
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid));
|
||||
clientInventory.addItem(new ClientItem(new Item(resultSet.getString(1), resultSet.getString(2)), resultSet.getInt(3)));
|
||||
}
|
||||
|
||||
return clientInventory;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -210,9 +209,4 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
{
|
||||
return _clientManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mineplex.core.movement;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -45,9 +44,4 @@ public class Movement extends MiniClientPlugin<ClientMovement>
|
||||
{
|
||||
return new ClientMovement();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package mineplex.core.pet;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.pet.repository.token.PetSalesToken;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -1,11 +1,9 @@
|
||||
package mineplex.core.pet;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.pet.repository.token.PetExtraToken;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -11,14 +11,10 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
||||
@ -27,15 +23,7 @@ import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -46,18 +34,13 @@ import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -394,11 +377,6 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
{
|
||||
return _activePetOwners.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
public void DisableAll()
|
||||
{
|
||||
|
@ -1,8 +1,9 @@
|
||||
package mineplex.core.preferences;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -12,9 +13,8 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -23,7 +23,7 @@ import mineplex.core.preferences.ui.PreferencesShop;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class PreferencesManager extends MiniClientPlugin<UserPreferences>
|
||||
public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
|
||||
{
|
||||
private PreferencesRepository _repository;
|
||||
private PreferencesShop _shop;
|
||||
@ -34,7 +34,7 @@ public class PreferencesManager extends MiniClientPlugin<UserPreferences>
|
||||
|
||||
public PreferencesManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("Preferences", plugin);
|
||||
super("Preferences", plugin, clientManager);
|
||||
|
||||
setupConfigValues();
|
||||
|
||||
@ -64,20 +64,6 @@ public class PreferencesManager extends MiniClientPlugin<UserPreferences>
|
||||
return new UserPreferences();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayerName(), _repository.loadClientInformation(event.getUniqueId()));
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void savePreferences(Player caller)
|
||||
{
|
||||
_saveBuffer.put(caller.getUniqueId().toString(), Get(caller));
|
||||
@ -134,4 +120,16 @@ public class PreferencesManager extends MiniClientPlugin<UserPreferences>
|
||||
{
|
||||
_shop.attemptShopOpen(caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Set(playerName, _repository.loadClientInformation(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;";
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,17 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
public class PreferencesRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), games BOOL NOT NULL DEFAULT 1, visibility BOOL NOT NULL DEFAULT 1, showChat BOOL NOT NULL DEFAULT 1, friendChat BOOL NOT NULL DEFAULT 1, privateMessaging BOOL NOT NULL DEFAULT 1, partyRequests BOOL NOT NULL DEFAULT 0, invisibility BOOL NOT NULL DEFAULT 0, forcefield BOOL NOT NULL DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));";
|
||||
private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;";
|
||||
private static String RETRIEVE_ACCOUNT_PREFERENCES = "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests FROM accountPreferences WHERE uuid = ?;";
|
||||
private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ? WHERE uuid=?;";
|
||||
|
||||
public PreferencesRepository(JavaPlugin plugin, String connectionString)
|
||||
@ -61,8 +58,33 @@ public class PreferencesRepository extends RepositoryBase
|
||||
|
||||
preparedStatement.addBatch();
|
||||
}
|
||||
|
||||
int[] rowsAffected = preparedStatement.executeBatch();
|
||||
int i = 0;
|
||||
|
||||
preparedStatement.executeBatch();
|
||||
for (Entry<String, UserPreferences> entry : preferences.entrySet())
|
||||
{
|
||||
if (rowsAffected[i] < 1)
|
||||
{
|
||||
executeUpdate(INSERT_ACCOUNT, new ColumnVarChar("uuid", 100, entry.getKey()));
|
||||
|
||||
preparedStatement.setBoolean(1, entry.getValue().HubGames);
|
||||
preparedStatement.setBoolean(2, entry.getValue().ShowPlayers);
|
||||
preparedStatement.setBoolean(3, entry.getValue().ShowChat);
|
||||
preparedStatement.setBoolean(4, entry.getValue().FriendChat);
|
||||
preparedStatement.setBoolean(5, entry.getValue().PrivateMessaging);
|
||||
preparedStatement.setBoolean(6, entry.getValue().PartyRequests);
|
||||
preparedStatement.setBoolean(7, entry.getValue().Invisibility);
|
||||
preparedStatement.setBoolean(8, entry.getValue().HubForcefield);
|
||||
preparedStatement.setBoolean(9, entry.getValue().ShowMacReports);
|
||||
preparedStatement.setBoolean(10, entry.getValue().IgnoreVelocity);
|
||||
preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests);
|
||||
preparedStatement.setString(12, entry.getKey());
|
||||
preparedStatement.execute();
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@ -84,34 +106,24 @@ public class PreferencesRepository extends RepositoryBase
|
||||
}
|
||||
}
|
||||
|
||||
public UserPreferences loadClientInformation(final UUID uuid)
|
||||
public UserPreferences loadClientInformation(final ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final UserPreferences preferences = new UserPreferences();
|
||||
|
||||
executeQuery(RETRIEVE_ACCOUNT_PREFERENCES, new ResultSetCallable()
|
||||
if (resultSet.next())
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
if (!resultSet.next())
|
||||
{
|
||||
executeUpdate(INSERT_ACCOUNT, new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
preferences.HubGames = resultSet.getBoolean(1);
|
||||
preferences.ShowPlayers = resultSet.getBoolean(2);
|
||||
preferences.ShowChat = resultSet.getBoolean(3);
|
||||
preferences.FriendChat = resultSet.getBoolean(4);
|
||||
preferences.PrivateMessaging = resultSet.getBoolean(5);
|
||||
preferences.PartyRequests = resultSet.getBoolean(6);
|
||||
preferences.Invisibility = resultSet.getBoolean(7);
|
||||
preferences.HubForcefield = resultSet.getBoolean(8);
|
||||
preferences.ShowMacReports = resultSet.getBoolean(9);
|
||||
preferences.IgnoreVelocity = resultSet.getBoolean(10);
|
||||
preferences.PendingFriendRequests = resultSet.getBoolean(11);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
preferences.HubGames = resultSet.getBoolean(1);
|
||||
preferences.ShowPlayers = resultSet.getBoolean(2);
|
||||
preferences.ShowChat = resultSet.getBoolean(3);
|
||||
preferences.FriendChat = resultSet.getBoolean(4);
|
||||
preferences.PrivateMessaging = resultSet.getBoolean(5);
|
||||
preferences.PartyRequests = resultSet.getBoolean(6);
|
||||
preferences.Invisibility = resultSet.getBoolean(7);
|
||||
preferences.HubForcefield = resultSet.getBoolean(8);
|
||||
preferences.ShowMacReports = resultSet.getBoolean(9);
|
||||
preferences.IgnoreVelocity = resultSet.getBoolean(10);
|
||||
preferences.PendingFriendRequests = resultSet.getBoolean(11);
|
||||
}
|
||||
|
||||
return preferences;
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
package mineplex.core.stats;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.stats.command.GiveStatCommand;
|
||||
import mineplex.core.stats.command.TimeCommand;
|
||||
import mineplex.core.stats.event.StatChangeEvent;
|
||||
|
||||
public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
{
|
||||
private static Object _statSync = new Object();
|
||||
|
||||
@ -25,9 +25,9 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
private NautHashMap<String, NautHashMap<String, Integer>> _statUploadQueue = new NautHashMap<String, NautHashMap<String, Integer>>();
|
||||
private Runnable _saveRunnable;
|
||||
|
||||
public StatsManager(JavaPlugin plugin)
|
||||
public StatsManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||
{
|
||||
super("StatsManager", plugin);
|
||||
super("Stats Manager", plugin, clientManager);
|
||||
|
||||
_repository = new StatsRepository(plugin);
|
||||
|
||||
@ -117,20 +117,6 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
return new PlayerStats();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayerName(), _repository.loadClientInformation(event.getUniqueId().toString()));
|
||||
event.decreaseProcessingCount();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public PlayerStats getOfflinePlayerStats(String playerName) throws SQLException
|
||||
{
|
||||
return _repository.loadOfflinePlayerStats(playerName);
|
||||
@ -185,4 +171,16 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
addCommand(new TimeCommand(this));
|
||||
addCommand(new GiveStatCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
Set(playerName, _repository.loadClientInformation(resultSet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(String uuid, String name)
|
||||
{
|
||||
return "SELECT stats.name, value FROM accountStats INNER JOIN stats ON stats.id = accountStats.statId INNER JOIN accounts ON accountStats.accountId = accounts.id WHERE accounts.uuid = '" + uuid + "';";
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package mineplex.core.stats;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@ -14,17 +13,12 @@ import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.AccountStatsRecord;
|
||||
import mineplex.database.tables.records.StatsRecord;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Insert;
|
||||
import org.jooq.InsertQuery;
|
||||
import org.jooq.Query;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.Record2;
|
||||
import org.jooq.Result;
|
||||
import org.jooq.Update;
|
||||
import org.jooq.UpdateQuery;
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
public class StatsRepository extends RepositoryBase
|
||||
@ -32,7 +26,6 @@ public class StatsRepository extends RepositoryBase
|
||||
private static String CREATE_STAT_TABLE = "CREATE TABLE IF NOT EXISTS stats (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX nameIndex (name));";
|
||||
private static String CREATE_STAT_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountStats (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, statId INT NOT NULL, value INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (statId) REFERENCES stats(id), UNIQUE INDEX accountStatIndex (accountId, statId));";
|
||||
|
||||
private static String RETRIEVE_PLAYER_STATS = "SELECT stats.name, value FROM accountStats INNER JOIN stats ON stats.id = accountStats.statId INNER JOIN accounts ON accountStats.accountId = accounts.id WHERE accounts.uuid = ?;";
|
||||
private static String RETRIEVE_STATS = "SELECT id, name FROM stats;";
|
||||
private static String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);";
|
||||
|
||||
@ -81,10 +74,9 @@ public class StatsRepository extends RepositoryBase
|
||||
executeUpdate(INSERT_STAT, new ColumnVarChar("name", 100, name));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void saveStats(NautHashMap<String, NautHashMap<Integer, Integer>> uploadQueue)
|
||||
{
|
||||
System.out.println("saving stats.");
|
||||
|
||||
try
|
||||
{
|
||||
DSLContext context = DSL.using(getConnection());
|
||||
@ -96,8 +88,6 @@ public class StatsRepository extends RepositoryBase
|
||||
{
|
||||
for (Integer statId : uploadQueue.get(uuid).keySet())
|
||||
{
|
||||
System.out.println("saving stat : uuid=" + uuid + " " + statId + "=" + uploadQueue.get(uuid).get(statId));
|
||||
|
||||
Update update = context
|
||||
.update(Tables.accountStats)
|
||||
.set(Tables.accountStats.value, Tables.accountStats.value.plus(uploadQueue.get(uuid).get(statId)))
|
||||
@ -166,20 +156,14 @@ public class StatsRepository extends RepositoryBase
|
||||
return playerStats;
|
||||
}
|
||||
|
||||
public PlayerStats loadClientInformation(String uuid)
|
||||
public PlayerStats loadClientInformation(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
final PlayerStats playerStats = new PlayerStats();
|
||||
|
||||
executeQuery(RETRIEVE_PLAYER_STATS, new ResultSetCallable()
|
||||
while (resultSet.next())
|
||||
{
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
playerStats.addStat(resultSet.getString(1), resultSet.getInt(2));
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid));
|
||||
playerStats.addStat(resultSet.getString(1), resultSet.getInt(2));
|
||||
}
|
||||
|
||||
return playerStats;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.task.repository.TaskRepository;
|
||||
import mineplex.core.task.repository.TaskToken;
|
||||
|
||||
@ -52,9 +51,4 @@ public class TaskManager extends MiniClientPlugin<TaskClient>
|
||||
|
||||
_repository.AddTask(client.Name, taskName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
StatsManager statsManager = new StatsManager(this);
|
||||
StatsManager statsManager = new StatsManager(this, clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
|
||||
HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager);
|
||||
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this), partyManager);
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
|
||||
|
||||
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
|
||||
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
|
||||
|
@ -42,9 +42,8 @@ import org.bukkit.scoreboard.Scoreboard;
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.benefit.RankBenefitsGiver9000;
|
||||
import mineplex.core.benefit.BenefitManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -170,8 +169,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_news = new NewsManager(this);
|
||||
|
||||
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
|
||||
_inventoryManager = new InventoryManager(plugin);
|
||||
new RankBenefitsGiver9000(plugin, clientManager, _inventoryManager);
|
||||
_inventoryManager = new InventoryManager(plugin, clientManager);
|
||||
new BenefitManager(plugin, clientManager, _inventoryManager);
|
||||
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
|
||||
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager, petManager, _blockRestore);
|
||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, false, _treasureManager);
|
||||
@ -960,12 +959,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
return _news;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ignoreVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
|
@ -13,6 +13,8 @@ public class PlayerPollData
|
||||
private NautHashMap<Integer, Integer> _pollAnswers;
|
||||
private long _nextPollTime;
|
||||
|
||||
public boolean Loaded;
|
||||
|
||||
public PlayerPollData()
|
||||
{
|
||||
_pollAnswers = new NautHashMap<Integer, Integer>();
|
||||
@ -40,7 +42,7 @@ public class PlayerPollData
|
||||
|
||||
public boolean shouldPoll()
|
||||
{
|
||||
return System.currentTimeMillis() > _nextPollTime;
|
||||
return Loaded && System.currentTimeMillis() > _nextPollTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutChat;
|
||||
import net.minecraft.util.com.google.gson.JsonObject;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -24,9 +23,6 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.poll.command.PollCommand;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/16/2014.
|
||||
*/
|
||||
public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
{
|
||||
private PollRepository _repository;
|
||||
@ -57,17 +53,14 @@ public class PollManager extends MiniClientPlugin<PlayerPollData>
|
||||
return new PlayerPollData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(final RetrieveClientInformationEvent event)
|
||||
public void loadClientInformation(final PlayerJoinEvent event)
|
||||
{
|
||||
event.incrementProcessingCount();
|
||||
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Set(event.getPlayerName(), _repository.loadPollData(event.getUniqueId()));
|
||||
event.decreaseProcessingCount();
|
||||
Set(event.getPlayer().getName(), _repository.loadPollData(event.getPlayer().getUniqueId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -89,6 +89,8 @@ public class PollRepository extends RepositoryBase
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
|
||||
pollData.Loaded = true;
|
||||
|
||||
return pollData;
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,10 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTok
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.account.event.RetrieveClientInformationEvent;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -309,9 +307,4 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadClientInformation(RetrieveClientInformationEvent event)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class ServerCommandManager
|
||||
*/
|
||||
private void initialize()
|
||||
{
|
||||
/* CAUSING STUTTER LAG IN HUBS
|
||||
final Jedis jedis = _jedisPool.getResource();
|
||||
|
||||
// Spin up a new thread and subscribe to the Redis pubsub network
|
||||
@ -67,30 +68,37 @@ public class ServerCommandManager
|
||||
});
|
||||
|
||||
thread.start();
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish a {@link ServerCommand} across the network to all live servers.
|
||||
* @param serverCommand - the {@link ServerCommand} to issue to all servers.
|
||||
*/
|
||||
public void publishCommand(ServerCommand serverCommand)
|
||||
public void publishCommand(final ServerCommand serverCommand)
|
||||
{
|
||||
Jedis jedis = _jedisPool.getResource();
|
||||
|
||||
try
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
String commandType = serverCommand.getClass().getSimpleName();
|
||||
String serializedCommand = Utility.serialize(serverCommand);
|
||||
jedis.publish(SERVER_COMMANDS_CHANNEL + ":" + commandType, serializedCommand);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_jedisPool.returnResource(jedis);
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
Jedis jedis = _jedisPool.getResource();
|
||||
|
||||
try
|
||||
{
|
||||
String commandType = serverCommand.getClass().getSimpleName();
|
||||
String serializedCommand = Utility.serialize(serverCommand);
|
||||
jedis.publish(SERVER_COMMANDS_CHANNEL + ":" + commandType, serializedCommand);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_jedisPool.returnResource(jedis);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,7 @@ public class StaffServer extends JavaPlugin
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal);
|
||||
|
||||
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this), new StatsManager(this)));
|
||||
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), new StatsManager(this, clientManager)));
|
||||
new Password(this, serverStatusManager.getCurrentServerName());
|
||||
|
||||
//Updates
|
||||
|
@ -111,7 +111,7 @@ public class Arcade extends JavaPlugin
|
||||
ProjectileManager projectileManager = new ProjectileManager(this);
|
||||
|
||||
//Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this);
|
||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
|
||||
|
@ -219,7 +219,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_projectileManager = projectileManager;
|
||||
|
||||
_statsManager = new StatsManager(plugin);
|
||||
_statsManager = new StatsManager(plugin, clientManager);
|
||||
_taskManager = new TaskManager(plugin, webAddress);
|
||||
_achievementManager = new AchievementManager(_statsManager, clientManager, donationManager);
|
||||
_inventoryManager = inventoryManager;
|
||||
@ -273,7 +273,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory, _achievementManager, clientManager);
|
||||
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress);
|
||||
|
||||
_eloManager = new EloManager(_plugin);
|
||||
_eloManager = new EloManager(_plugin, clientManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user