From e7f65e27db8536bded7c3e13ba123cf97bd09de7 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 18 Jul 2014 18:04:34 -0700 Subject: [PATCH] Show where to get help. --- src/bukkit/resources/config.yml | 1 + .../com/sk89q/worldedit/forge/ForgeConfiguration.java | 10 +++------- .../java/com/sk89q/worldedit/LocalConfiguration.java | 10 +++++----- src/main/java/com/sk89q/worldedit/LocalSession.java | 10 +++++++--- .../com/sk89q/worldedit/util/YAMLConfiguration.java | 11 ++++++----- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/bukkit/resources/config.yml b/src/bukkit/resources/config.yml index 913a0decc..2ad742afb 100644 --- a/src/bukkit/resources/config.yml +++ b/src/bukkit/resources/config.yml @@ -70,3 +70,4 @@ shell-save-type: no-double-slash: false no-op-permissions: false debug: false +show-help-on-first-use: true diff --git a/src/forge/java/com/sk89q/worldedit/forge/ForgeConfiguration.java b/src/forge/java/com/sk89q/worldedit/forge/ForgeConfiguration.java index 1b0c562eb..fc77d296d 100644 --- a/src/forge/java/com/sk89q/worldedit/forge/ForgeConfiguration.java +++ b/src/forge/java/com/sk89q/worldedit/forge/ForgeConfiguration.java @@ -19,21 +19,17 @@ package com.sk89q.worldedit.forge; -import java.io.File; - import com.sk89q.worldedit.util.PropertiesConfiguration; +import java.io.File; + public class ForgeConfiguration extends PropertiesConfiguration { public ForgeConfiguration(ForgeWorldEdit mod) { super(new File(mod.getWorkingDir() + File.separator + "worldedit.properties")); } - public void load() { - super.load(); - showFirstUseVersion = false; - } - + @Override public File getWorkingDirectory() { return ForgeWorldEdit.inst.getWorkingDir(); } diff --git a/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index 484dfd452..a89123841 100644 --- a/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -19,14 +19,14 @@ package com.sk89q.worldedit; -import java.io.File; -import java.util.HashSet; -import java.util.Set; - import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.ItemID; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; +import java.io.File; +import java.util.HashSet; +import java.util.Set; + /** * Represents WorldEdit's configuration. * @@ -108,7 +108,7 @@ public abstract class LocalConfiguration { public Set allowedDataCycleBlocks = new HashSet(); public String saveDir = "schematics"; public String scriptsDir = "craftscripts"; - public boolean showFirstUseVersion = true; + public boolean showHelpInfo = true; public int butcherDefaultRadius = -1; public int butcherMaxRadius = -1; public boolean allowSymlinks = false; diff --git a/src/main/java/com/sk89q/worldedit/LocalSession.java b/src/main/java/com/sk89q/worldedit/LocalSession.java index 0bf0bfeb3..baf6fc8ee 100644 --- a/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -40,6 +40,9 @@ import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.request.Request; +import com.sk89q.worldedit.util.formatting.ColorCodeBuilder; +import com.sk89q.worldedit.util.formatting.Style; +import com.sk89q.worldedit.util.formatting.StyledFragment; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.snapshot.Snapshot; @@ -582,10 +585,11 @@ public class LocalSession { * @param player */ public void tellVersion(Actor player) { - if (config.showFirstUseVersion) { + if (config.showHelpInfo) { if (!beenToldVersion) { - player.printRaw("\u00A78WorldEdit ver. " + WorldEdit.getVersion() - + " (http://sk89q.com/projects/worldedit/)"); + StyledFragment fragment = new StyledFragment(Style.GRAY_DARK); + fragment.append("Need help with WorldEdit? Ask us on IRC (irc.esper.net #sk89q) or on our forums @ http://forum.enginehub.org"); + player.printRaw(ColorCodeBuilder.asColorCodes(fragment)); beenToldVersion = true; } } diff --git a/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index cfff58f74..bd8e11534 100644 --- a/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -19,15 +19,15 @@ package com.sk89q.worldedit.util; -import java.io.IOException; -import java.util.HashSet; -import java.util.logging.Logger; - import com.sk89q.util.yaml.YAMLProcessor; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.world.snapshot.SnapshotRepository; +import java.io.IOException; +import java.util.HashSet; +import java.util.logging.Logger; + /** * A less simple implementation of {@link LocalConfiguration} using YAML configuration files. * @@ -50,7 +50,6 @@ public class YAMLConfiguration extends LocalConfiguration { logger.severe("Error loading WorldEdit configuration: " + e); e.printStackTrace(); } - showFirstUseVersion = false; profile = config.getBoolean("debug", profile); wandItem = config.getInt("wand-item", wandItem); @@ -109,6 +108,8 @@ public class YAMLConfiguration extends LocalConfiguration { LocalSession.MAX_HISTORY_SIZE = Math.max(0, config.getInt("history.size", 15)); LocalSession.EXPIRATION_GRACE = config.getInt("history.expiration", 10) * 60 * 1000; + showHelpInfo = config.getBoolean("show-help-on-first-use", true); + String snapshotsDir = config.getString("snapshots.directory", ""); if (snapshotsDir.length() > 0) { snapshotRepo = new SnapshotRepository(snapshotsDir);