![JAR search and dependency download from the Maven repository](/logo.png)
ru.cwcode.tkach.refreshmenu.inventory.ingredient.ActionIngredient Maven / Gradle / Ivy
package ru.cwcode.tkach.refreshmenu.inventory.ingredient;
import org.bukkit.Material;
import org.bukkit.event.inventory.ClickType;
import ru.cwcode.tkach.refreshmenu.MenuContext;
import ru.cwcode.tkach.refreshmenu.inventory.ingredient.action.Action;
import java.util.EnumMap;
import java.util.List;
public class ActionIngredient extends IngredientImpl {
EnumMap actions = new EnumMap<>(ClickType.class);
public ActionIngredient() {
}
public ActionIngredient(String name, List description, int amount, Material type, int customModelData, EnumMap actions) {
super(name, description, amount, type, customModelData);
this.actions = actions;
}
public ActionIngredient bind(ClickType clickType, Action action) {
actions.put(clickType, action);
return this;
}
@Override
public void onClick(MenuContext context, ClickType clickType) {
Action action = actions.get(clickType);
if (action != null) {
action.accept(context, clickType);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy