Create framework for proper test network
This commit is contained in:
parent
e339b0352a
commit
19ac8f0c3b
@ -18,11 +18,18 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class UtilServer
|
public class UtilServer
|
||||||
{
|
{
|
||||||
|
private static boolean TEST_OVERRIDE = false;
|
||||||
|
|
||||||
|
static {
|
||||||
|
TEST_OVERRIDE = new File("TEST_OVERRIDE.dat").exists();
|
||||||
|
}
|
||||||
|
|
||||||
public static Player[] getPlayers()
|
public static Player[] getPlayers()
|
||||||
{
|
{
|
||||||
return getServer().getOnlinePlayers().toArray(new Player[0]);
|
return getServer().getOnlinePlayers().toArray(new Player[0]);
|
||||||
@ -151,7 +158,7 @@ public class UtilServer
|
|||||||
|
|
||||||
public static boolean isTestServer()
|
public static boolean isTestServer()
|
||||||
{
|
{
|
||||||
return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing") || TEST_OVERRIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDevServer()
|
public static boolean isDevServer()
|
||||||
|
7
Plugins/Mineplex.Core/src/mineplex/core/Constants.java
Normal file
7
Plugins/Mineplex.Core/src/mineplex/core/Constants.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package mineplex.core;
|
||||||
|
|
||||||
|
public class Constants
|
||||||
|
{
|
||||||
|
public static final String WEB_ADDRESS = "http://accounts.mineplex.com/";
|
||||||
|
public static final String WEB_CONFIG_KEY = "webServer";
|
||||||
|
}
|
@ -69,17 +69,17 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
|
|
||||||
private final Set<UUID> _reservedSlots = Sets.newConcurrentHashSet();
|
private final Set<UUID> _reservedSlots = Sets.newConcurrentHashSet();
|
||||||
|
|
||||||
public CoreClientManager(JavaPlugin plugin, String webServer)
|
public CoreClientManager(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
this(plugin, webServer, Rank.MODERATOR);
|
this(plugin, Rank.MODERATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass)
|
public CoreClientManager(JavaPlugin plugin, Rank whitelistBypass)
|
||||||
{
|
{
|
||||||
super("Client Manager", plugin);
|
super("Client Manager", plugin);
|
||||||
|
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
_repository = new AccountRepository(plugin, webServer);
|
_repository = new AccountRepository();
|
||||||
WHITELIST_BYPASS = whitelistBypass;
|
WHITELIST_BYPASS = whitelistBypass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.sql.Connection;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -13,22 +12,20 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import org.apache.commons.dbcp2.BasicDataSource;
|
import org.apache.commons.dbcp2.BasicDataSource;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import mineplex.cache.player.PlayerCache;
|
import mineplex.cache.player.PlayerCache;
|
||||||
import mineplex.core.account.ILoginProcessor;
|
import mineplex.core.account.ILoginProcessor;
|
||||||
import mineplex.core.account.repository.token.LoginToken;
|
import mineplex.core.account.repository.token.LoginToken;
|
||||||
import mineplex.core.account.repository.token.RankUpdateToken;
|
import mineplex.core.account.repository.token.RankUpdateToken;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import mineplex.serverdata.database.DatabaseRunnable;
|
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
|
||||||
import mineplex.serverdata.database.column.ColumnTimestamp;
|
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class AccountRepository extends MinecraftRepository
|
public class AccountRepository extends MinecraftRepository
|
||||||
@ -43,13 +40,9 @@ public class AccountRepository extends MinecraftRepository
|
|||||||
private static String SELECT_ACCOUNT_UUID_BY_NAME = "SELECT uuid FROM accounts WHERE name = ? ORDER BY lastLogin DESC;";
|
private static String SELECT_ACCOUNT_UUID_BY_NAME = "SELECT uuid FROM accounts WHERE name = ? ORDER BY lastLogin DESC;";
|
||||||
private static String SELECT_ACCOUNT_ID_BY_UUID = "SELECT id FROM accounts WHERE accounts.uuid = ? LIMIT 1";
|
private static String SELECT_ACCOUNT_ID_BY_UUID = "SELECT id FROM accounts WHERE accounts.uuid = ? LIMIT 1";
|
||||||
|
|
||||||
private String _webAddress;
|
public AccountRepository()
|
||||||
|
|
||||||
public AccountRepository(JavaPlugin plugin, String webAddress)
|
|
||||||
{
|
{
|
||||||
super(DBPool.getAccount());
|
super(DBPool.getAccount());
|
||||||
|
|
||||||
_webAddress = webAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int login(final List<ILoginProcessor> loginProcessors, final UUID uuid, final String name) throws SQLException
|
public int login(final List<ILoginProcessor> loginProcessors, final UUID uuid, final String name) throws SQLException
|
||||||
@ -133,7 +126,8 @@ public class AccountRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void getAccountId(UUID uuid, Callback<Integer> callback)
|
public void getAccountId(UUID uuid, Callback<Integer> callback)
|
||||||
{
|
{
|
||||||
executeQuery(SELECT_ACCOUNT_ID_BY_UUID, resultSet -> {
|
executeQuery(SELECT_ACCOUNT_ID_BY_UUID, resultSet ->
|
||||||
|
{
|
||||||
int accountId = -1;
|
int accountId = -1;
|
||||||
while (resultSet.next()) accountId = resultSet.getInt(1);
|
while (resultSet.next()) accountId = resultSet.getInt(1);
|
||||||
callback.run(accountId);
|
callback.run(accountId);
|
||||||
@ -147,12 +141,12 @@ public class AccountRepository extends MinecraftRepository
|
|||||||
token.Uuid = uuid.toString();
|
token.Uuid = uuid.toString();
|
||||||
token.IpAddress = ipAddress;
|
token.IpAddress = ipAddress;
|
||||||
|
|
||||||
return new JsonWebCall(_webAddress + "PlayerAccount/Login").ExecuteReturnStream(token);
|
return handleSyncMSSQLCallStream("PlayerAccount/Login", token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClientByUUID(UUID uuid)
|
public String getClientByUUID(UUID uuid)
|
||||||
{
|
{
|
||||||
return new JsonWebCall(_webAddress + "PlayerAccount/GetAccountByUUID").ExecuteReturnStream(uuid.toString());
|
return handleSyncMSSQLCallStream("PlayerAccount/GetAccountByUUID", uuid.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getClientUUID(String name)
|
public UUID getClientUUID(String name)
|
||||||
@ -208,14 +202,10 @@ public class AccountRepository extends MinecraftRepository
|
|||||||
executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
|
executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
|
UtilServer.runSync(() ->
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
{
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.run(response);
|
callback.run(response);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -224,20 +214,11 @@ public class AccountRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void matchPlayerName(final Callback<List<String>> callback, final String userName)
|
public void matchPlayerName(final Callback<List<String>> callback, final String userName)
|
||||||
{
|
{
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
handleMSSQLCall("PlayerAccount/GetMatches", userName, new TypeToken<List<String>>(){}.getType(), callback::run);
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
List<String> tokenList = new JsonWebCall(_webAddress + "PlayerAccount/GetMatches").Execute(new TypeToken<List<String>>(){}.getType(), userName);
|
|
||||||
callback.run(tokenList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncThread.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClientByName(String playerName)
|
public String getClientByName(String playerName)
|
||||||
{
|
{
|
||||||
return new JsonWebCall(_webAddress + "PlayerAccount/GetAccount").ExecuteReturnStream(playerName);
|
return handleSyncMSSQLCallStream("PlayerAccount/GetAccount", playerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,12 @@ package mineplex.core.antihack.banwave;
|
|||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnLong;
|
import mineplex.serverdata.database.column.ColumnLong;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class BanWaveRepository extends MinecraftRepository
|
public class BanWaveRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String INITIALIZE_PENDING_TABLE = "CREATE TABLE IF NOT EXISTS banwavePending (" +
|
private static final String INITIALIZE_PENDING_TABLE = "CREATE TABLE IF NOT EXISTS banwavePending (" +
|
||||||
"accountId INT(11) NOT NULL, " +
|
"accountId INT(11) NOT NULL, " +
|
||||||
|
@ -6,8 +6,9 @@ import java.sql.SQLException;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
|
|
||||||
public class AnticheatDatabase extends MinecraftRepository
|
public class AnticheatDatabase extends RepositoryBase
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
CREATE TABLE IF NOT EXISTS anticheat_ban_metadata (id INT NOT NULL AUTO_INCREMENT, accountId INT, banId CHAR(10) NOT NULL, data MEDIUMTEXT NOT NULL, PRIMARY KEY(id));
|
CREATE TABLE IF NOT EXISTS anticheat_ban_metadata (id INT NOT NULL AUTO_INCREMENT, accountId INT, banId CHAR(10) NOT NULL, data MEDIUMTEXT NOT NULL, PRIMARY KEY(id));
|
||||||
|
@ -5,12 +5,13 @@ import java.sql.SQLException;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class BenefitManagerRepository extends MinecraftRepository
|
public class BenefitManagerRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import mineplex.core.common.Pair;
|
|||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
@ -28,7 +29,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class BonusRepository extends MinecraftRepository
|
public class BonusRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
||||||
private BonusManager _manager;
|
private BonusManager _manager;
|
||||||
|
@ -3,13 +3,14 @@ package mineplex.core.boosters.tips;
|
|||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.database.routines.CheckAmplifierThank;
|
import mineplex.database.routines.CheckAmplifierThank;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Shaun Bennett
|
* @author Shaun Bennett
|
||||||
*/
|
*/
|
||||||
public class BoosterThankRepository extends MinecraftRepository
|
public class BoosterThankRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
public BoosterThankRepository(JavaPlugin plugin)
|
public BoosterThankRepository(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
|
@ -9,11 +9,12 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import mineplex.core.botspam.SpamText;
|
import mineplex.core.botspam.SpamText;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class BotSpamRepository extends MinecraftRepository
|
public class BotSpamRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String GET_SPAM_TEXT = "SELECT * FROM botSpam";
|
private static final String GET_SPAM_TEXT = "SELECT * FROM botSpam";
|
||||||
private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text, createdBy, enabledBy) VALUES (?, ?, ?)";
|
private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text, createdBy, enabledBy) VALUES (?, ?, ?)";
|
||||||
|
@ -23,11 +23,12 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import mineplex.serverdata.data.DataRepository;
|
import mineplex.serverdata.data.DataRepository;
|
||||||
import mineplex.serverdata.data.PlayerStatus;
|
import mineplex.serverdata.data.PlayerStatus;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class CommunityRepository extends MinecraftRepository
|
public class CommunityRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String GET_ALL_COMMUNITIES = "SELECT * FROM communities WHERE region=?;";
|
private static final String GET_ALL_COMMUNITIES = "SELECT * FROM communities WHERE region=?;";
|
||||||
private static final String GET_COMMUNITY_BY_ID = "SELECT * FROM communities WHERE id=?;";
|
private static final String GET_COMMUNITY_BY_ID = "SELECT * FROM communities WHERE id=?;";
|
||||||
|
@ -14,6 +14,7 @@ import mineplex.core.customdata.CustomData;
|
|||||||
import mineplex.core.customdata.CustomDataManager;
|
import mineplex.core.customdata.CustomDataManager;
|
||||||
import mineplex.core.customdata.PlayerCustomData;
|
import mineplex.core.customdata.PlayerCustomData;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
@ -22,7 +23,7 @@ import mineplex.serverdata.database.column.ColumnVarChar;
|
|||||||
* Created by William (WilliamTiger).
|
* Created by William (WilliamTiger).
|
||||||
* 16/12/15
|
* 16/12/15
|
||||||
*/
|
*/
|
||||||
public class CustomDataRepository extends MinecraftRepository
|
public class CustomDataRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String SELECT_KEYS = "SELECT id, name FROM customData;";
|
private static final String SELECT_KEYS = "SELECT id, name FROM customData;";
|
||||||
private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);";
|
private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);";
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
package mineplex.core.database;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.server.remotecall.JsonWebCall;
|
||||||
|
import mineplex.core.thread.ThreadPool;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.utils.UtilScheduler;
|
||||||
|
import mineplex.serverdata.database.DatabaseRunnable;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public class BasicMSSQLProvider implements MSSQLProvider
|
||||||
|
{
|
||||||
|
private final String _webAddress = UtilServer.getWebServerURL();
|
||||||
|
|
||||||
|
// Queue for failed processes
|
||||||
|
private final Object QUEUE_LOCK = new Object();
|
||||||
|
private Set<DatabaseRunnable> _failedQueue = new HashSet<>();
|
||||||
|
|
||||||
|
private final BukkitTask _task;
|
||||||
|
private volatile boolean _shutdown = false;
|
||||||
|
|
||||||
|
public BasicMSSQLProvider()
|
||||||
|
{
|
||||||
|
_task = UtilScheduler.runEvery(UpdateType.MIN_01, this::processDatabaseQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T handleSyncMSSQLCall(String uri, Object param, Type responseType)
|
||||||
|
{
|
||||||
|
return new JsonWebCall(_webAddress + uri).Execute(responseType, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String handleSyncMSSQLCallStream(String uri, Object param)
|
||||||
|
{
|
||||||
|
return new JsonWebCall(_webAddress + uri).ExecuteReturnStream(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void handleMSSQLCall(String uri, String error, Object param, Class<T> responseType, Consumer<T> consumer)
|
||||||
|
{
|
||||||
|
handleDatabaseCall(new DatabaseRunnable(() ->
|
||||||
|
{
|
||||||
|
new JsonWebCall(_webAddress + uri).Execute(responseType, consumer::accept, param);
|
||||||
|
}, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void handleMSSQLCall(String uri, Object param, Class<T> responseType, Consumer<T> consumer)
|
||||||
|
{
|
||||||
|
handleDatabaseCall(new DatabaseRunnable(() ->
|
||||||
|
{
|
||||||
|
new JsonWebCall(_webAddress + uri).Execute(responseType, consumer::accept, param);
|
||||||
|
}, "Handling MSSQL Call " + uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void handleMSSQLCall(String uri, Object param, Type responseType, Consumer<T> consumer)
|
||||||
|
{
|
||||||
|
handleDatabaseCall(new DatabaseRunnable(() ->
|
||||||
|
{
|
||||||
|
T t = new JsonWebCall(_webAddress + uri).Execute(responseType, param);
|
||||||
|
consumer.accept(t);
|
||||||
|
}, "Handling MSSQL Call " + uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void handleMSSQLCall(String uri, Object param)
|
||||||
|
{
|
||||||
|
handleDatabaseCall(new DatabaseRunnable(() ->
|
||||||
|
{
|
||||||
|
new JsonWebCall(_webAddress + uri).Execute(param);
|
||||||
|
}, "Handling MSSQL Call " + uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deregister()
|
||||||
|
{
|
||||||
|
_shutdown = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleDatabaseCall(DatabaseRunnable databaseRunnable)
|
||||||
|
{
|
||||||
|
ThreadPool.ASYNC.submit(() ->
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
databaseRunnable.run();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
processFailedDatabaseCall(databaseRunnable, exception);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processFailedDatabaseCall(DatabaseRunnable databaseRunnable, Exception exception)
|
||||||
|
{
|
||||||
|
System.err.println(databaseRunnable.getErrorMessage());
|
||||||
|
exception.printStackTrace();
|
||||||
|
|
||||||
|
if (databaseRunnable.getFailedCounts() < 4)
|
||||||
|
{
|
||||||
|
databaseRunnable.incrementFailCount();
|
||||||
|
|
||||||
|
synchronized (QUEUE_LOCK)
|
||||||
|
{
|
||||||
|
_failedQueue.add(databaseRunnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processDatabaseQueue()
|
||||||
|
{
|
||||||
|
Set<DatabaseRunnable> clone;
|
||||||
|
|
||||||
|
synchronized (QUEUE_LOCK)
|
||||||
|
{
|
||||||
|
clone = new HashSet<>(_failedQueue);
|
||||||
|
_failedQueue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
clone.forEach(this::handleDatabaseCall);
|
||||||
|
|
||||||
|
if (_shutdown && _failedQueue.isEmpty())
|
||||||
|
{
|
||||||
|
_task.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package mineplex.core.database;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public interface MSSQLProvider
|
||||||
|
{
|
||||||
|
<T> T handleSyncMSSQLCall(String uri, Object param, Type responseType);
|
||||||
|
|
||||||
|
String handleSyncMSSQLCallStream(String uri, Object param);
|
||||||
|
|
||||||
|
<T> void handleMSSQLCall(String uri, String error, Object param, Class<T> responseType, Consumer<T> consumer);
|
||||||
|
|
||||||
|
<T> void handleMSSQLCall(String uri, Object param, Class<T> responseType, Consumer<T> consumer);
|
||||||
|
|
||||||
|
<T> void handleMSSQLCall(String uri, Object param, Type responseType, Consumer<T> consumer);
|
||||||
|
|
||||||
|
<T> void handleMSSQLCall(String uri, Object param);
|
||||||
|
|
||||||
|
void deregister();
|
||||||
|
}
|
@ -1,136 +1,69 @@
|
|||||||
package mineplex.core.database;
|
package mineplex.core.database;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import javax.sql.DataSource;
|
||||||
import java.util.Set;
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.rmi.CORBA.Util;
|
import org.bukkit.event.Listener;
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
import mineplex.core.thread.ThreadPool;
|
|
||||||
import mineplex.core.utils.UtilScheduler;
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
|
||||||
import mineplex.serverdata.database.DatabaseRunnable;
|
|
||||||
import mineplex.serverdata.database.RepositoryBase;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
|
|
||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
import org.jooq.SQLDialect;
|
import org.jooq.SQLDialect;
|
||||||
import org.jooq.impl.DSL;
|
import org.jooq.impl.DSL;
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
public abstract class MinecraftRepository extends RepositoryBase implements Listener
|
|
||||||
{
|
|
||||||
// Queue for failed processes
|
|
||||||
private final Object QUEUE_LOCK = new Object();
|
|
||||||
private Set<DatabaseRunnable> _failedQueue = new HashSet<>();
|
|
||||||
|
|
||||||
protected JavaPlugin _plugin; // Plugin responsible for this repository
|
|
||||||
|
|
||||||
private final String _webAddress = UtilServer.getWebServerURL();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Do not extend this class unless you are doing MSSQL calls (which you shouldn't be)
|
||||||
*
|
*
|
||||||
* @param dataSource - the {@link DataSource} responsible for providing the connection pool to this repository.
|
* @deprecated don't use mssql thx
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public abstract class MinecraftRepository extends RepositoryBase implements Listener
|
||||||
|
{
|
||||||
|
private static AtomicReference<MSSQLProvider> PROVIDER = new AtomicReference<>(new BasicMSSQLProvider());
|
||||||
|
|
||||||
|
public static void setMSSQLProvider(MSSQLProvider provider)
|
||||||
|
{
|
||||||
|
MSSQLProvider oldProvider = PROVIDER.getAndSet(provider);
|
||||||
|
oldProvider.deregister();
|
||||||
|
}
|
||||||
|
|
||||||
public MinecraftRepository(DataSource dataSource)
|
public MinecraftRepository(DataSource dataSource)
|
||||||
{
|
{
|
||||||
super(dataSource);
|
super(dataSource);
|
||||||
|
|
||||||
_plugin = UtilServer.getPlugin();
|
|
||||||
|
|
||||||
UtilServer.RegisterEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
|
|
||||||
UtilScheduler.runEvery(UpdateType.MIN_01, this::processDatabaseQueue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DSLContext jooq()
|
protected <T> T handleSyncMSSQLCall(String uri, Object param, Type responseType)
|
||||||
{
|
{
|
||||||
return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
return PROVIDER.get().handleSyncMSSQLCall(uri, param, responseType);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String handleSyncMSSQLCallStream(String uri, Object param)
|
||||||
|
{
|
||||||
|
return PROVIDER.get().handleSyncMSSQLCallStream(uri, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* One day, the stars will align, and we can get rid of this
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected <T> void handleMSSQLCall(String uri, String error, Object param, Class<T> responseType, Consumer<T> consumer)
|
protected <T> void handleMSSQLCall(String uri, String error, Object param, Class<T> responseType, Consumer<T> consumer)
|
||||||
{
|
{
|
||||||
handleDatabaseCall(new DatabaseRunnable(() ->
|
PROVIDER.get().handleMSSQLCall(uri, error, param, responseType, consumer);
|
||||||
{
|
|
||||||
new JsonWebCall(_webAddress + uri).Execute(responseType, consumer::accept, param);
|
|
||||||
}, error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected <T> void handleMSSQLCall(String uri, Object param, Class<T> responseType, Consumer<T> consumer)
|
||||||
* One day, the stars will align, and we can get rid of this
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected <T> void handleAsyncMSSQLCall(String uri, Object param, Class<T> responseType, Consumer<T> consumer)
|
|
||||||
{
|
{
|
||||||
new AsyncJsonWebCall(_webAddress + uri).Execute(responseType, consumer::accept, param);
|
PROVIDER.get().handleMSSQLCall(uri, param, responseType, consumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void handleMSSQLCall(String uri, Object param, Type responseType, Consumer<T> consumer)
|
||||||
|
{
|
||||||
|
PROVIDER.get().handleMSSQLCall(uri, param, responseType, consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* One day, the stars will align, and we can get rid of this
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
protected <T> void handleAsyncMSSQLCall(String uri, Object param)
|
protected <T> void handleAsyncMSSQLCall(String uri, Object param)
|
||||||
{
|
{
|
||||||
new AsyncJsonWebCall(_webAddress + uri).Execute(param);
|
PROVIDER.get().handleMSSQLCall(uri, param);
|
||||||
}
|
|
||||||
|
|
||||||
private void handleDatabaseCall(DatabaseRunnable databaseRunnable)
|
|
||||||
{
|
|
||||||
ThreadPool.ASYNC.submit(() ->
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
databaseRunnable.run();
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
processFailedDatabaseCall(databaseRunnable, exception);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processFailedDatabaseCall(DatabaseRunnable databaseRunnable, Exception exception)
|
|
||||||
{
|
|
||||||
System.err.println(databaseRunnable.getErrorMessage());
|
|
||||||
exception.printStackTrace();
|
|
||||||
|
|
||||||
if (databaseRunnable.getFailedCounts() < 4)
|
|
||||||
{
|
|
||||||
databaseRunnable.incrementFailCount();
|
|
||||||
|
|
||||||
synchronized (QUEUE_LOCK)
|
|
||||||
{
|
|
||||||
_failedQueue.add(databaseRunnable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processDatabaseQueue()
|
|
||||||
{
|
|
||||||
Set<DatabaseRunnable> clone;
|
|
||||||
|
|
||||||
synchronized (QUEUE_LOCK)
|
|
||||||
{
|
|
||||||
clone = new HashSet<>(_failedQueue);
|
|
||||||
_failedQueue.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
clone.forEach(this::handleDatabaseCall);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JavaPlugin getPlugin()
|
|
||||||
{
|
|
||||||
return _plugin;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,8 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import mineplex.core.donation.repository.token.GemRewardToken;
|
import mineplex.core.donation.repository.token.GemRewardToken;
|
||||||
import mineplex.core.donation.repository.token.PurchaseToken;
|
import mineplex.core.donation.repository.token.PurchaseToken;
|
||||||
import mineplex.core.donation.repository.token.UnknownPurchaseToken;
|
import mineplex.core.donation.repository.token.UnknownPurchaseToken;
|
||||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
import mineplex.core.server.util.TransactionResponse;
|
import mineplex.core.server.util.TransactionResponse;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import mineplex.serverdata.database.DatabaseRunnable;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class DonationRepository extends MinecraftRepository
|
public class DonationRepository extends MinecraftRepository
|
||||||
{
|
{
|
||||||
|
@ -9,10 +9,12 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnLong;
|
import mineplex.serverdata.database.column.ColumnLong;
|
||||||
|
|
||||||
@ -22,7 +24,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
public class EloRepository extends MinecraftRepository
|
public class EloRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private static String INSERT_ELO = "INSERT INTO eloRating (accountId, gameType, elo) VALUES (?, ?, ?);";
|
private static String INSERT_ELO = "INSERT INTO eloRating (accountId, gameType, elo) VALUES (?, ?, ?);";
|
||||||
@ -43,7 +45,7 @@ public class EloRepository extends MinecraftRepository
|
|||||||
public boolean saveElo(int accountId, int gameType, int oldElo, int elo) throws SQLException
|
public boolean saveElo(int accountId, int gameType, int oldElo, int elo) throws SQLException
|
||||||
{
|
{
|
||||||
List<Boolean> ret = Lists.newArrayList();
|
List<Boolean> ret = Lists.newArrayList();
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> {
|
UtilServer.runAsync(() -> {
|
||||||
boolean updateSucceeded = false;
|
boolean updateSucceeded = false;
|
||||||
|
|
||||||
// If we're increasing in elo we verify the server version matches the database version (prevent d/c and double wins with concurrent matches)
|
// If we're increasing in elo we verify the server version matches the database version (prevent d/c and double wins with concurrent matches)
|
||||||
@ -86,7 +88,7 @@ public class EloRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void getStrikeExpiry(int accountId, Callback<Long> call)
|
public void getStrikeExpiry(int accountId, Callback<Long> call)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_STRIKE_EXPIRY, resultSet -> {
|
UtilServer.runAsync(() -> executeQuery(GRAB_STRIKE_EXPIRY, resultSet -> {
|
||||||
boolean called = false;
|
boolean called = false;
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
@ -103,7 +105,7 @@ public class EloRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void getBanExpiryAsync(int accountId, Callback<Long> call)
|
public void getBanExpiryAsync(int accountId, Callback<Long> call)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_BAN_EXPIRY, resultSet -> {
|
UtilServer.runAsync(() -> executeQuery(GRAB_BAN_EXPIRY, resultSet -> {
|
||||||
boolean called = false;
|
boolean called = false;
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
@ -136,7 +138,7 @@ public class EloRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void getStrikes(int accountId, Callback<Integer> call)
|
public void getStrikes(int accountId, Callback<Integer> call)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeQuery(GRAB_STRIKES, resultSet -> {
|
UtilServer.runAsync(() -> executeQuery(GRAB_STRIKES, resultSet -> {
|
||||||
boolean called = false;
|
boolean called = false;
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
@ -189,13 +191,13 @@ public class EloRepository extends MinecraftRepository
|
|||||||
long strikesExpire = System.currentTimeMillis() + UtilTime.convert(1, TimeUnit.DAYS, TimeUnit.MILLISECONDS);
|
long strikesExpire = System.currentTimeMillis() + UtilTime.convert(1, TimeUnit.DAYS, TimeUnit.MILLISECONDS);
|
||||||
int newStrikes = Math.min(strikes + 1, 8);
|
int newStrikes = Math.min(strikes + 1, 8);
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeUpdate(UPDATE_BAN, new ColumnInt("accountId", accountId), new ColumnInt("strikes", newStrikes), new ColumnLong("strikesExpire", strikesExpire), new ColumnLong("banEnd", banEnd)));
|
UtilServer.runAsync(() -> executeUpdate(UPDATE_BAN, new ColumnInt("accountId", accountId), new ColumnInt("strikes", newStrikes), new ColumnLong("strikesExpire", strikesExpire), new ColumnLong("banEnd", banEnd)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetStrikes(int accountId)
|
public void resetStrikes(int accountId)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> executeUpdate(DELETE_STRIKES, new ColumnInt("accountId", accountId)));
|
UtilServer.runAsync(() -> executeUpdate(DELETE_STRIKES, new ColumnInt("accountId", accountId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getTopElo(int limit, Callback<List<TopEloData>> callback)
|
public void getTopElo(int limit, Callback<List<TopEloData>> callback)
|
||||||
@ -255,6 +257,6 @@ public class EloRepository extends MinecraftRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(_plugin);
|
}.runTaskAsynchronously(UtilServer.getPlugin());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,11 +8,12 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class FacebookRepository extends MinecraftRepository
|
public class FacebookRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String GET_CODE = "SELECT code, activated FROM facebook WHERE code = ?";
|
private static final String GET_CODE = "SELECT code, activated FROM facebook WHERE code = ?";
|
||||||
private static final String ACTIVATE_CODE = "UPDATE facebook SET activated = 1, accountId = ?, activationTime = NOW() WHERE code = ?";
|
private static final String ACTIVATE_CODE = "UPDATE facebook SET activated = 1, accountId = ?, activationTime = NOW() WHERE code = ?";
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
import mineplex.core.friend.FriendStatusType;
|
import mineplex.core.friend.FriendStatusType;
|
||||||
@ -24,7 +25,7 @@ import mineplex.serverdata.data.PlayerStatus;
|
|||||||
import mineplex.serverdata.redis.RedisDataRepository;
|
import mineplex.serverdata.redis.RedisDataRepository;
|
||||||
import mineplex.serverdata.servers.ServerManager;
|
import mineplex.serverdata.servers.ServerManager;
|
||||||
|
|
||||||
public class FriendRepository extends MinecraftRepository
|
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 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, tA.lastLogin, now(), uuidTarget FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN ";
|
private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now(), uuidTarget FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN ";
|
||||||
|
@ -12,12 +12,13 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
import mineplex.serverdata.Region;
|
import mineplex.serverdata.Region;
|
||||||
|
|
||||||
public class GiveawayRepository extends MinecraftRepository
|
public class GiveawayRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String INSERT_GIVEAWAY = "INSERT INTO Account.accountGiveaway (giveawayId, accountId, cooldownId, region, serverName, time, uuid) VALUES (?, ?, ?, ?, ?, now(), ?)";
|
private static final String INSERT_GIVEAWAY = "INSERT INTO Account.accountGiveaway (giveawayId, accountId, cooldownId, region, serverName, time, uuid) VALUES (?, ?, ?, ?, ?, now(), ?)";
|
||||||
private static final String LOAD_GIVEAWAY = "SELECT id, name, prettyName, header, message, max, notifyNetwork, notifyCooldown, canWinTwice FROM Account.giveaway WHERE enabled = TRUE";
|
private static final String LOAD_GIVEAWAY = "SELECT id, name, prettyName, header, message, max, notifyNetwork, notifyCooldown, canWinTwice FROM Account.giveaway WHERE enabled = TRUE";
|
||||||
|
@ -5,12 +5,13 @@ import java.sql.SQLException;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class IgnoreRepository extends MinecraftRepository
|
public class IgnoreRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String ADD_IGNORE_RECORD = "INSERT INTO accountIgnore (uuidIgnorer, uuidIgnored) SELECT fA.uuid AS uuidIgnorer, tA.uuid AS uuidIgnored FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;";
|
private static String ADD_IGNORE_RECORD = "INSERT INTO accountIgnore (uuidIgnorer, uuidIgnored) SELECT fA.uuid AS uuidIgnorer, tA.uuid AS uuidIgnored FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;";
|
||||||
private static String DELETE_IGNORE_RECORD = "DELETE aF FROM accountIgnore AS aF INNER JOIN accounts as fA ON aF.uuidIgnorer = fA.uuid INNER JOIN accounts AS tA ON aF.uuidIgnored = tA.uuid WHERE fA.name = ? AND tA.name = ?;";
|
private static String DELETE_IGNORE_RECORD = "DELETE aF FROM accountIgnore AS aF INNER JOIN accounts as fA ON aF.uuidIgnorer = fA.uuid INNER JOIN accounts AS tA ON aF.uuidIgnored = tA.uuid WHERE fA.name = ? AND tA.name = ?;";
|
||||||
|
@ -3,9 +3,10 @@ package mineplex.core.incognito.repository;
|
|||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.core.incognito.IncognitoManager;
|
import mineplex.core.incognito.IncognitoManager;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
|
|
||||||
public class IncognitoRepository extends MinecraftRepository
|
public class IncognitoRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, status TINYINT(1) DEFAULT '0', PRIMARY KEY (accountId));";
|
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, status TINYINT(1) DEFAULT '0', PRIMARY KEY (accountId));";
|
||||||
private static final String INSERT_STATUS = "INSERT INTO incognitoStaff (accountId, status) VALUES (?, ?);";
|
private static final String INSERT_STATUS = "INSERT INTO incognitoStaff (accountId, status) VALUES (?, ?);";
|
||||||
|
@ -10,13 +10,14 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
import mineplex.core.inventory.ClientInventory;
|
import mineplex.core.inventory.ClientInventory;
|
||||||
import mineplex.core.inventory.ClientItem;
|
import mineplex.core.inventory.ClientItem;
|
||||||
|
|
||||||
public class InventoryRepository extends MinecraftRepository
|
public class InventoryRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));";
|
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));";
|
||||||
private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));";
|
private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));";
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.core.leaderboard;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
* @author MrTwiggy
|
* @author MrTwiggy
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class StatEventsRepository extends MinecraftRepository
|
public class StatEventsRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
|
|
||||||
// Insert or update stat events query
|
// Insert or update stat events query
|
||||||
|
@ -101,13 +101,13 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
|||||||
private ShapeWings _wingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
|
private ShapeWings _wingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
|
||||||
|
|
||||||
public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager
|
public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager
|
||||||
, InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress)
|
, InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore)
|
||||||
{
|
{
|
||||||
super("Pet Manager", plugin);
|
super("Pet Manager", plugin);
|
||||||
|
|
||||||
_creatureModule = creatureModule;
|
_creatureModule = creatureModule;
|
||||||
_disguiseManager = disguiseManager;
|
_disguiseManager = disguiseManager;
|
||||||
_repository = new PetRepository(plugin, webAddress);
|
_repository = new PetRepository();
|
||||||
_blockRestore = restore;
|
_blockRestore = restore;
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
|
@ -1,46 +1,23 @@
|
|||||||
package mineplex.core.pet.repository;
|
package mineplex.core.pet.repository;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.core.pet.repository.token.PetChangeToken;
|
import mineplex.core.pet.repository.token.PetChangeToken;
|
||||||
import mineplex.core.pet.repository.token.PetExtraToken;
|
|
||||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
|
||||||
public class PetRepository extends MinecraftRepository
|
public class PetRepository extends MinecraftRepository
|
||||||
{
|
{
|
||||||
private String _webAddress;
|
public PetRepository()
|
||||||
|
|
||||||
public PetRepository(JavaPlugin plugin, String webAddress)
|
|
||||||
{
|
{
|
||||||
super(DBPool.getAccount());
|
super(DBPool.getAccount());
|
||||||
|
|
||||||
_webAddress = webAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPet(final PetChangeToken token)
|
public void AddPet(final PetChangeToken token)
|
||||||
{
|
{
|
||||||
new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token);
|
handleAsyncMSSQLCall("Pets/AddPet", token);
|
||||||
}
|
|
||||||
|
|
||||||
public void RemovePet(final PetChangeToken token)
|
|
||||||
{
|
|
||||||
new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PetExtraToken> GetPetExtras(List<PetExtraToken> petExtraTokens)
|
|
||||||
{
|
|
||||||
return new JsonWebCall(_webAddress + "Pets/GetPetExtras").Execute(new TypeToken<List<PetExtraToken>>(){}.getType(), petExtraTokens);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePet(final PetChangeToken token)
|
public void UpdatePet(final PetChangeToken token)
|
||||||
{
|
{
|
||||||
new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token);
|
handleAsyncMSSQLCall("Pets/UpdatePet", token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
@ -17,7 +18,7 @@ import mineplex.serverdata.database.column.ColumnVarChar;
|
|||||||
/**
|
/**
|
||||||
* Created by Shaun on 8/16/2014.
|
* Created by Shaun on 8/16/2014.
|
||||||
*/
|
*/
|
||||||
public class PollRepository extends MinecraftRepository
|
public class PollRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_POLL_TABLE = "CREATE TABLE IF NOT EXISTS polls (id INT NOT NULL AUTO_INCREMENT, enabled BIT(1), question VARCHAR(256) NOT NULL, answerA VARCHAR(256) NOT NULL, answerB VARCHAR(256), answerC VARCHAR(256), answerD VARCHAR(256), coinReward INT NOT NULL, displayType INT DEFAULT 0 NOT NULL, PRIMARY KEY (id));";
|
private static String CREATE_POLL_TABLE = "CREATE TABLE IF NOT EXISTS polls (id INT NOT NULL AUTO_INCREMENT, enabled BIT(1), question VARCHAR(256) NOT NULL, answerA VARCHAR(256) NOT NULL, answerB VARCHAR(256), answerC VARCHAR(256), answerD VARCHAR(256), coinReward INT NOT NULL, displayType INT DEFAULT 0 NOT NULL, PRIMARY KEY (id));";
|
||||||
private static String CREATE_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountPolls (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, pollId INT NOT NULL, value TINYINT(1) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (pollId) REFERENCES polls(id), UNIQUE INDEX accountPollIndex (accountId, pollId));";
|
private static String CREATE_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountPolls (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, pollId INT NOT NULL, value TINYINT(1) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (pollId) REFERENCES polls(id), UNIQUE INDEX accountPollIndex (accountId, pollId));";
|
||||||
|
@ -3,13 +3,14 @@ package mineplex.core.preferences;
|
|||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.core.progression.util.SQLStatement;
|
import mineplex.core.progression.util.SQLStatement;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class PreferencesRepository extends MinecraftRepository
|
public class PreferencesRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private static String UPSERT_ACCOUNT = "INSERT INTO `preferences` VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE `value`= ?";
|
private static String UPSERT_ACCOUNT = "INSERT INTO `preferences` VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE `value`= ?";
|
||||||
@ -91,7 +92,7 @@ public class PreferencesRepository extends MinecraftRepository
|
|||||||
|
|
||||||
public void async(Runnable runnable)
|
public void async(Runnable runnable)
|
||||||
{
|
{
|
||||||
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), runnable);
|
_manager.runAsync(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package mineplex.core.progression;
|
package mineplex.core.progression;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.core.progression.data.PlayerKit;
|
import mineplex.core.progression.data.PlayerKit;
|
||||||
import mineplex.core.progression.util.SQLStatement;
|
import mineplex.core.progression.util.SQLStatement;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
@ -15,7 +18,7 @@ import java.util.UUID;
|
|||||||
/**
|
/**
|
||||||
* Handles all things database related.
|
* Handles all things database related.
|
||||||
*/
|
*/
|
||||||
public class KitProgressionRepository extends MinecraftRepository
|
public class KitProgressionRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `kitProgression` (" +
|
private final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS `kitProgression` (" +
|
||||||
@ -72,7 +75,7 @@ public class KitProgressionRepository extends MinecraftRepository
|
|||||||
if (effect == -1)
|
if (effect == -1)
|
||||||
{
|
{
|
||||||
//Something went wrong uh oh
|
//Something went wrong uh oh
|
||||||
this.getPlugin().getLogger().severe("Inserting new Kit Data for " + playerKit.getUuid() + " failed!");
|
_kitProgressionManager.getPlugin().getLogger().severe("Inserting new Kit Data for " + playerKit.getUuid() + " failed!");
|
||||||
}
|
}
|
||||||
} catch (SQLException e)
|
} catch (SQLException e)
|
||||||
{
|
{
|
||||||
@ -117,7 +120,7 @@ public class KitProgressionRepository extends MinecraftRepository
|
|||||||
int effect = executeUpdate(statement);
|
int effect = executeUpdate(statement);
|
||||||
if (effect == -1)
|
if (effect == -1)
|
||||||
{
|
{
|
||||||
this.getPlugin().getLogger().severe("Updating default value for" + playerKit.getUuid().toString() + "'s kit failed!");
|
_kitProgressionManager.getPlugin().getLogger().severe("Updating default value for" + playerKit.getUuid().toString() + "'s kit failed!");
|
||||||
}
|
}
|
||||||
} catch (SQLException e)
|
} catch (SQLException e)
|
||||||
{
|
{
|
||||||
@ -236,7 +239,7 @@ public class KitProgressionRepository extends MinecraftRepository
|
|||||||
|
|
||||||
private void async(Runnable runnable)
|
private void async(Runnable runnable)
|
||||||
{
|
{
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(_plugin, runnable);
|
UtilServer.runAsync(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,13 +46,13 @@ public class Punish extends MiniPlugin
|
|||||||
private PunishRepository _repository;
|
private PunishRepository _repository;
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
|
|
||||||
public Punish(JavaPlugin plugin, String webServerAddress, CoreClientManager clientManager)
|
public Punish(JavaPlugin plugin, CoreClientManager clientManager)
|
||||||
{
|
{
|
||||||
super("Punish", plugin);
|
super("Punish", plugin);
|
||||||
|
|
||||||
_punishClients = new HashMap<String, PunishClient>();
|
_punishClients = new HashMap<String, PunishClient>();
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
_repository = new PunishRepository(webServerAddress);
|
_repository = new PunishRepository();
|
||||||
|
|
||||||
ServerCommandManager.getInstance().registerCommandType("PunishCommand", mineplex.serverdata.commands.PunishCommand.class, new PunishmentHandler(this));
|
ServerCommandManager.getInstance().registerCommandType("PunishCommand", mineplex.serverdata.commands.PunishCommand.class, new PunishmentHandler(this));
|
||||||
}
|
}
|
||||||
@ -416,11 +416,6 @@ public class Punish extends MiniPlugin
|
|||||||
}, punishmentId, target, reason, client.getName());
|
}, punishmentId, target, reason, client.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveBan(String name, String reason)
|
|
||||||
{
|
|
||||||
_repository.RemoveBan(name, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CoreClientManager GetClients()
|
public CoreClientManager GetClients()
|
||||||
{
|
{
|
||||||
return _clientManager;
|
return _clientManager;
|
||||||
|
@ -3,20 +3,19 @@ package mineplex.core.punish;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.core.punish.Tokens.PunishClientToken;
|
import mineplex.core.punish.Tokens.PunishClientToken;
|
||||||
import mineplex.core.punish.Tokens.PunishToken;
|
import mineplex.core.punish.Tokens.PunishToken;
|
||||||
import mineplex.core.punish.Tokens.RemovePunishToken;
|
import mineplex.core.punish.Tokens.RemovePunishToken;
|
||||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
|
|
||||||
public class PunishRepository
|
public class PunishRepository extends MinecraftRepository
|
||||||
{
|
{
|
||||||
private String _webAddress;
|
public PunishRepository()
|
||||||
|
|
||||||
public PunishRepository(String webServerAddress)
|
|
||||||
{
|
{
|
||||||
_webAddress = webServerAddress;
|
super(DBPool.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Punish(Callback<String> callback, String target, String category, PunishmentSentence punishment, String reason, double duration, String admin, int severity)
|
public void Punish(Callback<String> callback, String target, String category, PunishmentSentence punishment, String reason, double duration, String admin, int severity)
|
||||||
@ -30,7 +29,7 @@ public class PunishRepository
|
|||||||
token.Admin = admin;
|
token.Admin = admin;
|
||||||
token.Severity = severity;
|
token.Severity = severity;
|
||||||
|
|
||||||
new AsyncJsonWebCall(_webAddress + "PlayerAccount/Punish").Execute(String.class, callback, token);
|
handleMSSQLCall("PlayerAccount/Punish", token, String.class, callback::run);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemovePunishment(Callback<String> callback, int id, String target, String reason, String admin)
|
public void RemovePunishment(Callback<String> callback, int id, String target, String reason, String admin)
|
||||||
@ -41,34 +40,16 @@ public class PunishRepository
|
|||||||
token.Reason = reason;
|
token.Reason = reason;
|
||||||
token.Admin = admin;
|
token.Admin = admin;
|
||||||
|
|
||||||
new AsyncJsonWebCall(_webAddress + "PlayerAccount/RemovePunishment").Execute(String.class, callback, token);
|
handleMSSQLCall("PlayerAccount/RemovePunishment", token, String.class, callback::run);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPunishClient(String target, Callback<PunishClientToken> callback)
|
public void LoadPunishClient(String target, Callback<PunishClientToken> callback)
|
||||||
{
|
{
|
||||||
new AsyncJsonWebCall(_webAddress + "PlayerAccount/GetPunishClient").Execute(PunishClientToken.class, callback, target);
|
handleMSSQLCall("PlayerAccount/GetPunishClient", target, PunishClientToken.class, callback::run);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MatchPlayerName(final Callback<List<String>> callback, final String userName)
|
public void MatchPlayerName(final Callback<List<String>> callback, final String userName)
|
||||||
{
|
{
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
handleMSSQLCall("PlayerAccount/GetMatches", userName, new TypeToken<List<String>>(){}.getType(), callback::run);
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
List<String> tokenList = new JsonWebCall(_webAddress + "PlayerAccount/GetMatches").Execute(new TypeToken<List<String>>(){}.getType(), userName);
|
|
||||||
callback.run(tokenList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveBan(String name, String reason)
|
|
||||||
{
|
|
||||||
RemovePunishToken token = new RemovePunishToken();
|
|
||||||
token.Target = name;
|
|
||||||
token.Reason = reason;
|
|
||||||
|
|
||||||
new JsonWebCall(_webAddress + "PlayerAccount/RemoveBan").Execute(String.class, token);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,11 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.Region;
|
import mineplex.serverdata.Region;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class EternalGiveawayRepository extends MinecraftRepository
|
public class EternalGiveawayRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String ADD_ETERNAL = "INSERT INTO eternalGiveaway (accountId, region, serverName) VALUES (?, ?, ?)";
|
private static final String ADD_ETERNAL = "INSERT INTO eternalGiveaway (accountId, region, serverName) VALUES (?, ?, ?)";
|
||||||
|
|
||||||
|
@ -8,11 +8,12 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
import mineplex.serverdata.Region;
|
import mineplex.serverdata.Region;
|
||||||
|
|
||||||
public class TitanGiveawayRepository extends MinecraftRepository
|
public class TitanGiveawayRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String ADD_TITAN = "INSERT INTO titanGiveaway (accountId, region, serverName) VALUES (?, ?, ?)";
|
private static final String ADD_TITAN = "INSERT INTO titanGiveaway (accountId, region, serverName) VALUES (?, ?, ?)";
|
||||||
|
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
package mineplex.core.server.remotecall;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
|
|
||||||
public class AsyncJsonWebCall extends JsonWebCall
|
|
||||||
{
|
|
||||||
public AsyncJsonWebCall(String url)
|
|
||||||
{
|
|
||||||
super(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Execute()
|
|
||||||
{
|
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
AsyncJsonWebCall.super.Execute();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Execute(final Object argument)
|
|
||||||
{
|
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
AsyncJsonWebCall.super.Execute(argument);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void Execute(final Class<T> callbackClass, final Callback<T> callback)
|
|
||||||
{
|
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
AsyncJsonWebCall.super.Execute(callbackClass, callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void Execute(final Class<T> callbackClass, final Callback<T> callback, final Object argument)
|
|
||||||
{
|
|
||||||
Thread asyncThread = new Thread(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
AsyncJsonWebCall.super.Execute(callbackClass, callback, argument);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
asyncThread.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,10 +9,11 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class SpawnRepository extends MinecraftRepository
|
public class SpawnRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_SPAWN_TABLE = "CREATE TABLE IF NOT EXISTS spawns (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(100), location VARCHAR(100), PRIMARY KEY (id), INDEX serverNameIndex (serverName));";
|
private static String CREATE_SPAWN_TABLE = "CREATE TABLE IF NOT EXISTS spawns (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(100), location VARCHAR(100), PRIMARY KEY (id), INDEX serverNameIndex (serverName));";
|
||||||
private static String RETRIEVE_SPAWNS = "SELECT location FROM spawns WHERE serverName = ?;";
|
private static String RETRIEVE_SPAWNS = "SELECT location FROM spawns WHERE serverName = ?;";
|
||||||
|
@ -18,9 +18,10 @@ import org.jooq.types.ULong;
|
|||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.database.Tables;
|
import mineplex.database.Tables;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class StatsRepository extends MinecraftRepository
|
public class StatsRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String RETRIEVE_STATS = "SELECT id, name FROM stats;";
|
private static final String RETRIEVE_STATS = "SELECT id, name FROM stats;";
|
||||||
private static final String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);";
|
private static final String INSERT_STAT = "INSERT INTO stats (name) VALUES (?);";
|
||||||
|
@ -25,7 +25,7 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
|
|||||||
|
|
||||||
private NautHashMap<String, Integer> _tasks = new NautHashMap<String, Integer>();
|
private NautHashMap<String, Integer> _tasks = new NautHashMap<String, Integer>();
|
||||||
|
|
||||||
public TaskManager(JavaPlugin plugin, CoreClientManager clientManager, String webServerAddress)
|
public TaskManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||||
{
|
{
|
||||||
super("Task Manager", plugin, clientManager);
|
super("Task Manager", plugin, clientManager);
|
||||||
|
|
||||||
|
@ -9,13 +9,14 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
import mineplex.core.task.Task;
|
import mineplex.core.task.Task;
|
||||||
import mineplex.core.task.TaskClient;
|
import mineplex.core.task.TaskClient;
|
||||||
|
|
||||||
public class TaskRepository extends MinecraftRepository
|
public class TaskRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String ADD_ACCOUNT_TASK = "INSERT INTO accountTasks (accountId, taskId) VALUES (?, ?);";
|
private static String ADD_ACCOUNT_TASK = "INSERT INTO accountTasks (accountId, taskId) VALUES (?, ?);";
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class ThankManager extends MiniDbClientPlugin<ThankData>
|
|||||||
|
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
|
|
||||||
_thankRepository = new ThankRepository(plugin);
|
_thankRepository = new ThankRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,16 +4,17 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import mineplex.database.routines.AddThank;
|
import mineplex.database.routines.AddThank;
|
||||||
import mineplex.database.routines.ClaimThank;
|
import mineplex.database.routines.ClaimThank;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class ThankRepository extends MinecraftRepository
|
public class ThankRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String GET_THANK_DATA = "SELECT SUM(thankAmount) FROM accountThankTransactions WHERE receiverId = ? AND claimed = FALSE";
|
private static final String GET_THANK_DATA = "SELECT SUM(thankAmount) FROM accountThankTransactions WHERE receiverId = ? AND claimed = FALSE";
|
||||||
|
|
||||||
public ThankRepository(JavaPlugin plugin)
|
public ThankRepository()
|
||||||
{
|
{
|
||||||
super(DBPool.getAccount());
|
super(DBPool.getAccount());
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,12 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import mineplex.core.tournament.data.Tournament;
|
import mineplex.core.tournament.data.Tournament;
|
||||||
import mineplex.core.tournament.data.TournamentInviteStatus;
|
import mineplex.core.tournament.data.TournamentInviteStatus;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class TournamentRepository extends MinecraftRepository
|
public class TournamentRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String REGISTER_FOR_TOURNAMENT = "INSERT INTO tournamentTeams(accountId, tournamentId, status) VALUES (?, ?, ?);";
|
private static String REGISTER_FOR_TOURNAMENT = "INSERT INTO tournamentTeams(accountId, tournamentId, status) VALUES (?, ?, ?);";
|
||||||
private static String UNREGISTER_FOR_TOURNAMENT = "DELETE FROM TTI FROM tournamentTeamInvites AS TTI INNER JOIN tournamentTeams AS TT ON TT.id = TTI.teamId WHERE TTI.accountId = ? AND TT.tournamentId = ?;";
|
private static String UNREGISTER_FOR_TOURNAMENT = "DELETE FROM TTI FROM tournamentTeamInvites AS TTI INNER JOIN tournamentTeams AS TT ON TT.id = TTI.teamId WHERE TTI.accountId = ? AND TT.tournamentId = ?;";
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
package mineplex.core.utils;
|
package mineplex.core.utils;
|
||||||
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
|
|
||||||
public class UtilScheduler
|
public class UtilScheduler
|
||||||
{
|
{
|
||||||
public static void runEvery(UpdateType speed, Runnable action)
|
public static BukkitTask runEvery(UpdateType speed, Runnable action)
|
||||||
{
|
{
|
||||||
Plugin plugin = UtilServer.getPlugin();
|
Plugin plugin = UtilServer.getPlugin();
|
||||||
plugin.getServer().getScheduler().runTaskTimer(plugin, action, 0, (int) Math.ceil(speed.getMilliseconds() / 50.0));
|
return plugin.getServer().getScheduler().runTaskTimer(plugin, action, 0, (int) Math.ceil(speed.getMilliseconds() / 50.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runAsyncEvery(UpdateType speed, Runnable action)
|
public static BukkitTask runAsyncEvery(UpdateType speed, Runnable action)
|
||||||
{
|
{
|
||||||
Plugin plugin = UtilServer.getPlugin();
|
Plugin plugin = UtilServer.getPlugin();
|
||||||
plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, action, 0, (int) Math.ceil(speed.getMilliseconds() / 50.0));
|
return plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, action, 0, (int) Math.ceil(speed.getMilliseconds() / 50.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,11 @@ package mineplex.core.valentines;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class ValentinesGiftRepository extends MinecraftRepository
|
public class ValentinesGiftRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private String GIVE_GIFT = "INSERT INTO accountValentinesGift (senderId, targetId) VALUES (?, ?);";
|
private String GIVE_GIFT = "INSERT INTO accountValentinesGift (senderId, targetId) VALUES (?, ?);";
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor
|
|||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_inventoryManager = inventoryManager;
|
_inventoryManager = inventoryManager;
|
||||||
_punish = new Punish(plugin, plugin.GetWebServerAddress(), clientManager);
|
_punish = new Punish(plugin, clientManager);
|
||||||
|
|
||||||
_purchaseManager = new PurchaseManager(plugin);
|
_purchaseManager = new PurchaseManager(plugin);
|
||||||
_powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager);
|
_powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.enjinTranslator;
|
package mineplex.enjinTranslator;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.command.CommandCenter;
|
import mineplex.core.command.CommandCenter;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
@ -11,20 +12,18 @@ import static mineplex.core.Managers.require;
|
|||||||
|
|
||||||
public class EnjinTranslator extends JavaPlugin
|
public class EnjinTranslator extends JavaPlugin
|
||||||
{
|
{
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
//Static Modules
|
//Static Modules
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
|
|
||||||
//Core Modules
|
//Core Modules
|
||||||
CoreClientManager clientManager = new CoreClientManager(this, GetWebServerAddress());
|
CoreClientManager clientManager = new CoreClientManager(this);
|
||||||
CommandCenter.Instance.setClientManager(clientManager);
|
CommandCenter.Instance.setClientManager(clientManager);
|
||||||
|
|
||||||
DonationManager donationManager = require(DonationManager.class);
|
DonationManager donationManager = require(DonationManager.class);
|
||||||
@ -37,8 +36,7 @@ public class EnjinTranslator extends JavaPlugin
|
|||||||
|
|
||||||
public String GetWebServerAddress()
|
public String GetWebServerAddress()
|
||||||
{
|
{
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
return webServerAddress;
|
return getConfig().getString(Constants.WEB_CONFIG_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,11 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class TempRepository extends MinecraftRepository
|
public class TempRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) SELECT accounts.id, 5, ? FROM accounts WHERE accounts.name = ? ON DUPLICATE KEY UPDATE count=count + VALUES(count);";
|
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) SELECT accounts.id, 5, ? FROM accounts WHERE accounts.name = ? ON DUPLICATE KEY UPDATE count=count + VALUES(count);";
|
||||||
|
|
||||||
|
@ -9,12 +9,13 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class PurchaseRepository extends MinecraftRepository
|
public class PurchaseRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String INSERT_ACCOUNT_PURCHASE = "INSERT INTO accountPurchases (accountId, packageId, amount, date, success) VALUES (?, ?, ?, now(), ?);";
|
private static String INSERT_ACCOUNT_PURCHASE = "INSERT INTO accountPurchases (accountId, packageId, amount, date, success) VALUES (?, ?, ?, now(), ?);";
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import mineplex.core.common.util.Callback;
|
|||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.Column;
|
import mineplex.serverdata.database.column.Column;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||||
@ -36,7 +37,7 @@ import org.jooq.DSLContext;
|
|||||||
import static mineplex.database.Tables.*;
|
import static mineplex.database.Tables.*;
|
||||||
import static org.jooq.impl.DSL.*;
|
import static org.jooq.impl.DSL.*;
|
||||||
|
|
||||||
public class ClanRepository extends MinecraftRepository
|
public class ClanRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_CLAN_TABLE = "CREATE TABLE IF NOT EXISTS clans (id INT NOT NULL AUTO_INCREMENT, serverId INT NOT NULL, name VARCHAR(100), description VARCHAR(140), home VARCHAR(140), admin BIT(1), dateCreated DATETIME, lastOnline DATETIME, energy INT, PRIMARY KEY (id), INDEX clanName (name));";
|
private static String CREATE_CLAN_TABLE = "CREATE TABLE IF NOT EXISTS clans (id INT NOT NULL AUTO_INCREMENT, serverId INT NOT NULL, name VARCHAR(100), description VARCHAR(140), home VARCHAR(140), admin BIT(1), dateCreated DATETIME, lastOnline DATETIME, energy INT, PRIMARY KEY (id), INDEX clanName (name));";
|
||||||
private static String CREATE_ACCOUNT_CLAN_TABLE = "CREATE TABLE IF NOT EXISTS accountClan (id INT NOT NULL AUTO_INCREMENT, accountId INT, clanId INT, clanRole VARCHAR(140), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId));";
|
private static String CREATE_ACCOUNT_CLAN_TABLE = "CREATE TABLE IF NOT EXISTS accountClan (id INT NOT NULL AUTO_INCREMENT, accountId INT, clanId INT, clanRole VARCHAR(140), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId));";
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.spigotmc.SpigotConfig;
|
import org.spigotmc.SpigotConfig;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.CustomTagFix;
|
import mineplex.core.CustomTagFix;
|
||||||
import mineplex.core.FoodDupeFix;
|
import mineplex.core.FoodDupeFix;
|
||||||
import mineplex.core.TimingsFix;
|
import mineplex.core.TimingsFix;
|
||||||
@ -77,7 +78,6 @@ import static mineplex.core.Managers.require;
|
|||||||
public class Clans extends JavaPlugin
|
public class Clans extends JavaPlugin
|
||||||
{
|
{
|
||||||
public static final String MAP = "Season 2";
|
public static final String MAP = "Season 2";
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
@ -90,17 +90,15 @@ public class Clans extends JavaPlugin
|
|||||||
Bukkit.setSpawnRadius(0);
|
Bukkit.setSpawnRadius(0);
|
||||||
|
|
||||||
// Configs
|
// Configs
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
// Logger.initialize(this);
|
// Logger.initialize(this);
|
||||||
|
|
||||||
// Static Modules
|
// Static Modules
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
_clientManager = new CoreClientManager(this, webServerAddress);
|
_clientManager = new CoreClientManager(this);
|
||||||
CommandCenter.Instance.setClientManager(_clientManager);
|
CommandCenter.Instance.setClientManager(_clientManager);
|
||||||
|
|
||||||
require(TimingsFix.class);
|
require(TimingsFix.class);
|
||||||
@ -137,7 +135,7 @@ public class Clans extends JavaPlugin
|
|||||||
|
|
||||||
ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);
|
ClansBanManager clansBans = new ClansBanManager(this, _clientManager, _donationManager);
|
||||||
|
|
||||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
Punish punish = new Punish(this, _clientManager);
|
||||||
|
|
||||||
DisguiseManager disguiseManager = require(DisguiseManager.class);
|
DisguiseManager disguiseManager = require(DisguiseManager.class);
|
||||||
Creature creature = new Creature(this);
|
Creature creature = new Creature(this);
|
||||||
@ -254,7 +252,7 @@ public class Clans extends JavaPlugin
|
|||||||
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
|
||||||
|
|
||||||
HologramManager hologram = new HologramManager(this, packetHandler);
|
HologramManager hologram = new HologramManager(this, packetHandler);
|
||||||
_clansManager = new ClansManager(this, clansBans, serverStatusManager.getCurrentServerName(), incognito, packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, inventory, webServerAddress);
|
_clansManager = new ClansManager(this, clansBans, serverStatusManager.getCurrentServerName(), incognito, packetHandler, punish, _clientManager, _donationManager, preferenceManager, blockRestore, statsManager, teleport, chat, customGear, hologram, inventory);
|
||||||
new Recipes(this);
|
new Recipes(this);
|
||||||
new Farming(this);
|
new Farming(this);
|
||||||
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
new BuildingShop(_clansManager, _clientManager, _donationManager);
|
||||||
|
@ -252,7 +252,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
|
|
||||||
// Spawn area
|
// Spawn area
|
||||||
|
|
||||||
public ClansManager(JavaPlugin plugin, ClansBanManager clansBans, String serverName, IncognitoManager incognitoManager, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, InventoryManager inventoryManager, String webServerAddress)
|
public ClansManager(JavaPlugin plugin, ClansBanManager clansBans, String serverName, IncognitoManager incognitoManager, PacketHandler packetHandler, Punish punish, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, StatsManager statsManager, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, InventoryManager inventoryManager)
|
||||||
{
|
{
|
||||||
super("Clans Manager", plugin);
|
super("Clans Manager", plugin);
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
|
|
||||||
_worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null);
|
_worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null);
|
||||||
|
|
||||||
_taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
_taskManager = new TaskManager(plugin, _clientManager);
|
||||||
|
|
||||||
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||||
|
|
||||||
@ -341,8 +341,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
itemIgnore.add("Proximity Explosive");
|
itemIgnore.add("Proximity Explosive");
|
||||||
itemIgnore.add("Proximity Zapper");
|
itemIgnore.add("Proximity Zapper");
|
||||||
|
|
||||||
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, _damageManager, energy, fire, _projectileManager, webServerAddress, itemIgnore);
|
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, _damageManager, energy, fire, _projectileManager, itemIgnore);
|
||||||
SkillFactory skillManager = new SkillFactory(plugin, _damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
|
SkillFactory skillManager = new SkillFactory(plugin, _damageManager, this, _combatManager, _condition, _projectileManager, _disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy);
|
||||||
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
||||||
skillManager.removeSkill("Whirlwind Axe");
|
skillManager.removeSkill("Whirlwind Axe");
|
||||||
skillManager.removeSkill("Shield Smash");
|
skillManager.removeSkill("Shield Smash");
|
||||||
@ -380,7 +380,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
});
|
});
|
||||||
|
|
||||||
_worldEvent.setFactory(skillManager);
|
_worldEvent.setFactory(skillManager);
|
||||||
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory);
|
||||||
|
|
||||||
// Register redis based server commands
|
// Register redis based server commands
|
||||||
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
|
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
|
||||||
|
@ -4,6 +4,7 @@ import mineplex.core.Managers;
|
|||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ import java.util.Optional;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
public class ClansBanRepository extends MinecraftRepository
|
public class ClansBanRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String BAN_PLAYER = "INSERT INTO clanBans (uuid, admin, reason, banTime, unbanTime, permanent, removed) VALUES (?, ?, ?, ?, ?, ?, ?);";
|
private static final String BAN_PLAYER = "INSERT INTO clanBans (uuid, admin, reason, banTime, unbanTime, permanent, removed) VALUES (?, ?, ?, ?, ?, ?, ?);";
|
||||||
private static final String REMOVE_BAN = "UPDATE clanBans SET removed = 1 WHERE id = ?;";
|
private static final String REMOVE_BAN = "UPDATE clanBans SET removed = 1 WHERE id = ?;";
|
||||||
|
@ -13,13 +13,14 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database repository class for banners
|
* Database repository class for banners
|
||||||
*/
|
*/
|
||||||
public class BannerRepository extends MinecraftRepository
|
public class BannerRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanBanners (clanId INT NOT NULL,"
|
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanBanners (clanId INT NOT NULL,"
|
||||||
+ "baseColor VARCHAR(15),"
|
+ "baseColor VARCHAR(15),"
|
||||||
|
@ -10,10 +10,11 @@ import mineplex.core.common.util.Callback;
|
|||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
|
import mineplex.game.clans.clans.nameblacklist.ClansBlacklist;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnTimestamp;
|
import mineplex.serverdata.database.column.ColumnTimestamp;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class ClanNameBlacklistRepository extends MinecraftRepository
|
public class ClanNameBlacklistRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanNameBlacklist ("
|
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanNameBlacklist ("
|
||||||
+ "clanName VARCHAR(20) NOT NULL, "
|
+ "clanName VARCHAR(20) NOT NULL, "
|
||||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans.clans.nether;
|
|||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
@ -12,7 +13,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
/**
|
/**
|
||||||
* Database repository class for nether portals
|
* Database repository class for nether portals
|
||||||
*/
|
*/
|
||||||
public class PortalRepository extends MinecraftRepository
|
public class PortalRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansNetherPortals (id INT NOT NULL AUTO_INCREMENT,"
|
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansNetherPortals (id INT NOT NULL AUTO_INCREMENT,"
|
||||||
+ "cornerOne VARCHAR(30),"
|
+ "cornerOne VARCHAR(30),"
|
||||||
|
@ -18,12 +18,13 @@ import mineplex.game.clans.clans.siege.outpost.OutpostState;
|
|||||||
import mineplex.game.clans.clans.siege.outpost.OutpostType;
|
import mineplex.game.clans.clans.siege.outpost.OutpostType;
|
||||||
import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken;
|
import mineplex.game.clans.clans.siege.repository.tokens.OutpostToken;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnByte;
|
import mineplex.serverdata.database.column.ColumnByte;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnTimestamp;
|
import mineplex.serverdata.database.column.ColumnTimestamp;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class OutpostRepository extends MinecraftRepository
|
public class OutpostRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private OutpostManager _manager;
|
private OutpostManager _manager;
|
||||||
|
|
||||||
|
@ -16,11 +16,12 @@ import mineplex.game.clans.clans.ClanInfo;
|
|||||||
import mineplex.game.clans.clans.siege.SiegeManager;
|
import mineplex.game.clans.clans.siege.SiegeManager;
|
||||||
import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken;
|
import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnTimestamp;
|
import mineplex.serverdata.database.column.ColumnTimestamp;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class SiegeWeaponRepository extends MinecraftRepository
|
public class SiegeWeaponRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansSiegeWeapons (uniqueId INT NOT NULL,"
|
private static final String CREATE = "CREATE TABLE IF NOT EXISTS clansSiegeWeapons (uniqueId INT NOT NULL,"
|
||||||
+ "serverId INT NOT NULL,"
|
+ "serverId INT NOT NULL,"
|
||||||
|
@ -9,13 +9,14 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnByte;
|
import mineplex.serverdata.database.column.ColumnByte;
|
||||||
import mineplex.serverdata.database.column.ColumnDouble;
|
import mineplex.serverdata.database.column.ColumnDouble;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class FieldRepository extends MinecraftRepository
|
public class FieldRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String ALL_STRING = "ALL";
|
private static String ALL_STRING = "ALL";
|
||||||
|
|
||||||
|
@ -7,10 +7,11 @@ import mineplex.core.common.util.EnclosedObject;
|
|||||||
import mineplex.core.common.util.UUIDFetcher;
|
import mineplex.core.common.util.UUIDFetcher;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class TutorialRepository extends MinecraftRepository
|
public class TutorialRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS clansTutorial (uuid VARCHAR(36), timesPlayed INT, PRIMARY KEY (uuid));";
|
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS clansTutorial (uuid VARCHAR(36), timesPlayed INT, PRIMARY KEY (uuid));";
|
||||||
private static final String GET = "SELECT * FROM clansTutorial WHERE uuid = ?;";
|
private static final String GET = "SELECT * FROM clansTutorial WHERE uuid = ?;";
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.CustomTagFix;
|
import mineplex.core.CustomTagFix;
|
||||||
import mineplex.core.PacketsInteractionFix;
|
import mineplex.core.PacketsInteractionFix;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
@ -70,18 +71,14 @@ import static mineplex.core.Managers.require;
|
|||||||
*/
|
*/
|
||||||
public class ClansHub extends JavaPlugin
|
public class ClansHub extends JavaPlugin
|
||||||
{
|
{
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
Bukkit.setSpawnRadius(0);
|
Bukkit.setSpawnRadius(0);
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
//Logger.initialize(this);
|
//Logger.initialize(this);
|
||||||
|
|
||||||
//Velocity Fix
|
//Velocity Fix
|
||||||
@ -90,14 +87,14 @@ public class ClansHub extends JavaPlugin
|
|||||||
//Static Modules
|
//Static Modules
|
||||||
require(ProfileCacheManager.class);
|
require(ProfileCacheManager.class);
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
CoreClientManager clientManager = new CoreClientManager(this);
|
||||||
CommandCenter.Instance.setClientManager(clientManager);
|
CommandCenter.Instance.setClientManager(clientManager);
|
||||||
|
|
||||||
// new ProfileCacheManager(this);
|
// new ProfileCacheManager(this);
|
||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
VisibilityManager.Initialize(this); Give.Initialize(this);
|
VisibilityManager.Initialize(this); Give.Initialize(this);
|
||||||
Punish punish = new Punish(this, webServerAddress, clientManager);
|
Punish punish = new Punish(this, clientManager);
|
||||||
BlockRestore blockRestore = new BlockRestore(this);
|
BlockRestore blockRestore = new BlockRestore(this);
|
||||||
DonationManager donationManager = require(DonationManager.class);
|
DonationManager donationManager = require(DonationManager.class);
|
||||||
|
|
||||||
@ -115,7 +112,7 @@ public class ClansHub extends JavaPlugin
|
|||||||
Creature creature = new Creature(this);
|
Creature creature = new Creature(this);
|
||||||
NpcManager npcManager = new NpcManager(this, creature);
|
NpcManager npcManager = new NpcManager(this, creature);
|
||||||
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
||||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress);
|
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||||
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
||||||
|
|
||||||
//Main Modules
|
//Main Modules
|
||||||
@ -147,7 +144,7 @@ public class ClansHub extends JavaPlugin
|
|||||||
ConditionManager condition = new ConditionManager(this);
|
ConditionManager condition = new ConditionManager(this);
|
||||||
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
||||||
BoosterManager boosterManager = new BoosterManager(this, "", clientManager, donationManager, inventoryManager, thankManager);
|
BoosterManager boosterManager = new BoosterManager(this, "", clientManager, donationManager, inventoryManager, thankManager);
|
||||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, condition, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager);
|
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, condition, disguiseManager, new TaskManager(this, clientManager), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager);
|
||||||
|
|
||||||
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
||||||
|
|
||||||
|
@ -11,11 +11,12 @@ import mineplex.core.common.Rank;
|
|||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class SalesAnnouncementRepository extends MinecraftRepository
|
public class SalesAnnouncementRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS salesAnnouncements (id INT NOT NULL AUTO_INCREMENT, ranks VARCHAR(250), message VARCHAR(256), enabled BOOL, PRIMARY KEY (id));";
|
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS salesAnnouncements (id INT NOT NULL AUTO_INCREMENT, ranks VARCHAR(250), message VARCHAR(256), enabled BOOL, PRIMARY KEY (id));";
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.CustomTagFix;
|
import mineplex.core.CustomTagFix;
|
||||||
import mineplex.core.PacketsInteractionFix;
|
import mineplex.core.PacketsInteractionFix;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
@ -89,20 +90,16 @@ import static mineplex.core.Managers.require;
|
|||||||
|
|
||||||
public class Hub extends JavaPlugin implements IRelation
|
public class Hub extends JavaPlugin implements IRelation
|
||||||
{
|
{
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
private NpcManager _npcManager;
|
private NpcManager _npcManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
Bukkit.setSpawnRadius(0);
|
Bukkit.setSpawnRadius(0);
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
//Logger.initialize(this);
|
//Logger.initialize(this);
|
||||||
|
|
||||||
//Velocity Fix
|
//Velocity Fix
|
||||||
@ -111,14 +108,14 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
//Static Modules
|
//Static Modules
|
||||||
require(ProfileCacheManager.class);
|
require(ProfileCacheManager.class);
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
CoreClientManager clientManager = new CoreClientManager(this);
|
||||||
CommandCenter.Instance.setClientManager(clientManager);
|
CommandCenter.Instance.setClientManager(clientManager);
|
||||||
|
|
||||||
// new ProfileCacheManager(this);
|
// new ProfileCacheManager(this);
|
||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
VisibilityManager.Initialize(this); Give.Initialize(this);
|
VisibilityManager.Initialize(this); Give.Initialize(this);
|
||||||
Punish punish = new Punish(this, webServerAddress, clientManager);
|
Punish punish = new Punish(this, clientManager);
|
||||||
BlockRestore blockRestore = new BlockRestore(this);
|
BlockRestore blockRestore = new BlockRestore(this);
|
||||||
DonationManager donationManager = require(DonationManager.class);
|
DonationManager donationManager = require(DonationManager.class);
|
||||||
|
|
||||||
@ -137,7 +134,7 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
NpcManager npcManager = new NpcManager(this, creature);
|
NpcManager npcManager = new NpcManager(this, creature);
|
||||||
_npcManager = npcManager;
|
_npcManager = npcManager;
|
||||||
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
||||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress);
|
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||||
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
||||||
//new TournamentManager(this, clientManager, donationManager);
|
//new TournamentManager(this, clientManager, donationManager);
|
||||||
|
|
||||||
@ -175,7 +172,7 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
String boosterGroup = serverConfiguration.getServerGroup().getBoosterGroup();
|
String boosterGroup = serverConfiguration.getServerGroup().getBoosterGroup();
|
||||||
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
||||||
BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager, thankManager);
|
BoosterManager boosterManager = new BoosterManager(this, boosterGroup, clientManager, donationManager, inventoryManager, thankManager);
|
||||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager);
|
HubManager hubManager = new HubManager(this, blockRestore, clientManager, incognito, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, customDataManager, thankManager, boosterManager);
|
||||||
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
HologramManager hologramManager = new HologramManager(this, packetHandler);
|
||||||
|
|
||||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, eloManager, partyManager);
|
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, eloManager, partyManager);
|
||||||
@ -213,9 +210,9 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
Energy energy = new Energy(this);
|
Energy energy = new Energy(this);
|
||||||
energy.setEnabled(false);
|
energy.setEnabled(false);
|
||||||
|
|
||||||
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress);
|
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager);
|
||||||
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
|
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy);
|
||||||
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory, webServerAddress);
|
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory);
|
||||||
|
|
||||||
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
|
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
|
||||||
|
|
||||||
|
@ -10,12 +10,13 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import mineplex.database.Tables;
|
import mineplex.database.Tables;
|
||||||
import mineplex.database.tables.records.MailRecord;
|
import mineplex.database.tables.records.MailRecord;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
|
|
||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
import org.jooq.Result;
|
import org.jooq.Result;
|
||||||
import org.jooq.impl.DSL;
|
import org.jooq.impl.DSL;
|
||||||
|
|
||||||
public class MailRepository extends MinecraftRepository
|
public class MailRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private MailManager _manager;
|
private MailManager _manager;
|
||||||
|
|
||||||
|
@ -11,11 +11,12 @@ import mineplex.core.common.Rank;
|
|||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnBoolean;
|
import mineplex.serverdata.database.column.ColumnBoolean;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class SalesAnnouncementRepository extends MinecraftRepository
|
public class SalesAnnouncementRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS salesAnnouncements (id INT NOT NULL AUTO_INCREMENT, ranks VARCHAR(250), message VARCHAR(256), enabled BOOL, PRIMARY KEY (id));";
|
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS salesAnnouncements (id INT NOT NULL AUTO_INCREMENT, ranks VARCHAR(250), message VARCHAR(256), enabled BOOL, PRIMARY KEY (id));";
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|||||||
private ConcurrentHashMap<String, Callback<String>> _messageSuppressed;
|
private ConcurrentHashMap<String, Callback<String>> _messageSuppressed;
|
||||||
|
|
||||||
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
|
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
|
||||||
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
|
SkillFactory skillFactory, ItemFactory itemFactory)
|
||||||
{
|
{
|
||||||
super("Class Manager", plugin);
|
super("Class Manager", plugin);
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_skillFactory = skillFactory;
|
_skillFactory = skillFactory;
|
||||||
_itemFactory = itemFactory;
|
_itemFactory = itemFactory;
|
||||||
_repository = new ClassRepository(webAddress);
|
_repository = new ClassRepository();
|
||||||
_classes = new HashMap<String, IPvpClass>();
|
_classes = new HashMap<String, IPvpClass>();
|
||||||
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
|
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
|
||||||
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
|
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
|
||||||
@ -67,7 +67,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager,
|
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager,
|
||||||
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
|
SkillFactory skillFactory, ItemFactory itemFactory)
|
||||||
{
|
{
|
||||||
super("Class Manager", plugin);
|
super("Class Manager", plugin);
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
|||||||
_gadgetManager = gadgetManager;
|
_gadgetManager = gadgetManager;
|
||||||
_skillFactory = skillFactory;
|
_skillFactory = skillFactory;
|
||||||
_itemFactory = itemFactory;
|
_itemFactory = itemFactory;
|
||||||
_repository = new ClassRepository(webAddress);
|
_repository = new ClassRepository();
|
||||||
_classes = new HashMap<String, IPvpClass>();
|
_classes = new HashMap<String, IPvpClass>();
|
||||||
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
|
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
|
||||||
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
|
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
|
||||||
|
@ -1,32 +1,18 @@
|
|||||||
package mineplex.minecraft.game.classcombat.Class.repository;
|
package mineplex.minecraft.game.classcombat.Class.repository;
|
||||||
|
|
||||||
import java.util.List;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.ClassToken;
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||||
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
|
||||||
public class ClassRepository
|
public class ClassRepository extends MinecraftRepository
|
||||||
{
|
{
|
||||||
private String _webAddress;
|
public ClassRepository()
|
||||||
|
|
||||||
public ClassRepository(String webAddress)
|
|
||||||
{
|
{
|
||||||
_webAddress = webAddress;
|
super(DBPool.getAccount());
|
||||||
}
|
|
||||||
|
|
||||||
public List<ClassToken> GetClasses(List<ClassToken> pvpClasses)
|
|
||||||
{
|
|
||||||
return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken<List<ClassToken>>()
|
|
||||||
{
|
|
||||||
}.getType(), pvpClasses);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveCustomBuild(CustomBuildToken token)
|
public void SaveCustomBuild(CustomBuildToken token)
|
||||||
{
|
{
|
||||||
new AsyncJsonWebCall(_webAddress + "PlayerAccount/SaveCustomBuild").Execute(token);
|
handleAsyncMSSQLCall("PlayerAccount/SaveCustomBuild", token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsFury;
|
|||||||
import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsPounce;
|
import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsPounce;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository;
|
import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
||||||
import mineplex.minecraft.game.classcombat.item.Throwable.ProximityManager;
|
|
||||||
import mineplex.minecraft.game.core.IRelation;
|
import mineplex.minecraft.game.core.IRelation;
|
||||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||||
@ -130,11 +129,11 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
|||||||
|
|
||||||
public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation,
|
public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation,
|
||||||
CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, DisguiseManager disguiseManager,
|
CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, DisguiseManager disguiseManager,
|
||||||
BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy, String webAddress)
|
BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy)
|
||||||
{
|
{
|
||||||
super("Skill Factory", plugin);
|
super("Skill Factory", plugin);
|
||||||
|
|
||||||
_repository = new SkillRepository(webAddress);
|
_repository = new SkillRepository();
|
||||||
_damageManager = damageManager;
|
_damageManager = damageManager;
|
||||||
_relation = relation;
|
_relation = relation;
|
||||||
_combatManager = combatManager;
|
_combatManager = combatManager;
|
||||||
|
@ -4,20 +4,19 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
||||||
|
import mineplex.core.database.MinecraftRepository;
|
||||||
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
|
||||||
public class SkillRepository
|
public class SkillRepository extends MinecraftRepository
|
||||||
{
|
{
|
||||||
private String _webAddress;
|
public SkillRepository()
|
||||||
|
|
||||||
public SkillRepository(String webAddress)
|
|
||||||
{
|
{
|
||||||
_webAddress = webAddress;
|
super(DBPool.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SkillToken> GetSkills(List<SkillToken> skills)
|
public List<SkillToken> GetSkills(List<SkillToken> skills)
|
||||||
{
|
{
|
||||||
return new JsonWebCall(_webAddress + "Dominate/GetSkills").Execute(new TypeToken<List<SkillToken>>(){}.getType(), skills);
|
return handleSyncMSSQLCall("Dominate/GetSkills", skills, new TypeToken<List<SkillToken>>(){}.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,12 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
|||||||
private HashMap<String, Item> _items;
|
private HashMap<String, Item> _items;
|
||||||
private HashSet<String> _ignore;
|
private HashSet<String> _ignore;
|
||||||
|
|
||||||
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress)
|
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager)
|
||||||
{
|
{
|
||||||
this(plugin, blockRestore, condition, damage, energy, fire, projectileManager, webAddress, new HashSet<String>());
|
this(plugin, blockRestore, condition, damage, energy, fire, projectileManager, new HashSet<String>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, String webAddress, HashSet<String> ignore)
|
public ItemFactory(JavaPlugin plugin, BlockRestore blockRestore, ConditionManager condition, DamageManager damage, Energy energy, Fire fire, ProjectileManager projectileManager, HashSet<String> ignore)
|
||||||
{
|
{
|
||||||
super("Item Factory", plugin);
|
super("Item Factory", plugin);
|
||||||
|
|
||||||
@ -67,10 +67,10 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
PopulateFactory(webAddress);
|
PopulateFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopulateFactory(String webAddress)
|
private void PopulateFactory()
|
||||||
{
|
{
|
||||||
_items.clear();
|
_items.clear();
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
package mineplex.minecraft.game.classcombat.item.repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import mineplex.core.server.remotecall.JsonWebCall;
|
|
||||||
|
|
||||||
public class ItemRepository
|
|
||||||
{
|
|
||||||
private String _webAddress;
|
|
||||||
|
|
||||||
public ItemRepository(String webAddress)
|
|
||||||
{
|
|
||||||
_webAddress = webAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ItemToken> GetItems(List<ItemToken> items)
|
|
||||||
{
|
|
||||||
return new JsonWebCall(_webAddress + "Dominate/GetItems").Execute(new TypeToken<List<ItemToken>>(){}.getType(), items);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package mineplex.minecraft.game.classcombat.item.repository;
|
|
||||||
|
|
||||||
import mineplex.core.donation.repository.GameSalesPackageToken;
|
|
||||||
|
|
||||||
public class ItemToken
|
|
||||||
{
|
|
||||||
public String Name;
|
|
||||||
public String Material;
|
|
||||||
|
|
||||||
public GameSalesPackageToken SalesPackage;
|
|
||||||
}
|
|
@ -32,5 +32,10 @@
|
|||||||
<groupId>com.mineplex</groupId>
|
<groupId>com.mineplex</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jooq</groupId>
|
||||||
|
<artifactId>jooq</artifactId>
|
||||||
|
<version>3.5.2</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -18,6 +18,7 @@ public final class DBPool
|
|||||||
private static DataSource MINEPLEX_STATS;
|
private static DataSource MINEPLEX_STATS;
|
||||||
private static DataSource PLAYER_STATS;
|
private static DataSource PLAYER_STATS;
|
||||||
private static DataSource SERVER_STATS;
|
private static DataSource SERVER_STATS;
|
||||||
|
private static DataSource MSSQL_MOCK;
|
||||||
|
|
||||||
private static DataSource openDataSource(String url, String username, String password)
|
private static DataSource openDataSource(String url, String username, String password)
|
||||||
{
|
{
|
||||||
@ -38,6 +39,14 @@ public final class DBPool
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DataSource getMssqlMock()
|
||||||
|
{
|
||||||
|
if (MSSQL_MOCK == null)
|
||||||
|
loadDataSources();
|
||||||
|
|
||||||
|
return MSSQL_MOCK;
|
||||||
|
}
|
||||||
|
|
||||||
public static DataSource getAccount()
|
public static DataSource getAccount()
|
||||||
{
|
{
|
||||||
if (ACCOUNT == null)
|
if (ACCOUNT == null)
|
||||||
@ -138,6 +147,8 @@ public final class DBPool
|
|||||||
PLAYER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
PLAYER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||||
else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS"))
|
else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS"))
|
||||||
SERVER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
SERVER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||||
|
else if (dbSource.toUpperCase().equalsIgnoreCase("MSSQL_MOCK"))
|
||||||
|
MSSQL_MOCK = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,10 @@ import java.sql.Statement;
|
|||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.jooq.DSLContext;
|
||||||
|
import org.jooq.SQLDialect;
|
||||||
|
import org.jooq.impl.DSL;
|
||||||
|
|
||||||
import mineplex.serverdata.database.column.Column;
|
import mineplex.serverdata.database.column.Column;
|
||||||
|
|
||||||
public abstract class RepositoryBase
|
public abstract class RepositoryBase
|
||||||
@ -291,4 +295,9 @@ public abstract class RepositoryBase
|
|||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DSLContext jooq()
|
||||||
|
{
|
||||||
|
return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package mineplex.staffServer;
|
package mineplex.staffServer;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.achievement.AchievementManager;
|
import mineplex.core.achievement.AchievementManager;
|
||||||
import mineplex.core.chat.Chat;
|
import mineplex.core.chat.Chat;
|
||||||
@ -39,26 +41,22 @@ import static mineplex.core.Managers.require;
|
|||||||
|
|
||||||
public class StaffServer extends JavaPlugin
|
public class StaffServer extends JavaPlugin
|
||||||
{
|
{
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
//Static Modules
|
//Static Modules
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress, Rank.DEVELOPER);
|
CoreClientManager clientManager = new CoreClientManager(this, Rank.DEVELOPER);
|
||||||
CommandCenter.Instance.setClientManager(clientManager);
|
CommandCenter.Instance.setClientManager(clientManager);
|
||||||
Recharge.Initialize(this);
|
Recharge.Initialize(this);
|
||||||
|
|
||||||
DonationManager donationManager = require(DonationManager.class);
|
DonationManager donationManager = require(DonationManager.class);
|
||||||
|
|
||||||
Punish punish = new Punish(this, webServerAddress, clientManager);
|
Punish punish = new Punish(this, clientManager);
|
||||||
new NpcManager(this, new Creature(this));
|
new NpcManager(this, new Creature(this));
|
||||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
|
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
|
||||||
PreferencesManager preferenceManager = new PreferencesManager(this, null, clientManager);
|
PreferencesManager preferenceManager = new PreferencesManager(this, null, clientManager);
|
||||||
|
@ -4,8 +4,9 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
|
|
||||||
public class CustomerSupportRepository extends MinecraftRepository
|
public class CustomerSupportRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
public CustomerSupportRepository(JavaPlugin plugin)
|
public CustomerSupportRepository(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
|
@ -9,10 +9,11 @@ import mineplex.core.database.MinecraftRepository;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.ResultSetCallable;
|
import mineplex.serverdata.database.ResultSetCallable;
|
||||||
import mineplex.serverdata.database.column.ColumnVarChar;
|
import mineplex.serverdata.database.column.ColumnVarChar;
|
||||||
|
|
||||||
public class PasswordRepository extends MinecraftRepository
|
public class PasswordRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_SERVER_PASSWORD_TABLE = "CREATE TABLE IF NOT EXISTS serverPassword (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), password VARCHAR(100), PRIMARY KEY (id));";
|
private static String CREATE_SERVER_PASSWORD_TABLE = "CREATE TABLE IF NOT EXISTS serverPassword (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), password VARCHAR(100), PRIMARY KEY (id));";
|
||||||
private static String RETRIEVE_SERVER_PASSWORD = "SELECT password FROM serverPassword WHERE server = ?;";
|
private static String RETRIEVE_SERVER_PASSWORD = "SELECT password FROM serverPassword WHERE server = ?;";
|
||||||
|
@ -61,7 +61,7 @@ public class SalesPackageManager extends MiniPlugin
|
|||||||
_statsManager = statsManager;
|
_statsManager = statsManager;
|
||||||
_powerPlayRepo = powerPlayRepo;
|
_powerPlayRepo = powerPlayRepo;
|
||||||
|
|
||||||
_petRepo = new PetRepository(plugin, plugin.getConfig().getString("webServer"));
|
_petRepo = new PetRepository();
|
||||||
|
|
||||||
|
|
||||||
//Strutt20 asked me to remove some of the stuff from the menu
|
//Strutt20 asked me to remove some of the stuff from the menu
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.spigotmc.SpigotConfig;
|
import org.spigotmc.SpigotConfig;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.CustomTagFix;
|
import mineplex.core.CustomTagFix;
|
||||||
import mineplex.core.FoodDupeFix;
|
import mineplex.core.FoodDupeFix;
|
||||||
import mineplex.core.PacketsInteractionFix;
|
import mineplex.core.PacketsInteractionFix;
|
||||||
@ -81,8 +82,6 @@ import static mineplex.core.Managers.require;
|
|||||||
|
|
||||||
public class Arcade extends JavaPlugin
|
public class Arcade extends JavaPlugin
|
||||||
{
|
{
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
//Modules
|
//Modules
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
private DonationManager _donationManager;
|
private DonationManager _donationManager;
|
||||||
@ -100,17 +99,15 @@ public class Arcade extends JavaPlugin
|
|||||||
DeleteFolders();
|
DeleteFolders();
|
||||||
|
|
||||||
//Configs
|
//Configs
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
//Logger.initialize(this);
|
//Logger.initialize(this);
|
||||||
|
|
||||||
//Static Modules
|
//Static Modules
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
_clientManager = new CoreClientManager(this, webServerAddress);
|
_clientManager = new CoreClientManager(this);
|
||||||
CommandCenter.Instance.setClientManager(_clientManager);
|
CommandCenter.Instance.setClientManager(_clientManager);
|
||||||
require(ProfileCacheManager.class);
|
require(ProfileCacheManager.class);
|
||||||
|
|
||||||
@ -148,7 +145,7 @@ public class Arcade extends JavaPlugin
|
|||||||
NpcManager npcmanager = new NpcManager(this, creature);
|
NpcManager npcmanager = new NpcManager(this, creature);
|
||||||
_damageManager = new DamageManager(this, new CombatManager(this), npcmanager, disguiseManager, null);
|
_damageManager = new DamageManager(this, new CombatManager(this), npcmanager, disguiseManager, null);
|
||||||
|
|
||||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
Punish punish = new Punish(this, _clientManager);
|
||||||
|
|
||||||
require(AntiHack.class);
|
require(AntiHack.class);
|
||||||
|
|
||||||
@ -172,7 +169,7 @@ public class Arcade extends JavaPlugin
|
|||||||
|
|
||||||
//Inventory
|
//Inventory
|
||||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore, webServerAddress);
|
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito);
|
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito);
|
||||||
ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager);
|
ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager);
|
||||||
@ -186,7 +183,7 @@ public class Arcade extends JavaPlugin
|
|||||||
|
|
||||||
//Arcade Manager
|
//Arcade Manager
|
||||||
PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
|
PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
|
||||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, customDataManager, punish, eloManager, thankManager, boosterManager);
|
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, pollManager, npcmanager, customDataManager, punish, eloManager, thankManager, boosterManager);
|
||||||
|
|
||||||
require(AntihackLogger.class).registerMetadata(new GameInfoMetadata());
|
require(AntihackLogger.class).registerMetadata(new GameInfoMetadata());
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
||||||
StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
|
StatsManager statsManager, IncognitoManager incognitoManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
|
||||||
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
|
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
|
||||||
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager,
|
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, PollManager pollManager,
|
||||||
NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, ThankManager thankManager, BoosterManager boosterManager)
|
NpcManager npcManager, CustomDataManager customDataManager, Punish punish, EloManager eloManager, ThankManager thankManager, BoosterManager boosterManager)
|
||||||
{
|
{
|
||||||
super("Game Manager", plugin);
|
super("Game Manager", plugin);
|
||||||
@ -314,7 +314,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
|
|
||||||
_partyManager = new PartyManager();
|
_partyManager = new PartyManager();
|
||||||
_statsManager = statsManager;
|
_statsManager = statsManager;
|
||||||
_taskManager = new TaskManager(plugin, clientManager, webAddress);
|
_taskManager = new TaskManager(plugin, clientManager);
|
||||||
_achievementManager = achievementManager;
|
_achievementManager = achievementManager;
|
||||||
_inventoryManager = inventoryManager;
|
_inventoryManager = inventoryManager;
|
||||||
_cosmeticManager = cosmeticManager;
|
_cosmeticManager = cosmeticManager;
|
||||||
@ -371,14 +371,14 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
_energy = new Energy(plugin);
|
_energy = new Energy(plugin);
|
||||||
|
|
||||||
_itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy,
|
_itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, _energy,
|
||||||
_fire, _projectileManager, webAddress);
|
_fire, _projectileManager);
|
||||||
|
|
||||||
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
|
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
|
||||||
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
|
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
|
||||||
_energy, webAddress);
|
_energy);
|
||||||
|
|
||||||
_classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory,
|
_classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory
|
||||||
webAddress);
|
);
|
||||||
|
|
||||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager);
|
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager);
|
||||||
|
|
||||||
|
@ -6,10 +6,11 @@ import java.sql.Types;
|
|||||||
|
|
||||||
import mineplex.core.database.MinecraftRepository;
|
import mineplex.core.database.MinecraftRepository;
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class TitanGiveawayRepository extends MinecraftRepository
|
public class TitanGiveawayRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private int _titanGiveawayCount;
|
private int _titanGiveawayCount;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package mineplex.mavericks.review;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.Constants;
|
||||||
import mineplex.core.CustomTagFix;
|
import mineplex.core.CustomTagFix;
|
||||||
import mineplex.core.FoodDupeFix;
|
import mineplex.core.FoodDupeFix;
|
||||||
import mineplex.core.PacketsInteractionFix;
|
import mineplex.core.PacketsInteractionFix;
|
||||||
@ -60,9 +61,6 @@ import static mineplex.core.Managers.require;
|
|||||||
*/
|
*/
|
||||||
public class Hub extends JavaPlugin
|
public class Hub extends JavaPlugin
|
||||||
{
|
{
|
||||||
|
|
||||||
private String WEB_CONFIG = "webServer";
|
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
private DonationManager _donationManager;
|
private DonationManager _donationManager;
|
||||||
@ -74,15 +72,13 @@ public class Hub extends JavaPlugin
|
|||||||
// Delete Old Games Folders
|
// Delete Old Games Folders
|
||||||
|
|
||||||
// Configs
|
// Configs
|
||||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
getConfig().addDefault(Constants.WEB_CONFIG_KEY, Constants.WEB_ADDRESS);
|
||||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
getConfig().set(Constants.WEB_CONFIG_KEY, getConfig().getString(Constants.WEB_CONFIG_KEY));
|
||||||
saveConfig();
|
saveConfig();
|
||||||
|
|
||||||
String webServerAddress = getConfig().getString(WEB_CONFIG);
|
|
||||||
|
|
||||||
// Static Modules
|
// Static Modules
|
||||||
CommandCenter.Initialize(this);
|
CommandCenter.Initialize(this);
|
||||||
_clientManager = new CoreClientManager(this, webServerAddress);
|
_clientManager = new CoreClientManager(this);
|
||||||
CommandCenter.Instance.setClientManager(_clientManager);
|
CommandCenter.Instance.setClientManager(_clientManager);
|
||||||
|
|
||||||
ItemStackFactory.Initialize(this, false);
|
ItemStackFactory.Initialize(this, false);
|
||||||
@ -109,7 +105,7 @@ public class Hub extends JavaPlugin
|
|||||||
|
|
||||||
DisguiseManager disguiseManager = require(DisguiseManager.class);
|
DisguiseManager disguiseManager = require(DisguiseManager.class);
|
||||||
|
|
||||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
Punish punish = new Punish(this, _clientManager);
|
||||||
require(AntiHack.class);
|
require(AntiHack.class);
|
||||||
|
|
||||||
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
||||||
@ -129,8 +125,7 @@ public class Hub extends JavaPlugin
|
|||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore,
|
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||||
webServerAddress);
|
|
||||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager,
|
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager,
|
||||||
preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito);
|
preferenceManager, disguiseManager, blockRestore, projectileManager, achievementManager, packetHandler, hologramManager, incognito);
|
||||||
|
Loading…
Reference in New Issue
Block a user