@Override public void load() { super.load(); creativeEnable = node.getNode("use-in-creative").getBoolean(false); cheatMode = node.getNode("cheat-mode").getBoolean(false); try { config.save(node); } catch (IOException e) { logger.warn("Error loading WorldEdit configuration", e); } }
profile = node.getNode("debug").getBoolean(profile); traceUnflushedSessions = node.getNode("debugging", "trace-unflushed-sessions").getBoolean(traceUnflushedSessions); wandItem = node.getNode("wand-item").getString(wandItem); try { wandItem = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(wandItem)).getId(); defaultChangeLimit = Math.max(-1, node.getNode("limits", "max-blocks-changed", "default").getInt(defaultChangeLimit)); maxChangeLimit = Math.max(-1, node.getNode("limits", "max-blocks-changed", "maximum").getInt(maxChangeLimit)); defaultMaxPolygonalPoints = Math.max(-1, node.getNode("limits", "max-polygonal-points", "default").getInt(defaultMaxPolygonalPoints)); maxPolygonalPoints = Math.max(-1, node.getNode("limits", "max-polygonal-points", "maximum").getInt(maxPolygonalPoints)); maxRadius = Math.max(-1, node.getNode("limits", "max-radius").getInt(maxRadius)); maxBrushRadius = node.getNode("limits", "max-brush-radius").getInt(maxBrushRadius); maxSuperPickaxeSize = Math.max(1, node.getNode("limits", "max-super-pickaxe-size").getInt(maxSuperPickaxeSize)); butcherDefaultRadius = Math.max(-1, node.getNode("limits", "butcher-radius", "default").getInt(butcherDefaultRadius)); butcherMaxRadius = Math.max(-1, node.getNode("limits", "butcher-radius", "maximum").getInt(butcherMaxRadius)); disallowedBlocks = new HashSet<>(node.getNode("limits", "disallowed-blocks").getList(TypeToken.of(String.class))); } catch (ObjectMappingException e) { logger.warn("Error loading WorldEdit configuration", e); allowedDataCycleBlocks = new HashSet<>(node.getNode("limits", "allowed-data-cycle-blocks").getList(TypeToken.of(String.class))); } catch (ObjectMappingException e) { logger.warn("Error loading WorldEdit configuration", e); registerHelp = node.getNode("register-help").getBoolean(true); logCommands = node.getNode("logging", "log-commands").getBoolean(logCommands);
private <T> void setValueAndComment(ConfigurationNode node, TypeToken<T> type, T value, String comment) throws ObjectMappingException { node.setValue(type, value); if (node instanceof CommentedConfigurationNode) { ((CommentedConfigurationNode) node).setComment(comment); } } }
@Override protected SimpleCommentedConfigurationNode createNode(Object path) { return new SimpleCommentedConfigurationNode(path, this, getOptions()); }
@Override public SimpleCommentedConfigurationNode setValue(Object value) { if (value instanceof CommentedConfigurationNode && ((CommentedConfigurationNode) value).getComment().isPresent()) { setComment(((CommentedConfigurationNode) value).getComment().get()); } return (SimpleCommentedConfigurationNode)super.setValue(value); }
public static SimpleCommentedConfigurationNode root(ConfigurationOptions options) { return new SimpleCommentedConfigurationNode(null, null, options); }
@Override public SimpleCommentedConfigurationNode setComment(String comment) { attachIfNecessary(); this.comment.set(comment); return this; }
@NonNull @Override public SimpleCommentedConfigurationNode copy() { return copy(null); }
@Override public boolean getBoolean(String path) { return file.getNode(path).getBoolean(); }
private void setValueAndComment(ConfigurationNode node, Object value, String comment) { node.setValue(value); if (node instanceof CommentedConfigurationNode) { ((CommentedConfigurationNode) node).setComment(comment); } } private <T> void setValueAndComment(ConfigurationNode node, TypeToken<T> type, T value, String comment)
@Override protected SimpleCommentedConfigurationNode createNode(Object path) { return new SimpleCommentedConfigurationNode(path, this, getOptions()); }
@NonNull public static SimpleCommentedConfigurationNode root(@NonNull ConfigurationOptions options) { return new SimpleCommentedConfigurationNode(null, null, options); }
/** * Has the server owner denied plugin metrics? * * @return true if metrics should be opted out of it */ public boolean isOptOut() { synchronized (optOutLock) { loadConfiguration(); return config.getNode("mcstats.opt-out").getBoolean(); } }
@Override protected SimpleCommentedConfigurationNode createNode(Object path) { return new SimpleCommentedConfigurationNode(path, this, getOptions()); }
@NonNull public static SimpleCommentedConfigurationNode root(@NonNull ConfigurationOptions options) { return new SimpleCommentedConfigurationNode(null, null, options); }