修复<br>标签导致颜色变白和交易同步缺少id字段
This commit is contained in:
@@ -779,12 +779,13 @@ public class BondManager {
|
|||||||
List<Map<String, Object>> transactions = new ArrayList<>();
|
List<Map<String, Object>> transactions = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
PreparedStatement ps = db.prepareStatement(
|
PreparedStatement ps = db.prepareStatement(
|
||||||
"SELECT player_name, type, amount, target_player, operator, reason, balance_before, balance_after, time "
|
"SELECT id, player_name, type, amount, target_player, operator, reason, balance_before, balance_after, time "
|
||||||
+ "FROM bond_transaction WHERE time > ? ORDER BY time ASC");
|
+ "FROM bond_transaction WHERE time > ? ORDER BY time ASC");
|
||||||
ps.setLong(1, afterTime);
|
ps.setLong(1, afterTime);
|
||||||
ResultSet rs = ps.executeQuery();
|
ResultSet rs = ps.executeQuery();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
Map<String, Object> tx = new LinkedHashMap<>();
|
Map<String, Object> tx = new LinkedHashMap<>();
|
||||||
|
tx.put("id", rs.getInt("id"));
|
||||||
tx.put("player_name", rs.getString("player_name"));
|
tx.put("player_name", rs.getString("player_name"));
|
||||||
tx.put("type", rs.getString("type"));
|
tx.put("type", rs.getString("type"));
|
||||||
tx.put("amount", rs.getInt("amount"));
|
tx.put("amount", rs.getInt("amount"));
|
||||||
|
|||||||
@@ -1661,13 +1661,10 @@ public class ShopManager implements Listener {
|
|||||||
result = result.replaceAll("<u>(.*?)</u>", "§n$1§r");
|
result = result.replaceAll("<u>(.*?)</u>", "§n$1§r");
|
||||||
result = result.replaceAll("<b>(.*?)</b>", "§l$1§r");
|
result = result.replaceAll("<b>(.*?)</b>", "§l$1§r");
|
||||||
result = result.replaceAll("<i>(.*?)</i>", "§o$1§r");
|
result = result.replaceAll("<i>(.*?)</i>", "§o$1§r");
|
||||||
result = result.replaceAll("<br>", "\n");
|
|
||||||
result = result.replaceAll("<br/>", "\n");
|
|
||||||
|
|
||||||
// 3. 处理 <p style="color:#xxx"> 或 <p style="color:xxx">
|
// 3. 处理 <p style="color:#xxx"> 或 <p style="color:xxx">
|
||||||
java.util.regex.Pattern pPattern = java.util.regex.Pattern.compile(
|
java.util.regex.Pattern pPattern = java.util.regex.Pattern.compile(
|
||||||
"<p\\s+style=[\"']color:\\s*(#[0-9a-fA-F]{3,8}|[a-zA-Z_]+|rgb\\([^)]+\\)|rgba\\([^)]+\\)|hsl\\([^)]+\\)|hsla\\([^)]+\\))\\s*;?[\"']\\s*>(.*?)</p>",
|
"<p\\s+style=[\"']color:\\s*(#[0-9a-fA-F]{3,8}|[a-zA-Z_]+|rgb\\([^)]+\\)|rgba\\([^)]+\\)|hsl\\([^)]+\\)|hsla\\([^)]+\\))\\s*;?[\"']\\s*>(.*?)</p>",
|
||||||
java.util.regex.Pattern.CASE_INSENSITIVE);
|
java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.DOTALL);
|
||||||
java.util.regex.Matcher pMatcher = pPattern.matcher(result);
|
java.util.regex.Matcher pMatcher = pPattern.matcher(result);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
while (pMatcher.find()) {
|
while (pMatcher.find()) {
|
||||||
@@ -1678,6 +1675,8 @@ public class ShopManager implements Listener {
|
|||||||
}
|
}
|
||||||
pMatcher.appendTail(sb);
|
pMatcher.appendTail(sb);
|
||||||
result = sb.toString();
|
result = sb.toString();
|
||||||
|
result = result.replaceAll("<br>", "\n");
|
||||||
|
result = result.replaceAll("<br/>", "\n");
|
||||||
|
|
||||||
// 4. 处理 <p>段落</p> (无style) → 换行分隔
|
// 4. 处理 <p>段落</p> (无style) → 换行分隔
|
||||||
result = result.replaceAll("<p>(.*?)</p>", "$1\n");
|
result = result.replaceAll("<p>(.*?)</p>", "$1\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user