Archived
0

More todo things

This commit is contained in:
Dico
2018-08-06 02:57:46 +01:00
parent 0b8deb4c54
commit de1833607c
3 changed files with 7 additions and 1 deletions

View File

@@ -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

View File

@@ -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)