mirror of
https://github.com/Auxilor/EcoMenus.git
synced 2025-12-19 15:09:20 +00:00
Improved _example.yml, fixed slot conditions
This commit is contained in:
@@ -84,7 +84,7 @@ class ConfigurableSlot(
|
|||||||
action,
|
action,
|
||||||
plugin,
|
plugin,
|
||||||
context.with(section).with(typeName)
|
context.with(section).with(typeName)
|
||||||
)?.toSlotAction() ?: continue
|
)?.toSlotAction(conditions) ?: continue
|
||||||
|
|
||||||
onClick(clickType, function)
|
onClick(clickType, function)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,17 @@ package com.willfp.ecomenus.slots
|
|||||||
import com.willfp.eco.core.gui.menu.Menu
|
import com.willfp.eco.core.gui.menu.Menu
|
||||||
import com.willfp.eco.core.gui.slot.Slot
|
import com.willfp.eco.core.gui.slot.Slot
|
||||||
import com.willfp.ecomponent.SlotAction
|
import com.willfp.ecomponent.SlotAction
|
||||||
|
import com.willfp.libreforge.EmptyProvidedHolder
|
||||||
|
import com.willfp.libreforge.conditions.ConditionList
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent
|
import org.bukkit.event.inventory.InventoryClickEvent
|
||||||
|
|
||||||
interface SlotFunction {
|
interface SlotFunction {
|
||||||
fun execute(player: Player, event: InventoryClickEvent, slot: Slot, menu: Menu)
|
fun execute(player: Player, event: InventoryClickEvent, slot: Slot, menu: Menu)
|
||||||
|
|
||||||
fun toSlotAction(): SlotAction = this::execute
|
fun toSlotAction(conditions: ConditionList): SlotAction = { player, event, slot, menu ->
|
||||||
|
if (conditions.areMet(player, EmptyProvidedHolder)) {
|
||||||
|
this.execute(player, event, slot, menu)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ forwards-arrow:
|
|||||||
item: arrow name:"&fNext Page"
|
item: arrow name:"&fNext Page"
|
||||||
enabled: true
|
enabled: true
|
||||||
location:
|
location:
|
||||||
row: 3
|
row: 6
|
||||||
column: 6
|
column: 8
|
||||||
|
|
||||||
backwards-arrow:
|
backwards-arrow:
|
||||||
item: arrow name:"&fPrevious Page"
|
item: arrow name:"&fPrevious Page"
|
||||||
enabled: true
|
enabled: true
|
||||||
location:
|
location:
|
||||||
row: 3
|
row: 6
|
||||||
column: 4
|
column: 2
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
- page: 1
|
- page: 1
|
||||||
@@ -68,6 +68,18 @@ pages:
|
|||||||
- "210010012"
|
- "210010012"
|
||||||
- "211111112"
|
- "211111112"
|
||||||
- "211101112"
|
- "211101112"
|
||||||
|
- page: 2
|
||||||
|
mask:
|
||||||
|
items:
|
||||||
|
- gray_stained_glass_pane
|
||||||
|
- red_stained_glass_pane
|
||||||
|
pattern:
|
||||||
|
- "211101112"
|
||||||
|
- "211111112"
|
||||||
|
- "210000012"
|
||||||
|
- "210010012"
|
||||||
|
- "211111112"
|
||||||
|
- "211101112"
|
||||||
|
|
||||||
slots:
|
slots:
|
||||||
- item: barrier name:"&cClose"
|
- item: barrier name:"&cClose"
|
||||||
@@ -88,7 +100,7 @@ slots:
|
|||||||
conditions: [ ]
|
conditions: [ ]
|
||||||
|
|
||||||
# If the item should be shown if the conditions are not met
|
# If the item should be shown if the conditions are not met
|
||||||
show-if-not-met: true
|
show-if-not-met: false
|
||||||
|
|
||||||
left-click:
|
left-click:
|
||||||
- type: effects
|
- type: effects
|
||||||
@@ -97,7 +109,7 @@ slots:
|
|||||||
args:
|
args:
|
||||||
message: "&cYou clicked the close button!"
|
message: "&cYou clicked the close button!"
|
||||||
|
|
||||||
- type: command
|
- type: close
|
||||||
commands: [ ]
|
commands: [ ]
|
||||||
|
|
||||||
- type: menu
|
- type: menu
|
||||||
@@ -106,3 +118,24 @@ slots:
|
|||||||
- type: console_command
|
- type: console_command
|
||||||
commands:
|
commands:
|
||||||
- "eco give %player% 100"
|
- "eco give %player% 100"
|
||||||
|
|
||||||
|
- item: player_head head:%player% name:"&f%player%"
|
||||||
|
location:
|
||||||
|
row: 1
|
||||||
|
column: 5
|
||||||
|
page: 1
|
||||||
|
|
||||||
|
# Read https://plugins.auxilor.io/effects/configuring-a-condition
|
||||||
|
# The conditions required to click the item
|
||||||
|
conditions: [ ]
|
||||||
|
|
||||||
|
# If the item should be shown if the conditions are not met
|
||||||
|
show-if-not-met: true
|
||||||
|
|
||||||
|
left-click:
|
||||||
|
- type: menu
|
||||||
|
menu: other_example_menu
|
||||||
|
|
||||||
|
- type: console_command
|
||||||
|
commands:
|
||||||
|
- "eco give %player% 100"
|
||||||
|
|||||||
Reference in New Issue
Block a user