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 //FORGE-DEPENDENT
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
object EventWrapper { object EventHandler {
//MC-VERSION & FORGE DEPENDENT //MC-VERSION & FORGE DEPENDENT
@SubscribeEvent @SubscribeEvent
@ -38,7 +38,7 @@ object EventWrapper {
fun chatEvent(e: ServerChatEvent) { fun chatEvent(e: ServerChatEvent) {
val user = e.username val user = e.username
val msg = e.message val msg = e.message
ChatHandler.handleChat(user, msg) ChatProcessor.sendToBridge(user, msg,"")
} }
//FORGE-DEPENDENT //FORGE-DEPENDENT
@ -58,7 +58,7 @@ object EventWrapper {
e.command is CommandBroadcast -> "" e.command is CommandBroadcast -> ""
else -> return 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 //FORGE-DEPENDENT
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
object EventWrapper { object EventHandler {
//MC-VERSION & FORGE DEPENDENT //MC-VERSION & FORGE DEPENDENT
@SubscribeEvent @SubscribeEvent
@ -38,7 +38,7 @@ object EventWrapper {
fun chatEvent(e: ServerChatEvent) { fun chatEvent(e: ServerChatEvent) {
val user = e.username val user = e.username
val msg = e.message val msg = e.message
ChatHandler.handleChat(user, msg) ChatProcessor.sendToBridge(user, msg,"")
} }
//FORGE-DEPENDENT //FORGE-DEPENDENT
@ -58,7 +58,7 @@ object EventWrapper {
e.command is CommandBroadcast -> "" e.command is CommandBroadcast -> ""
else -> return 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 //FORGE-DEPENDENT
@Mod.EventBusSubscriber @Mod.EventBusSubscriber
object EventWrapper { object EventHandler {
//MC-VERSION & FORGE DEPENDENT //MC-VERSION & FORGE DEPENDENT
@SubscribeEvent @SubscribeEvent
@ -39,7 +39,7 @@ object EventWrapper {
fun chatEvent(e: ServerChatEvent) { fun chatEvent(e: ServerChatEvent) {
val user = e.username val user = e.username
val msg = e.message val msg = e.message
ChatHandler.handleChat(user, msg) ChatProcessor.sendToBridge(user, msg,"")
} }
//FORGE-DEPENDENT //FORGE-DEPENDENT
@ -59,7 +59,7 @@ object EventWrapper {
e.command is CommandBroadcast -> "" e.command is CommandBroadcast -> ""
else -> return 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.bridge.MessageHandler
import matterlink.instance import matterlink.instance
object ChatHandler { object ChatProcessor {
fun handleChat(user: String, msg: String) { fun sendToBridge(user: String, msg: String, event: String) {
val message = msg.trim() val message = msg.trim()
when { when {
message.isNotBlank() -> MessageHandler.transmit(ApiMessage( 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
))
}
}