Begin refactor

This commit is contained in:
DaMachinator 2018-02-17 11:39:05 -05:00
parent 19d7017336
commit 4c19b26ce3
5 changed files with 11 additions and 25 deletions

View File

@ -21,7 +21,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
//FORGE-DEPENDENT
@Mod.EventBusSubscriber
object EventWrapper {
object EventHandler {
//MC-VERSION & FORGE DEPENDENT
@SubscribeEvent
@ -38,7 +38,7 @@ object EventWrapper {
fun chatEvent(e: ServerChatEvent) {
val user = e.username
val msg = e.message
ChatHandler.handleChat(user, msg)
ChatProcessor.sendToBridge(user, msg,"")
}
//FORGE-DEPENDENT
@ -58,7 +58,7 @@ object EventWrapper {
e.command is CommandBroadcast -> ""
else -> return
}
CommandHandler.handleCommand(sender, args, type)
ChatProcessor.sendToBridge(sender, args, type)
}

View File

@ -21,7 +21,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
//FORGE-DEPENDENT
@Mod.EventBusSubscriber
object EventWrapper {
object EventHandler {
//MC-VERSION & FORGE DEPENDENT
@SubscribeEvent
@ -38,7 +38,7 @@ object EventWrapper {
fun chatEvent(e: ServerChatEvent) {
val user = e.username
val msg = e.message
ChatHandler.handleChat(user, msg)
ChatProcessor.sendToBridge(user, msg,"")
}
//FORGE-DEPENDENT
@ -58,7 +58,7 @@ object EventWrapper {
e.command is CommandBroadcast -> ""
else -> return
}
CommandHandler.handleCommand(sender, args, type)
ChatProcessor.sendToBridge(sender, args, type)
}

View File

@ -21,7 +21,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent
//FORGE-DEPENDENT
@Mod.EventBusSubscriber
object EventWrapper {
object EventHandler {
//MC-VERSION & FORGE DEPENDENT
@SubscribeEvent
@ -39,7 +39,7 @@ object EventWrapper {
fun chatEvent(e: ServerChatEvent) {
val user = e.username
val msg = e.message
ChatHandler.handleChat(user, msg)
ChatProcessor.sendToBridge(user, msg,"")
}
//FORGE-DEPENDENT
@ -59,7 +59,7 @@ object EventWrapper {
e.command is CommandBroadcast -> ""
else -> return
}
CommandHandler.handleCommand(sender, args, type)
ChatProcessor.sendToBridge(sender, args, type)
}

View File

@ -4,8 +4,8 @@ import matterlink.bridge.ApiMessage
import matterlink.bridge.MessageHandler
import matterlink.instance
object ChatHandler {
fun handleChat(user: String, msg: String) {
object ChatProcessor {
fun sendToBridge(user: String, msg: String, event: String) {
val message = msg.trim()
when {
message.isNotBlank() -> MessageHandler.transmit(ApiMessage(

View File

@ -1,14 +0,0 @@
package matterlink.handlers
import matterlink.bridge.ApiMessage
import matterlink.bridge.MessageHandler
object CommandHandler {
fun handleCommand(sender: String, args: String, type: String) {
MessageHandler.transmit(ApiMessage(
username = sender,
text = args,
event = type
))
}
}