Merge branch 'dev'

# Conflicts:
#	gradle.properties
This commit is contained in:
Auxilor
2021-09-17 19:53:40 +01:00
27 changed files with 700 additions and 147 deletions

View File

@@ -15,6 +15,7 @@ import com.willfp.eco.core.gui.GUIFactory
import com.willfp.eco.core.integrations.placeholder.PlaceholderIntegration
import com.willfp.eco.core.proxy.Cleaner
import com.willfp.eco.core.proxy.ProxyFactory
import com.willfp.eco.core.requirement.RequirementFactory
import com.willfp.eco.core.scheduling.Scheduler
import com.willfp.eco.internal.EcoCleaner
import com.willfp.eco.internal.Plugins
@@ -30,6 +31,7 @@ import com.willfp.eco.internal.gui.EcoGUIFactory
import com.willfp.eco.internal.integrations.PlaceholderIntegrationPAPI
import com.willfp.eco.internal.logging.EcoLogger
import com.willfp.eco.internal.proxy.EcoProxyFactory
import com.willfp.eco.internal.requirement.EcoRequirementFactory
import com.willfp.eco.internal.scheduling.EcoScheduler
import com.willfp.eco.proxy.FastItemStackFactoryProxy
import com.willfp.eco.spigot.integrations.bstats.MetricHandler
@@ -39,6 +41,7 @@ import java.util.logging.Logger
@Suppress("UNUSED")
class EcoHandler : EcoSpigotPlugin(), Handler {
private val cleaner = EcoCleaner()
private val requirementFactory = EcoRequirementFactory()
override fun createScheduler(plugin: EcoPlugin): Scheduler {
return EcoScheduler(plugin)
@@ -119,4 +122,8 @@ class EcoHandler : EcoSpigotPlugin(), Handler {
override fun registerBStats(plugin: EcoPlugin) {
MetricHandler.createMetrics(plugin, this.ecoPlugin)
}
override fun getRequirementFactory(): RequirementFactory {
return requirementFactory
}
}

View File

@@ -12,6 +12,7 @@ import com.willfp.eco.core.integrations.shop.ShopManager
import com.willfp.eco.core.items.Items
import com.willfp.eco.core.items.args.EnchantmentArgParser
import com.willfp.eco.core.items.args.TextureArgParser
import com.willfp.eco.internal.display.EcoDisplayHandler
import com.willfp.eco.internal.drops.DropManager
import com.willfp.eco.proxy.BlockBreakProxy
import com.willfp.eco.proxy.FastItemStackFactoryProxy
@@ -45,8 +46,6 @@ abstract class EcoSpigotPlugin : EcoPlugin(
"&a"
) {
init {
Display.setFinalizeKey(namespacedKeyFactory.create("finalized"))
Items.registerArgParser(EnchantmentArgParser())
Items.registerArgParser(TextureArgParser())
@@ -58,6 +57,12 @@ abstract class EcoSpigotPlugin : EcoPlugin(
val blockBreakProxy = getProxy(BlockBreakProxy::class.java)
BlockUtils.initialize { player: Player, block: Block -> blockBreakProxy.breakBlock(player, block) }
postInit()
}
private fun postInit() {
Display.handler = EcoDisplayHandler(this)
}
override fun handleEnable() {

View File

@@ -73,9 +73,7 @@ class GUIListener(private val plugin: EcoPlugin) : Listener {
val menu = MenuHandler.getMenu(inv) ?: return
val rowColumn = MenuUtils.convertSlotToRowColumn(inv.firstEmpty())
val row = rowColumn.first!!
val column = rowColumn.second!!
val (row, column) = MenuUtils.convertSlotToRowColumn(inv.firstEmpty())
val slot = menu.getSlot(row, column)
if (!slot.isCaptive) {