format all the things

This commit is contained in:
NikkyAI 2018-02-19 00:19:13 +01:00
parent 6c5a381903
commit 41c8776993
12 changed files with 27 additions and 31 deletions

View File

@ -60,7 +60,7 @@ object EventHandler {
val sender = when { val sender = when {
e.sender is DedicatedServer -> cfg.relay.systemUser e.sender is DedicatedServer -> cfg.relay.systemUser
e.sender is TileEntityCommandBlock -> "CommandBlock" e.sender is TileEntityCommandBlock -> "CommandBlock"
else -> e.sender.name else -> e.sender.name
} }
val args = e.parameters.joinToString(" ") val args = e.parameters.joinToString(" ")
val type = when { val type = when {

View File

@ -1,4 +1,3 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
@ -24,7 +23,7 @@ sourceCompatibility = targetCompatibility = '1.8'
dependencies { dependencies {
compile project(':core') compile project(':core')
compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version
} }
shadowJar { shadowJar {
@ -55,16 +54,16 @@ compileKotlin.doFirst {
from("src/templates/kotlin/matterlink/Constants.kt") from("src/templates/kotlin/matterlink/Constants.kt")
into(target) into(target)
} }
ant.replaceregexp(match:'@MODVERSION@', replace: project.mod_version, flags:'g', byline:true) { ant.replaceregexp(match: '@MODVERSION@', replace: project.mod_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
ant.replaceregexp(match:'@MCVERSION@', replace: project.mc_version, flags:'g', byline:true) { ant.replaceregexp(match: '@MCVERSION@', replace: project.mc_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
ant.replaceregexp(match:'@FORGELIN-VERSION@', replace: project.forgelin_version, flags:'g', byline:true) { ant.replaceregexp(match: '@FORGELIN-VERSION@', replace: project.forgelin_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
ant.replaceregexp(match:'@FORGE-VERSION@', replace: project.forge_version, flags:'g', byline:true) { ant.replaceregexp(match: '@FORGE-VERSION@', replace: project.forge_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
} }
@ -95,7 +94,7 @@ sourceJar {
from sourceSets.main.allSource from sourceSets.main.allSource
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from (project(":core").sourceSets.main.allSource) { from(project(":core").sourceSets.main.allSource) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }

View File

@ -1,4 +1,3 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
@ -81,7 +80,7 @@ sourceJar {
from sourceSets.main.allSource from sourceSets.main.allSource
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from (project(":core").sourceSets.main.allSource) { from(project(":core").sourceSets.main.allSource) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }

View File

@ -1,4 +1,3 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
@ -47,16 +46,16 @@ compileKotlin.doFirst {
from("src/templates/kotlin/matterlink/Constants.kt") from("src/templates/kotlin/matterlink/Constants.kt")
into(target) into(target)
} }
ant.replaceregexp(match:'@MODVERSION@', replace: project.mod_version, flags:'g', byline:true) { ant.replaceregexp(match: '@MODVERSION@', replace: project.mod_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
ant.replaceregexp(match:'@MCVERSION@', replace: project.mc_version, flags:'g', byline:true) { ant.replaceregexp(match: '@MCVERSION@', replace: project.mc_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
ant.replaceregexp(match:'@FORGELIN-VERSION@', replace: project.forgelin_version, flags:'g', byline:true) { ant.replaceregexp(match: '@FORGELIN-VERSION@', replace: project.forgelin_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
ant.replaceregexp(match:'@FORGE-VERSION@', replace: project.forge_version, flags:'g', byline:true) { ant.replaceregexp(match: '@FORGE-VERSION@', replace: project.forge_version, flags: 'g', byline: true) {
fileset(dir: target, includes: 'Constants.kt') fileset(dir: target, includes: 'Constants.kt')
} }
} }
@ -82,7 +81,7 @@ processResources {
jar { jar {
configurations.shade.each { dep -> configurations.shade.each { dep ->
from (project.zipTree(dep)) { from(project.zipTree(dep)) {
exclude "META-INF", "META-INF/**" exclude "META-INF", "META-INF/**"
} }
} }

View File

@ -10,7 +10,7 @@ subprojects {
if (project.hasProperty('build_number')) { if (project.hasProperty('build_number')) {
mod_version += "-build-$build_number" mod_version += "-build-$build_number"
} else if(!project.hasProperty('release')) { } else if (!project.hasProperty('release')) {
mod_version += "-dev" mod_version += "-dev"
} }
@ -44,7 +44,7 @@ subprojects {
project { project {
id = '287323' id = '287323'
releaseType = 'beta' releaseType = 'beta'
if(project.hasProperty('changelog_file')) { if (project.hasProperty('changelog_file')) {
println("changelog = $changelog_file") println("changelog = $changelog_file")
changelogType = "markdown" changelogType = "markdown"
changelog = file(changelog_file) changelog = file(changelog_file)

View File

@ -1,4 +1,3 @@
buildscript { buildscript {
ext.kotlin_version = '1.2.21' ext.kotlin_version = '1.2.21'
repositories { repositories {

View File

@ -14,7 +14,7 @@ abstract class IMatterLink {
abstract val mcVersion: String abstract val mcVersion: String
abstract val modVersion: String abstract val modVersion: String
abstract fun commandSenderFor(user: String, userid: String, server: String): IMinecraftCommandSender abstract fun commandSenderFor(user: String, userId: String, server: String): IMinecraftCommandSender
abstract fun wrappedSendToPlayers(msg: String) abstract fun wrappedSendToPlayers(msg: String)

View File

@ -8,13 +8,13 @@ object HelpCommand : IBridgeCommand {
override val alias: String = "help" override val alias: String = "help"
override val help: String = "Returns the help string for the given command. Syntax: help <command>" override val help: String = "Returns the help string for the given command. Syntax: help <command>"
override val permLevel = 0 override val permLevel = 0
override fun execute(user:String, userId:String, server:String, args:String) : Boolean { override fun execute(user: String, userId: String, server: String, args: String): Boolean {
val msg: String = when { val msg: String = when {
args.isEmpty() -> args.isEmpty() ->
"Available commands: ${BridgeCommandRegistry.getCommandList(IBridgeCommand.getPermLevel(userId, server))}" "Available commands: ${BridgeCommandRegistry.getCommandList(IBridgeCommand.getPermLevel(userId, server))}"
else -> args.split(" ", ignoreCase = false) else -> args.split(" ", ignoreCase = false)
.joinToString(separator = "\n") { .joinToString(separator = "\n") {
"$it: ${ BridgeCommandRegistry.getHelpString(it) }" "$it: ${BridgeCommandRegistry.getHelpString(it)}"
} }
} }
MessageHandler.transmit(ApiMessage(text = msg)) MessageHandler.transmit(ApiMessage(text = msg))

View File

@ -12,7 +12,7 @@ abstract class IMinecraftCommandSender(val user: String, val userId: String, val
val accountName = "$user (id=$userId server=$server)" val accountName = "$user (id=$userId server=$server)"
fun canExecute(commandName: String) : Boolean { fun canExecute(commandName: String): Boolean {
instance.info("testing $commandName") instance.info("testing $commandName")
val command = BridgeCommandRegistry[commandName] ?: return false val command = BridgeCommandRegistry[commandName] ?: return false

View File

@ -4,7 +4,6 @@ import com.google.gson.Gson
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import com.google.gson.JsonSyntaxException import com.google.gson.JsonSyntaxException
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.google.gson.stream.MalformedJsonException
import matterlink.instance import matterlink.instance
import java.io.File import java.io.File

View File

@ -16,8 +16,9 @@ object DeathHandler {
) { ) {
if (cfg.death.showDeath) { if (cfg.death.showDeath) {
var msg = deathMessage.replace(player, player.antiping) var msg = deathMessage.replace(player, player.antiping)
if(cfg.death.showDamageType) { if (cfg.death.showDamageType) {
val emojis = cfg.death.damageTypeMapping[damageType]?.split(' ') ?: listOf("\uD83D\uDC7B unknown type '$damageType'") val emojis = cfg.death.damageTypeMapping[damageType]?.split(' ')
?: listOf("\uD83D\uDC7B unknown type '$damageType'")
val damageEmoji = emojis[random.nextInt(emojis.size)] val damageEmoji = emojis[random.nextInt(emojis.size)]
msg += " " + damageEmoji msg += " " + damageEmoji
} }

View File

@ -254,11 +254,11 @@ enable=true
# key="yourkey" # key="yourkey"
#[[gateway.inout]] can be used when then channel will be used to receive from # #[[gateway.inout]] can be used when then channel will be used to receive from
#and send messages to # #and send messages to
[[gateway.inout]] # [[gateway.inout]]
account="irc.freenode" # account="irc.freenode"
channel="#matterlink-testing" # channel="#matterlink-testing"
# #OPTIONAL - only used for IRC protocol at the moment # #OPTIONAL - only used for IRC protocol at the moment
# [gateway.out.options] # [gateway.out.options]