Fix database timeout when not releasing connection. Fix '+' and '*' not

being escaped properly.
This commit is contained in:
Aust1n46 2020-03-26 12:33:03 -04:00
parent a7ff8e29a3
commit 2e4b748845
5 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
Version: 2.18.0
Version: 2.18.1
BlockCommandPlayer: '&cYou have been blocked from entering command {command}.'
BlockCommandSender: '&cBlocked player &6{player} &cfrom entering command {command}.'
BlockedCommand: '&cYou are blocked from entering this command: {command}'

View File

@ -1,4 +1,4 @@
name: VentureChat
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
version: 2.18.0
version: 2.18.1
author: Aust1n46

View File

@ -20,12 +20,11 @@ public abstract class Database {
public void writeVentureChat(String time, String uuid, String name, String server, String channel, String text, String type) {
MineverseChat plugin = MineverseChat.getInstance();
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try {
final Connection conn = dataSource.getConnection();
final PreparedStatement statement = conn.prepareStatement(
"INSERT INTO VentureChat " +
"(ChatTime, UUID, Name, Server, Channel, Text, Type) " +
"VALUES (?, ?, ?, ?, ?, ?, ?)");
try(final Connection conn = dataSource.getConnection();
final PreparedStatement statement = conn.prepareStatement(
"INSERT INTO VentureChat " +
"(ChatTime, UUID, Name, Server, Channel, Text, Type) " +
"VALUES (?, ?, ?, ?, ?, ?, ?)")) {
statement.setString(1, time);
statement.setString(2, uuid);
statement.setString(3, name);
@ -34,7 +33,8 @@ public abstract class Database {
statement.setString(6, text);
statement.setString(7, type);
statement.executeUpdate();
} catch(SQLException e) {
}
catch(SQLException e) {
throw new RuntimeException(e);
}
});

View File

@ -34,8 +34,8 @@ public class Format {
String prefix = "";
String suffix = "";
try {
prefix = FormatStringAll(MineverseChat.chat.getPlayerPrefix(sender.getPlayer()).replace("|", ""));
suffix = FormatStringAll(MineverseChat.chat.getPlayerSuffix(sender.getPlayer()).replace("|", ""));
prefix = FormatStringAll(MineverseChat.chat.getPlayerPrefix(sender.getPlayer()).replace("|", "").replace("+", "").replace("*", ""));
suffix = FormatStringAll(MineverseChat.chat.getPlayerSuffix(sender.getPlayer()).replace("|", "").replace("+", "").replace("*", ""));
if(suffix.equals("")) {
suffix = "venturechat_no_suffix_code";
}
@ -52,7 +52,7 @@ public class Format {
}
String nickname = "";
if(sender.getPlayer() != null) {
nickname = FormatStringAll(sender.getPlayer().getDisplayName().replace("|", ""));
nickname = FormatStringAll(sender.getPlayer().getDisplayName().replace("|", "").replace("+", "").replace("*", ""));
}
json += convertPlaceholders(f, JSONformat, prefix, nickname, suffix, sender);
json += "]}";

View File

@ -1,5 +1,5 @@
name: VentureChat
version: 2.18.0
version: 2.18.1
api-version: 1.13
main: mineverse.Aust1n46.chat.MineverseChat
depend: [Vault, ProtocolLib, PlaceholderAPI]