summaryrefslogtreecommitdiff
path: root/src/main/kotlin/io/dico/parcels2/storage/migration/plotme/PlotmeTables.kt
blob: 8564ad3e8dc4778ad19e5dc4ebe49e7c9a217c92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package io.dico.parcels2.storage.migration.plotme

import org.jetbrains.exposed.sql.Table

const val uppercase: Boolean = false
@Suppress("ConstantConditionIf")
fun String.toCorrectCase() = if (uppercase) this else toLowerCase()

sealed class PlotmeTable(name: String) : Table(name) {
    val px = integer("idX").primaryKey()
    val pz = integer("idZ").primaryKey()
    val world_name = varchar("world", 32).primaryKey()
}

object PlotmePlotsT : PlotmeTable("plotmePlots".toCorrectCase()) {
    val owner_name = varchar("owner", 32)
    val owner_uuid = blob("ownerid").nullable()
}

sealed class PlotmePlotPlayerMap(name: String) : PlotmeTable(name) {
    val player_name = varchar("player", 32)
    val player_uuid = blob("playerid").nullable()
}

object PlotmeAllowedT : PlotmePlotPlayerMap("plotmeAllowed".toCorrectCase())
object PlotmeDeniedT : PlotmePlotPlayerMap("plotmeDenied".toCorrectCase())