mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
fix AxPlayersWarps incompatibility (#82)
This commit is contained in:
commit
e4176404ac
4 changed files with 37 additions and 2 deletions
|
|
@ -26,7 +26,6 @@ val effectiveVersion = "$version" +
|
|||
repositories {
|
||||
// EcoEnchants
|
||||
maven(url = "https://repo.auxilor.io/repository/maven-public/")
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
@ -61,6 +60,9 @@ dependencies {
|
|||
// ToolStats
|
||||
compileOnly(files("libs/toolstats-1.9.6-stripped.jar"))
|
||||
|
||||
// AxPlayerWarps
|
||||
compileOnly(files("libs/AxPlayerWarps-1.10.3.jar"))
|
||||
|
||||
// Include nms
|
||||
implementation(project(":nms:nms-common"))
|
||||
implementation(project(":nms:v1_17R1", configuration = "reobf"))
|
||||
|
|
|
|||
BIN
libs/AxPlayerWarps-1.10.3.jar
Normal file
BIN
libs/AxPlayerWarps-1.10.3.jar
Normal file
Binary file not shown.
|
|
@ -1,9 +1,11 @@
|
|||
package xyz.alexcrea.cuanvil.dependency
|
||||
|
||||
import com.willfp.eco.core.gui.player
|
||||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.Bukkit
|
||||
import org.bukkit.ChatColor
|
||||
import org.bukkit.entity.HumanEntity
|
||||
import org.bukkit.entity.Player
|
||||
import org.bukkit.event.inventory.InventoryClickEvent
|
||||
import org.bukkit.event.inventory.PrepareAnvilEvent
|
||||
import org.bukkit.inventory.AnvilInventory
|
||||
|
|
@ -40,6 +42,8 @@ object DependencyManager {
|
|||
var disenchantmentCompatibility: DisenchantmentDependency? = null
|
||||
var havenBagsCompatibility: HavenBagsDependency? = null
|
||||
|
||||
var axPlayerWarpsCompatibility: AxPlayerWarpsDependency? = null
|
||||
|
||||
val genericDependencies = ArrayList<GenericPluginDependency>()
|
||||
|
||||
fun loadDependency() {
|
||||
|
|
@ -88,6 +92,11 @@ object DependencyManager {
|
|||
havenBagsCompatibility!!.redirectListeners()
|
||||
}
|
||||
|
||||
// AxPlayerWarps dependency
|
||||
if (pluginManager.isPluginEnabled("AxPlayerWarps")) {
|
||||
axPlayerWarpsCompatibility = AxPlayerWarpsDependency()
|
||||
}
|
||||
|
||||
// "Generic" dependencies
|
||||
if (pluginManager.isPluginEnabled("ToolStats"))
|
||||
genericDependencies.add(ToolStatsDependency(pluginManager.getPlugin("ToolStats")!!))
|
||||
|
|
@ -153,6 +162,9 @@ object DependencyManager {
|
|||
// Test if the inventory is a gui(version specific)
|
||||
if (!bypass && (externGuiTester?.testIfGui(event.view) == true)) bypass = true
|
||||
|
||||
// Test if in an ax player warp rating gui
|
||||
if (!bypass && (axPlayerWarpsCompatibility?.testIfGui(player) == true)) bypass = true
|
||||
|
||||
return bypass
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +215,12 @@ object DependencyManager {
|
|||
}
|
||||
|
||||
// Return null if there was an issue
|
||||
fun tryTreatAnvilResult(event: PrepareAnvilEvent, result: ItemStack, useType: AnvilUseType, cost: Int): CATreatAnvilResultEvent? {
|
||||
fun tryTreatAnvilResult(
|
||||
event: PrepareAnvilEvent,
|
||||
result: ItemStack,
|
||||
useType: AnvilUseType,
|
||||
cost: Int
|
||||
): CATreatAnvilResultEvent? {
|
||||
val treatEvent = CATreatAnvilResultEvent(event, useType, result, cost)
|
||||
try {
|
||||
unsafeTryTreatAnvilResult(treatEvent)
|
||||
|
|
@ -279,6 +296,9 @@ object DependencyManager {
|
|||
// Test if the inventory is a gui(version specific)
|
||||
if (!bypass && (externGuiTester?.testIfGui(event.view) == true)) bypass = true
|
||||
|
||||
// Test if in an ax player warp rating gui
|
||||
if (!bypass && (axPlayerWarpsCompatibility?.testIfGui(event.player) == true)) bypass = true
|
||||
|
||||
return bypass
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package xyz.alexcrea.cuanvil.dependency.plugins
|
||||
|
||||
import com.artillexstudios.axplayerwarps.libs.axapi.gui.AnvilInput
|
||||
import org.bukkit.entity.HumanEntity
|
||||
import org.bukkit.entity.Player
|
||||
|
||||
class AxPlayerWarpsDependency {
|
||||
|
||||
fun testIfGui(player: HumanEntity): Boolean {
|
||||
return player is Player && AnvilInput.get(player) != null
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue