@Override
protected void loadTemplate(ConfigurationSection template)
{
castOnNoTarget = true;
super.loadTemplate(template);
undoable = false;
requiresBuildPermission = false;
requiresBreakPermission = false;
usesBrush = template.getBoolean("uses_brush", false);
if (template.contains("actions"))
{
ConfigurationSection parameters = template.getConfigurationSection("parameters");
ConfigurationSection actionsNode = template.getConfigurationSection("actions");
Object baseActions = actionsNode.get("cast");
Collection<String> templateKeys = template.getKeys(false);
for (String templateKey : templateKeys)
{
if (templateKey.endsWith("_parameters"))
{
ConfigurationSection overrides = new MemoryConfiguration();
ConfigurationUtils.addConfigurations(overrides, template.getConfigurationSection(templateKey));
String handlerKey = templateKey.substring(0, templateKey.length() - 11);
handlerParameters.put(handlerKey, overrides);
// Auto-register base actions, kind of hacky to check for alternates though.
if (baseActions != null && !actionsNode.contains(handlerKey) && handlerKey.startsWith("alternate_"))
{
actionsNode.set(handlerKey, baseActions);
}
}
}
actionsNode = ConfigurationUtils.replaceParameters(actionsNode, parameters);
if (actionsNode != null)
{
Collection<String> actionKeys = actionsNode.getKeys(false);
for (String actionKey : actionKeys)
{
ActionHandler handler = new ActionHandler();
handler.load(this, actionsNode, actionKey);
handler.initialize(this, parameters);
usesBrush = usesBrush || handler.usesBrush();
undoable = undoable || handler.isUndoable();
requiresBuildPermission = requiresBuildPermission || handler.requiresBuildPermission();
requiresBreakPermission = requiresBreakPermission || handler.requiresBreakPermission();
actions.put(actionKey, handler);
}
}
}
undoable = template.getBoolean("undoable", undoable);
}
ActionSpell.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:MagicLib
作者:
评论列表
文章目录