diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-08 22:37:38 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-05-08 22:37:38 +0000 |
commit | 02a9909e8be18d50354d7d9ed9683d0e800f2daf (patch) | |
tree | f7701247120587a4d88b78030b95141e4ff3beca | |
parent | fb82943f29c4f57e2aa5be94043cf9ba15ae5f67 (diff) | |
download | Essentials-02a9909e8be18d50354d7d9ed9683d0e800f2daf.tar Essentials-02a9909e8be18d50354d7d9ed9683d0e800f2daf.tar.gz Essentials-02a9909e8be18d50354d7d9ed9683d0e800f2daf.tar.lz Essentials-02a9909e8be18d50354d7d9ed9683d0e800f2daf.tar.xz Essentials-02a9909e8be18d50354d7d9ed9683d0e800f2daf.zip |
[trunk] Help: first test for help_username.txt, then help_groupname.txt and then help.txt, to allow help files for seperate groups and users.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1376 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandhelp.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 8bd4d6a5e..c992eda19 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -12,8 +12,8 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.SafeConstructor; -import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; public class Commandhelp extends EssentialsCommand @@ -59,10 +59,18 @@ public class Commandhelp extends EssentialsCommand private List<String> getHelpLines(User user) throws Exception { List<String> retval = new ArrayList<String>(); - File file = new File(ess.getDataFolder(), "help.txt"); - if (file.exists()) + File helpFile = new File(ess.getDataFolder(), "help_"+Util.sanitizeFileName(user.getName()) +".txt"); + if (!helpFile.exists()) { - BufferedReader rx = new BufferedReader(new FileReader(file)); + helpFile = new File(ess.getDataFolder(), "help_"+Util.sanitizeFileName(user.getGroup()) +".txt"); + } + if (!helpFile.exists()) + { + helpFile = new File(ess.getDataFolder(), "help.txt"); + } + if (helpFile.exists()) + { + BufferedReader rx = new BufferedReader(new FileReader(helpFile)); for (String l = null; rx.ready() && (l = rx.readLine()) != null;) { retval.add(l.replace('&', 'ยง')); |