blob: 37456609e83dada204198ad2808d6b2ad0b552a0 [file] [log] [blame] [raw]
package li.cil.oc.common
import cpw.mods.fml.common.{ModContainer, Loader}
import cpw.mods.fml.common.network.{Player, IConnectionHandler}
import li.cil.oc.{UpdateCheck, Settings}
import li.cil.oc.util.LuaStateFactory
import li.cil.oc.util.mods.ProjectRed
import net.minecraft.entity.player.EntityPlayerMP
import net.minecraft.network.packet.{Packet1Login, NetHandler}
import net.minecraft.network.{NetLoginHandler, INetworkManager}
import net.minecraft.server.MinecraftServer
import net.minecraft.util.ChatMessageComponent
import scala.collection.convert.WrapAsScala._
object ConnectionHandler extends IConnectionHandler {
def playerLoggedIn(player: Player, netHandler: NetHandler, manager: INetworkManager) {
if (netHandler.isServerHandler) player match {
case p: EntityPlayerMP =>
if (!LuaStateFactory.isAvailable) {
p.sendChatToPlayer(ChatMessageComponent.createFromText("§aOpenComputers§f: ").addKey(Settings.namespace + "gui.Chat.WarningLuaFallback"))
}
if (ProjectRed.isAvailable && !ProjectRed.isAPIAvailable) {
p.sendChatToPlayer(ChatMessageComponent.createFromText("§aOpenComputers§f: ").addKey(Settings.namespace + "gui.Chat.WarningProjectRed"))
}
if (!Settings.get.pureIgnorePower && !Loader.isModLoaded("UniversalElectricity")) {
p.sendChatToPlayer(ChatMessageComponent.createFromText("§aOpenComputers§f: ").addKey(Settings.namespace + "gui.Chat.WarningPower"))
}
val mod = Loader.instance.getIndexedModList.get("OpenComputers")
new UpdateCheck(mod.getVersion, p)
case _ =>
}
}
def connectionReceived(netHandler: NetLoginHandler, manager: INetworkManager) = null
def connectionOpened(netClientHandler: NetHandler, server: String, port: Int, manager: INetworkManager) {
}
def connectionOpened(netClientHandler: NetHandler, server: MinecraftServer, manager: INetworkManager) {
}
def connectionClosed(manager: INetworkManager) {
}
def clientLoggedIn(clientHandler: NetHandler, manager: INetworkManager, login: Packet1Login) {
}
}