Badges on all the README's and code formatting
This commit is contained in:
parent
928576c64b
commit
3de56755be
|
@ -8,7 +8,6 @@ import net.minecraft.command.server.CommandEmote
|
|||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.player.EntityPlayerMP
|
||||
import net.minecraft.server.dedicated.DedicatedServer
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock
|
||||
import net.minecraftforge.event.CommandEvent
|
||||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
|
@ -101,7 +100,7 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun serverTickEvent(e: TickEvent.ServerTickEvent) {
|
||||
if(e.phase == TickEvent.Phase.END)
|
||||
if (e.phase == TickEvent.Phase.END)
|
||||
TickHandler.handleTick()
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.command.CommandMatterlink
|
||||
import matterlink.command.MatterLinkCommandSender
|
||||
import matterlink.config.cfg
|
||||
|
@ -8,7 +7,10 @@ import net.minecraft.util.text.TextComponentString
|
|||
import net.minecraftforge.common.ForgeVersion
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.event.*
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.apache.logging.log4j.Logger
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.config.BaseConfig
|
||||
import matterlink.config.cfg
|
||||
import net.minecraftforge.common.config.Configuration
|
||||
import java.io.File
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package matterlink.command
|
||||
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.config.cfg
|
||||
import net.minecraft.command.CommandResultStats
|
||||
import net.minecraft.command.ICommandSender
|
||||
import net.minecraft.entity.Entity
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.command.server.CommandEmote
|
|||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.player.EntityPlayerMP
|
||||
import net.minecraft.server.dedicated.DedicatedServer
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock
|
||||
import net.minecraftforge.event.CommandEvent
|
||||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
|
@ -102,7 +101,7 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun serverTickEvent(e: TickEvent.ServerTickEvent) {
|
||||
if(e.phase == TickEvent.Phase.END)
|
||||
if (e.phase == TickEvent.Phase.END)
|
||||
TickHandler.handleTick()
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.command.CommandMatterlink
|
||||
import matterlink.command.MatterLinkCommandSender
|
||||
import matterlink.config.cfg
|
||||
|
@ -8,7 +7,10 @@ import net.minecraft.util.text.TextComponentString
|
|||
import net.minecraftforge.common.ForgeVersion
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.event.*
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent
|
||||
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent
|
||||
import org.apache.logging.log4j.Level
|
||||
import org.apache.logging.log4j.Logger
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.config.BaseConfig
|
||||
import matterlink.config.cfg
|
||||
import net.minecraftforge.common.config.Configuration
|
||||
import java.io.File
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package matterlink.command
|
||||
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.config.cfg
|
||||
import net.minecraft.command.CommandResultStats
|
||||
import net.minecraft.command.ICommandSender
|
||||
import net.minecraft.entity.Entity
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.command.server.CommandBroadcast
|
|||
import net.minecraft.command.server.CommandEmote
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.server.dedicated.DedicatedServer
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock
|
||||
import net.minecraftforge.event.CommandEvent
|
||||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
|
@ -96,7 +95,7 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun serverTickEvent(e: TickEvent.ServerTickEvent) {
|
||||
if(e.phase == TickEvent.Phase.END)
|
||||
if (e.phase == TickEvent.Phase.END)
|
||||
TickHandler.handleTick()
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.command.CommandMatterlink
|
||||
import matterlink.command.MatterLinkCommandSender
|
||||
import matterlink.config.cfg
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.command.server.CommandEmote
|
|||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.player.EntityPlayerMP
|
||||
import net.minecraft.server.dedicated.DedicatedServer
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock
|
||||
import net.minecraftforge.event.CommandEvent
|
||||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
|
|
|
@ -2,9 +2,11 @@ package matterlink
|
|||
|
||||
import cpw.mods.fml.common.FMLCommonHandler
|
||||
import cpw.mods.fml.common.Mod
|
||||
import cpw.mods.fml.common.event.*
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent
|
||||
import matterlink.command.CommandMatterlink
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.command.MatterLinkCommandSender
|
||||
import matterlink.config.cfg
|
||||
import net.minecraft.server.MinecraftServer
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package matterlink.command
|
||||
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.config.cfg
|
||||
import net.minecraft.command.ICommandSender
|
||||
import net.minecraft.server.MinecraftServer
|
||||
import net.minecraft.util.ChatComponentText
|
||||
|
|
80
README.md
80
README.md
|
@ -1,5 +1,10 @@
|
|||
# MatterLink
|
||||
|
||||
- [Downloads](#downloads)
|
||||
- [Dependencies](#dependencies)
|
||||
- [Features](#features)
|
||||
- [Setup](#setup)
|
||||
|
||||
A MatterBridge endpoint for MC servers!
|
||||
|
||||
THIS MOD REQUIRES YOU TO ALSO RUN A MATTERBRIDGE RELAY
|
||||
|
@ -7,26 +12,37 @@ https://github.com/42wim/matterbridge
|
|||
|
||||
Chat with us on IRC: [#matterbridge @ irc.esper.net](irc://irc.esper.net/matterbridge)
|
||||
|
||||
Requires the matterbridge config api section to be setup along these lines:
|
||||
## Downloads
|
||||
|
||||
```
|
||||
[api]
|
||||
[api.local]
|
||||
BindAddress="0.0.0.0:4242" # or listen only to localhost: 127.0.0.1:4242
|
||||
#OPTIONAL (no authorization if token is empty)
|
||||
Token="mytoken"
|
||||
Buffer=1000
|
||||
RemoteNickFormat="{NICK}"
|
||||
ShowJoinPart = true
|
||||
```
|
||||
[](https://github.com/elytra/MatterLink/releases)
|
||||
|
||||
[](https://ci.elytradev.com/job/elytra/job/MatterLink/job/master/lastSuccessfulBuild/artifact/)
|
||||
|
||||
[](https://minecraft.curseforge.com/projects/287323/files)
|
||||
|
||||
[](https://curse.nikky.moe/api/url/287323?version=1.12.2)
|
||||
|
||||
[](https://curse.nikky.moe/api/url/287323?version=1.11.2)
|
||||
|
||||
[](https://curse.nikky.moe/api/url/287323?version=1.10.2)
|
||||
|
||||
[](https://curse.nikky.moe/api/url/287323?version=1.7.10)
|
||||
|
||||
## Dependencies
|
||||
|
||||
[](https://minecraft.curseforge.com/projects/248453/files)
|
||||
|
||||
## Features
|
||||
|
||||
* Custom bridge commands, including passthrough to MC!
|
||||
Default commands: `help, tps, list, seed, uptime`
|
||||
### Custom bridge commands
|
||||
|
||||
including passthrough to MC!
|
||||
Default commands: `help, tps, list, seed, uptime`
|
||||
|
||||
Commands are specified in JSON format as follows:
|
||||
|
||||
Passthrough command (executes the configured command from the MC server console)
|
||||
|
||||
Commands are specified in JSON format as follows:
|
||||
Passthrough command (executes the configured command as if from the MC server console)
|
||||
```json
|
||||
{
|
||||
"alias": "tps",
|
||||
|
@ -37,7 +53,9 @@ Passthrough command (executes the configured command as if from the MC server co
|
|||
"allowArgs": false
|
||||
}
|
||||
```
|
||||
|
||||
Response command
|
||||
|
||||
```json
|
||||
{
|
||||
"alias": "uptime",
|
||||
|
@ -48,10 +66,13 @@ Response command
|
|||
"allowArgs": false
|
||||
}
|
||||
```
|
||||
* Command permissions!
|
||||
|
||||
### Command permissions
|
||||
|
||||
Higher numbers mean more permissions. Configured on a network-by-network basis.
|
||||
For IRC, this is your hostmask.
|
||||
For Discord, this is your userid (NOT the four-digit number.)
|
||||
|
||||
```json
|
||||
{
|
||||
"irc.esper": {
|
||||
|
@ -68,19 +89,21 @@ For Discord, this is your userid (NOT the four-digit number.)
|
|||
then reconnects.
|
||||
```
|
||||
|
||||
## Downloads
|
||||
|
||||
https://github.com/elytra/MatterLink/releases
|
||||
|
||||
https://ci.elytradev.com/job/elytra/job/MatterLink/job/master/lastSuccessfulBuild/ - may be unstable
|
||||
|
||||
https://minecraft.curseforge.com/projects/matterlink
|
||||
|
||||
## Dependencies
|
||||
|
||||
- forgelin: https://minecraft.curseforge.com/projects/shadowfacts-forgelin
|
||||
|
||||
## Setup
|
||||
|
||||
Requires the matterbridge config api section to be setup along these lines:
|
||||
|
||||
```
|
||||
[api]
|
||||
[api.local]
|
||||
BindAddress="0.0.0.0:4242" # or listen only to localhost: 127.0.0.1:4242
|
||||
#OPTIONAL (no authorization if token is empty)
|
||||
Token="mytoken"
|
||||
Buffer=1000
|
||||
RemoteNickFormat="{NICK}"
|
||||
ShowJoinPart = true
|
||||
```
|
||||
|
||||
Now you just need to run MatterBridge on the server, the default configuration works with the provided sample.
|
||||
|
||||
Install matterbridge and try out the basic sample:
|
||||
|
@ -93,7 +116,6 @@ matterbridge
|
|||
|
||||
now start the server with matterlink (and forgelin )in the mods folder
|
||||
|
||||
|
||||
and then [RTFM!!!](https://github.com/42wim/matterbridge#configuration) and configure all your needed gateways, endpoints etc
|
||||
|
||||
powered by wishful thinking
|
|
@ -4,7 +4,6 @@ import matterlink.bridge.MessageHandler
|
|||
import matterlink.bridge.command.BridgeCommandRegistry
|
||||
import matterlink.bridge.command.IMinecraftCommandSender
|
||||
import matterlink.config.cfg
|
||||
import matterlink.update.UpdateChecker
|
||||
|
||||
lateinit var instance: IMatterLink
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ object MessageHandler {
|
|||
))
|
||||
}
|
||||
|
||||
if(firstRun) {
|
||||
if (firstRun) {
|
||||
UpdateChecker.run()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ object BridgeCommandRegistry {
|
|||
operator fun get(command: String) = commandMap[command]
|
||||
|
||||
fun getName(command: IBridgeCommand): String? {
|
||||
commandMap.forEach{(alias, cmd) ->
|
||||
if(command == cmd) return alias
|
||||
commandMap.forEach { (alias, cmd) ->
|
||||
if (command == cmd) return alias
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ data class CustomCommand(
|
|||
override fun execute(alias: String, user: String, userId: String, server: String, args: String): Boolean {
|
||||
if (!allowArgs && args.isNotBlank()) return false
|
||||
|
||||
if (TickHandler.tickCounter - lastUsed < timeout)
|
||||
{
|
||||
if (TickHandler.tickCounter - lastUsed < timeout) {
|
||||
instance.debug("dropped command $alias")
|
||||
return true //eat command silently
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package matterlink.bridge.command
|
|||
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.config.cfg
|
||||
|
||||
object HelpCommand : IBridgeCommand {
|
||||
override val help: String = "Returns the help string for the given command. Syntax: help <command>"
|
||||
|
|
|
@ -2,8 +2,6 @@ package matterlink.bridge.command
|
|||
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.config.cfg
|
||||
import matterlink.instance
|
||||
|
||||
abstract class IMinecraftCommandSender(val user: String, val userId: String, val server: String) {
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package matterlink.command
|
||||
|
||||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.bridge.command.BridgeCommandRegistry
|
||||
import matterlink.config.cfg
|
||||
import matterlink.instance
|
||||
|
||||
object CommandCore {
|
||||
fun getName() = "bridge"
|
||||
|
|
|
@ -20,7 +20,7 @@ object DeathHandler {
|
|||
val emojis = cfg.outgoing.death.damageTypeMapping[damageType]?.split(' ')
|
||||
?: listOf("\uD83D\uDC7B unknown type '$damageType'")
|
||||
val damageEmoji = emojis[random.nextInt(emojis.size)]
|
||||
msg += " " + damageEmoji
|
||||
msg += " $damageEmoji"
|
||||
}
|
||||
MessageHandler.transmit(ApiMessage(
|
||||
text = msg
|
||||
|
|
|
@ -22,7 +22,7 @@ object TickHandler {
|
|||
|
||||
ServerChatHandler.writeIncomingToChat()
|
||||
|
||||
if(accumulator++ > updateInterval) {
|
||||
if (accumulator++ > updateInterval) {
|
||||
accumulator -= updateInterval
|
||||
UpdateChecker.run()
|
||||
}
|
||||
|
|
|
@ -8,13 +8,4 @@ data class CurseFile(
|
|||
val gameVersion: List<String>,
|
||||
val releaseType: String,
|
||||
val fileStatus: String
|
||||
) {
|
||||
companion object {
|
||||
val gson = Gson()
|
||||
|
||||
fun decode(json: String): CurseFile {
|
||||
return gson.fromJson(json, CurseFile::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
|
@ -7,9 +7,7 @@ import matterlink.bridge.MessageHandler
|
|||
import matterlink.config.cfg
|
||||
import matterlink.instance
|
||||
import org.apache.http.HttpResponse
|
||||
import org.apache.http.client.HttpClient
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.apache.http.impl.client.CloseableHttpClient
|
||||
import org.apache.http.impl.client.HttpClients
|
||||
import java.io.BufferedReader
|
||||
|
||||
|
|
Loading…
Reference in New Issue