Brikster / Chatty

Bukkit-compatible chat management system
MIT License
92 stars 47 forks source link

[v3] Проблема со spy модом при проксировании #323

Closed Vinellon closed 1 week ago

Vinellon commented 2 months ago
[21:18:25] [Async Chat Thread - #7/ERROR]: [ru.brikster.chatty.chat.executor.LegacyEventExecutor] Cannot handle chat event
java.lang.IllegalStateException: Cannot check player spy mode
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.repository.player.MysqlPlayerDataRepository.isEnableSpy(MysqlPlayerDataRepository.java:222) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.chat.message.transform.stage.early.SpyModeStrategy.handle(SpyModeStrategy.java:34) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.chat.message.transform.processor.MessageTransformStrategiesProcessorImpl.handle(MessageTransformStrategiesProcessorImpl.java:43) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.chat.executor.LegacyEventExecutor.onChat(LegacyEventExecutor.java:74) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.chat.executor.LegacyEventExecutor.execute(LegacyEventExecutor.java:62) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:72) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:60) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:629) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
    at io.papermc.paper.adventure.ChatProcessor.post(ChatProcessor.java:380) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at io.papermc.paper.adventure.ChatProcessor.process(ChatProcessor.java:87) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.chat(ServerGamePacketListenerImpl.java:2457) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.broadcastChatMessage(ServerGamePacketListenerImpl.java:2573) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChat$14(ServerGamePacketListenerImpl.java:2198) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at net.minecraft.util.FutureChain.lambda$append$1(FutureChain.java:25) ~[leaf-1.21.jar:1.21-DEV-ee6983a]
    at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
    at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
    at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.sql.SQLException: Before start of result set
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:81) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:55) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.result.ResultSetImpl.checkRowPos(ResultSetImpl.java:519) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1237) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.result.ResultSetImpl.getBoolean(ResultSetImpl.java:695) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at com.mysql.cj.jdbc.result.ResultSetImpl.getBoolean(ResultSetImpl.java:701) ~[mysql-connector-j-8.4.0.jar:8.4.0]
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.shaded.com.zaxxer.hikari.pool.HikariProxyResultSet.getBoolean(HikariProxyResultSet.java) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    at Chatty-3.0.0-SNAPSHOT.jar/ru.brikster.chatty.repository.player.MysqlPlayerDataRepository.isEnableSpy(MysqlPlayerDataRepository.java:220) ~[Chatty-3.0.0-SNAPSHOT.jar:?]
    ... 19 more
[21:18:25] [Async Chat Thread - #7/WARN]: [ru.brikster.chatty.chat.executor.LegacyEventExecutor] Cannot handle unprocessed chat event from "Vinely" with format "<%1$s> %2$s" and message "dawdaw"
BoBkiNN commented 1 week ago

Возможный фикс: https://github.com/Brikster/Chatty/blob/cd1e56c803ff4d94e80cbd48ab29946ecb2c3207/spigot/src/main/java/ru/brikster/chatty/repository/player/MysqlPlayerDataRepository.java#L220 Поменять на

if (resultSet.next()) {
    return resultSet.getBoolean("spy");
} else return false;
Brikster commented 1 week ago

Исправлено в 08fd97c·