Skip to content
Merged
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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "pl.syntaxdevteam"
version = "1.0.0"
version = "1.0.0-profile.1"
description = "Lightweight and versatile player plot protection plugin"

repositories {
Expand Down
5 changes: 5 additions & 0 deletions docs/profile-details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Owner profile read API

Read-only persisted snapshots for MiniPortalPlayerProfile 0.3.0. Existing snapshot constructors and existing API methods remain unchanged. New optional owner-list method provides composed detailed snapshots. No entity/chunk loading, teleport, database writes or simulation updates.

getOwnedPlotProfiles(UUID) uses the existing plot cache and owner filter. PlotProfileSnapshot wraps the original plot and nullable configured teleport block. TP X/Z are integer block coordinates (in-game destination uses +0.5). It is not a safe destination guarantee: the normal teleport flow revalidates blocks and can select a fallback. A missing configured point must not be replaced with a fabricated TP.
5 changes: 5 additions & 0 deletions src/main/kotlin/pl/syntaxdevteam/plotsx/api/PlotsXApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ interface PlotsXApi {
fun getPlot(id: Int): PlotSnapshot?
fun getPlotAt(world: String, blockX: Int, blockZ: Int): PlotSnapshot?
fun getPlots(): List<PlotSnapshot>
fun getOwnedPlotProfiles(owner: UUID): List<PlotProfileSnapshot>
fun getOwnedPlots(owner: UUID): List<PlotSnapshot>
fun getAccessiblePlots(player: UUID): List<PlotSnapshot>
fun getMembers(plotId: Int): List<MemberSnapshot>
Expand Down Expand Up @@ -154,3 +155,7 @@ data class PlotRegionSnapshot(val x: Int, val z: Int, val radius: Int) {
fun contains(x: Int, z: Int): Boolean = kotlin.math.abs(x.toLong() - this.x) <= radius &&
kotlin.math.abs(z.toLong() - this.z) <= radius
}

/** Configured teleport block, not a promise that it is currently safe. No chunk loads. */
data class PlotProfileSnapshot(val plot: PlotSnapshot, val teleport: PlotTeleportSnapshot?)
data class PlotTeleportSnapshot(val x: Int, val y: Int, val z: Int)
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ internal class DefaultPlotsXApi(private val plugin: PlotsX) : PlotsXApi, Listene
return plugin.cacheManager.getPlotAt(world, blockX, blockZ)?.snapshot()
}
override fun getPlots(): List<PlotSnapshot> { ready(); return immutable(plugin.cacheManager.getCachedPlots().map { it.snapshot() }) }
override fun getOwnedPlotProfiles(owner: UUID): List<PlotProfileSnapshot> {
ready()
return immutable(plugin.cacheManager.getCachedPlots().filter { it.ownerUuid == owner }.map {
PlotProfileSnapshot(it.snapshot(), it.teleportSpawn?.let { spawn -> PlotTeleportSnapshot(spawn.x, spawn.y, spawn.z) })
})
}
override fun getOwnedPlots(owner: UUID) = immutable(getPlots().filter { it.owner == owner })
override fun getAccessiblePlots(player: UUID) = immutable(getPlots().filter { it.owner == player || isMember(it.id, player) })
override fun getMembers(plotId: Int): List<MemberSnapshot> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class DatabaseHandler(private val plugin: PlotsX) {
username = user
this.password = password
}
DatabaseType.SQL_SERVER -> error("SQL Server schema support is not enabled in PlotsX")
else -> error("Database dialect $type is not supported by PlotsX")
}
pool {
poolName = "PlotsX-SyntaxDB"
Expand Down
Loading