Skip to content

Commit

Permalink
Optimisations
Browse files Browse the repository at this point in the history
Added new search constraints
Moved to API 17
Java 16 now minimum
  • Loading branch information
HoshiKurama committed Jun 19, 2021
1 parent 1ad581a commit 2a744fb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 38 deletions.
36 changes: 3 additions & 33 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.5.10"
id("com.github.johnrengelman.shadow") version "7.0.0"
application
java
}

group = "com.hoshikurama.github"
version = "4.1.0"

apply {
plugin("application")
}

application {
mainClass.set("com.hoshikurama.github.ticketmanager.TicketManagerPlugin")
}

repositories {
mavenCentral()
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
Expand All @@ -27,7 +17,7 @@ repositories {
}

dependencies {
compileOnly("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT")
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
implementation("joda-time:joda-time:2.10.10")
implementation(kotlin("stdlib", version = "1.5.10"))
Expand All @@ -37,26 +27,6 @@ dependencies {
implementation("org.xerial:sqlite-jdbc:3.34.0")
}

tasks {
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
dependencies {
include(dependency("com.zaxxer:HikariCP:4.0.3"))
include(dependency("mysql:mysql-connector-java:8.0.25"))
include(dependency("org.xerial:sqlite-jdbc:3.34.0"))
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.5.10"))
include(dependency("com.github.seratch:kotliquery:1.3.1"))
include(dependency("joda-time:joda-time:2.10.10"))
}

relocate("com.zaxxer.hikari","com.hoshikurama.github.ticketmanager.shaded.zaxxerHikari")
relocate("com.mysql","com.hoshikurama.github.ticketmanager.shaded.mysqlDrivers")
relocate("org.sqlite","com.hoshikurama.github.ticketmanager.shaded.sqliteDrivers")
relocate("kotlin","com.hoshikurama.github.ticketmanager.shaded.kotlin-stdlib")
relocate("kotliquery","com.hoshikurama.github.ticketmanager.shaded.kotliquery")
relocate("org.joda","com.hoshikurama.github.ticketmanager.shaded.joda-time")
}
}

tasks.withType<KotlinCompile>() {
kotlinOptions.jvmTarget = "11"
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "16"
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ internal class MySQL(
override fun addTicket(ticket: Ticket, action: Ticket.Action): Int {
return using(sessionOf(dataSource)) {
val id = writeTicket(ticket, it)
writeAction(action, id!!.toInt(), it)
writeAction(action, id.toInt(), it)
return@using id.toInt()
}
}
Expand Down Expand Up @@ -294,7 +294,7 @@ internal class MySQL(
}
)
val id = writeTicket(ticket, session)
ticket.actions.forEach { writeAction(it, id!!.toInt(), session) }
ticket.actions.forEach { writeAction(it, id.toInt(), session) }
}

session.run(queryOf("DROP INDEX STATUS ON TicketManagerTicketsV2;").asExecute)
Expand Down Expand Up @@ -344,7 +344,7 @@ internal class MySQL(
mainPlugin.pluginLocked = false
}

private fun writeTicket(ticket: Ticket, session: Session): Long? {
private fun writeTicket(ticket: Ticket, session: Session): Long {
val stmt = session.connection.underlying.prepareStatement(
"INSERT INTO TicketManager_V4_Tickets (CREATOR_UUID, PRIORITY, STATUS, ASSIGNED_TO, STATUS_UPDATE_FOR_CREATOR, LOCATION) VALUES (?,?,?,?,?,?);",
Statement.RETURN_GENERATED_KEYS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Ticket(
}

data class Action(val type: Type, val user: UUID?, val message: String? = null, val timestamp: Long = Instant.now().epochSecond) {
enum class Type() {
enum class Type {
ASSIGN, CLOSE, COMMENT, OPEN, REOPEN, SET_PRIORITY, MASS_CLOSE
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
name: TicketManager
version: 4.1.0
main: com.hoshikurama.github.ticketmanager.TicketManagerPlugin
api-version: 1.16
api-version: 1.17
authors: [HoshiKurama]
depend: [Vault]
libraries:
- com.zaxxer:HikariCP:4.0.3
- mysql:mysql-connector-java:8.0.25
- org.xerial:sqlite-jdbc:3.34.0
- org.jetbrains.kotlin:kotlin-stdlib:1.5.10
- com.github.seratch:kotliquery:1.3.1
- joda-time:joda-time:2.10.10
commands:
ticket:
description: Base for all TicketManager commands
Expand Down

0 comments on commit 2a744fb

Please sign in to comment.