Java Code Examples for ninja.leaping.configurate.commented.CommentedConfigurationNode#getKey()
The following examples show how to use
ninja.leaping.configurate.commented.CommentedConfigurationNode#getKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageStorage.java From GriefDefender with MIT License | 6 votes |
@SuppressWarnings({"unchecked", "rawtypes"}) public void resetMessageData(String message) { for (Map.Entry<Object, ? extends CommentedConfigurationNode> mapEntry : this.root.getNode(GriefDefenderPlugin.MOD_ID).getChildrenMap().entrySet()) { CommentedConfigurationNode node = (CommentedConfigurationNode) mapEntry.getValue(); String key = ""; String comment = node.getComment().orElse(null); if (comment == null && node.getKey() instanceof String) { key = (String) node.getKey(); if (key.equalsIgnoreCase(message)) { this.root.getNode(GriefDefenderPlugin.MOD_ID).removeChild(mapEntry.getKey()); } } } try { this.loader.save(this.root); this.configMapper = (ObjectMapper.BoundInstance) ObjectMapper.forClass(MessageDataConfig.class).bindToNew(); this.configBase = this.configMapper.populate(this.root.getNode(GriefDefenderPlugin.MOD_ID)); } catch (IOException | ObjectMappingException e) { e.printStackTrace(); } GriefDefenderPlugin.getInstance().messageData = this.configBase; }
Example 2
Source File: MessageStorage.java From GriefDefender with MIT License | 6 votes |
@SuppressWarnings({"unchecked", "rawtypes"}) public void resetMessageData(String message) { for (Map.Entry<Object, ? extends CommentedConfigurationNode> mapEntry : this.root.getNode(GriefDefenderPlugin.MOD_ID).getChildrenMap().entrySet()) { CommentedConfigurationNode node = (CommentedConfigurationNode) mapEntry.getValue(); String key = ""; String comment = node.getComment().orElse(null); if (comment == null && node.getKey() instanceof String) { key = (String) node.getKey(); if (key.equalsIgnoreCase(message)) { this.root.getNode(GriefDefenderPlugin.MOD_ID).removeChild(mapEntry.getKey()); } } } try { this.loader.save(this.root); this.configMapper = (ObjectMapper.BoundInstance) ObjectMapper.forClass(MessageDataConfig.class).bindToNew(); this.configBase = this.configMapper.populate(this.root.getNode(GriefDefenderPlugin.MOD_ID)); } catch (IOException | ObjectMappingException e) { e.printStackTrace(); } GriefDefenderPlugin.getInstance().messageData = this.configBase; }
Example 3
Source File: MessageStorage.java From GriefPrevention with MIT License | 6 votes |
@SuppressWarnings({"unchecked", "rawtypes"}) public void resetMessageData(String message) { for (Map.Entry<Object, ? extends CommentedConfigurationNode> mapEntry : this.root.getNode(GriefPreventionPlugin.MOD_ID).getChildrenMap().entrySet()) { CommentedConfigurationNode node = (CommentedConfigurationNode) mapEntry.getValue(); String key = ""; String comment = node.getComment().orElse(null); if (comment == null && node.getKey() instanceof String) { key = (String) node.getKey(); if (key.equalsIgnoreCase(message)) { this.root.getNode(GriefPreventionPlugin.MOD_ID).removeChild(mapEntry.getKey()); } } } try { this.loader.save(this.root); this.configMapper = (ObjectMapper.BoundInstance) ObjectMapper.forClass(MessageDataConfig.class).bindToNew(); this.configBase = this.configMapper.populate(this.root.getNode(GriefPreventionPlugin.MOD_ID)); } catch (IOException | ObjectMappingException e) { e.printStackTrace(); } GriefPreventionPlugin.instance.messageData = this.configBase; }