diff --git a/multichat/pom.xml b/multichat/pom.xml index fe1f0695..d7ab6bae 100644 --- a/multichat/pom.xml +++ b/multichat/pom.xml @@ -5,7 +5,7 @@ xyz.olivermartin.multichat multichat - 1.8 + 1.8.1 diff --git a/multichat/releases/1.8.1/multichat-1.8.1-snapshot-2020.4.8.1.jar b/multichat/releases/1.8.1/multichat-1.8.1-snapshot-2020.4.8.1.jar new file mode 100644 index 00000000..2753c295 Binary files /dev/null and b/multichat/releases/1.8.1/multichat-1.8.1-snapshot-2020.4.8.1.jar differ diff --git a/multichat/releases/1.8.1/multichat-1.8.1-special-debug.jar b/multichat/releases/1.8.1/multichat-1.8.1-special-debug.jar new file mode 100644 index 00000000..b8369918 Binary files /dev/null and b/multichat/releases/1.8.1/multichat-1.8.1-special-debug.jar differ diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Channel.java b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Channel.java index 6451208d..50915240 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Channel.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Channel.java @@ -142,7 +142,7 @@ public void sendMessage(ProxiedPlayer sender, String message, String format) { for (ProxiedPlayer receiver : ProxyServer.getInstance().getPlayers()) { - if (receiver != null) { + if (receiver != null && sender != null) { synchronized (receiver) { @@ -172,6 +172,14 @@ public void sendMessage(ProxiedPlayer sender, String message, String format) { } + } else { + + DebugManager.log("NULL POINTER WAS DETECTED CHECKS!"); + DebugManager.log("< START >"); + DebugManager.log(sender != null ? sender.getName() : "SENDER NULL"); + DebugManager.log(receiver != null ? receiver.getUniqueId().toString() : "RECEIVER NULL"); + DebugManager.log("< / END >"); + } } diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java index 86eb7637..3b86ab6c 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/Events.java @@ -355,6 +355,14 @@ public void onChat(ChatEvent event) { message = ChatControl.replaceLinks(message); event.setMessage(message); } + + DebugManager.log("NULL POINTER CHECKS!"); + DebugManager.log("< START >"); + DebugManager.log(player.getName()); + DebugManager.log(player.getUniqueId().toString()); + DebugManager.log(Channel.getChannel(player.getUniqueId()).getName()); + DebugManager.log(player.getServer().getInfo().getName()); + DebugManager.log("< / END >"); // Let server know players channel preference BungeeComm.sendPlayerChannelMessage(player.getName(), Channel.getChannel(player.getUniqueId()).getName(), Channel.getChannel(player.getUniqueId()), player.getServer().getInfo(), (player.hasPermission("multichat.chat.colour")||player.hasPermission("multichat.chat.color"))); diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java index 7c4552e7..f085b9eb 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/bungee/MultiChat.java @@ -37,11 +37,12 @@ */ public class MultiChat extends Plugin implements Listener { - public static final String LATEST_VERSION = "1.8"; + public static final String LATEST_VERSION = "1.8.1"; public static final String[] ALLOWED_VERSIONS = new String[] { LATEST_VERSION, + "1.8", "1.7.5", "1.7.4", "1.7.3", diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/database/DatabaseManager.java b/multichat/src/main/java/xyz/olivermartin/multichat/database/DatabaseManager.java index 9f80c07f..4e6f496a 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/database/DatabaseManager.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/database/DatabaseManager.java @@ -38,7 +38,7 @@ private DatabaseManager() { //////////// public static void main(String args[]) throws SQLException { - + DatabaseManager.getInstance().setPathSQLite(new File("C:\\multichat\\db\\")); DatabaseManager.getInstance().createDatabase("multichat.db"); @@ -52,31 +52,31 @@ public static void main(String args[]) throws SQLException { try { db.connectToDatabase(); - db.execute("DROP TABLE IF EXISTS name_data;"); - db.execute("DROP TABLE IF EXISTS nick_data;"); - - db.update("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); - db.update("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); - - db.update("INSERT INTO name_data VALUES ('" + uuid1.toString() + "', 'Revilo410', 'revilo410');"); - db.update("INSERT INTO nick_data VALUES ('" + uuid1.toString() + "', '&3Revi', 'revi');"); - db.update("INSERT INTO name_data VALUES ('" + uuid2.toString() + "', 'Revilo510', 'revilo510');"); - ResultSet results = db.query("SELECT * FROM name_data;"); + db.safeExecute("DROP TABLE IF EXISTS name_data;"); + db.safeExecute("DROP TABLE IF EXISTS nick_data;"); + + db.safeUpdate("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); + db.safeUpdate("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); + + db.safeUpdate("INSERT INTO name_data VALUES (?, 'Revilo410', 'revilo410');", uuid1.toString()); + db.safeUpdate("INSERT INTO nick_data VALUES (?, '&3Revi', 'revi');", uuid1.toString()); + db.safeUpdate("INSERT INTO name_data VALUES (?, 'Revilo510', 'revilo510');", uuid2.toString()); + ResultSet results = db.safeQuery("SELECT * FROM name_data;"); while (results.next()) { System.out.println(results.getString("id")); } - - results = db.query("SELECT * FROM nick_data;"); + + results = db.safeQuery("SELECT * FROM nick_data;"); while (results.next()) { System.out.println(results.getString("id")); } - - results = db.query("SELECT * FROM name_data INNER JOIN nick_data ON name_data.id = nick_data.id;"); + + results = db.safeQuery("SELECT * FROM name_data INNER JOIN nick_data ON name_data.id = nick_data.id;"); while (results.next()) { System.out.println(results.getString("id")); } - - results = db.query("SELECT * FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id;"); + + results = db.safeQuery("SELECT * FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id;"); while (results.next()) { System.out.println(results.getString("id")); if (results.getString("f_nick") == null) { @@ -85,8 +85,8 @@ public static void main(String args[]) throws SQLException { System.out.println(results.getString("f_nick")); } } - - results = db.query("SELECT f_name, f_nick FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id WHERE name_data.id = '" + uuid1.toString() + "';"); + + results = db.safeQuery("SELECT f_name, f_nick FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id WHERE name_data.id = ?;", uuid1.toString()); while (results.next()) { if (results.getString("f_nick") == null) { System.out.println(results.getString("f_name")); @@ -94,12 +94,12 @@ public static void main(String args[]) throws SQLException { System.out.println(results.getString("f_nick")); } } - + db.disconnectFromDatabase(); } catch (SQLException e) { e.printStackTrace(); } - + } /*DatabaseManager.getInstance().setPathSQLite(new File("C:\\multichat\\db\\")); diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/database/GenericDatabase.java b/multichat/src/main/java/xyz/olivermartin/multichat/database/GenericDatabase.java index 8ed8aba5..821c39f7 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/database/GenericDatabase.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/database/GenericDatabase.java @@ -7,7 +7,7 @@ public abstract class GenericDatabase { protected String url; private boolean ready; - + protected String username; protected String password; @@ -15,7 +15,7 @@ public GenericDatabase(String url) throws SQLException { this.url = url; ready = setupDatabase(url); } - + public GenericDatabase(String url, String user, String pass) throws SQLException { this.url = url; this.username = user; @@ -37,11 +37,17 @@ public boolean isReady() { protected abstract boolean connect() throws SQLException; - public abstract ResultSet query(String sql) throws SQLException; + public abstract ResultSet safeQuery(String sqlTemplate, String... stringParameters) throws SQLException; + + public abstract void safeUpdate(String sqlTemplate, String... stringParameters) throws SQLException; + + public abstract void safeExecute(String sqlTemplate, String... stringParameters) throws SQLException; + + //public abstract ResultSet query(String sql) throws SQLException; + + //public abstract void update(String sql) throws SQLException; - public abstract void update(String sql) throws SQLException; - - public abstract void execute(String sql) throws SQLException; + //public abstract void execute(String sql) throws SQLException; public void connectToDatabase() throws SQLException { this.ready = connect(); diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/database/MySQLDatabase.java b/multichat/src/main/java/xyz/olivermartin/multichat/database/MySQLDatabase.java index b5e4cf4d..d7e6b00a 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/database/MySQLDatabase.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/database/MySQLDatabase.java @@ -2,6 +2,7 @@ import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -70,7 +71,7 @@ protected boolean connect() throws SQLException { return true; } - @Override + /*@Override public ResultSet query(String sql) throws SQLException { ResultSet results = conn.createStatement().executeQuery(sql); @@ -90,8 +91,47 @@ public void execute(String sql) throws SQLException { conn.createStatement().execute(sql); + }*/ + + @Override + public ResultSet safeQuery(String sqlTemplate, String... stringParameters) throws SQLException { + + PreparedStatement p = conn.prepareStatement(sqlTemplate); + + for (int i = 1; i <= stringParameters.length; i++) { + p.setString(i, stringParameters[i-1]); + } + + ResultSet results = p.executeQuery(); + + return results; + + } + + @Override + public void safeUpdate(String sqlTemplate, String... stringParameters) throws SQLException { + + PreparedStatement p = conn.prepareStatement(sqlTemplate); + + for (int i = 1; i <= stringParameters.length; i++) { + p.setString(i, stringParameters[i-1]); + } + + p.executeUpdate(); + } + @Override + public void safeExecute(String sqlTemplate, String... stringParameters) throws SQLException { + + PreparedStatement p = conn.prepareStatement(sqlTemplate); + + for (int i = 1; i <= stringParameters.length; i++) { + p.setString(i, stringParameters[i-1]); + } + + p.execute(); + } } diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/database/SQLiteDatabase.java b/multichat/src/main/java/xyz/olivermartin/multichat/database/SQLiteDatabase.java index 185194a7..227a98ab 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/database/SQLiteDatabase.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/database/SQLiteDatabase.java @@ -3,6 +3,7 @@ import java.io.File; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -71,7 +72,7 @@ protected boolean connect() throws SQLException { return true; } - @Override + /*@Override public ResultSet query(String sql) throws SQLException { ResultSet results = conn.createStatement().executeQuery(sql); @@ -91,6 +92,47 @@ public void execute(String sql) throws SQLException { conn.createStatement().execute(sql); + }*/ + + @Override + public ResultSet safeQuery(String sqlTemplate, String... stringParameters) throws SQLException { + + PreparedStatement p = conn.prepareStatement(sqlTemplate); + + for (int i = 1; i <= stringParameters.length; i++) { + p.setString(i, stringParameters[i-1]); + } + + ResultSet results = p.executeQuery(); + + return results; + + } + + @Override + public void safeUpdate(String sqlTemplate, String... stringParameters) throws SQLException { + + PreparedStatement p = conn.prepareStatement(sqlTemplate); + + for (int i = 1; i <= stringParameters.length; i++) { + p.setString(i, stringParameters[i-1]); + } + + p.executeUpdate(); + + } + + @Override + public void safeExecute(String sqlTemplate, String... stringParameters) throws SQLException { + + PreparedStatement p = conn.prepareStatement(sqlTemplate); + + for (int i = 1; i <= stringParameters.length; i++) { + p.setString(i, stringParameters[i-1]); + } + + p.execute(); + } } diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/MultiChatSpigot.java b/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/MultiChatSpigot.java index 0ef0dc10..889a8076 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/MultiChatSpigot.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/MultiChatSpigot.java @@ -112,7 +112,7 @@ public void onEnable() { getDataFolder().mkdirs(); configDir = getDataFolder(); } - + String translationsDir = configDir.toString() + File.separator + "translations"; if (!new File(translationsDir).exists()) { getLogger().info(logPrefix + "Creating translations directory!"); @@ -121,7 +121,7 @@ public void onEnable() { SpigotConfigManager.getInstance().registerHandler("spigotconfig.yml", configDir); SpigotConfigManager.getInstance().registerHandler("spigotconfig_fr.yml", new File(translationsDir)); - + Configuration config = SpigotConfigManager.getInstance().getHandler("spigotconfig.yml").getConfig(); if (config.contains("server_name")) { @@ -183,8 +183,8 @@ public void onEnable() { } DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().connectToDatabase(); - DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().update("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); - DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().update("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().disconnectFromDatabase(); NameManager.useSQL(nicknameSQL); @@ -207,8 +207,8 @@ public void onEnable() { DatabaseManager.getInstance().createDatabase("multichatspigot.db"); DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().connectToDatabase(); - DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().update("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); - DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().update("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); DatabaseManager.getInstance().getDatabase("multichatspigot.db").get().disconnectFromDatabase(); NameManager.useSQL(nicknameSQL); diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/SQLNameManager.java b/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/SQLNameManager.java index 5696da6b..6cad439f 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/SQLNameManager.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/SQLNameManager.java @@ -49,21 +49,19 @@ public String getCurrentName(UUID uuid, boolean withPrefix) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT f_name, f_nick FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id WHERE name_data.id = '" + uuid.toString() + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT f_name, f_nick FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id WHERE name_data.id = ?;", uuid.toString()); results.next(); if (results.getString("f_nick") == null) { name = results.getString("f_name"); } else { name = results.getString("f_nick"); + if (MultiChatSpigot.showNicknamePrefix && withPrefix) { + name = MultiChatSpigot.nicknamePrefix + name; + } } - //spigotdatabase.disconnectFromDatabase(); } - if (MultiChatSpigot.showNicknamePrefix && withPrefix) { - return MultiChatSpigot.nicknamePrefix + name; - } else { - return name; - } + return name; } catch (SQLException e) { e.printStackTrace(); @@ -86,7 +84,7 @@ public String getName(UUID uuid) { String name; synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT f_name FROM name_data WHERE id = '" + uuid.toString() + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT f_name FROM name_data WHERE id = ?;", uuid.toString()); results.next(); name = results.getString("f_name"); //spigotdatabase.disconnectFromDatabase(); @@ -117,7 +115,7 @@ protected Optional getUUIDFromUnformattedNickname(String nickname) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id FROM nick_data WHERE u_nick = '" + nickname + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT id FROM nick_data WHERE u_nick = ?;", nickname); if (results.next()) { UUID id = UUID.fromString(results.getString("id")); //spigotdatabase.disconnectFromDatabase(); @@ -151,7 +149,7 @@ public Optional getUUIDFromName(String username) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id FROM name_data WHERE u_name = '" + username + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT id FROM name_data WHERE u_name = ?;", username); if (results.next() ) { UUID id = UUID.fromString(results.getString("id")); //spigotdatabase.disconnectFromDatabase(); @@ -196,7 +194,7 @@ public void registerPlayer(Player player) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("UPDATE name_data SET u_name = '" + username.toLowerCase() + "', f_name = '" + username + "' WHERE id = '" + uuid.toString() + "';"); + spigotdatabase.safeUpdate("UPDATE name_data SET u_name = ?, f_name = ? WHERE id = ?;", username.toLowerCase(), username, uuid.toString()); //spigotdatabase.disconnectFromDatabase(); } @@ -213,7 +211,7 @@ public void registerPlayer(Player player) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + username + "', '" + username.toLowerCase()+ "');"); + spigotdatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), username, username.toLowerCase()); //spigotdatabase.disconnectFromDatabase(); } @@ -248,7 +246,7 @@ public void testRegisterFakePlayer(UUID uuid, String username) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("UPDATE name_data SET u_name = '" + username.toLowerCase() + "', f_name = '" + username + "' WHERE id = '" + uuid.toString() + "';"); + spigotdatabase.safeUpdate("UPDATE name_data SET u_name = ?, f_name = ? WHERE id = ?;", username.toLowerCase(), username, uuid.toString()); //spigotdatabase.disconnectFromDatabase(); } @@ -265,7 +263,7 @@ public void testRegisterFakePlayer(UUID uuid, String username) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + username + "', '" + username.toLowerCase() + "');"); + spigotdatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), username, username.toLowerCase()); //spigotdatabase.disconnectFromDatabase(); } @@ -291,7 +289,7 @@ public boolean existsUUID(UUID uuid) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id FROM name_data WHERE id = '" + uuid.toString() + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT id FROM name_data WHERE id = ?;", uuid.toString()); if (results.next()) { //TODO fixed this line... //spigotdatabase.disconnectFromDatabase(); return true; @@ -319,7 +317,7 @@ public boolean hasNickname(UUID uuid) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id FROM nick_data WHERE id = '" + uuid.toString() + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT id FROM nick_data WHERE id = ?;", uuid.toString()); if (results.next()) { //TODO fixed this line... //spigotdatabase.disconnectFromDatabase(); return true; @@ -357,14 +355,14 @@ public void registerMigratedPlayer(UUID uuid, String name, String formattedName, try { spigotdatabase.connectToDatabase(); - spigotdatabase.update("UPDATE name_data SET f_name = '" + formattedName + "', u_name = '" + name + "' WHERE id = '" + uuid.toString() + "';"); + spigotdatabase.safeUpdate("UPDATE name_data SET f_name = ?, u_name = ? WHERE id = ?;", formattedName, name, uuid.toString()); if (setNick) { if (hasNickname(uuid)) { - spigotdatabase.update("UPDATE nick_data SET u_nick = '" + nick + "', f_nick = '" + formattedNick + "' WHERE id = '" + uuid.toString() + "';"); + spigotdatabase.safeUpdate("UPDATE nick_data SET u_nick = ?, f_nick = ? WHERE id = ?;", nick, formattedNick, uuid.toString()); } else { - spigotdatabase.update("INSERT INTO nick_data VALUES ('" + uuid.toString() + "', '" + nick + "', '" + formattedNick + "');"); + spigotdatabase.safeUpdate("INSERT INTO nick_data VALUES (?, ?, ?);", uuid.toString(), nick, formattedNick); } } @@ -381,10 +379,10 @@ public void registerMigratedPlayer(UUID uuid, String name, String formattedName, synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + formattedName + "', '" + name + "');"); + spigotdatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), formattedName, name); if (setNick) { - spigotdatabase.update("INSERT INTO nick_data VALUES ('" + uuid.toString() + "', '" + nick + "', '" + formattedNick + "');"); + spigotdatabase.safeUpdate("INSERT INTO nick_data VALUES (?, ?, ?);", uuid.toString(), nick, formattedNick); } //spigotdatabase.disconnectFromDatabase(); @@ -418,7 +416,7 @@ public void registerOfflinePlayerByUUID(UUID uuid, String username) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + username + "', '" + username.toLowerCase() + "');"); + spigotdatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), username, username.toLowerCase()); //spigotdatabase.disconnectFromDatabase(); } @@ -462,10 +460,10 @@ public void setNickname(UUID uuid, String nickname) { if (hasNickname(uuid)) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("UPDATE nick_data SET u_nick = '" + unformattedNickname + "', f_nick = '" + nickname + "' WHERE id = '" + uuid.toString() + "';"); + spigotdatabase.safeUpdate("UPDATE nick_data SET u_nick = ?, f_nick = ? WHERE id = ?;", unformattedNickname, nickname, uuid.toString()); } else { spigotdatabase.connectToDatabase(); - spigotdatabase.update("INSERT INTO nick_data VALUES ('" + uuid.toString() + "', '" + unformattedNickname + "', '" + nickname + "');"); + spigotdatabase.safeUpdate("INSERT INTO nick_data VALUES (?, ?, ?);", uuid.toString(), unformattedNickname, nickname); } //spigotdatabase.disconnectFromDatabase(); @@ -489,7 +487,7 @@ public boolean existsPlayer(String username) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT u_name FROM name_data WHERE u_name = '" + username.toLowerCase() + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT u_name FROM name_data WHERE u_name = ?;", username.toLowerCase()); if (results.next()) { //spigotdatabase.disconnectFromDatabase(); return true; @@ -518,7 +516,7 @@ public boolean existsNickname(String nickname) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT u_nick FROM nick_data WHERE u_nick = '" + stripAllFormattingCodes(nickname.toLowerCase()) + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT u_nick FROM nick_data WHERE u_nick = ?;", stripAllFormattingCodes(nickname.toLowerCase())); if (results.next()) { //spigotdatabase.disconnectFromDatabase(); return true; @@ -546,7 +544,7 @@ public boolean otherPlayerHasNickname(String nickname, UUID uuid) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id, u_nick FROM nick_data WHERE u_nick = '" + stripAllFormattingCodes(nickname.toLowerCase()) + "';"); + ResultSet results = spigotdatabase.safeQuery("SELECT id, u_nick FROM nick_data WHERE u_nick = ?;", stripAllFormattingCodes(nickname.toLowerCase())); if (results.next()) { if (results.getString("id").equals(uuid.toString())) { //spigotdatabase.disconnectFromDatabase(); @@ -580,7 +578,7 @@ public Optional> getPartialNicknameMatches(String nickname) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id FROM nick_data WHERE (u_nick LIKE '%" + stripAllFormattingCodes(nickname.toLowerCase()) + "%');"); + ResultSet results = spigotdatabase.safeQuery("SELECT id FROM nick_data WHERE (u_nick LIKE ?);", "%" + stripAllFormattingCodes(nickname.toLowerCase()) + "%"); if (results.next()) { Set uuids = new HashSet(); uuids.add(UUID.fromString(results.getString("id"))); @@ -616,7 +614,7 @@ public Optional> getPartialNameMatches(String name) { synchronized (spigotdatabase) { spigotdatabase.connectToDatabase(); - ResultSet results = spigotdatabase.query("SELECT id, f_name FROM name_data WHERE (u_name LIKE '%" + name.toLowerCase() + "%');"); + ResultSet results = spigotdatabase.safeQuery("SELECT id, f_name FROM name_data WHERE (u_name LIKE ?);", "%" + name.toLowerCase() + "%"); if (results.next()) { Set uuids = new HashSet(); uuids.add(UUID.fromString(results.getString("id"))); @@ -662,7 +660,7 @@ public void removeNickname(UUID uuid) { spigotdatabase.connectToDatabase(); - spigotdatabase.update("DELETE FROM nick_data WHERE id = '" + uuid.toString() + "';"); + spigotdatabase.safeUpdate("DELETE FROM nick_data WHERE id = ?;", uuid.toString()); //spigotdatabase.disconnectFromDatabase(); } diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/commands/CommandHandler.java b/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/commands/CommandHandler.java index ed926179..d2a2db47 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/commands/CommandHandler.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/spigotbridge/commands/CommandHandler.java @@ -340,7 +340,7 @@ public boolean onCommand(CommandSender commandSender, Command cmd, String label, return true; } - String targetNickname = NameManager.getInstance().stripAllFormattingCodes(NameManager.getInstance().getCurrentName(targetUUID)); + String targetNickname = NameManager.getInstance().stripAllFormattingCodes(NameManager.getInstance().getCurrentName(targetUUID, false)); String targetName = NameManager.getInstance().getName(targetUUID); if (NameManager.getInstance().existsNickname(args[0]) && !targetNickname.equalsIgnoreCase(NameManager.getInstance().stripAllFormattingCodes(args[0])) ) { //&& !sender.hasPermission("multichatspigot.nick.duplicate")) { @@ -444,7 +444,7 @@ public boolean onCommand(CommandSender commandSender, Command cmd, String label, return true; } - String targetNickname = NameManager.getInstance().stripAllFormattingCodes(NameManager.getInstance().getCurrentName(targetUUID)); + String targetNickname = NameManager.getInstance().stripAllFormattingCodes(NameManager.getInstance().getCurrentName(targetUUID, false)); String targetName = NameManager.getInstance().getName(targetUUID); if (NameManager.getInstance().existsNickname(args[1]) && !targetNickname.equalsIgnoreCase(NameManager.getInstance().stripAllFormattingCodes(args[1])) ) { //&& !sender.hasPermission("multichatspigot.nick.duplicate")) { diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/MultiChatSponge.java b/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/MultiChatSponge.java index c28c8365..7fe4f725 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/MultiChatSponge.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/MultiChatSponge.java @@ -66,7 +66,7 @@ * @author Oliver Martin (Revilo410) * */ -@Plugin(id = "multichat", name = "MultiChatSponge", version = "1.8", dependencies = { @Dependency(id = "placeholderapi", optional = true) }) +@Plugin(id = "multichat", name = "MultiChatSponge", version = "1.8.1", dependencies = { @Dependency(id = "placeholderapi", optional = true) }) public final class MultiChatSponge { public static SimpleMutableMessageChannel multichatChannel; @@ -189,8 +189,8 @@ public void onServerStart(GameStartedServerEvent event) { } DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().connectToDatabase(); - DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().update("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); - DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().update("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); ///DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().disconnectFromDatabase(); SpongeNameManager.useSQL(nicknameSQL); @@ -219,8 +219,8 @@ public void onServerStart(GameStartedServerEvent event) { DatabaseManager.getInstance().createDatabase("multichatsponge.db"); DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().connectToDatabase(); - DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().update("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); - DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().update("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS name_data(id VARCHAR(128), f_name VARCHAR(255), u_name VARCHAR(255), PRIMARY KEY (id));"); + DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().safeUpdate("CREATE TABLE IF NOT EXISTS nick_data(id VARCHAR(128), u_nick VARCHAR(255), f_nick VARCHAR(255), PRIMARY KEY (id));"); //DatabaseManager.getInstance().getDatabase("multichatsponge.db").get().disconnectFromDatabase(); SpongeNameManager.useSQL(nicknameSQL); diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/SpongeSQLNameManager.java b/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/SpongeSQLNameManager.java index 7d0fe2d3..28aecffe 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/SpongeSQLNameManager.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/SpongeSQLNameManager.java @@ -50,27 +50,25 @@ public String getCurrentName(UUID uuid, boolean withPrefix) { String name; synchronized (spongedatabase) { - DebugManager.log("!Syncronise on database..."); + spongedatabase.connectToDatabase(); - DebugManager.log("!Connected to database..."); - ResultSet results = spongedatabase.query("SELECT f_name, f_nick FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id WHERE name_data.id = '" + uuid.toString() + "';"); - DebugManager.log("!Query executed..."); - DebugManager.log("!Is it closed? : " + results.isClosed()); + + ResultSet results = spongedatabase.safeQuery("SELECT f_name, f_nick FROM name_data LEFT JOIN nick_data ON name_data.id = nick_data.id WHERE name_data.id = ?;", uuid.toString()); + results.next(); - DebugManager.log("!Should now have the nex result ready!"); + if (results.getString("f_nick") == null) { name = results.getString("f_name"); } else { name = results.getString("f_nick"); + if (MultiChatSponge.showNicknamePrefix && withPrefix) { + name = MultiChatSponge.nicknamePrefix + name; + } } } - if (MultiChatSponge.showNicknamePrefix && withPrefix) { - return MultiChatSponge.nicknamePrefix + name; - } else { - return name; - } + return name; } catch (SQLException e) { e.printStackTrace(); @@ -93,7 +91,7 @@ public String getName(UUID uuid) { String name; synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT f_name FROM name_data WHERE id = '" + uuid.toString() + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT f_name FROM name_data WHERE id = ?;", uuid.toString()); results.next(); name = results.getString("f_name"); @@ -124,7 +122,7 @@ protected Optional getUUIDFromUnformattedNickname(String nickname) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id FROM nick_data WHERE u_nick = '" + nickname + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT id FROM nick_data WHERE u_nick = ?;", nickname); if (results.next()) { UUID id = UUID.fromString(results.getString("id")); @@ -158,7 +156,7 @@ public Optional getUUIDFromName(String username) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id FROM name_data WHERE u_name = '" + username + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT id FROM name_data WHERE u_name = ?;", username); if (results.next() ) { UUID id = UUID.fromString(results.getString("id")); @@ -209,7 +207,7 @@ public void registerPlayer(Player player) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - spongedatabase.update("UPDATE name_data SET u_name = '" + username.toLowerCase() + "', f_name = '" + username + "' WHERE id = '" + uuid.toString() + "';"); + spongedatabase.safeUpdate("UPDATE name_data SET u_name = ?, f_name = ? WHERE id = ?;", username.toLowerCase(), username, uuid.toString()); } @@ -230,7 +228,7 @@ public void registerPlayer(Player player) { spongedatabase.connectToDatabase(); DebugManager.log("SHOULD NOW BE CONNECTED..."); - spongedatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + username + "', '" + username.toLowerCase()+ "');"); + spongedatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), username, username.toLowerCase()); DebugManager.log("SHOULD NOW HAVE ADDED THE NEW ROWS TO THE DATABASE!"); } @@ -264,7 +262,7 @@ public void testRegisterFakePlayer(UUID uuid, String username) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - spongedatabase.update("UPDATE name_data SET u_name = '" + username.toLowerCase() + "', f_name = '" + username + "' WHERE id = '" + uuid.toString() + "';"); + spongedatabase.safeUpdate("UPDATE name_data SET u_name = ?, f_name = ? WHERE id = ?;", username.toLowerCase(), username, uuid.toString()); } @@ -280,7 +278,7 @@ public void testRegisterFakePlayer(UUID uuid, String username) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - spongedatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + username + "', '" + username.toLowerCase() + "');"); + spongedatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), username, username.toLowerCase()); } @@ -305,7 +303,7 @@ public boolean existsUUID(UUID uuid) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id FROM name_data WHERE id = '" + uuid.toString() + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT id FROM name_data WHERE id = ?;", uuid.toString()); if (results.next()) { return true; } else { @@ -331,7 +329,7 @@ public boolean hasNickname(UUID uuid) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id FROM nick_data WHERE id = '" + uuid.toString() + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT id FROM nick_data WHERE id = ?;", uuid.toString()); if (results.next()) { return true; } else { @@ -367,14 +365,14 @@ public void registerMigratedPlayer(UUID uuid, String name, String formattedName, try { spongedatabase.connectToDatabase(); - spongedatabase.update("UPDATE name_data SET f_name = '" + formattedName + "', u_name = '" + name + "' WHERE id = '" + uuid.toString() + "';"); + spongedatabase.safeUpdate("UPDATE name_data SET f_name = ?, u_name = ? WHERE id = ?;", formattedName, name, uuid.toString()); if (setNick) { if (hasNickname(uuid)) { - spongedatabase.update("UPDATE nick_data SET u_nick = '" + nick + "', f_nick = '" + formattedNick + "' WHERE id = '" + uuid.toString() + "';"); + spongedatabase.safeUpdate("UPDATE nick_data SET u_nick = ?, f_nick = ? WHERE id = ?;", nick, formattedNick, uuid.toString()); } else { - spongedatabase.update("INSERT INTO nick_data VALUES ('" + uuid.toString() + "', '" + nick + "', '" + formattedNick + "');"); + spongedatabase.safeUpdate("INSERT INTO nick_data VALUES (?, ?, ?);", uuid.toString(), nick, formattedNick); } } @@ -391,10 +389,10 @@ public void registerMigratedPlayer(UUID uuid, String name, String formattedName, synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - spongedatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + formattedName + "', '" + name + "');"); + spongedatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), formattedName, name); if (setNick) { - spongedatabase.update("INSERT INTO nick_data VALUES ('" + uuid.toString() + "', '" + nick + "', '" + formattedNick + "');"); + spongedatabase.safeUpdate("INSERT INTO nick_data VALUES (?, ?, ?);", uuid.toString(), nick, formattedNick); } } @@ -427,7 +425,7 @@ public void registerOfflinePlayerByUUID(UUID uuid, String username) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - spongedatabase.update("INSERT INTO name_data VALUES ('" + uuid.toString() + "', '" + username + "', '" + username.toLowerCase() + "');"); + spongedatabase.safeUpdate("INSERT INTO name_data VALUES (?, ?, ?);", uuid.toString(), username, username.toLowerCase()); } @@ -470,10 +468,10 @@ public void setNickname(UUID uuid, String nickname) { if (hasNickname(uuid)) { spongedatabase.connectToDatabase(); - spongedatabase.update("UPDATE nick_data SET u_nick = '" + unformattedNickname + "', f_nick = '" + nickname + "' WHERE id = '" + uuid.toString() + "';"); + spongedatabase.safeUpdate("UPDATE nick_data SET u_nick = ?, f_nick = ? WHERE id = ?;", unformattedNickname, nickname, uuid.toString()); } else { spongedatabase.connectToDatabase(); - spongedatabase.update("INSERT INTO nick_data VALUES ('" + uuid.toString() + "', '" + unformattedNickname + "', '" + nickname + "');"); + spongedatabase.safeUpdate("INSERT INTO nick_data VALUES (?, ?, ?);", uuid.toString(), unformattedNickname, nickname); } } @@ -496,7 +494,7 @@ public boolean existsPlayer(String username) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT u_name FROM name_data WHERE u_name = '" + username.toLowerCase() + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT u_name FROM name_data WHERE u_name = ?;", username.toLowerCase()); if (results.next()) { return true; } else { @@ -523,7 +521,7 @@ public boolean existsNickname(String nickname) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT u_nick FROM nick_data WHERE u_nick = '" + stripAllFormattingCodes(nickname.toLowerCase()) + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT u_nick FROM nick_data WHERE u_nick = ?;", stripAllFormattingCodes(nickname.toLowerCase())); if (results.next()) { return true; } else { @@ -549,7 +547,7 @@ public boolean otherPlayerHasNickname(String nickname, UUID uuid) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id, u_nick FROM nick_data WHERE u_nick = '" + stripAllFormattingCodes(nickname.toLowerCase()) + "';"); + ResultSet results = spongedatabase.safeQuery("SELECT id, u_nick FROM nick_data WHERE u_nick = ?;", stripAllFormattingCodes(nickname.toLowerCase())); if (results.next()) { if (results.getString("id").equals(uuid.toString())) { return false; @@ -580,7 +578,7 @@ public Optional> getPartialNicknameMatches(String nickname) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id FROM nick_data WHERE (u_nick LIKE '%" + stripAllFormattingCodes(nickname.toLowerCase()) + "%');"); + ResultSet results = spongedatabase.safeQuery("SELECT id FROM nick_data WHERE (u_nick LIKE ?);", "%" + stripAllFormattingCodes(nickname.toLowerCase()) + "%"); if (results.next()) { Set uuids = new HashSet(); uuids.add(UUID.fromString(results.getString("id"))); @@ -614,7 +612,7 @@ public Optional> getPartialNameMatches(String name) { synchronized (spongedatabase) { spongedatabase.connectToDatabase(); - ResultSet results = spongedatabase.query("SELECT id, f_name FROM name_data WHERE (u_name LIKE '%" + name.toLowerCase() + "%');"); + ResultSet results = spongedatabase.safeQuery("SELECT id, f_name FROM name_data WHERE (u_name LIKE ?);", "%" + name.toLowerCase() + "%"); if (results.next()) { Set uuids = new HashSet(); uuids.add(UUID.fromString(results.getString("id"))); @@ -658,7 +656,7 @@ public void removeNickname(UUID uuid) { spongedatabase.connectToDatabase(); - spongedatabase.update("DELETE FROM nick_data WHERE id = '" + uuid.toString() + "';"); + spongedatabase.safeUpdate("DELETE FROM nick_data WHERE id = ?;", uuid.toString()); } diff --git a/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/commands/SpongeNickCommand.java b/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/commands/SpongeNickCommand.java index 8921d71d..630e76c9 100644 --- a/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/commands/SpongeNickCommand.java +++ b/multichat/src/main/java/xyz/olivermartin/multichat/spongebridge/commands/SpongeNickCommand.java @@ -116,7 +116,7 @@ public CommandResult execute(CommandSource sender, CommandContext args) throws C return CommandResult.success(); } - String targetNickname = SpongeNameManager.getInstance().stripAllFormattingCodes(SpongeNameManager.getInstance().getCurrentName(targetUUID)); + String targetNickname = SpongeNameManager.getInstance().stripAllFormattingCodes(SpongeNameManager.getInstance().getCurrentName(targetUUID, false)); if (SpongeNameManager.getInstance().existsNickname(strippedNickname) && !targetNickname.equalsIgnoreCase(strippedNickname)) { diff --git a/multichat/src/main/resources/bungee.yml b/multichat/src/main/resources/bungee.yml index 541c4ca4..8b79ea29 100644 --- a/multichat/src/main/resources/bungee.yml +++ b/multichat/src/main/resources/bungee.yml @@ -1,5 +1,5 @@ name: MultiChat main: xyz.olivermartin.multichat.bungee.MultiChat -version: 1.8 +version: 1.8.1 author: Revilo410 api-version: 1.15 \ No newline at end of file diff --git a/multichat/src/main/resources/chatcontrol.yml b/multichat/src/main/resources/chatcontrol.yml index d7370b1b..6db88dfe 100644 --- a/multichat/src/main/resources/chatcontrol.yml +++ b/multichat/src/main/resources/chatcontrol.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## # 1. Chat Control Rules diff --git a/multichat/src/main/resources/chatcontrol_fr.yml b/multichat/src/main/resources/chatcontrol_fr.yml index 2ba13a38..899dc427 100644 --- a/multichat/src/main/resources/chatcontrol_fr.yml +++ b/multichat/src/main/resources/chatcontrol_fr.yml @@ -6,10 +6,10 @@ # By Revilo410 -################# -# NE PAS EDITER # -version: "1.8" # -################# +################## +# NE PAS EDITER # +version: "1.8.1" # +################## # French Translation by Nogapra - Thank you ! # Pour utiliser ce fichier, renommer en 'chatcontrol.yml'. diff --git a/multichat/src/main/resources/config.yml b/multichat/src/main/resources/config.yml index 824aaa49..4d404831 100644 --- a/multichat/src/main/resources/config.yml +++ b/multichat/src/main/resources/config.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## # 1. General diff --git a/multichat/src/main/resources/config_fr.yml b/multichat/src/main/resources/config_fr.yml index a2c55282..1bb2bbc9 100644 --- a/multichat/src/main/resources/config_fr.yml +++ b/multichat/src/main/resources/config_fr.yml @@ -6,10 +6,10 @@ # By Revilo410 -################# -# NE PAS EDITER # -version: "1.8" # -################# +################## +# NE PAS EDITER # +version: "1.8.1" # +################## # French Translation by Nogapra - Thank you ! # Pour utiliser ce fichier, renommer en 'config.yml' diff --git a/multichat/src/main/resources/joinmessages.yml b/multichat/src/main/resources/joinmessages.yml index eb963240..85c8056b 100644 --- a/multichat/src/main/resources/joinmessages.yml +++ b/multichat/src/main/resources/joinmessages.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## ############################################################ diff --git a/multichat/src/main/resources/joinmessages_fr.yml b/multichat/src/main/resources/joinmessages_fr.yml index 431fee44..0ef01388 100644 --- a/multichat/src/main/resources/joinmessages_fr.yml +++ b/multichat/src/main/resources/joinmessages_fr.yml @@ -8,7 +8,7 @@ ################## # Ne pas éditer # -version: "1.8" # +version: "1.8.1" # ################## # French Translation by Nogapra - Thank you! diff --git a/multichat/src/main/resources/messages.yml b/multichat/src/main/resources/messages.yml index 18fc83b5..5bff86e3 100644 --- a/multichat/src/main/resources/messages.yml +++ b/multichat/src/main/resources/messages.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## ############################################################ diff --git a/multichat/src/main/resources/messages_fr.yml b/multichat/src/main/resources/messages_fr.yml index 3c17b2a1..23ba6e31 100644 --- a/multichat/src/main/resources/messages_fr.yml +++ b/multichat/src/main/resources/messages_fr.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## # French Translation by Nogapra - Thank you! diff --git a/multichat/src/main/resources/multichatsponge.yml b/multichat/src/main/resources/multichatsponge.yml index 2f418aa0..efa96ae6 100644 --- a/multichat/src/main/resources/multichatsponge.yml +++ b/multichat/src/main/resources/multichatsponge.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## # Specify the name of this server here for the %SERVER% placeholder diff --git a/multichat/src/main/resources/multichatsponge_fr.yml b/multichat/src/main/resources/multichatsponge_fr.yml index 23187617..dd53f985 100644 --- a/multichat/src/main/resources/multichatsponge_fr.yml +++ b/multichat/src/main/resources/multichatsponge_fr.yml @@ -8,7 +8,7 @@ ################## # NE PAS EDITER # -version: "1.8" # +version: "1.8.1" # ################## # French Translation by Nogapra - Thank you ! diff --git a/multichat/src/main/resources/plugin.yml b/multichat/src/main/resources/plugin.yml index d16e9bec..47531353 100644 --- a/multichat/src/main/resources/plugin.yml +++ b/multichat/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: MultiChatSpigot -version: 1.8 +version: 1.8.1 author: Revilo410 main: xyz.olivermartin.multichat.spigotbridge.MultiChatSpigot softdepend: [Vault,PlaceholderAPI] diff --git a/multichat/src/main/resources/spigotconfig.yml b/multichat/src/main/resources/spigotconfig.yml index c92bbbac..19992cc5 100644 --- a/multichat/src/main/resources/spigotconfig.yml +++ b/multichat/src/main/resources/spigotconfig.yml @@ -8,7 +8,7 @@ ################## # DON'T EDIT # -version: "1.8" # +version: "1.8.1" # ################## # Specify the name of this server here for the %SERVER% placeholder diff --git a/multichat/src/main/resources/spigotconfig_fr.yml b/multichat/src/main/resources/spigotconfig_fr.yml index a1f2bf7e..f0c04788 100644 --- a/multichat/src/main/resources/spigotconfig_fr.yml +++ b/multichat/src/main/resources/spigotconfig_fr.yml @@ -8,7 +8,7 @@ ################## # NE PAS EDITER # -version: "1.8" # +version: "1.8.1" # ################## # French Translation by Nogapra - Thank you !