1package org.jire.runehiveps.event.widget
3import com.runehive.content.clanchannel.channel.ClanChannel
4import com.runehive.game.event.impl.CommandEvent
5import com.runehive.game.plugin.PluginManager
6import com.runehive.game.world.entity.mob.player.Player
7import com.runehive.game.world.entity.mob.player.command.CommandParser
8import com.runehive.util.Utility
13class CommandEvent(val input: String) : WidgetEvent {
15 override fun handle(player: Player) {
16 val parser = CommandParser.split(input, " ")
18 if (parser.command.startsWith("/")) {
19 if (player.punishment.isMuted) {
20 player.message("You can not send clan messages while muted!")
23 player.forClan { channel: ClanChannel ->
24 val copy = CommandParser.split(input, "/")
26 val line = copy.nextLine()
27 channel.chat(player.name, Utility.capitalizeSentence(line))
33 PluginManager.getDataBus().publish(player, CommandEvent(parser))