RuneHive-Game
Loading...
Searching...
No Matches
ChatMessageEvent.kt
Go to the documentation of this file.
1package org.jire.runehiveps.event.widget
2
3import com.runehive.game.event.impl.log.ChatLogEvent
4import com.runehive.game.world.World
5import com.runehive.game.world.entity.mob.player.Player
6import com.runehive.game.world.entity.mob.player.relations.ChatColor
7import com.runehive.game.world.entity.mob.player.relations.ChatEffect
8import com.runehive.game.world.entity.mob.player.relations.ChatMessage
9import com.runehive.util.ChatCodec
10import java.util.*
11
12/**
13 * @author Jire
14 */
15class ChatMessageEvent(
16 val effect: Int,
17 val color: Int,
18 val size: Int,
19 val bytes: ByteArray
20) : WidgetEvent {
21
22 override fun handle(player: Player) {
23 val decoded = ChatCodec.decode(bytes)
24
25 player.chat(ChatMessage.create(decoded, ChatColor.values[color], ChatEffect.values[effect]))
26 World.getDataBus().publish(ChatLogEvent(player, decoded))
27
28 println("User: " + player.username.uppercase(Locale.getDefault()) + " said: " + decoded)
29 }
30
31}