From c1389712306cefcd2f30f8a42796ebf0a756189c Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 1 Aug 2022 10:58:11 -0700 Subject: [PATCH] Code cleanup --- .idea/codeStyles/codeStyleConfig.xml | 2 +- .idea/kotlinc.xml | 6 ++++++ src/main/java/net/thauvin/erik/mobibot/modules/War.java | 2 +- src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt | 2 ++ .../kotlin/net/thauvin/erik/mobibot/commands/Versions.kt | 2 +- .../net/thauvin/erik/mobibot/modules/RockPaperScissors.kt | 2 ++ 6 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .idea/kotlinc.xml diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index 79ee123..a55e7a1 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -1,5 +1,5 @@ - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml new file mode 100644 index 0000000..b1077fb --- /dev/null +++ b/.idea/kotlinc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/War.java b/src/main/java/net/thauvin/erik/mobibot/modules/War.java index 12036a2..b12563b 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/War.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/War.java @@ -103,7 +103,7 @@ public final class War extends AbstractModule { result = bold("tie") + ". This means " + bold("WAR"); } - event.respond(DECK[RANDOM.nextInt(DECK.length)][i] + " " + DECK[RANDOM.nextInt(DECK.length)][y] + + event.respond(DECK[RANDOM.nextInt(DECK.length)][i] + " " + DECK[RANDOM.nextInt(DECK.length)][y] + " » You " + result + '!'); } while (i == y); diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt index cdc7a8f..01d2548 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Mobibot.kt @@ -282,11 +282,13 @@ class Mobibot(nickname: String, val channel: String, logsDirPath: String, p: Pro // Output the usage HelpFormatter().printHelp(Mobibot::class.java.name, options) } + commandLine.hasOption(Constants.VERSION_ARG[0]) -> { // Output the version println("${ReleaseInfo.PROJECT} ${ReleaseInfo.VERSION} (${ReleaseInfo.BUILDDATE.toIsoLocalDate()})") println(ReleaseInfo.WEBSITE) } + else -> { // Load the properties val p = Properties() diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Versions.kt b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Versions.kt index 36ac362..0512a61 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/commands/Versions.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/commands/Versions.kt @@ -43,7 +43,7 @@ class Versions : AbstractCommand() { "Version : ${ReleaseInfo.VERSION} (${ReleaseInfo.BUILDDATE.toIsoLocalDate()})", "Platform : ${System.getProperty("os.name")} ${System.getProperty("os.version")}" + " (${System.getProperty("os.arch")})", - "Runtimes : Java ${System.getProperty("java.runtime.version")}, Kotlin " + KotlinVersion.CURRENT + "Runtimes : Java ${System.getProperty("java.runtime.version")}, Kotlin " + KotlinVersion.CURRENT ) override val name = "versions" override val help = listOf("To view the versions data (bot, platform, java, etc.):", helpFormat("%c $name")) diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissors.kt b/src/main/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissors.kt index 5a4cfda..bc02a4d 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissors.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissors.kt @@ -102,9 +102,11 @@ class RockPaperScissors : AbstractModule() { hand == botHand -> { event.respond("${hand.name} vs. ${botHand.name} » You ${"tie".bold()}.") } + hand.beats(botHand) -> { event.respond("${hand.name.bold()} ${hand.action} ${botHand.name} » You ${"win".bold()}!") } + else -> { event.respond("${botHand.name.bold()} ${botHand.action} ${hand.name} » You ${"lose".bold()}!") }