remove API module
This commit is contained in:
@@ -2,6 +2,7 @@ package com.alttd.chat;
|
||||
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.alttd.chat.database.DatabaseConnection;
|
||||
import com.alttd.chat.database.Queries;
|
||||
import com.alttd.chat.managers.ChatUserManager;
|
||||
import com.alttd.chat.managers.RegexManager;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
@@ -26,6 +27,7 @@ public class ChatImplementation implements ChatAPI{
|
||||
|
||||
luckPerms = getLuckPerms();
|
||||
databaseConnection = getDataBase();
|
||||
Queries.createTables();
|
||||
|
||||
ChatUserManager.initialize(); // loads all the users from the db and adds them.
|
||||
RegexManager.initRegex(); // load the filters and regexes from config
|
||||
|
||||
@@ -28,8 +28,10 @@ public final class Config {
|
||||
static int version;
|
||||
static boolean verbose;
|
||||
|
||||
public static void init() { // todo setup share for the config
|
||||
CONFIG_FILE = new File(new File(System.getProperty("user.home")), "config.yml");;
|
||||
public static void init(File path) {
|
||||
CONFIG_FILE = new File(path, "config.yml");;
|
||||
// public static void init() { // todo setup share for the config
|
||||
// CONFIG_FILE = new File(new File(System.getProperty("user.home")+File.separator+"ChatPlugin"), "config.yml");;
|
||||
configLoader = YAMLConfigurationLoader.builder()
|
||||
.setFile(CONFIG_FILE)
|
||||
.setFlowStyle(DumperOptions.FlowStyle.BLOCK)
|
||||
@@ -181,7 +183,7 @@ public final class Config {
|
||||
MESSAGESENDER = getString("commands.message.sender-message", MESSAGESENDER);
|
||||
MESSAGERECIEVER = getString("commands.message.reciever-message", MESSAGERECIEVER);
|
||||
}
|
||||
|
||||
///broadcast <white><light_purple><prefix></light_purple> <gray>Momlly</gray> <hover:show_text:on Atoll><yellow>to Global</yellow></hover><gray>: We Love <gold>Teri</gold> and <light_purple>Kappa</light_purple></gray></white>
|
||||
public static String GCFORMAT = "<white><light_purple><prefix></light_purple> <gray><sender></gray> <hover:show_text:on <server>><yellow>to Global</yellow></hover><gray>: <message></gray></white>";
|
||||
public static String GCPERMISSION = "proxy.globalchat";
|
||||
public static List<String> GCALIAS = new ArrayList<>();
|
||||
@@ -195,7 +197,7 @@ public final class Config {
|
||||
}
|
||||
|
||||
public static List<String> GACECOMMANDALIASES = new ArrayList<>();
|
||||
public static String GACFORMAT = "<hover:show_text:Click to reply><click:suggest_command:/msg <sender> ><yellow>(<sender> on <server> -> Team) <message></yellow>";
|
||||
public static String GACFORMAT = "<hover:show_text:Click to reply><click:suggest_command:/acg ><yellow>(<sender> on <server> -> Team) <message></yellow>";
|
||||
private static void globalAdminChat() {
|
||||
GACECOMMANDALIASES = getList("commands.globaladminchat.aliases", Lists.newArrayList("acg"));
|
||||
GACFORMAT = getString("commands.globaladminchat.format", GACFORMAT);
|
||||
|
||||
@@ -11,19 +11,11 @@ public class DatabaseConnection {
|
||||
|
||||
private static DatabaseConnection instance;
|
||||
private Connection connection;
|
||||
private final String drivers, ip, port, database, username, password;
|
||||
|
||||
/**
|
||||
* Sets information for the database and opens the connection.
|
||||
*/
|
||||
public DatabaseConnection() {
|
||||
|
||||
this.drivers = Config.DRIVER;
|
||||
this.ip = Config.IP;
|
||||
this.port = Config.PORT;
|
||||
this.database = Config.DATABASE;
|
||||
this.username = Config.USERNAME;
|
||||
this.password = Config.PASSWORD;
|
||||
instance = this;
|
||||
|
||||
try {
|
||||
@@ -52,8 +44,8 @@ public class DatabaseConnection {
|
||||
e.printStackTrace();
|
||||
}
|
||||
connection = DriverManager.getConnection(
|
||||
"jdbc:" + drivers + "://" + ip + ":" + port + "/" + database + "?autoReconnect=true", username,
|
||||
password);
|
||||
"jdbc:" + Config.DRIVER + "://" + Config.IP + ":" + Config.PORT + "/" + Config.DATABASE + "?autoReconnect=true",
|
||||
Config.USERNAME, Config.PASSWORD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Queries {
|
||||
List<String> tables = new ArrayList<>();
|
||||
tables.add("CREATE TABLE IF NOT EXISTS ignored_users (`uuid` VARCHAR(36) NOT NULL, `ignored_uuid` VARCHAR(36) NOT NULL, PRIMARY KEY (`uuid`, `ignored_uuid`))");
|
||||
tables.add("CREATE TABLE IF NOT EXISTS parties (`id` INT NOT NULL AUTO_INCREMENT, `owner_uuid` VARCHAR(36) NOT NULL, `party_name` VARCHAR(36) NOT NULL, `password` VARCHAR(36), PRIMARY KEY (`id`))");
|
||||
tables.add("CREATE TABLE IF NOT EXISTS chat_users (`uuid` VARCHAR(36) NOT NULL, `party_id` INT NOT NULL, `toggled_chat` BIT(1) DEFAULT b'0', `force_tp` BIT(1) DEFAULT b'1', `toggled_gc` BIT(1) DEFAULT b'0', PRIMARY KEY (`uuid`), FOREIGN KEY (party_id) REFERENCES parties(id) ON DELETE CASCADE)");
|
||||
tables.add("CREATE TABLE IF NOT EXISTS chat_users (`uuid` VARCHAR(36) NOT NULL, `party_id` INT NOT NULL, `toggled_chat` BIT(1) DEFAULT b'0', `force_tp` BIT(1) DEFAULT b'1', `toggled_gc` BIT(1) DEFAULT b'0', PRIMARY KEY (`uuid`))");
|
||||
|
||||
try {
|
||||
Connection connection = DatabaseConnection.getConnection();
|
||||
@@ -249,8 +249,6 @@ public class Queries {
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
//Chat Users
|
||||
//@teri what's this?
|
||||
private static void getChatUsers(HashMap<Integer, Party> parties) { //TODO Get parties from cache somewhere
|
||||
String query = "SELECT * FROM chat_users";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user