Finished GUI
This commit is contained in:
@@ -17,7 +17,6 @@ import com.willfp.eco.spigot.display.*
|
||||
import com.willfp.eco.spigot.drops.CollatedRunnable
|
||||
import com.willfp.eco.spigot.eventlisteners.*
|
||||
import com.willfp.eco.spigot.gui.GUIListener
|
||||
import com.willfp.eco.spigot.gui.GUITester
|
||||
import com.willfp.eco.spigot.integrations.anticheat.*
|
||||
import com.willfp.eco.spigot.integrations.antigrief.*
|
||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsOraxen
|
||||
@@ -142,8 +141,7 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
PlayerJumpListeners(),
|
||||
GUIListener(this),
|
||||
ArrowDataListener(this),
|
||||
ArmorChangeEventListeners(this),
|
||||
GUITester(this)
|
||||
ArmorChangeEventListeners(this)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class GUIListener(plugin: EcoPlugin) : PluginDependent<EcoPlugin>(plugin), Liste
|
||||
event.isCancelled = true
|
||||
ecoSlot.handleInventoryClick(event, menu)
|
||||
|
||||
plugin.scheduler.run{ MenuHandler.getExtendedInventory(event.clickedInventory!!).refresh(player) }
|
||||
plugin.scheduler.run{ MenuHandler.getExtendedInventory(event.clickedInventory!!)!!.refresh(player) }
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -46,7 +46,7 @@ class GUIListener(plugin: EcoPlugin) : PluginDependent<EcoPlugin>(plugin), Liste
|
||||
|
||||
val menu = MenuHandler.getMenu(player.openInventory.topInventory) ?: return
|
||||
|
||||
plugin.scheduler.run{ MenuHandler.getExtendedInventory(player.openInventory.topInventory).refresh(player) }
|
||||
plugin.scheduler.run{ MenuHandler.getExtendedInventory(player.openInventory.topInventory)!!.refresh(player) }
|
||||
plugin.scheduler.runLater({ Bukkit.getLogger().info(menu.getCaptiveItems(player).toString()) }, 1)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.willfp.eco.spigot.gui
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin
|
||||
import com.willfp.eco.core.PluginDependent
|
||||
import com.willfp.eco.core.gui.menu.Menu
|
||||
import com.willfp.eco.core.gui.slot.FillerMask
|
||||
import com.willfp.eco.core.gui.slot.Slot
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.event.EventHandler
|
||||
import org.bukkit.event.Listener
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
class GUITester(plugin: EcoPlugin) : PluginDependent<EcoPlugin>(plugin), Listener {
|
||||
private val menu: Menu = Menu.builder(3)
|
||||
.setMask(
|
||||
FillerMask(
|
||||
Material.BLACK_STAINED_GLASS_PANE,
|
||||
"111111111",
|
||||
"100000001",
|
||||
"111111111"
|
||||
)
|
||||
).setSlot(
|
||||
2, 2,
|
||||
Slot.builder()
|
||||
.setCaptive()
|
||||
.build()
|
||||
).modfiy { builder ->
|
||||
run {
|
||||
val slot = Slot.builder(ItemStack(Material.RED_STAINED_GLASS_PANE))
|
||||
.setModifier{ player, menu, prev -> run {
|
||||
if (menu.getCaptiveItems(player).isNotEmpty()) {
|
||||
prev.type = Material.GREEN_STAINED_GLASS_PANE
|
||||
}
|
||||
}}
|
||||
.build()
|
||||
for (i in 3..8) {
|
||||
builder.setSlot(2, i, slot)
|
||||
}
|
||||
}
|
||||
}.build()
|
||||
|
||||
@EventHandler
|
||||
fun test(event: AsyncPlayerChatEvent) {
|
||||
if (!event.message.equals("testgui", true)) {
|
||||
return
|
||||
}
|
||||
|
||||
plugin.scheduler.run { menu.open(event.player) }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user