当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationNode.getChildrenList方法代码示例

本文整理汇总了Java中ninja.leaping.configurate.ConfigurationNode.getChildrenList方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationNode.getChildrenList方法的具体用法?Java ConfigurationNode.getChildrenList怎么用?Java ConfigurationNode.getChildrenList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ninja.leaping.configurate.ConfigurationNode的用法示例。


在下文中一共展示了ConfigurationNode.getChildrenList方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MultiDrop

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public MultiDrop(ConfigurationNode node) {
    super(node);
    try {
        ConfigurationNode drops_node = node.getNode("DROPS");
        ConfigurationNode give_all_node = node.getNode("GIVE_ALL");
        if (drops_node.isVirtual()) {
            throw new RuntimeException("DROPS node does not exist");
        }
        drops = new ArrayList<Drop>();
        for (ConfigurationNode drop_node : drops_node.getChildrenList()) {
            drops.add((Drop) Utils.createSuperObject(drop_node, SuperObjectType.DROP));
        }
        give_all = give_all_node.getBoolean(true);
    } catch (Exception e) {
        throw new RuntimeException("Exception creating Multi Drop!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:18,代码来源:MultiDrop.java

示例2: MultiKey

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public MultiKey(ConfigurationNode node) {
    super(node);
    try {
        ConfigurationNode keys_node = node.getNode("KEYS");
        ConfigurationNode all_keys_needed_node = node.getNode("ALL_KEYS_NEEDED");
        if (keys_node.isVirtual()) {
            throw new RuntimeException("KEYS node does not exist");
        }
        keys = new ArrayList<Key>();
        for (ConfigurationNode key_node : keys_node.getChildrenList()) {
            keys.add((Key) Utils.createSuperObject(key_node, SuperObjectType.KEY));
        }
        all_keys_needed = all_keys_needed_node.getBoolean(false);
    } catch (Exception e) {
        throw new RuntimeException("Exception creating Multi Key!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:18,代码来源:MultiKey.java

示例3: deserialize

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
@Override
public JsonArray deserialize(TypeToken<?> type, ConfigurationNode node) throws ObjectMappingException {
    JsonArray array = new JsonArray();
    for (ConfigurationNode child : node.getChildrenList()) {
        array.add(child.getValue(JSON_ELEMENT_TYPE, JsonNull.INSTANCE));
    }
    return array;
}
 
开发者ID:lucko,项目名称:helper,代码行数:9,代码来源:JsonArraySerializer.java

示例4: CommandsDrop

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public CommandsDrop(ConfigurationNode node) {
    super(node);
    try {
        ConfigurationNode commands_node = node.getNode("COMMANDS");
        if (commands_node.isVirtual()) {
            throw new RuntimeException("COMMANDS node does not exist!");
        }
        commands = new ArrayList<Command>();
        for (ConfigurationNode command_node : commands_node.getChildrenList()) {
            commands.add(Utils.parseCommand(command_node));
        }
    } catch (Exception e) {
        throw new RuntimeException("Exception creating Commands Drop!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:16,代码来源:CommandsDrop.java

示例5: FirstGuiPreview

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public FirstGuiPreview(ConfigurationNode node) {
    super(node);
    try {
        ConfigurationNode display_name_node = node.getNode("DISPLAY_NAME");
        ConfigurationNode decorative_items_node = node.getNode("DECORATIVE_ITEMS");
        ConfigurationNode scroll_delay_node = node.getNode("SCROLL_DELAY");
        ConfigurationNode decorative_items_change_mode_node = node.getNode("DECORATIVE_ITEMS_CHANGE_MODE");
        if (!display_name_node.isVirtual()) {
            display_name = Optional.of(TextSerializers.FORMATTING_CODE.deserialize(display_name_node.getString()));
        }
        if (decorative_items_node.isVirtual()) {
            throw new RuntimeException("DECORATIVE_ITEMS node does not exist!");
        }
        decorative_items = new ArrayList<ItemStack>();
        for (ConfigurationNode decorative_item_node : decorative_items_node.getChildrenList()) {
            decorative_items.add(Utils.parseItem(decorative_item_node));
        }
        if (decorative_items.size() != 20) {
            throw new RuntimeException("DECORATIVE_ITEMS size must be 20 instead of " + decorative_items.size() + "!");
        }
        scroll_delay = scroll_delay_node.getInt(10);
        if (!decorative_items_change_mode_node.isVirtual()) {
            decorative_items_change_mode = Optional.of((DecorativeItemsChangeMode) Utils.createSuperObject(decorative_items_change_mode_node, SuperObjectType.DECORATIVE_ITEMS_CHANGE_MODE));
        }
    } catch (Exception e) {
        throw new RuntimeException("Exception creating First Gui Preview!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:29,代码来源:FirstGuiPreview.java

示例6: load

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
private void load() {
    try {
        ConfigurationNode node = getNode();
        ConfigurationNode commands_node = node.getNode("COMMANDS");
        if (!commands_node.isVirtual()) {
            for (ConfigurationNode command_node : commands_node.getChildrenList()) {
                ConfigurationNode cmd_node = command_node.getNode("CMD");
                ConfigurationNode console_node = command_node.getNode("CONSOLE");
                CommandPanel panel = new CommandPanel();
                panel.getDeleteButton().addActionListener(e2 -> {
                    commands_panel.remove(panel);
                    commands.remove(panel);
                    commands_panel.revalidate();
                    commands_panel.repaint();
                });
                commands_panel.add(panel);
                commands.add(panel);
                panel.getCommandField().setText(cmd_node.getString());
                panel.getConsoleCheckBox().setSelected(console_node.getBoolean());
                commands_panel.revalidate();
                commands_panel.repaint();
            }
        }
    } catch (Exception e) {
        throw new RuntimeException("Exception loading Commands Drop Configuration Dialog!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:28,代码来源:CommandsDropConfigurationDialog.java

示例7: Manager

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public Manager(ConfigurationNode node) {
    ConfigurationNode id_node = node.getNode("ID");
    ConfigurationNode name_node = node.getNode("NAME");
    ConfigurationNode case_node = node.getNode("CASE");
    ConfigurationNode key_node = node.getNode("KEY");
    ConfigurationNode open_manager_node = node.getNode("OPEN_MANAGER");
    ConfigurationNode drops_node = node.getNode("DROPS");
    ConfigurationNode preview_node = node.getNode("PREVIEW");
    ConfigurationNode send_open_message_node = node.getNode("SEND_OPEN_MESSAGE");
    ConfigurationNode custom_open_message_node = node.getNode("CUSTOM_OPEN_MESSAGE");
    if (id_node.isVirtual()) {
        throw new RuntimeException("ID node does not exist!");
    }
    if (name_node.isVirtual()) {
        throw new RuntimeException("NAME node does not exist!");
    }
    if (case_node.isVirtual()) {
        throw new RuntimeException("CASE node does not exist!");
    }
    if (key_node.isVirtual()) {
        throw new RuntimeException("KEY node does not exist!");
    }
    if (open_manager_node.isVirtual()) {
        throw new RuntimeException("OPEN_MANGER node does not exist!");
    }
    if (drops_node.isVirtual()) {
        throw new RuntimeException("DROPS node does not exist!");
    }
    id = id_node.getString();
    name = name_node.getString();
    caze = (Case) Utils.createSuperObject(case_node, SuperObjectType.CASE);
    key = (Key) Utils.createSuperObject(key_node, SuperObjectType.KEY);
    drops = new ArrayList<Drop>();
    for (ConfigurationNode drop_node : drops_node.getChildrenList()) {
        drops.add((Drop) Utils.createSuperObject(drop_node, SuperObjectType.DROP));
    }
    open_manager = (OpenManager) Utils.createSuperObject(open_manager_node, SuperObjectType.OPEN_MANAGER);
    if (!preview_node.isVirtual()) {
        preview = Optional.of((Preview) Utils.createSuperObject(preview_node, SuperObjectType.PREVIEW));
    }
    send_open_message = send_open_message_node.getBoolean(true);
    if (!custom_open_message_node.isVirtual()) {
        custom_open_message = Optional.of(custom_open_message_node.getString());
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:46,代码来源:Manager.java

示例8: parseItem

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public static ItemStack parseItem(ConfigurationNode node) {
    try {
        ConfigurationNode item_type_node = node.getNode("ITEM_TYPE");
        ConfigurationNode quantity_node = node.getNode("QUANTITY");
        ConfigurationNode sub_id_node = node.getNode("SUB_ID");
        ConfigurationNode nbt_node = node.getNode("NBT");
        ConfigurationNode durability_node = node.getNode("DURABILITY");
        ConfigurationNode display_name_node = node.getNode("DISPLAY_NAME");
        ConfigurationNode lore_node = node.getNode("LORE");
        ConfigurationNode enchantments_node = node.getNode("ENCHANTMENTS");
        ConfigurationNode hide_enchantments_node = node.getNode("HIDE_ENCHANTMENTS");
        if (item_type_node.isVirtual()) {
            throw new RuntimeException("ITEM_TYPE node does not exist!");
        }
        //Mega-shit-code start
        ConfigurationNode temp_node = node.getNode("TEMP_SPONGE_ITEM_STACK_NODE");
        temp_node.getNode("ItemType").setValue(item_type_node.getString());
        temp_node.getNode("UnsafeDamage").setValue(sub_id_node.getInt(0));
        temp_node.getNode("Count").setValue(quantity_node.getInt(1));
        ItemStack item = temp_node.getValue(TypeToken.of(ItemStack.class));
        temp_node.setValue(null);
        //Mega-shit-code end; Another not good code start
        if (!nbt_node.isVirtual()) {
            LinkedHashMap nbt_map = (LinkedHashMap) nbt_node.getValue();
            if (item.toContainer().get(DataQuery.of("UnsafeData")).isPresent()) {
                Map unsafe_data_map = item.toContainer().getMap(DataQuery.of("UnsafeData")).get();
                nbt_map.putAll(unsafe_data_map);
            }
            DataContainer container = item.toContainer().set(DataQuery.of("UnsafeData"), nbt_map);
            item = ItemStack.builder().fromContainer(container).build();
        }
        //Another not good code end
        if (!durability_node.isVirtual()) {
            int durability = durability_node.getInt();
            item.offer(Keys.ITEM_DURABILITY, durability);
        }
        if (!display_name_node.isVirtual()) {
            Text display_name = TextSerializers.FORMATTING_CODE.deserialize(display_name_node.getString());
            item.offer(Keys.DISPLAY_NAME, display_name);
        }
        if (!lore_node.isVirtual()) {
            List<Text> lore = lore_node.getList(TypeToken.of(String.class)).stream().
                    map(TextSerializers.FORMATTING_CODE::deserialize).
                    collect(Collectors.toList());
            item.offer(Keys.ITEM_LORE, lore);
        }
        if (!enchantments_node.isVirtual()) {
            List<Enchantment> item_enchantments = new ArrayList<Enchantment>();
            for (ConfigurationNode enchantment_node : enchantments_node.getChildrenList()) {
                item_enchantments.add(parseEnchantment(enchantment_node));
            }
            item.offer(Keys.ITEM_ENCHANTMENTS, item_enchantments);
        }
        if (!hide_enchantments_node.isVirtual()) {
            item.offer(Keys.HIDE_ENCHANTMENTS, hide_enchantments_node.getBoolean());
        }
        return item;
    } catch (Exception e) {
        throw new RuntimeException("Exception parsing item!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:62,代码来源:Utils.java

示例9: load

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public void load(ConfigurationNode node) {
    try {
        ConfigurationNode item_type_node = node.getNode("ITEM_TYPE");
        ConfigurationNode quantity_node = node.getNode("QUANTITY");
        ConfigurationNode sub_id_node = node.getNode("SUB_ID");
        ConfigurationNode nbt_node = node.getNode("NBT");
        ConfigurationNode durability_node = node.getNode("DURABILITY");
        ConfigurationNode display_name_node = node.getNode("DISPLAY_NAME");
        ConfigurationNode lore_node = node.getNode("LORE");
        ConfigurationNode enchantments_node = node.getNode("ENCHANTMENTS");
        ConfigurationNode hide_enchantments_node = node.getNode("HIDE_ENCHANTMENTS");
        item_type_combo_box.setSelectedItem(item_type_node.getString("NO ITEM"));
        if (!quantity_node.isVirtual()) {
            quantity_field.setText(String.valueOf(quantity_node.getInt()));
        }
        if (!sub_id_node.isVirtual()) {
            sub_id_field.setText(String.valueOf(sub_id_node.getInt()));
        }
        if (!durability_node.isVirtual()) {
            durability_field.setText(String.valueOf(durability_node.getInt()));
        }
        if (!display_name_node.isVirtual()) {
            display_name_field.setText(display_name_node.getString());
        }
        if (!lore_node.isVirtual()) {
            lore_text_area.setText(Utils.listToString(lore_node.getList(TypeToken.of(String.class))));
        }
        if (!enchantments_node.isVirtual()) {
            for (ConfigurationNode enchantment_node : enchantments_node.getChildrenList()) {
                GUIEnchantment gui_enchantment = new GUIEnchantment();
                gui_enchantment.getDeleteButton().addActionListener(e2 -> {
                    enchantments_panel.remove(gui_enchantment);
                    enchantments.remove(gui_enchantment);
                    enchantments_panel.revalidate();
                    enchantments_panel.repaint();
                });
                gui_enchantment.getEnchantmentComboBox().setSelectedItem(enchantment_node.getNode("ENCHANTMENT").getString());
                gui_enchantment.getEnchantmentLevelSpinner().setValue(enchantment_node.getNode("LEVEL").getInt());
                enchantments_panel.add(gui_enchantment);
                enchantments.add(gui_enchantment);
            }
            enchantments_panel.revalidate();
            enchantments_panel.repaint();
        }
        if (!hide_enchantments_node.isVirtual()) {
            hide_enchantments_check_box.setSelected(hide_enchantments_node.getBoolean());
        }
    } catch (Exception e) {
        throw new RuntimeException("Exception loading Item Panel!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:52,代码来源:ItemPanel.java

示例10: update

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public void update(ConfigurationNode node) {
    output.setText(node);
    manager_id_field.reset();
    manager_name_field.reset();
    case_panel.clear();
    key_panel.clear();
    open_manager_panel.clear();
    preview_panel.clear();
    new ArrayList<FlatSuperObjectPanel>(drops). //Prevents ConcurrentModificationException
            forEach(this::removeDrop);
    ConfigurationNode manager_id_node = node.getNode("ID");
    ConfigurationNode manager_name_node = node.getNode("NAME");
    ConfigurationNode case_node = node.getNode("CASE");
    ConfigurationNode key_node = node.getNode("KEY");
    ConfigurationNode open_manager_node = node.getNode("OPEN_MANAGER");
    ConfigurationNode preview_node = node.getNode("PREVIEW");
    ConfigurationNode drops_node = node.getNode("DROPS");
    if (!manager_id_node.isVirtual()) {
        manager_id_field.setText(manager_id_node.getString().toLowerCase().replace(' ', '_'));
    }
    if (!manager_name_node.isVirtual()) {
        manager_name_field.setText(manager_name_node.getString());
    }
    if (!case_node.isVirtual()) {
        case_panel.setNode(case_node);
    }
    if (!key_node.isVirtual()) {
        key_panel.setNode(key_node);
    }
    if (!open_manager_node.isVirtual()) {
        open_manager_panel.setNode(open_manager_node);
    }
    if (!preview_node.isVirtual()) {
        preview_panel.setNode(preview_node);
    }
    if (!drops_node.isVirtual()) {
        for (ConfigurationNode drop_node : drops_node.getChildrenList()) {
            addDrop().setNode(drop_node);
        }
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:42,代码来源:GWMCratesGUI.java

示例11: FirstOpenManager

import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public FirstOpenManager(ConfigurationNode node) {
    super(node);
    try {
        ConfigurationNode display_name_node = node.getNode("DISPLAY_NAME");
        ConfigurationNode decorative_items_node = node.getNode("DECORATIVE_ITEMS");
        ConfigurationNode scroll_delays_node = node.getNode("SCROLL_DELAYS");
        ConfigurationNode clear_decorative_items_node = node.getNode("CLEAR_DECORATIVE_ITEMS");
        ConfigurationNode clear_other_drops_node = node.getNode("CLEAR_OTHER_DROPS");
        ConfigurationNode close_delay_node = node.getNode("CLOSE_DELAY");
        ConfigurationNode forbid_close_node = node.getNode("FORBID_CLOSE");
        ConfigurationNode scroll_sound_node = node.getNode("SCROLL_SOUND");
        ConfigurationNode win_sound_node = node.getNode("WIN_SOUND");
        ConfigurationNode decorative_items_change_mode_node = node.getNode("DECORATIVE_ITEMS_CHANGE_MODE");
        if (!display_name_node.isVirtual()) {
            display_name = Optional.of(TextSerializers.FORMATTING_CODE.deserialize(display_name_node.getString()));
        }
        if (decorative_items_node.isVirtual()) {
            throw new RuntimeException("DECORATIVE_ITEMS node does not exist!");
        }
        decorative_items = new ArrayList<ItemStack>();
        for (ConfigurationNode decorative_item_node : decorative_items_node.getChildrenList()) {
            decorative_items.add(Utils.parseItem(decorative_item_node));
        }
        if (decorative_items.size() != 20) {
            throw new RuntimeException("DECORATIVE_ITEMS size must be 20 instead of " + decorative_items.size() + "!");
        }
        if (scroll_delays_node.isVirtual()) {
            throw new RuntimeException("SCROLL_DELAYS node does not exist!");
        }
        scroll_delays = scroll_delays_node.getList(TypeToken.of(Integer.class));
        clear_decorative_items = clear_decorative_items_node.getBoolean(false);
        clear_other_drops = clear_other_drops_node.getBoolean(true);
        if (close_delay_node.isVirtual()) {
            throw new RuntimeException("CLOSE_DELAY node does not exist!");
        }
        close_delay = close_delay_node.getInt();
        forbid_close = forbid_close_node.getBoolean(true);
        if (!scroll_sound_node.isVirtual()) {
            scroll_sound = Optional.of(scroll_sound_node.getValue(TypeToken.of(SoundType.class)));
        }
        if (!win_sound_node.isVirtual()) {
            win_sound = Optional.of(win_sound_node.getValue(TypeToken.of(SoundType.class)));
        }
        if (!decorative_items_change_mode_node.isVirtual()) {
            decorative_items_change_mode = Optional.of((DecorativeItemsChangeMode) Utils.createSuperObject(decorative_items_change_mode_node, SuperObjectType.DECORATIVE_ITEMS_CHANGE_MODE));
        }
    } catch (Exception e) {
        throw new RuntimeException("Exception creating First Gui Open Manager!", e);
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:51,代码来源:FirstOpenManager.java


注:本文中的ninja.leaping.configurate.ConfigurationNode.getChildrenList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。