Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add Fun commands! #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Because we want to have a chat system that actually wOREks for us.
| `/mail send <player> <message>` | `chattore.mail` | Send a mail message | No aliases |
| `/mail read <mail ID>` | `chattore.mail` | Read a mail message (Designed for usage with `/mailbox`) | No aliases |
| `/me <message>` | `chattore.me` | Have a thought in chat | No aliases |
| `/waffle` | `chattore.waffle` | Do you like waffles? | No aliases |
| `/nou` | `chattore.nou` | #nou | No aliases |
| `/lag` | `chattore.lag` | Fix your lag easily! | No aliases |
| `/message <player> <message>` | `chattore.message` | Send a message to a player | `/m\|/pm\|/msg\|/vmsg\|/vmessage\|/whisper\|/tell` |
| `/reply <message>` | `chattore.message` | Reply to a message | `/playerprofile` |
| `/profile info <player>` | `chattore.profile` | View a player's profile | `/playerprofile` |
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.gradleup.shadow") version "8.3.0"
id("org.jetbrains.kotlin.jvm") version "1.9.22"
id("org.jetbrains.kotlin.kapt") version "1.9.22"
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
Expand Down Expand Up @@ -46,7 +46,7 @@ dependencies {
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
kotlinOptions.jvmTarget = "21"
kotlinOptions.javaParameters = true
}

Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/ChattORE.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private const val VERSION = "0.1.0-SNAPSHOT"
version = VERSION,
url = "https://openredstone.org",
description = "Because we want to have a chat system that actually wOREks for us.",
authors = ["Nickster258", "PaukkuPalikka", "StackDoubleFlow", "sodiboo"],
authors = ["Nickster258", "PaukkuPalikka", "StackDoubleFlow", "sodiboo", "wueffi"],
dependencies = [Dependency(id = "luckperms")]
)
class ChattORE @Inject constructor(val proxy: ProxyServer, val logger: Logger, @DataDirectory dataFolder: Path) {
Expand Down Expand Up @@ -116,6 +116,9 @@ class ChattORE @Inject constructor(val proxy: ProxyServer, val logger: Logger, @
registerCommand(Nick(this@ChattORE))
registerCommand(Profile(this@ChattORE))
registerCommand(Reply(config, this@ChattORE, replyMap))
registerCommand(Waffle(config, this@ChattORE))
registerCommand(Nou(config, this@ChattORE))
registerCommand(Lag(config, this@ChattORE))
setDefaultExceptionHandler(::handleCommandException, false)
commandCompletions.registerCompletion("bool") { listOf("true", "false")}
commandCompletions.registerCompletion("colors") { ctx ->
Expand Down
35 changes: 35 additions & 0 deletions src/main/kotlin/commands/Lag.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package chattore.commands

import chattore.ChattORE
import chattore.render
import co.aikar.commands.BaseCommand
import co.aikar.commands.annotation.CommandAlias
import co.aikar.commands.annotation.CommandPermission
import co.aikar.commands.annotation.Default
import co.aikar.commands.annotation.Syntax
import com.velocitypowered.api.proxy.Player
import chattore.entity.ChattORESpec
import chattore.toComponent
import com.uchuhimo.konf.Config
import net.kyori.adventure.text.Component

@CommandAlias("lag")
@CommandPermission("chattore.lag")
class Lag(
private val config: Config,
private val chattORE: ChattORE
) : BaseCommand() {

@Default
@Syntax("")
fun default(player: Player) {
chattORE.logger.info("${player.username} lagg'd")
chattORE.broadcast(
config[ChattORESpec.format.lag].render(
mapOf("sender" to player.username.toComponent())
)
)

player.disconnect(Component.text("Should be fixed now! 🧇"))
}
}
32 changes: 32 additions & 0 deletions src/main/kotlin/commands/Nou.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package chattore.commands

import chattore.ChattORE
import chattore.render
import co.aikar.commands.BaseCommand
import co.aikar.commands.annotation.CommandAlias
import co.aikar.commands.annotation.CommandPermission
import co.aikar.commands.annotation.Default
import co.aikar.commands.annotation.Syntax
import com.velocitypowered.api.proxy.Player
import chattore.entity.ChattORESpec
import chattore.toComponent
import com.uchuhimo.konf.Config

@CommandAlias("nou")
@CommandPermission("chattore.nou")
class Nou(
private val config: Config,
private val chattORE: ChattORE
) : BaseCommand() {

@Default
@Syntax("")
fun default(player: Player) {
chattORE.logger.info("${player.username} nou'd")
chattORE.broadcast(
config[ChattORESpec.format.nou].render(
mapOf("sender" to player.username.toComponent())
)
)
}
}
32 changes: 32 additions & 0 deletions src/main/kotlin/commands/Waffle.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package chattore.commands

import chattore.ChattORE
import chattore.render
import co.aikar.commands.BaseCommand
import co.aikar.commands.annotation.CommandAlias
import co.aikar.commands.annotation.CommandPermission
import co.aikar.commands.annotation.Default
import co.aikar.commands.annotation.Syntax
import com.velocitypowered.api.proxy.Player
import chattore.entity.ChattORESpec
import chattore.toComponent
import com.uchuhimo.konf.Config

@CommandAlias("waffle")
@CommandPermission("chattore.waffle")
class Waffle(
private val config: Config,
private val chattORE: ChattORE
) : BaseCommand() {

@Default
@Syntax("")
fun default(player: Player) {
chattORE.logger.info("${player.username} waffl'd")
chattORE.broadcast(
config[ChattORESpec.format.waffle].render(
mapOf("sender" to player.username.toComponent())
)
)
}
}
3 changes: 3 additions & 0 deletions src/main/kotlin/entity/ChattORESpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ object ChattORESpec : ConfigSpec("") {
val leave by optional("<yellow><player> has left the network")
val joinDiscord by optional("**<player> has joined the network**")
val leaveDiscord by optional("**<player> has left the network**")
val waffle by optional("<yellow>Guess who likes waffles? <gold><sender></gold> does!")
val nou by optional("<gold><sender><b><red> nou'd")
val lag by optional("<gold><sender><orange> thought there was some <b><red>lag</b><orange>...")
}

val nicknamePresets by optional(pridePresets)
Expand Down