More wrappers
This commit is contained in:
parent
cac5c59f75
commit
224af67113
|
@ -56,6 +56,7 @@ object MatterLink {
|
|||
BridgeCommandRegistry.registerAll(PlayerListCommand, HelpCommand)
|
||||
}
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
fun serverStarting(event: FMLServerStartingEvent) {
|
||||
logger.debug("Registering server commands")
|
||||
|
@ -69,8 +70,13 @@ object MatterLink {
|
|||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
fun writeToServerChat(msg: String) {
|
||||
fun wrappedSendToPlayers(msg: String) {
|
||||
FMLCommonHandler.instance().minecraftServerInstance.playerList.sendMessage(TextComponentString(msg))
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
fun wrappedPlayerList(): Array<String> {
|
||||
return FMLCommonHandler.instance().minecraftServerInstance.playerList.onlinePlayerNames
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,10 +3,6 @@ package matterlink.bridge
|
|||
import matterlink.MatterLink
|
||||
import matterlink.bridge.command.BridgeCommandRegistry
|
||||
import matterlink.cfg
|
||||
import net.minecraft.util.text.TextComponentString
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent
|
||||
|
||||
object ServerChatHandler {
|
||||
/**
|
||||
|
@ -39,7 +35,7 @@ object ServerChatHandler {
|
|||
return
|
||||
}
|
||||
}
|
||||
FMLCommonHandler.instance().minecraftServerInstance.playerList.sendMessage(TextComponentString(message))
|
||||
MatterLink.wrappedSendToPlayers(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package matterlink.bridge.command
|
||||
|
||||
import matterlink.MatterLink
|
||||
import matterlink.antiping
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.cfg
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
|
||||
object PlayerListCommand : IBridgeCommand {
|
||||
override val name: String = "players"
|
||||
|
@ -14,7 +14,7 @@ object PlayerListCommand : IBridgeCommand {
|
|||
|
||||
MessageHandler.transmit(ApiMessage(
|
||||
username = cfg!!.relay.systemUser,
|
||||
text = FMLCommonHandler.instance().minecraftServerInstance.playerList.onlinePlayerNames.joinToString(" ") { it.antiping() }
|
||||
text = MatterLink.wrappedPlayerList().joinToString(" ") { it.antiping() }
|
||||
))
|
||||
|
||||
return true
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package matterlink.handlers
|
||||
|
||||
import matterlink.antiping
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.JOIN_LEAVE
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.cfg
|
||||
import matterlink.antiping
|
||||
import matterlink.bridge.JOIN_LEAVE
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent
|
||||
|
||||
object JoinLeaveHandler {
|
||||
fun handleJoin(player: String) {
|
||||
|
|
Loading…
Reference in New Issue