move to elytra namespace and rename to matterlink
This commit is contained in:
parent
7d44539b91
commit
0f82a1ad24
27
.travis.yml
27
.travis.yml
|
@ -1,27 +0,0 @@
|
|||
language: java
|
||||
jdk:
|
||||
- openjdk8
|
||||
|
||||
before_install:
|
||||
- chmod +x gradlew
|
||||
|
||||
install: ./gradlew setupCIWorkspace -S
|
||||
script: ./gradlew build -S
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
channels:
|
||||
- "irc.esper.net#ruby"
|
||||
template:
|
||||
- "%{repository}#%{build_number} (%{branch} - %{commit} : %{commit_message} by %{author}): %{message} Details: %{build_url} Changes: %{compare_url}"
|
||||
use_notice: true
|
||||
# nick: travis-ci
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
29
README.md
29
README.md
|
@ -1,5 +1,28 @@
|
|||
# CivilEngineering
|
||||
|
||||
[![Build Status](https://travis-ci.org/NikkyAI/CivilEngineering.svg?branch=master)](https://travis-ci.org/NikkyAI/CivilEngineering)
|
||||
# MatterLink
|
||||
|
||||
matterbridge for MC servers
|
||||
|
||||
https://github.com/42wim/matterbridge
|
||||
|
||||
requires api section to be setup along these lines
|
||||
|
||||
```
|
||||
[api]
|
||||
[api.local]
|
||||
BindAddress="0.0.0.0:4343" # or listen only to localhost
|
||||
|
||||
#Bearer token used for authentication
|
||||
#curl -H "Authorization: Bearer testtoken" http://localhost:4343/api/messages
|
||||
|
||||
#OPTIONAL (no authorization if token is empty)
|
||||
Token="testtoken"
|
||||
|
||||
Buffer=1000
|
||||
|
||||
RemoteNickFormat="{NICK}"
|
||||
|
||||
ShowJoinPart = true
|
||||
```
|
||||
|
||||
values you need to remember are obviously the IP, port and token
|
||||
MatterLInk will need them in the configuration
|
|
@ -18,7 +18,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
|||
|
||||
|
||||
version = "0.2.0"
|
||||
group = "civilengineering" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
group = "matterlink" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "CivilEngineering"
|
||||
|
||||
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package civilengineering
|
||||
package matterlink
|
||||
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import civilengineering.bridge.ServerChatHelper
|
||||
import civilengineering.command.BridgeCommand
|
||||
import civilengineering.eventhandlers.*
|
||||
import net.minecraft.advancements.Advancement
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.bridge.ServerChatHelper
|
||||
import matterlink.command.BridgeCommand
|
||||
import matterlink.eventhandlers.*
|
||||
import net.minecraftforge.common.MinecraftForge
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.event.*
|
||||
|
@ -15,8 +14,8 @@ import org.apache.logging.log4j.simple.SimpleLogger
|
|||
import org.apache.logging.log4j.util.PropertiesUtil
|
||||
import java.util.*
|
||||
|
||||
const val MODID = "civilengineering"
|
||||
const val NAME = "Civil Engineering"
|
||||
const val MODID = "matterlink"
|
||||
const val NAME = "MatterLink"
|
||||
const val VERSION = "0.2.0"
|
||||
|
||||
@Mod(
|
||||
|
@ -27,7 +26,7 @@ const val VERSION = "0.2.0"
|
|||
acceptableRemoteVersions = "*",
|
||||
modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter"
|
||||
)
|
||||
object CivilEngineering {
|
||||
object MatterLink {
|
||||
//create fake logger to get around Nullability
|
||||
var logger: Logger = SimpleLogger("",
|
||||
Level.OFF,
|
||||
|
@ -45,7 +44,7 @@ object CivilEngineering {
|
|||
logger = event.modLog
|
||||
logger.info("Building bridge!")
|
||||
|
||||
CivilEngineeringConfig(event.modConfigurationDirectory)
|
||||
MatterLinkConfig()
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
|
@ -1,11 +1,11 @@
|
|||
package civilengineering
|
||||
package matterlink
|
||||
|
||||
import net.minecraftforge.common.config.Configuration
|
||||
import java.io.File
|
||||
|
||||
var cfg: CivilEngineeringConfig? = null
|
||||
var cfg: MatterLinkConfig? = null
|
||||
|
||||
class CivilEngineeringConfig(file: File) {
|
||||
class MatterLinkConfig() {
|
||||
private val CATEGORY_RELAY_OPTIONS = "relay"
|
||||
private val CATEGORY_FORMATTING = "formatting"
|
||||
private val CATEGORY_CONNECTION = "connection"
|
||||
|
@ -34,8 +34,8 @@ class CivilEngineeringConfig(file: File) {
|
|||
)
|
||||
|
||||
init {
|
||||
CivilEngineering.logger.info("Reading bridge blueprints...")
|
||||
val config = Configuration(file.resolve("CivilEngineering.cfg"))
|
||||
MatterLink.logger.info("Reading bridge blueprints...")
|
||||
val config = Configuration()
|
||||
|
||||
config.addCustomCategoryComment(CATEGORY_RELAY_OPTIONS, "Relay options")
|
||||
relay = RelayOptions(
|
|
@ -1,4 +1,4 @@
|
|||
package civilengineering
|
||||
package matterlink
|
||||
|
||||
|
||||
private const val ZWSP: Char = '\u200b'
|
|
@ -1,7 +1,7 @@
|
|||
package civilengineering.bridge
|
||||
package matterlink.bridge
|
||||
|
||||
import civilengineering.cfg
|
||||
import civilengineering.antiping
|
||||
import matterlink.cfg
|
||||
import matterlink.antiping
|
||||
import com.google.gson.Gson
|
||||
|
||||
data class ApiMessage(
|
|
@ -1,6 +1,6 @@
|
|||
package civilengineering.bridge;
|
||||
package matterlink.bridge;
|
||||
|
||||
import civilengineering.CivilEngineering
|
||||
import matterlink.MatterLink
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.apache.http.impl.client.HttpClients
|
||||
import java.io.InputStream
|
||||
|
@ -30,7 +30,7 @@ class HttpStreamConnection(private val getClosure: () -> HttpGet, private val mh
|
|||
if (chars > 0) {
|
||||
buffer += String(buf.dropLast(buf.count() - chars).toByteArray())
|
||||
|
||||
CivilEngineering.logger.debug(buffer)
|
||||
MatterLink.logger.debug(buffer)
|
||||
|
||||
while (buffer.contains("\n")) {
|
||||
val line = buffer.substringBefore("\n")
|
||||
|
@ -42,11 +42,11 @@ class HttpStreamConnection(private val getClosure: () -> HttpGet, private val mh
|
|||
}
|
||||
}
|
||||
} catch (e: SocketException) {
|
||||
// CivilEngineering.logger.error("Bridge Connection interrupted...")
|
||||
// MatterLink.logger.error("Bridge Connection interrupted...")
|
||||
}
|
||||
CivilEngineering.logger.debug("closing stream")
|
||||
MatterLink.logger.debug("closing stream")
|
||||
content.close()
|
||||
CivilEngineering.logger.debug("thread finished")
|
||||
MatterLink.logger.debug("thread finished")
|
||||
onClose()
|
||||
return
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package civilengineering.bridge
|
||||
package matterlink.bridge
|
||||
|
||||
import civilengineering.CivilEngineering
|
||||
import civilengineering.cfg
|
||||
import matterlink.MatterLink
|
||||
import matterlink.cfg
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.apache.http.client.methods.HttpPost
|
||||
import org.apache.http.client.methods.HttpRequestBase
|
||||
|
@ -30,7 +30,7 @@ object MessageHandler {
|
|||
}
|
||||
|
||||
private fun createThread(): HttpStreamConnection {
|
||||
CivilEngineering.logger.info("Attempting to open bridge connection.")
|
||||
MatterLink.logger.info("Attempting to open bridge connection.")
|
||||
return HttpStreamConnection(
|
||||
{
|
||||
HttpGet(cfg!!.connect.url + "/api/stream").apply {
|
||||
|
@ -41,10 +41,10 @@ object MessageHandler {
|
|||
rcvQueue.add(
|
||||
ApiMessage.decode(it)
|
||||
)
|
||||
CivilEngineering.logger.debug("Received: " + it)
|
||||
MatterLink.logger.debug("Received: " + it)
|
||||
},
|
||||
{
|
||||
CivilEngineering.logger.info("Bridge connection closed!")
|
||||
MatterLink.logger.info("Bridge connection closed!")
|
||||
connected = false
|
||||
}
|
||||
)
|
||||
|
@ -52,13 +52,13 @@ object MessageHandler {
|
|||
|
||||
fun transmit(msg: ApiMessage) {
|
||||
if (connected && streamConnection.isAlive) {
|
||||
CivilEngineering.logger.debug("Transmitting: " + msg)
|
||||
MatterLink.logger.debug("Transmitting: " + msg)
|
||||
transmitMessage(msg)
|
||||
}
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
CivilEngineering.logger.info("Closing bridge connection...")
|
||||
MatterLink.logger.info("Closing bridge connection...")
|
||||
// MessageHandler.transmit(ApiMessage(text="bridge closing", username="Server"))
|
||||
streamConnection.close()
|
||||
}
|
||||
|
@ -87,14 +87,14 @@ object MessageHandler {
|
|||
val response = client.execute(post)
|
||||
val code = response.statusLine.statusCode
|
||||
if (code != 200) {
|
||||
CivilEngineering.logger.error("Server returned $code for $post")
|
||||
MatterLink.logger.error("Server returned $code for $post")
|
||||
}
|
||||
sendErrors = 0
|
||||
} catch (e: IOException) {
|
||||
CivilEngineering.logger.error("sending message caused $e")
|
||||
MatterLink.logger.error("sending message caused $e")
|
||||
sendErrors++
|
||||
if (sendErrors > 5) {
|
||||
CivilEngineering.logger.error("caught too many errors, closing bridge")
|
||||
MatterLink.logger.error("caught too many errors, closing bridge")
|
||||
stop()
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package civilengineering.bridge
|
||||
package matterlink.bridge
|
||||
|
||||
import civilengineering.CivilEngineering
|
||||
import civilengineering.cfg
|
||||
import matterlink.MatterLink
|
||||
import matterlink.cfg
|
||||
import net.minecraft.util.text.TextComponentString
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
|
@ -11,7 +11,7 @@ class ServerChatHelper {
|
|||
@SubscribeEvent
|
||||
fun onServerUpdate(event: TickEvent.ServerTickEvent) {
|
||||
if (MessageHandler.rcvQueue.isNotEmpty())
|
||||
CivilEngineering.logger.debug("incoming: " + MessageHandler.rcvQueue.toString())
|
||||
MatterLink.logger.debug("incoming: " + MessageHandler.rcvQueue.toString())
|
||||
val nextMessage = MessageHandler.rcvQueue.poll()
|
||||
|
||||
if (nextMessage != null && nextMessage.gateway == cfg!!.connect.gateway) {
|
||||
|
@ -25,11 +25,11 @@ class ServerChatHelper {
|
|||
val user = nextMessage.username
|
||||
val text = nextMessage.text
|
||||
val json = nextMessage.encode()
|
||||
CivilEngineering.logger.debug("Threw out message with unhandled event: $event")
|
||||
CivilEngineering.logger.debug(" Message contents:")
|
||||
CivilEngineering.logger.debug(" User: $user")
|
||||
CivilEngineering.logger.debug(" Text: $text")
|
||||
CivilEngineering.logger.debug(" JSON: $json")
|
||||
MatterLink.logger.debug("Threw out message with unhandled event: $event")
|
||||
MatterLink.logger.debug(" Message contents:")
|
||||
MatterLink.logger.debug(" User: $user")
|
||||
MatterLink.logger.debug(" Text: $text")
|
||||
MatterLink.logger.debug(" JSON: $json")
|
||||
return
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package civilengineering.command
|
||||
package matterlink.command
|
||||
|
||||
import civilengineering.*
|
||||
import civilengineering.CivilEngineering.logger
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import matterlink.*
|
||||
import matterlink.MatterLink.logger
|
||||
import matterlink.bridge.MessageHandler
|
||||
import com.google.common.collect.Lists
|
||||
import net.minecraft.command.CommandBase
|
||||
import net.minecraft.command.ICommandSender
|
|
@ -1,9 +1,9 @@
|
|||
package civilengineering.eventhandlers
|
||||
package matterlink.eventhandlers
|
||||
|
||||
import civilengineering.bridge.ApiMessage
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import civilengineering.cfg
|
||||
import civilengineering.antiping
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.cfg
|
||||
import matterlink.antiping
|
||||
import net.minecraftforge.event.entity.player.AdvancementEvent
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package civilengineering.eventhandlers
|
||||
package matterlink.eventhandlers
|
||||
|
||||
import civilengineering.bridge.ApiMessage
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
package civilengineering.eventhandlers
|
||||
package matterlink.eventhandlers
|
||||
|
||||
import civilengineering.CivilEngineering
|
||||
import civilengineering.bridge.ApiMessage
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import net.minecraft.command.server.CommandBroadcast
|
||||
import net.minecraft.command.server.CommandEmote
|
||||
import net.minecraft.entity.player.EntityPlayer
|
|
@ -1,9 +1,9 @@
|
|||
package civilengineering.eventhandlers
|
||||
package matterlink.eventhandlers
|
||||
|
||||
import civilengineering.bridge.ApiMessage
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import civilengineering.cfg
|
||||
import civilengineering.antiping
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.cfg
|
||||
import matterlink.antiping
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
|
@ -1,9 +1,9 @@
|
|||
package civilengineering.eventhandlers
|
||||
package matterlink.eventhandlers
|
||||
|
||||
import civilengineering.bridge.ApiMessage
|
||||
import civilengineering.bridge.MessageHandler
|
||||
import civilengineering.cfg
|
||||
import civilengineering.antiping
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.cfg
|
||||
import matterlink.antiping
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
[{
|
||||
"modid": "civilengineering",
|
||||
"name": "Civil Engineering",
|
||||
"modid": "matterlink",
|
||||
"name": "MatterLink",
|
||||
"description": "Minecraft Server Matterbridge link",
|
||||
"version": "0.2.0",
|
||||
"version": "1.0",
|
||||
"mcversion": "1.12.2",
|
||||
"authorList":["Arcanitor", "NikkyAi"],
|
||||
"credits": "Blame Nikky for talking me into this."
|
||||
|
|
Loading…
Reference in New Issue