Skip to content

Feat/additions for kevin#11

Merged
Keviro merged 16 commits intoversion/1.21.11from
feat/additions-for-kevin
Mar 13, 2026
Merged

Feat/additions for kevin#11
Keviro merged 16 commits intoversion/1.21.11from
feat/additions-for-kevin

Conversation

@TheBjoRedCraft
Copy link
Copy Markdown
Member

No description provided.

@TheBjoRedCraft TheBjoRedCraft self-assigned this Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 16:52
JoField08
JoField08 previously approved these changes Mar 12, 2026
@JoField08 JoField08 enabled auto-merge March 12, 2026 16:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces operational/admin additions around protection management, including persistence of in-progress “ProtectionMode” state across shutdowns, startup restoration of marker blocks, and an admin command suite for managing protections.

Changes:

  • Add shutdown-safe persistence for unfinished protection mode sessions and “dirty” marker blocks, plus startup restoration logic.
  • Introduce a new protectionadmin command (delete/teleport/reload) with dedicated permissions and a reusable ProtectionArgument.
  • Consolidate duplicated “region item” UI builder logic into a shared menu util and extend region lore (e.g., center location).

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/main/kotlin/dev/slne/surf/protect/paper/util/util.kt Adds formatting helper for nullable WorldGuard/WorldEdit teleport locations.
src/main/kotlin/dev/slne/surf/protect/paper/user/ProtectionUser.kt Refactors region creation reset/restore flow and adds shutdown persistence hook.
src/main/kotlin/dev/slne/surf/protect/paper/user/ProtectionCooldownTracker.kt Updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/region/visual/Trail.kt Updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/region/visual/Marker.kt Adds shutdown path to persist marker restoration data instead of editing blocks.
src/main/kotlin/dev/slne/surf/protect/paper/region/utils.kt Updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/region/ProtectionRegion.kt Threads a shutdown flag through marker removal/cancel flow.
src/main/kotlin/dev/slne/surf/protect/paper/permission/ProtectPermissionRegistry.kt Adds new admin permissions for the new command tree.
src/main/kotlin/dev/slne/surf/protect/paper/message/Messages.kt Updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/menu/view/sell/ProtectionSellConfirmView.kt Removes duplicated region item builder (now shared).
src/main/kotlin/dev/slne/surf/protect/paper/menu/view/list/ProtectionListView.kt Removes duplicated region item builder (now shared).
src/main/kotlin/dev/slne/surf/protect/paper/menu/view/book/ProtectionBook.kt Updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/menu/view/ProtectionInfoView.kt Lore rendering tweaks and removes duplicated region item builder.
src/main/kotlin/dev/slne/surf/protect/paper/menu/util/view-util.kt Adds shared createRegionItem builder and displays center location.
src/main/kotlin/dev/slne/surf/protect/paper/menu/dialog/ProtectionRenameDialog.kt Updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/math/Mth.kt Adjusts effective cost rounding behavior and updates config import usage.
src/main/kotlin/dev/slne/surf/protect/paper/listener/listeners/ProtectionModeListener.kt Restores awaiting protection mode state on player join.
src/main/kotlin/dev/slne/surf/protect/paper/config/ProtectionConfigManager.kt Introduces a config manager wrapper for loading/editing/saving.
src/main/kotlin/dev/slne/surf/protect/paper/config/ProtectionConfig.kt Adds Base64-blob config entries for dirty markers and awaiting protection sessions.
src/main/kotlin/dev/slne/surf/protect/paper/command/commands/protection/argument/ProtectionArgument.kt Adds a custom CommandAPI argument for selecting protected regions.
src/main/kotlin/dev/slne/surf/protect/paper/command/commands/protection/ProtectionAdminCommand.kt Adds admin delete/teleport/reload commands.
src/main/kotlin/dev/slne/surf/protect/paper/command/CommandManager.kt Registers the new admin command and removes a legacy visualize command.
src/main/kotlin/dev/slne/surf/protect/paper/PaperMain.kt Adds dirty marker restoration on enable and shutdown persistence wiring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/kotlin/dev/slne/surf/protect/paper/user/ProtectionUser.kt Outdated
Comment thread src/main/kotlin/dev/slne/surf/protect/paper/region/visual/Marker.kt
Comment thread src/main/kotlin/dev/slne/surf/protect/paper/PaperMain.kt
Comment thread src/main/kotlin/dev/slne/surf/protect/paper/PaperMain.kt
Comment thread src/main/kotlin/dev/slne/surf/protect/paper/PaperMain.kt
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 13, 2026

@TheBjoRedCraft I've opened a new pull request, #13, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 13, 2026 12:32
… for player state mutations

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
fix(user): ensure resetRegionCreation runs player state mutations on entity dispatcher
Copilot AI review requested due to automatic review settings March 13, 2026 12:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +143 to +152
val player = this.bukkitPlayer ?: return
withContext(plugin.entityDispatcher(player)) {
restorePlayerProperties(
player,
creation.startingInventoryContent.map { it ?: ItemStack.empty() }.toTypedArray()
)
}

player.teleportAsync(creation.startLocation).await()
player.teleportAsync(creation.startLocation)
}
Comment on lines +404 to 413
suspend fun cancelProtection(shutdown: Boolean = false) {
removeAllMarkers(shutdown)

protectionUser.bukkitPlayer?.sendText {
appendInfoPrefix()
info("Der Grundstückserstellungsprozess wurde abgebrochen.")
}
protectionUser.resetRegionCreation(true)

protectionUser.resetRegionCreation(true, shutdown)
}
Comment on lines +54 to +58
player.teleportAsync(BukkitAdapter.adapt(protection.getFlag(Flags.TELE_LOC)))
.thenRun {
player.sendText {
appendSuccessPrefix()
success("Du wurdest zum Grundstück teleportiert.")
Comment on lines +170 to +182
val location: Location
get() = decodeStream { din ->
val worldName = din.readUTF()
val x = din.readInt()
val y = din.readInt()
val z = din.readInt()
Location(
server.getWorld(worldName) ?: error("World '$worldName' not found"),
x.toDouble(),
y.toDouble(),
z.toDouble()
)
}
Comment on lines +46 to +52
val regionManager = protection.getRegionManagerOrNull() ?: run {
player.sendText {
appendErrorPrefix()
error("Das Grundstück existiert nicht.")
}
return@playerExecutor
}
Comment on lines +79 to +82

configManager.edit {
dirtyMarkers.remove(marker)
}
Comment on lines +91 to 94
val configManager = ProtectionConfigManager()
val config get() = configManager.protectionConfig

val plugin get() = JavaPlugin.getPlugin(PaperMain::class.java)
}
}

if (configManager.protectionConfig.dirtyMarkers.isNotEmpty()) {
Comment on lines +388 to 395
suspend fun removeAllMarkers(shutdown: Boolean = false) {
coroutineScope {
markers.toObjectList().map { marker ->
async {
marker.restorePreviousData()
marker.restorePreviousData(shutdown)
}
}.awaitAll()
}
Comment on lines +22 to +25
fun edit(actions: ProtectionConfig.() -> Unit) {
configManager.config = configManager.config.apply { actions() }
configManager.save()
}
@Keviro Keviro disabled auto-merge March 13, 2026 23:59
@Keviro Keviro merged commit 2936777 into version/1.21.11 Mar 13, 2026
@TheBjoRedCraft TheBjoRedCraft deleted the feat/additions-for-kevin branch March 14, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants