mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 20:05:02 -04:00
internal chat: differentiate between debug and internal messages
This commit is contained in:
parent
06e3b386dd
commit
2dda35ea74
@ -18,6 +18,6 @@ import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
class PlayerPrintTarget(val connection: PlayConnection) : PrintTarget {
|
||||
|
||||
override fun print(message: Any) {
|
||||
connection.util.sendDebugMessage(message)
|
||||
connection.util.sendInternal(message)
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ object RenderConstants {
|
||||
const val COLORMAP_SIZE = 255
|
||||
|
||||
const val DEBUG_MESSAGES_PREFIX = "§f[§e§lDEBUG§f] "
|
||||
const val INTERNAL_MESSAGES_PREFIX = "§f[§a§lINTERNAL§f] "
|
||||
|
||||
val TEXT_BACKGROUND_COLOR = RGBColor(0, 0, 0, 80)
|
||||
|
||||
|
@ -76,17 +76,18 @@ class ScreenshotTaker(
|
||||
ImageIO.write(bufferedImage, "png", file)
|
||||
var deleted = false
|
||||
|
||||
renderWindow.connection.util.sendDebugMessage(BaseComponent(
|
||||
"§aScreenshot saved: ",
|
||||
TextComponent(file.name).apply {
|
||||
color = ChatColors.WHITE
|
||||
underline()
|
||||
clickEvent = OpenFileClickEvent(file.slashPath)
|
||||
hoverEvent = TextHoverEvent("Click to open")
|
||||
},
|
||||
" ",
|
||||
TextComponent("[DELETE]").apply {
|
||||
color = ChatColors.RED
|
||||
renderWindow.connection.util.sendInternal(
|
||||
BaseComponent(
|
||||
"§aScreenshot saved: ",
|
||||
TextComponent(file.name).apply {
|
||||
color = ChatColors.WHITE
|
||||
underline()
|
||||
clickEvent = OpenFileClickEvent(file.slashPath)
|
||||
hoverEvent = TextHoverEvent("Click to open")
|
||||
},
|
||||
" ",
|
||||
TextComponent("[DELETE]").apply {
|
||||
color = ChatColors.RED
|
||||
bold()
|
||||
clickEvent = ClickCallbackClickEvent {
|
||||
if (deleted) {
|
||||
@ -113,7 +114,7 @@ class ScreenshotTaker(
|
||||
|
||||
private fun Throwable?.fail() {
|
||||
this?.printStackTrace()
|
||||
renderWindow.connection.util.sendDebugMessage("§cFailed to make a screenshot: ${this?.message}")
|
||||
renderWindow.connection.util.sendInternal("§cFailed to make a screenshot: ${this?.message}")
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -33,8 +33,16 @@ class ConnectionUtil(
|
||||
) {
|
||||
|
||||
fun sendDebugMessage(message: Any) {
|
||||
connection.fireEvent(InternalMessageReceiveEvent(connection, BaseComponent(RenderConstants.DEBUG_MESSAGES_PREFIX, ChatComponent.of(message).apply { applyDefaultColor(ChatColors.BLUE) })))
|
||||
Log.log(LogMessageType.CHAT_IN, LogLevels.INFO) { message }
|
||||
val component = BaseComponent(RenderConstants.DEBUG_MESSAGES_PREFIX, ChatComponent.of(message).apply { applyDefaultColor(ChatColors.BLUE) })
|
||||
connection.fireEvent(InternalMessageReceiveEvent(connection, component))
|
||||
Log.log(LogMessageType.CHAT_IN, LogLevels.INFO) { component }
|
||||
}
|
||||
|
||||
fun sendInternal(message: Any) {
|
||||
val component = ChatComponent.of(message)
|
||||
val prefixed = BaseComponent(RenderConstants.INTERNAL_MESSAGES_PREFIX, component)
|
||||
connection.fireEvent(InternalMessageReceiveEvent(connection, if (connection.profiles.gui.chat.internal.hidden) prefixed else component))
|
||||
Log.log(LogMessageType.CHAT_IN, LogLevels.INFO) { prefixed }
|
||||
}
|
||||
|
||||
fun sendChatMessage(message: String) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user