Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd14fc666a | ||
|
|
ae0150f012 | ||
|
|
04418fa038 | ||
|
|
bcb9523315 | ||
|
|
43e7972ca3 |
@@ -22,7 +22,7 @@ dependencies {
|
||||
compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
|
||||
|
||||
// Plugin dependencies
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
|
||||
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT'
|
||||
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.7-SNAPSHOT'
|
||||
compileOnly 'com.github.TechFortress:GriefPrevention:16.17.1'
|
||||
compileOnly 'com.massivecraft:Factions:1.6.9.5-U0.5.10'
|
||||
@@ -36,7 +36,7 @@ dependencies {
|
||||
compileOnly 'com.gmail.nossr50.mcMMO:mcMMO:2.1.202'
|
||||
compileOnly 'me.clip:placeholderapi:2.10.10'
|
||||
compileOnly 'com.github.oraxen:oraxen:bd81ace154'
|
||||
compileOnly 'com.github.brcdev-minecraft:shopgui-api:2.2.0'
|
||||
compileOnly 'com.github.brcdev-minecraft:shopgui-api:3.0.0'
|
||||
compileOnly 'com.github.LoneDev6:API-ItemsAdder:2.4.7'
|
||||
compileOnly 'com.arcaniax:HeadDatabase-API:1.3.0'
|
||||
compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0'
|
||||
|
||||
@@ -17,11 +17,13 @@ class PacketSetSlot(plugin: EcoPlugin) : AbstractPacketAdapter(plugin, PacketTyp
|
||||
player: Player,
|
||||
event: PacketEvent
|
||||
) {
|
||||
packet.itemModifier.modify(0) { item: ItemStack? ->
|
||||
Display.display(
|
||||
item!!, player
|
||||
)
|
||||
}
|
||||
packet.itemModifier.modify(0, object : VersionCompatiblePLibFunction<ItemStack> {
|
||||
override fun apply(item: ItemStack) =
|
||||
Display.display(
|
||||
item,
|
||||
player
|
||||
)
|
||||
})
|
||||
|
||||
player.lastDisplayFrame = DisplayFrame.EMPTY
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.willfp.eco.internal.spigot.display
|
||||
|
||||
import com.google.common.base.Function
|
||||
import java.util.function.UnaryOperator
|
||||
|
||||
interface VersionCompatiblePLibFunction<T> : Function<T, T>, UnaryOperator<T> {
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import org.bukkit.event.EventPriority
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.inventory.InventoryClickEvent
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent
|
||||
|
||||
class GUIListener(private val plugin: EcoPlugin) : Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@@ -45,7 +46,6 @@ class GUIListener(private val plugin: EcoPlugin) : Listener {
|
||||
}
|
||||
|
||||
val menu = inv.getMenu() ?: return
|
||||
val rendered = inv.asRenderedInventory() ?: return
|
||||
|
||||
val (row, column) = MenuUtils.convertSlotToRowColumn(inv.firstEmpty())
|
||||
|
||||
@@ -54,8 +54,6 @@ class GUIListener(private val plugin: EcoPlugin) : Listener {
|
||||
if (!slot.isCaptive) {
|
||||
event.isCancelled = true
|
||||
}
|
||||
|
||||
plugin.scheduler.run { rendered.render() }
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@@ -66,4 +64,25 @@ class GUIListener(private val plugin: EcoPlugin) : Listener {
|
||||
|
||||
plugin.scheduler.run { MenuHandler.unregisterInventory(event.inventory) }
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun forceRender(event: InventoryClickEvent) {
|
||||
val player = event.whoClicked as? Player ?: return
|
||||
player.renderActiveMenu()
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
fun forceRender(event: PlayerItemHeldEvent) {
|
||||
val player = event.player
|
||||
player.renderActiveMenu()
|
||||
}
|
||||
|
||||
private fun Player.renderActiveMenu() {
|
||||
val inv = this.openInventory.topInventory
|
||||
|
||||
val rendered = inv.asRenderedInventory() ?: return
|
||||
|
||||
rendered.render()
|
||||
plugin.scheduler.run { rendered.render() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version = 6.38.0
|
||||
version = 6.38.2
|
||||
plugin-name = eco
|
||||
kotlin.code.style = official
|
||||
Reference in New Issue
Block a user