mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-06-10 02:04:05 +00:00
[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
This commit is contained in:
parent
fb82943f29
commit
02a9909e8b
1 changed files with 12 additions and 4 deletions
|
@ -12,8 +12,8 @@ import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
|
|
||||||
|
|
||||||
public class Commandhelp extends EssentialsCommand
|
public class Commandhelp extends EssentialsCommand
|
||||||
|
@ -59,10 +59,18 @@ public class Commandhelp extends EssentialsCommand
|
||||||
private List<String> getHelpLines(User user) throws Exception
|
private List<String> getHelpLines(User user) throws Exception
|
||||||
{
|
{
|
||||||
List<String> retval = new ArrayList<String>();
|
List<String> retval = new ArrayList<String>();
|
||||||
File file = new File(ess.getDataFolder(), "help.txt");
|
File helpFile = new File(ess.getDataFolder(), "help_"+Util.sanitizeFileName(user.getName()) +".txt");
|
||||||
if (file.exists())
|
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;)
|
for (String l = null; rx.ready() && (l = rx.readLine()) != null;)
|
||||||
{
|
{
|
||||||
retval.add(l.replace('&', '§'));
|
retval.add(l.replace('&', '§'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue