mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
remove more nms sub modules
This commit is contained in:
parent
c12e70ca54
commit
a8553debeb
22 changed files with 34 additions and 355 deletions
|
|
@ -72,11 +72,6 @@ dependencies {
|
||||||
|
|
||||||
// Include nms
|
// Include nms
|
||||||
implementation(project(":nms:nms-common"))
|
implementation(project(":nms:nms-common"))
|
||||||
implementation(project(":nms:v1_21R1"))
|
|
||||||
implementation(project(":nms:v1_21R2"))
|
|
||||||
implementation(project(":nms:v1_21R3"))
|
|
||||||
implementation(project(":nms:v1_21R4"))
|
|
||||||
implementation(project(":nms:v1_21R5"))
|
|
||||||
|
|
||||||
// include kotlin for the offline jar
|
// include kotlin for the offline jar
|
||||||
implementation(kotlin("stdlib"))
|
implementation(kotlin("stdlib"))
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.scheduler
|
|
||||||
|
|
||||||
import org.bukkit.entity.Entity
|
|
||||||
import org.bukkit.plugin.Plugin
|
|
||||||
|
|
||||||
interface TaskScheduler {
|
|
||||||
|
|
||||||
fun scheduleGlobally(plugin: Plugin, task: Runnable, time: Long): Any?
|
|
||||||
fun scheduleGlobally(plugin: Plugin, task: Runnable): Any?{
|
|
||||||
return scheduleGlobally(plugin, task, 0L)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun scheduleOnEntity(plugin: Plugin, entity: Entity, task: Runnable, time: Long): Any?
|
|
||||||
fun scheduleOnEntity(plugin: Plugin, entity: Entity, task: Runnable): Any?{
|
|
||||||
return scheduleOnEntity(plugin, entity, task, 0L)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
nms/v1_21R1/.gitignore
vendored
1
nms/v1_21R1/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
.lastDeploymentsId
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
||||||
|
|
||||||
group = rootProject.group
|
|
||||||
version = rootProject.version
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("io.papermc.paperweight.userdev")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":nms:nms-common"))
|
|
||||||
|
|
||||||
// Used for nms
|
|
||||||
paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set target version
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
|
||||||
sourceCompatibility = "21"
|
|
||||||
targetCompatibility = "21"
|
|
||||||
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
|
||||||
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
|
||||||
jvmTarget.set(JvmTarget.JVM_21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
|
||||||
import org.bukkit.inventory.InventoryView
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
|
||||||
|
|
||||||
class v1_21R1_ExternGuiTester : ExternGuiTester {
|
|
||||||
override val wesjdAnvilGuiName = "Wrapper1_21_R1"
|
|
||||||
|
|
||||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
|
||||||
if (view !is CraftInventoryView<*, *>) return null
|
|
||||||
val container = view.handle
|
|
||||||
|
|
||||||
return container.javaClass
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
nms/v1_21R2/.gitignore
vendored
1
nms/v1_21R2/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
.lastDeploymentsId
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
||||||
|
|
||||||
group = rootProject.group
|
|
||||||
version = rootProject.version
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("io.papermc.paperweight.userdev")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":nms:nms-common"))
|
|
||||||
|
|
||||||
// Used for nms
|
|
||||||
paperweight.paperDevBundle("1.21.3-R0.1-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set target version
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
|
||||||
sourceCompatibility = "21"
|
|
||||||
targetCompatibility = "21"
|
|
||||||
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
|
||||||
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
|
||||||
jvmTarget.set(JvmTarget.JVM_21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
|
||||||
import org.bukkit.inventory.InventoryView
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
|
||||||
|
|
||||||
class v1_21R2_ExternGuiTester : ExternGuiTester {
|
|
||||||
override val wesjdAnvilGuiName = "Wrapper1_21_R2"
|
|
||||||
|
|
||||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
|
||||||
if (view !is CraftInventoryView<*, *>) return null
|
|
||||||
val container = view.handle
|
|
||||||
|
|
||||||
return container.javaClass
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
nms/v1_21R3/.gitignore
vendored
1
nms/v1_21R3/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
.lastDeploymentsId
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
||||||
|
|
||||||
group = rootProject.group
|
|
||||||
version = rootProject.version
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("io.papermc.paperweight.userdev")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":nms:nms-common"))
|
|
||||||
|
|
||||||
// Used for nms
|
|
||||||
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set target version
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
|
||||||
sourceCompatibility = "21"
|
|
||||||
targetCompatibility = "21"
|
|
||||||
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
|
||||||
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
|
||||||
jvmTarget.set(JvmTarget.JVM_21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
|
||||||
import org.bukkit.inventory.InventoryView
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
|
||||||
|
|
||||||
class v1_21R3_ExternGuiTester: ExternGuiTester {
|
|
||||||
override val wesjdAnvilGuiName = "Wrapper1_21_R3"
|
|
||||||
|
|
||||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
|
||||||
if(view !is CraftInventoryView<*, *>) return null
|
|
||||||
val container = view.handle
|
|
||||||
|
|
||||||
return container.javaClass
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
nms/v1_21R4/.gitignore
vendored
1
nms/v1_21R4/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
.lastDeploymentsId
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
||||||
|
|
||||||
group = rootProject.group
|
|
||||||
version = rootProject.version
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("io.papermc.paperweight.userdev")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":nms:nms-common"))
|
|
||||||
|
|
||||||
// Used for nms
|
|
||||||
paperweight.paperDevBundle("1.21.5-R0.1-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set target version
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
|
||||||
sourceCompatibility = "21"
|
|
||||||
targetCompatibility = "21"
|
|
||||||
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
|
||||||
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
|
||||||
jvmTarget.set(JvmTarget.JVM_21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
|
||||||
import org.bukkit.inventory.InventoryView
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
|
||||||
|
|
||||||
class v1_21R4_ExternGuiTester : ExternGuiTester {
|
|
||||||
override val wesjdAnvilGuiName = "Wrapper1_21_R4"
|
|
||||||
|
|
||||||
var tested = false
|
|
||||||
var possible = false
|
|
||||||
|
|
||||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
|
||||||
// In case we are in a test environment
|
|
||||||
if (!tested) testClassExist()
|
|
||||||
if (!possible) return null
|
|
||||||
|
|
||||||
if (view !is CraftInventoryView<*, *>) return null
|
|
||||||
val container = view.handle
|
|
||||||
|
|
||||||
return container.javaClass
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testClassExist() {
|
|
||||||
tested = true
|
|
||||||
try {
|
|
||||||
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
|
|
||||||
possible = true
|
|
||||||
} catch (e: ClassNotFoundException) {
|
|
||||||
possible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
nms/v1_21R5/.gitignore
vendored
1
nms/v1_21R5/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
||||||
.lastDeploymentsId
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
||||||
|
|
||||||
group = rootProject.group
|
|
||||||
version = rootProject.version
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id("io.papermc.paperweight.userdev")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation(project(":nms:nms-common"))
|
|
||||||
|
|
||||||
// Used for nms
|
|
||||||
paperweight.paperDevBundle("1.21.6-R0.1-SNAPSHOT")
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven("https://repo.papermc.io/repository/maven-public/")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set target version
|
|
||||||
tasks.withType<JavaCompile>().configureEach {
|
|
||||||
sourceCompatibility = "21"
|
|
||||||
targetCompatibility = "21"
|
|
||||||
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
|
||||||
compilerOptions {
|
|
||||||
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
|
|
||||||
jvmTarget.set(JvmTarget.JVM_21)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui.version
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
|
||||||
import org.bukkit.inventory.InventoryView
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
|
||||||
|
|
||||||
class v1_21R5_ExternGuiTester: ExternGuiTester {
|
|
||||||
override val wesjdAnvilGuiName = "Wrapper1_21_R5"
|
|
||||||
|
|
||||||
var tested = false;
|
|
||||||
var possible = false;
|
|
||||||
|
|
||||||
override fun getContainerClass(view: InventoryView): Class<Any>? {
|
|
||||||
// In case we are in a test environment
|
|
||||||
if(!tested) testClassExist()
|
|
||||||
if(!possible) return null
|
|
||||||
|
|
||||||
if(view !is CraftInventoryView<*, *>) return null
|
|
||||||
val container = view.handle
|
|
||||||
|
|
||||||
return container.javaClass
|
|
||||||
}
|
|
||||||
|
|
||||||
fun testClassExist(){
|
|
||||||
tested = true;
|
|
||||||
try {
|
|
||||||
Class.forName("org.bukkit.craftbukkit.inventory.CraftInventoryView")
|
|
||||||
possible = true
|
|
||||||
} catch (e: ClassNotFoundException){
|
|
||||||
possible = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -3,14 +3,4 @@ rootProject.name = "CustomAnvil"
|
||||||
// NMS subproject
|
// NMS subproject
|
||||||
include("nms:nms-common")
|
include("nms:nms-common")
|
||||||
findProject(":nms:nms-common")?.name = "nms-common"
|
findProject(":nms:nms-common")?.name = "nms-common"
|
||||||
include("nms:v1_21R1")
|
|
||||||
findProject(":nms:v1_21R1")?.name = "v1_21R1"
|
|
||||||
include("nms:v1_21R2")
|
|
||||||
findProject(":nms:v1_21R2")?.name = "v1_21R2"
|
|
||||||
include("nms:v1_21R3")
|
|
||||||
findProject(":nms:v1_21R3")?.name = "v1_21R3"
|
|
||||||
include("nms:v1_21R4")
|
|
||||||
findProject(":nms:v1_21R4")?.name = "v1_21R4"
|
|
||||||
include("nms:v1_21R5")
|
|
||||||
findProject(":nms:v1_21R5")?.name = "v1_21R5"
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,20 @@ import org.bukkit.inventory.view.AnvilView
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
||||||
import xyz.alexcrea.cuanvil.dependency.datapack.DataPackDependency
|
import xyz.alexcrea.cuanvil.dependency.datapack.DataPackDependency
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
import xyz.alexcrea.cuanvil.dependency.gui.ExternGuiTester
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.GuiTesterSelector
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
|
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerBase
|
||||||
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerSelector
|
import xyz.alexcrea.cuanvil.dependency.packet.PacketManagerSelector
|
||||||
import xyz.alexcrea.cuanvil.dependency.plugins.*
|
import xyz.alexcrea.cuanvil.dependency.plugins.*
|
||||||
import xyz.alexcrea.cuanvil.dependency.scheduler.TaskScheduler
|
import xyz.alexcrea.cuanvil.dependency.scheduler.FoliaScheduler
|
||||||
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener.Companion.ANVIL_OUTPUT_SLOT
|
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener.Companion.ANVIL_OUTPUT_SLOT
|
||||||
import xyz.alexcrea.cuanvil.util.AnvilUseType
|
import xyz.alexcrea.cuanvil.util.AnvilUseType
|
||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
|
|
||||||
|
|
||||||
@Suppress("unstableApiUsage")
|
@Suppress("unstableApiUsage")
|
||||||
object DependencyManager {
|
object DependencyManager {
|
||||||
|
|
||||||
var isFolia: Boolean = false
|
var isFolia: Boolean = false
|
||||||
lateinit var scheduler: TaskScheduler
|
lateinit var scheduler: FoliaScheduler
|
||||||
lateinit var packetManager: PacketManagerBase
|
lateinit var packetManager: PacketManagerBase
|
||||||
private var externGuiTester: ExternGuiTester? = null
|
|
||||||
|
|
||||||
var enchantmentSquaredCompatibility: EnchantmentSquaredDependency? = null
|
var enchantmentSquaredCompatibility: EnchantmentSquaredDependency? = null
|
||||||
private var ecoEnchantCompatibility: EcoEnchantDependency? = null
|
private var ecoEnchantCompatibility: EcoEnchantDependency? = null
|
||||||
|
|
@ -54,11 +51,11 @@ object DependencyManager {
|
||||||
if (isFolia) {
|
if (isFolia) {
|
||||||
CustomAnvil.instance.logger.info("Folia detected... Custom Anvil Folia support is experimental. issues are more likely to happens.")
|
CustomAnvil.instance.logger.info("Folia detected... Custom Anvil Folia support is experimental. issues are more likely to happens.")
|
||||||
}
|
}
|
||||||
|
scheduler = FoliaScheduler()
|
||||||
|
|
||||||
// Packet Manager
|
// Packet Manager
|
||||||
val forceProtocolib = ConfigHolder.DEFAULT_CONFIG.config.getBoolean("force_protocolib", false)
|
val forceProtocolib = ConfigHolder.DEFAULT_CONFIG.config.getBoolean("force_protocolib", false)
|
||||||
packetManager = PacketManagerSelector.selectPacketManager(forceProtocolib)
|
packetManager = PacketManagerSelector.selectPacketManager(forceProtocolib)
|
||||||
externGuiTester = GuiTesterSelector.selectGuiTester
|
|
||||||
|
|
||||||
// Enchantment Squared dependency
|
// Enchantment Squared dependency
|
||||||
if (pluginManager.isPluginEnabled("EnchantsSquared")) {
|
if (pluginManager.isPluginEnabled("EnchantsSquared")) {
|
||||||
|
|
@ -158,7 +155,7 @@ object DependencyManager {
|
||||||
var bypass = bypassEvent.isCancelled
|
var bypass = bypassEvent.isCancelled
|
||||||
|
|
||||||
// Test if the inventory is a gui(version specific)
|
// Test if the inventory is a gui(version specific)
|
||||||
if (!bypass && (externGuiTester?.testIfGui(event.view) == true)) bypass = true
|
if (!bypass && ExternGuiTester.testIfGui(event.view)) bypass = true
|
||||||
|
|
||||||
// Test if in an ax player warp rating gui
|
// Test if in an ax player warp rating gui
|
||||||
if (!bypass && (axPlayerWarpsCompatibility?.testIfGui(player) == true)) bypass = true
|
if (!bypass && (axPlayerWarpsCompatibility?.testIfGui(player) == true)) bypass = true
|
||||||
|
|
@ -289,7 +286,7 @@ object DependencyManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if the inventory is a gui(version specific)
|
// Test if the inventory is a gui(version specific)
|
||||||
if (!bypass && (externGuiTester?.testIfGui(event.view) == true)) bypass = true
|
if (!bypass && ExternGuiTester.testIfGui(event.view)) bypass = true
|
||||||
|
|
||||||
// Test if in an ax player warp rating gui
|
// Test if in an ax player warp rating gui
|
||||||
if (!bypass && (axPlayerWarpsCompatibility?.testIfGui(event.player) == true)) bypass = true
|
if (!bypass && (axPlayerWarpsCompatibility?.testIfGui(event.player) == true)) bypass = true
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui
|
package xyz.alexcrea.cuanvil.dependency.gui
|
||||||
|
|
||||||
|
import org.bukkit.craftbukkit.inventory.CraftInventoryView
|
||||||
import org.bukkit.inventory.InventoryView
|
import org.bukkit.inventory.InventoryView
|
||||||
|
|
||||||
interface ExternGuiTester {
|
object ExternGuiTester {
|
||||||
|
|
||||||
val wesjdAnvilGuiName: String?
|
fun getContainerClass(view: InventoryView): Class<Any>? {
|
||||||
|
if (view !is CraftInventoryView<*, *>) return null
|
||||||
|
val container = view.handle
|
||||||
|
|
||||||
fun getContainerClass(view: InventoryView): Class<Any>?
|
return container.javaClass
|
||||||
|
}
|
||||||
|
|
||||||
fun testIfGui(view: InventoryView): Boolean {
|
fun testIfGui(view: InventoryView): Boolean {
|
||||||
// this mean we are on test
|
// this mean we are on test
|
||||||
|
|
@ -25,7 +29,10 @@ interface ExternGuiTester {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun expectWesjd(name: String): Boolean {
|
fun expectWesjd(name: String): Boolean {
|
||||||
val expectedWesjdGuiPath = "anvilgui.version.$wesjdAnvilGuiName"
|
val spigotVer = GuiTesterSelector.spigotVersionString
|
||||||
|
if(spigotVer == null) return false
|
||||||
|
|
||||||
|
val expectedWesjdGuiPath = "anvilgui.version.Wrapper${spigotVer}"
|
||||||
|
|
||||||
return name.contains(expectedWesjdGuiPath)
|
return name.contains(expectedWesjdGuiPath)
|
||||||
}
|
}
|
||||||
|
|
@ -1,24 +1,21 @@
|
||||||
package xyz.alexcrea.cuanvil.dependency.gui
|
package xyz.alexcrea.cuanvil.dependency.gui
|
||||||
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.gui.version.*
|
|
||||||
import xyz.alexcrea.cuanvil.update.UpdateUtils
|
import xyz.alexcrea.cuanvil.update.UpdateUtils
|
||||||
|
|
||||||
object GuiTesterSelector {
|
object GuiTesterSelector {
|
||||||
|
|
||||||
val selectGuiTester: ExternGuiTester?
|
val spigotVersionString: String?
|
||||||
get() {
|
get() {
|
||||||
val versionParts = UpdateUtils.currentMinecraftVersionArray()
|
val versionParts = UpdateUtils.currentMinecraftVersionArray()
|
||||||
if (versionParts[0] != 1) return null
|
if (versionParts[0] != 1) return null
|
||||||
|
|
||||||
return when (versionParts[1]) {
|
return when (versionParts[1]) {
|
||||||
// Can't support 1.16.5 bc 1.16.5 paper userdev do not exist
|
|
||||||
|
|
||||||
21 -> when (versionParts[2]) {
|
21 -> when (versionParts[2]) {
|
||||||
0, 1 -> v1_21R1_ExternGuiTester()
|
0, 1 -> "1_21_R1"
|
||||||
2, 3 -> v1_21R2_ExternGuiTester()
|
2, 3 -> "1_21_R2"
|
||||||
4 -> v1_21R3_ExternGuiTester()
|
4 -> "1_21_R3"
|
||||||
5 -> v1_21R4_ExternGuiTester()
|
5 -> "1_21_R4"
|
||||||
6, 7, 8 -> v1_21R5_ExternGuiTester()
|
6, 7, 8 -> "1_21_R5"
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,10 @@ import org.bukkit.Bukkit
|
||||||
import org.bukkit.entity.Entity
|
import org.bukkit.entity.Entity
|
||||||
import org.bukkit.plugin.Plugin
|
import org.bukkit.plugin.Plugin
|
||||||
|
|
||||||
class FoliaScheduler : TaskScheduler {
|
//TODO replace usage of this to in code correct version
|
||||||
|
class FoliaScheduler {
|
||||||
|
|
||||||
override fun scheduleGlobally(plugin: Plugin, task: Runnable, time: Long): Any {
|
fun scheduleGlobally(plugin: Plugin, task: Runnable, time: Long): Any {
|
||||||
if (time < 1) {
|
if (time < 1) {
|
||||||
return Bukkit.getGlobalRegionScheduler().run(
|
return Bukkit.getGlobalRegionScheduler().run(
|
||||||
plugin
|
plugin
|
||||||
|
|
@ -20,8 +21,11 @@ class FoliaScheduler : TaskScheduler {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun scheduleGlobally(plugin: Plugin, task: Runnable): Any?{
|
||||||
|
return scheduleGlobally(plugin, task, 0L)
|
||||||
|
}
|
||||||
|
|
||||||
override fun scheduleOnEntity(plugin: Plugin, entity: Entity, task: Runnable, time: Long): Any? {
|
fun scheduleOnEntity(plugin: Plugin, entity: Entity, task: Runnable, time: Long): Any? {
|
||||||
if (time < 1) {
|
if (time < 1) {
|
||||||
return entity.scheduler.run(
|
return entity.scheduler.run(
|
||||||
plugin,
|
plugin,
|
||||||
|
|
@ -36,4 +40,8 @@ class FoliaScheduler : TaskScheduler {
|
||||||
time
|
time
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun scheduleOnEntity(plugin: Plugin, entity: Entity, task: Runnable): Any?{
|
||||||
|
return scheduleOnEntity(plugin, entity, task, 0L)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue