mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 21:27:44 +01:00
Implement ACTION defining by ACTION TYPE (#1938)
This change implements a new way how to define actions via a custom panel template. Previously there were 2 options how to define an action: - by click-type - as an array list This adds the third type: by action type. It means that now developers could code that action is the main key for defining what happens when button is clicked: ``` actions: visit: click-type: LEFT tooltip: Tooltip text for left click action ```
This commit is contained in:
parent
fa68f8f01c
commit
d492539c51
@ -360,6 +360,24 @@ public class TemplateReader
|
||||
itemRecord.addAction(actionData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ConfigurationSection actionDataSection = actionSection.getConfigurationSection(actionKey);
|
||||
|
||||
if (actionDataSection != null && actionDataSection.contains("click-type"))
|
||||
{
|
||||
clickType = Enums.getIfPresent(ClickType.class,
|
||||
actionDataSection.getString("click-type", "UNKNOWN").toUpperCase()).
|
||||
or(ClickType.UNKNOWN);
|
||||
|
||||
ItemTemplateRecord.ActionRecords actionData =
|
||||
new ItemTemplateRecord.ActionRecords(clickType,
|
||||
actionKey,
|
||||
actionDataSection.getString("content"),
|
||||
actionDataSection.getString("tooltip"));
|
||||
itemRecord.addAction(actionData);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user