Change UserActionHandler to handle /say broadcasts as well
This commit is contained in:
parent
59fffab908
commit
bd91a381cd
|
@ -5,7 +5,7 @@ import civilengineering.bridge.ServerChatHelper
|
|||
import civilengineering.command.BridgeCommand
|
||||
import civilengineering.eventhandlers.ChatMessageHandler
|
||||
import civilengineering.eventhandlers.DeathEventHandler
|
||||
import civilengineering.eventhandlers.UserActionHandler
|
||||
import civilengineering.eventhandlers.CommandEventHandler
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.event.*
|
||||
|
@ -65,7 +65,7 @@ object CivilEngineering {
|
|||
MinecraftForge.EVENT_BUS.register(ServerChatHelper())
|
||||
MinecraftForge.EVENT_BUS.register(ChatMessageHandler())
|
||||
MinecraftForge.EVENT_BUS.register(DeathEventHandler())
|
||||
MinecraftForge.EVENT_BUS.register(UserActionHandler())
|
||||
MinecraftForge.EVENT_BUS.register(CommandEventHandler())
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package civilengineering.eventhandlers
|
||||
|
||||
import civilengineering.CivilEngineering
|
||||
import civilengineering.bridge.ApiMessage
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import net.minecraft.command.server.CommandBroadcast
|
||||
import net.minecraft.command.server.CommandEmote
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraftforge.event.CommandEvent
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
|
||||
class UserActionHandler {
|
||||
class CommandEventHandler {
|
||||
@SubscribeEvent
|
||||
fun handleCommandEvent(event: CommandEvent) {
|
||||
if (event.command is CommandEmote && event.sender is EntityPlayer) {
|
||||
|
@ -22,6 +24,14 @@ class UserActionHandler {
|
|||
message = message.trim { it <= ' ' }
|
||||
|
||||
MessageHandler.transmit(ApiMessage(username=user, text=message, event="user_action"))
|
||||
} else if(event.command is CommandBroadcast) {
|
||||
var message = ""
|
||||
for (word in event.parameters) {
|
||||
message = message + " " + word
|
||||
}
|
||||
message = message.trim { it <= ' ' }
|
||||
|
||||
MessageHandler.transmit(ApiMessage(event.sender.name,message))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"modid": "civilengineering",
|
||||
"name": "Civil Engineering",
|
||||
"description": "Minecraft Server Matterbridge link",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1q.1",
|
||||
"mcversion": "1.12.2",
|
||||
"authorList":["Arcanitor", "NikkyAi"],
|
||||
"credits": "Blame Nikky for talking me into this."
|
||||
|
|
Loading…
Reference in New Issue