Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0066481
init
Nov 10, 2025
a35e752
init
Nov 10, 2025
0659a3d
use utils in module
Nov 10, 2025
811ce33
refactor: update particle effects and clean up unused code in InvModule
Nov 11, 2025
bfe3b19
refactor: simplify block utility functions and improve property access
Nov 11, 2025
c52b88e
refactor: convert nickname and scoreboard visibility functions to pro…
Nov 11, 2025
88907e0
refactor: add extension property to check container block accessibility
Nov 11, 2025
71a1b80
added todo
Nov 11, 2025
9322063
refactor: simplify BookData initialization by setting default values …
Nov 11, 2025
b880d8a
refactor: enhance command utility functions for improved hover text a…
Nov 11, 2025
e5b9778
refactor: update delete cross-component to use SignedMessage for impr…
Nov 11, 2025
8158bc0
refactor: remove isContainerAccessible check from inventory module fo…
Nov 11, 2025
c2e9f3e
refactor: move hasMatchingEnchantments logic to ItemStackUtils for be…
Nov 11, 2025
3486687
refactor: remove lastUnloads map and simplify player quit handling
Nov 11, 2025
c21e37c
woops
Nov 11, 2025
eb896f9
cleanup
Nov 11, 2025
ca5eae0
refactor: simplify item transfer logic and remove unused performUnloa…
Nov 11, 2025
9aea884
refactor: improve container handling in inventory transfer logic
Nov 11, 2025
9b8e3c1
add todo
Nov 11, 2025
ccde60b
fix legacy material usage
Nov 12, 2025
78103cd
confused
Nov 12, 2025
53391b5
feat: add agent migration state configuration and optimize item stack…
Nov 12, 2025
0054d59
Update src/main/kotlin/org/xodium/vanillaplus/utils/ItemStackUtils.kt
illyrius666 Nov 12, 2025
c94d4c1
Update src/main/kotlin/org/xodium/vanillaplus/modules/ChatModule.kt
illyrius666 Nov 12, 2025
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
8 changes: 8 additions & 0 deletions .idea/copilot.data.migration.agent.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/dictionaries/project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/modules/VanillaPlus.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/modules/VanillaPlus.test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/main/kotlin/org/xodium/vanillaplus/data/BookData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ package org.xodium.vanillaplus.data

import net.kyori.adventure.inventory.Book
import org.bukkit.permissions.PermissionDefault
import org.xodium.vanillaplus.VanillaPlus.Companion.instance
import org.xodium.vanillaplus.utils.ExtUtils.mm
import org.xodium.vanillaplus.utils.FmtUtils.fireFmt

/**
* Represents the data structure for a book in the game.
* @property cmd The command associated with the book.
* @property permission The default permission level for this book's command (defaults to TRUE).
* @property title The [title] of the book.
* @property author The [author] of the book.
* @property title The [title] of the book. Defaults to the command name with the first letter capitalized and formatted.
* @property author The [author] of the book. Defaults to the name of the main plugin instance class.
* @property pages The content of the book, represented as a list of [pages], where each page is a list of lines.
*/
internal data class BookData(
val cmd: String,
val permission: PermissionDefault = PermissionDefault.TRUE,
private val title: String,
private val author: String,
private val title: String = cmd.replaceFirstChar { it.uppercase() }.fireFmt(),
private val author: String = instance::class.simpleName.toString(),
private val pages: List<List<String>>,
) {
/**
Expand Down
45 changes: 0 additions & 45 deletions src/main/kotlin/org/xodium/vanillaplus/engines/ExpressionEngine.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.KotlinModule
import org.xodium.vanillaplus.VanillaPlus.Companion.instance
import org.xodium.vanillaplus.utils.ExtUtils.toSnakeCase
import org.xodium.vanillaplus.utils.ExtUtils.snakeCase
import java.io.IOException
import java.nio.file.Path
import kotlin.io.path.createDirectories
Expand All @@ -24,7 +24,7 @@ interface DataInterface<K, T : Any> {
val dataClass: KClass<T>
val cache: MutableMap<K, T>
val fileName: String
get() = "${dataClass.simpleName?.toSnakeCase()}.json"
get() = "${dataClass.simpleName?.snakeCase}.json"
val filePath: Path
get() = instance.dataFolder.toPath().resolve(fileName)
val jsonMapper: ObjectMapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal object ConfigManager : DataInterface<String, ModuleInterface.Config> {
*/
fun update(modules: List<ModuleInterface<ModuleInterface.Config>>) {
modules.forEach { module ->
val key = module.key()
val key = module.key
val fileConfig = readFileConfig(key, module)
val mergedConfig = fileConfig?.let { jsonMapper.updateValue(module.config, it) } ?: module.config
set(key, mergedConfig)
Expand Down
5 changes: 0 additions & 5 deletions src/main/kotlin/org/xodium/vanillaplus/modules/BooksModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ package org.xodium.vanillaplus.modules
import io.papermc.paper.command.brigadier.Commands
import org.bukkit.entity.Player
import org.bukkit.permissions.Permission
import org.bukkit.permissions.PermissionDefault
import org.xodium.vanillaplus.VanillaPlus.Companion.instance
import org.xodium.vanillaplus.data.BookData
import org.xodium.vanillaplus.data.CommandData
import org.xodium.vanillaplus.interfaces.ModuleInterface
import org.xodium.vanillaplus.utils.ExtUtils.tryCatch
import org.xodium.vanillaplus.utils.FmtUtils.fireFmt

/** Represents a module handling book mechanics within the system. */
internal class BooksModule : ModuleInterface<BooksModule.Config> {
Expand Down Expand Up @@ -49,9 +47,6 @@ internal class BooksModule : ModuleInterface<BooksModule.Config> {
listOf(
BookData(
cmd = "rules",
permission = PermissionDefault.TRUE,
title = "Rules".fireFmt(),
author = instance::class.simpleName.toString(),
pages =
listOf(
// Page 1: Player Rules (1-7)
Expand Down
78 changes: 31 additions & 47 deletions src/main/kotlin/org/xodium/vanillaplus/modules/ChatModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.mojang.brigadier.arguments.StringArgumentType
import io.papermc.paper.chat.ChatRenderer
import io.papermc.paper.command.brigadier.Commands
import io.papermc.paper.event.player.AsyncChatEvent
import net.kyori.adventure.chat.SignedMessage
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.event.ClickEvent
import net.kyori.adventure.text.event.HoverEvent
Expand All @@ -18,7 +19,9 @@ import org.bukkit.permissions.PermissionDefault
import org.xodium.vanillaplus.VanillaPlus.Companion.instance
import org.xodium.vanillaplus.data.CommandData
import org.xodium.vanillaplus.interfaces.ModuleInterface
import org.xodium.vanillaplus.utils.ExtUtils.clickOpenUrl
import org.xodium.vanillaplus.utils.ExtUtils.clickRunCmd
import org.xodium.vanillaplus.utils.ExtUtils.clickSuggestCmd
import org.xodium.vanillaplus.utils.ExtUtils.face
import org.xodium.vanillaplus.utils.ExtUtils.mm
import org.xodium.vanillaplus.utils.ExtUtils.prefix
Expand Down Expand Up @@ -70,25 +73,6 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {
"This command allows you to whisper to players",
listOf("w", "msg", "tell", "tellraw"),
),
CommandData(
Commands
.literal("guide")
.requires { it.sender.hasPermission(perms()[1]) }
.executes { ctx ->
ctx.tryCatch {
if (it.sender !is Player) instance.logger.warning("Command can only be executed by a Player!")
val sender = it.sender as Player
sender.sendMessage(
instance.prefix +
"Click me to open url!".mangoFmt(true).mm().clickEvent(
ClickEvent.openUrl("https://illyria.fandom.com/"),
),
)
}
},
"This command redirects you to the wiki",
emptyList(),
),
)
}

Expand All @@ -99,11 +83,6 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {
"Allows use of the whisper command",
PermissionDefault.TRUE,
),
Permission(
"${instance::class.simpleName}.guide".lowercase(),
"Allows use of the guide command",
PermissionDefault.TRUE,
),
)

@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
Expand All @@ -122,9 +101,9 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {
.clickEvent(ClickEvent.suggestCommand("/w ${player.name} "))
.hoverEvent(HoverEvent.showText(config.i18n.clickToWhisper.mm())),
),
Placeholder.component("message", message.pt().mm()),
Placeholder.component("message", message),
)
if (audience == player) base = base.appendSpace().append(createDeleteCross(event))
if (audience == player) base = base.appendSpace().append(createDeleteCross(event.signedMessage()))
base
}
}
Expand All @@ -139,13 +118,7 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {
Regex("<image>")
.replace(config.welcomeText.joinToString("\n")) { "<image${++imageIndex}>" }
.mm(
Placeholder.component(
"player",
player
.displayName()
.clickEvent(ClickEvent.suggestCommand("/nickname ${player.name}"))
.hoverEvent(HoverEvent.showText(config.i18n.clickMe.mm())),
),
Placeholder.component("player", player.displayName()),
*player
.face()
.lines()
Expand Down Expand Up @@ -203,14 +176,14 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {

/**
* Creates to delete cross-component for message deletion.
* @param event The [AsyncChatEvent] containing the message to be deleted.
* @param signedMessage The signed message to be deleted.
* @return A [Component] representing the delete cross with hover text and click action.
*/
private fun createDeleteCross(event: AsyncChatEvent): Component =
private fun createDeleteCross(signedMessage: SignedMessage): Component =
config.deleteCross
.mm()
.hoverEvent(config.i18n.deleteMessage.mm())
.clickEvent(ClickEvent.callback { instance.server.deleteMessage(event.signedMessage()) })
.clickEvent(ClickEvent.callback { instance.server.deleteMessage(signedMessage) })

data class Config(
override var enabled: Boolean = true,
Expand All @@ -220,15 +193,26 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {
"]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[".mangoFmt(true),
"<image>${"⯈".mangoFmt(true)}",
"<image>${"⯈".mangoFmt(true)}",
"<image>${"⯈".mangoFmt(true)} ${"Welcome".fireFmt()} <player>",
"<image>${"⯈".mangoFmt(true)}",
"<image>${"⯈".mangoFmt(true)}",
"<image>${"⯈".mangoFmt(true)} ${"Check out".fireFmt()}<gray>: ${
"/rules".clickRunCmd("Click Me!".fireFmt()).skylineFmt()
} <gray>🟅 ${
"/guide".clickRunCmd("Click Me!".fireFmt()).skylineFmt()
"<image>${"⯈".mangoFmt(true)} ${"Welcome".fireFmt()} <player> ${
"<white><sprite:item/name_tag></white>".clickSuggestCmd(
"/nickname ",
"Set your nickname!".mangoFmt(),
)
}",
"<image>${"⯈".mangoFmt(true)}",
"<image>${"⯈".mangoFmt(true)} ${"Check out".fireFmt()}<gray>:",
"<image>${"⯈".mangoFmt(true)} ${
"<white><sprite:item/writable_book></white>".clickRunCmd(
"/rules",
"View the server /rules".mangoFmt(),
)
}",
"<image>${"⯈".mangoFmt(true)} ${
"<white><sprite:item/light></white>".clickOpenUrl(
"https://illyria.fandom.com",
"Visit the wiki!".mangoFmt(),
)
}",
"<image>${"⯈".mangoFmt(true)}",
"]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[=]|[".mangoFmt(true),
),
Expand All @@ -240,11 +224,11 @@ internal class ChatModule : ModuleInterface<ChatModule.Config> {
var i18n: I18n = I18n(),
) : ModuleInterface.Config {
data class I18n(
var clickMe: String = "Click Me!".fireFmt(),
var clickToWhisper: String = "Click to Whisper".fireFmt(),
var clickMe: String = "Click me!".mangoFmt(),
var clickToWhisper: String = "Click to Whisper".mangoFmt(),
var playerIsNotOnline: String = "${instance.prefix} Player is not Online!".fireFmt(),
var deleteMessage: String = "Click to delete your message".fireFmt(),
var clickToClipboard: String = "Click to copy position to clipboard".fireFmt(),
var deleteMessage: String = "Click to delete your message".mangoFmt(),
var clickToClipboard: String = "Click to copy position to clipboard".mangoFmt(),
var playerSetSpawn: String = "${"❗".fireFmt()} ${"›".mangoFmt(true)} <notification>",
)
}
Expand Down
Loading
Loading