More todo things
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.UUID
|
|||||||
interface PlayerProfile {
|
interface PlayerProfile {
|
||||||
val uuid: UUID? get() = null
|
val uuid: UUID? get() = null
|
||||||
val name: String?
|
val name: String?
|
||||||
|
val nameOrBukkitName: String?
|
||||||
val notNullName: String
|
val notNullName: String
|
||||||
val isStar: Boolean get() = false
|
val isStar: Boolean get() = false
|
||||||
val exists: Boolean get() = this is RealImpl
|
val exists: Boolean get() = this is RealImpl
|
||||||
@@ -75,6 +76,8 @@ interface PlayerProfile {
|
|||||||
|
|
||||||
interface Real : PlayerProfile {
|
interface Real : PlayerProfile {
|
||||||
override val uuid: UUID
|
override val uuid: UUID
|
||||||
|
override val nameOrBukkitName: String?
|
||||||
|
get() = name ?: Bukkit.getOfflinePlayer(uuid).takeIf { it.isValid }?.name
|
||||||
override val notNullName: String
|
override val notNullName: String
|
||||||
get() = name ?: getPlayerNameOrDefault(uuid)
|
get() = name ?: getPlayerNameOrDefault(uuid)
|
||||||
|
|
||||||
@@ -121,6 +124,7 @@ interface PlayerProfile {
|
|||||||
|
|
||||||
abstract class NameOnly(override val name: String) : BaseImpl() {
|
abstract class NameOnly(override val name: String) : BaseImpl() {
|
||||||
override val notNullName get() = name
|
override val notNullName get() = name
|
||||||
|
override val nameOrBukkitName: String get() = name
|
||||||
|
|
||||||
override fun matches(player: OfflinePlayer, allowNameMatch: Boolean): Boolean {
|
override fun matches(player: OfflinePlayer, allowNameMatch: Boolean): Boolean {
|
||||||
return allowNameMatch && player.name == name
|
return allowNameMatch && player.name == name
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ object ProfilesT : IdTransactionsTable<ProfilesT, PlayerProfile>("parcel_profile
|
|||||||
val uuid = binary("uuid", 16).nullable()
|
val uuid = binary("uuid", 16).nullable()
|
||||||
val name = varchar("name", 32).nullable()
|
val name = varchar("name", 32).nullable()
|
||||||
|
|
||||||
// MySQL dialect MUST permit multiple null values for this to work
|
// MySQL dialect MUST permit multiple null values for this to work. Server SQL does not allow this. That dialect is shit anyway.
|
||||||
val uuid_constraint = uniqueIndexR("uuid_constraint", uuid)
|
val uuid_constraint = uniqueIndexR("uuid_constraint", uuid)
|
||||||
val index_pair = uniqueIndexR("index_pair", uuid, name)
|
val index_pair = uniqueIndexR("index_pair", uuid, name)
|
||||||
|
|
||||||
|
|||||||
2
todo.md
2
todo.md
@@ -77,4 +77,6 @@ Use an atomic GET OR INSERT query so that parallel execution doesn't cause probl
|
|||||||
|
|
||||||
Implement a container that doesn't require loading all parcel data on startup (Complex).
|
Implement a container that doesn't require loading all parcel data on startup (Complex).
|
||||||
|
|
||||||
|
Update player profiles in the database on join to account for name changes.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user