generated from MineInAbyss/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
355 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
plugins { | ||
id("com.mineinabyss.conventions.kotlin") | ||
id("com.mineinabyss.conventions.papermc") | ||
id("com.mineinabyss.conventions.copyjar") | ||
id("com.mineinabyss.conventions.publication") | ||
id("com.mineinabyss.conventions.testing") | ||
kotlin("plugin.serialization") | ||
} | ||
|
||
repositories { | ||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") | ||
} | ||
|
||
dependencies { | ||
// MineInAbyss platform | ||
compileOnly(libs.kotlinx.serialization.json) | ||
compileOnly(libs.kotlinx.serialization.kaml) | ||
compileOnly(libs.kotlinx.coroutines) | ||
compileOnly(libs.minecraft.mccoroutine) | ||
compileOnly(libs.koin.core) | ||
|
||
// Other plugins | ||
compileOnly(chattyLibs.geary.papermc.core) | ||
compileOnly(chattyLibs.bondrewdlikeshisemotes) | ||
|
||
/// Third-party plugins | ||
compileOnly(chattyLibs.placeholderapi) | ||
|
||
// Shaded | ||
implementation(libs.idofront.core) | ||
// compileOnly(libs.idofront.nms) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
chatty-paper/src/main/kotlin/com/mineinabyss/chatty/listeners/ChattyProxyListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.mineinabyss.chatty.listeners | ||
|
||
import com.mineinabyss.chatty.chattyProxyChannel | ||
import com.mineinabyss.chatty.components.ChannelType | ||
import com.mineinabyss.chatty.helpers.getChannelFromId | ||
import com.mineinabyss.idofront.messaging.miniMsg | ||
import org.bukkit.Bukkit | ||
import org.bukkit.entity.Player | ||
import org.bukkit.plugin.messaging.PluginMessageListener | ||
|
||
class ChattyProxyListener : PluginMessageListener { | ||
override fun onPluginMessageReceived(ch: String, player: Player, message: ByteArray) { | ||
if (ch != chattyProxyChannel) return | ||
// Get channel from last part of string as it is sent via the proxy message | ||
val decoded = message.decodeToString() | ||
val channelId = decoded.substringBefore(" ") | ||
val channel = getChannelFromId(channelId) ?: return | ||
val msg = decoded.replaceFirst("$channelId ", "") | ||
when (channel.channelType) { | ||
ChannelType.GLOBAL -> Bukkit.getOnlinePlayers() | ||
ChannelType.RADIUS -> emptyList() | ||
ChannelType.PERMISSION -> Bukkit.getOnlinePlayers().filter { it.hasPermission(channel.permission) } | ||
ChannelType.PRIVATE -> emptyList() //TODO Implement this when PRIVATE is more clear | ||
}.forEach { it.sendMessage(msg.miniMsg()) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
val kotlinVersion: String by project | ||
val velocityVersion: String by project | ||
val coroutinesVersion: String by project | ||
|
||
group = "com.velocitypowered" | ||
version = "$velocityVersion+$kotlinVersion" | ||
|
||
plugins { | ||
kotlin("jvm") | ||
kotlin("kapt") | ||
kotlin("plugin.serialization") | ||
id("com.github.johnrengelman.shadow") | ||
`maven-publish` | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven("https://repo.papermc.io/repository/maven-public/") | ||
} | ||
|
||
dependencies { | ||
implementation(kotlin("reflect")) | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3") | ||
api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:$coroutinesVersion")) | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion") | ||
implementation("net.kyori:adventure-extra-kotlin:4.10.1") | ||
|
||
compileOnly(chattyLibs.velocity) | ||
kapt(chattyLibs.velocity) | ||
} | ||
|
||
tasks.build { | ||
dependsOn(tasks.shadowJar.get()) | ||
dependsOn("generateTemplates") | ||
} | ||
|
||
val templateSource = file("src/main/templates") | ||
val templateDest = layout.buildDirectory.dir("generated/sources/templates") | ||
tasks.create<Copy>("generateTemplates") { | ||
val props = mapOf( | ||
"version" to project.version | ||
) | ||
inputs.properties(props) | ||
from(templateSource) | ||
into(templateDest) | ||
expand(props) | ||
} | ||
|
||
sourceSets.main { | ||
java { | ||
srcDir(templateDest) | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
artifact(tasks.shadowJar.get()) | ||
} | ||
} | ||
} |
Oops, something went wrong.