diff options
author | Dico <dico.karssiens@gmail.com> | 2018-08-06 02:57:46 +0100 |
---|---|---|
committer | Dico <dico.karssiens@gmail.com> | 2018-08-06 02:57:46 +0100 |
commit | de1833607c0643534d68c520de4fa15943017846 (patch) | |
tree | 12d62cd724bcffeca60aea1dfb49af2a70d79697 | |
parent | 0b8deb4c54f6ad96e0a63692c09a5929f39920fa (diff) |
More todo things
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/PlayerProfile.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/storage/exposed/IdTables.kt | 2 | ||||
-rw-r--r-- | todo.md | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/main/kotlin/io/dico/parcels2/PlayerProfile.kt b/src/main/kotlin/io/dico/parcels2/PlayerProfile.kt index 2e543dc..b096665 100644 --- a/src/main/kotlin/io/dico/parcels2/PlayerProfile.kt +++ b/src/main/kotlin/io/dico/parcels2/PlayerProfile.kt @@ -16,6 +16,7 @@ import java.util.UUID interface PlayerProfile { val uuid: UUID? get() = null val name: String? + val nameOrBukkitName: String? val notNullName: String val isStar: Boolean get() = false val exists: Boolean get() = this is RealImpl @@ -75,6 +76,8 @@ interface PlayerProfile { interface Real : PlayerProfile { override val uuid: UUID + override val nameOrBukkitName: String? + get() = name ?: Bukkit.getOfflinePlayer(uuid).takeIf { it.isValid }?.name override val notNullName: String get() = name ?: getPlayerNameOrDefault(uuid) @@ -121,6 +124,7 @@ interface PlayerProfile { abstract class NameOnly(override val name: String) : BaseImpl() { override val notNullName get() = name + override val nameOrBukkitName: String get() = name override fun matches(player: OfflinePlayer, allowNameMatch: Boolean): Boolean { return allowNameMatch && player.name == name diff --git a/src/main/kotlin/io/dico/parcels2/storage/exposed/IdTables.kt b/src/main/kotlin/io/dico/parcels2/storage/exposed/IdTables.kt index 45386e8..9b383af 100644 --- a/src/main/kotlin/io/dico/parcels2/storage/exposed/IdTables.kt +++ b/src/main/kotlin/io/dico/parcels2/storage/exposed/IdTables.kt @@ -93,7 +93,7 @@ object ProfilesT : IdTransactionsTable<ProfilesT, PlayerProfile>("parcel_profile val uuid = binary("uuid", 16).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 index_pair = uniqueIndexR("index_pair", uuid, name) @@ -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). +Update player profiles in the database on join to account for name changes. + |