motd and rules are now configured in the files motd.txt and rules.txt, values from config.yml are copied automatically

New features:
Info command now understands the tags from motd and rules
motd and rules are now multipage
On join, only the first page of motd is shown.
This commit is contained in:
snowleo 2011-11-18 04:18:03 +01:00
parent 2a98734d22
commit 0bbc1e540b
15 changed files with 524 additions and 320 deletions

View File

@ -36,7 +36,6 @@ import com.earth2me.essentials.signs.SignPlayerListener;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.PluginCommandYamlParser;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
@ -240,120 +239,6 @@ public class Essentials extends JavaPlugin implements IEssentials
}
Util.updateLocale(settings.getLocale(), this);
// for motd
getConfiguration().load();
}
@Override
public String[] getMotd(final CommandSender sender, final String def)
{
return getLines(sender, "motd", def);
}
@Override
public String[] getLines(final CommandSender sender, final String node, final String def)
{
List<String> lines = (List<String>)getConfiguration().getProperty(node);
if (lines == null)
{
return new String[0];
}
String[] retval = new String[lines.size()];
if (lines.isEmpty() || lines.get(0) == null)
{
try
{
lines = new ArrayList<String>();
// "[]" in YaML indicates empty array, so respect that
if (!getConfiguration().getString(node, def).equals("[]"))
{
lines.add(getConfiguration().getString(node, def));
retval = new String[lines.size()];
}
}
catch (Throwable ex2)
{
LOGGER.log(Level.WARNING, Util.format("corruptNodeInConfig", node));
return new String[0];
}
}
// if still empty, call it a day
if (lines == null || lines.isEmpty() || lines.get(0) == null)
{
return new String[0];
}
for (int i = 0; i < lines.size(); i++)
{
String m = lines.get(i);
if (m == null)
{
continue;
}
m = m.replace('&', '§').replace("§§", "&");
if (sender instanceof User || sender instanceof Player)
{
User user = getUser(sender);
m = m.replace("{PLAYER}", user.getDisplayName());
m = m.replace("{IP}", user.getAddress().toString());
m = m.replace("{BALANCE}", Double.toString(user.getMoney()));
m = m.replace("{MAILS}", Integer.toString(user.getMails().size()));
m = m.replace("{WORLD}", user.getLocation().getWorld().getName());
}
int playerHidden = 0;
for (Player p : getServer().getOnlinePlayers())
{
if (getUser(p).isHidden())
{
playerHidden++;
}
}
m = m.replace("{ONLINE}", Integer.toString(getServer().getOnlinePlayers().length - playerHidden));
m = m.replace("{UNIQUE}", Integer.toString(userMap.getUniqueUsers()));
if (m.matches(".*\\{PLAYERLIST\\}.*"))
{
StringBuilder online = new StringBuilder();
for (Player p : getServer().getOnlinePlayers())
{
if (getUser(p).isHidden())
{
continue;
}
if (online.length() > 0)
{
online.append(", ");
}
online.append(p.getDisplayName());
}
m = m.replace("{PLAYERLIST}", online.toString());
}
if (sender instanceof Player)
{
try
{
Class User = getClassLoader().loadClass("bukkit.Vandolis.User");
Object vuser = User.getConstructor(User.class).newInstance((Player)sender);
m = m.replace("{RED:BALANCE}", User.getMethod("getMoney").invoke(vuser).toString());
m = m.replace("{RED:BUYS}", User.getMethod("getNumTransactionsBuy").invoke(vuser).toString());
m = m.replace("{RED:SELLS}", User.getMethod("getNumTransactionsSell").invoke(vuser).toString());
}
catch (Throwable ex)
{
m = m.replace("{RED:BALANCE}", "N/A");
m = m.replace("{RED:BUYS}", "N/A");
m = m.replace("{RED:SELLS}", "N/A");
}
}
retval[i] = m + " ";
}
return retval;
}
@Override

View File

@ -1,5 +1,10 @@
package com.earth2me.essentials;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@ -8,13 +13,10 @@ import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerAnimationType;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -177,13 +179,16 @@ public class EssentialsPlayerListener extends PlayerListener
if (!ess.getSettings().isCommandDisabled("motd") && user.isAuthorized("essentials.motd"))
{
for (String m : ess.getMotd(user, null))
try
{
if (m == null)
{
continue;
}
user.sendMessage(m);
final IText input = new TextInput(user, "motd", true, ess);
final IText output = new KeywordReplacer(input, user, ess);
final TextPager pager = new TextPager(output, false);
pager.showPage("1", null, user);
}
catch (IOException ex)
{
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
}
}

View File

@ -8,6 +8,7 @@ import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.security.DigestInputStream;
import java.security.MessageDigest;
@ -82,6 +83,50 @@ public class EssentialsUpgrade
}
}
private void moveMotdRulesToFile(String name)
{
if (doneFile.getBoolean("move"+name+"ToFile", false))
{
return;
}
try
{
final File file = new File(ess.getDataFolder(), name+".txt");
if (file.exists())
{
return;
}
final File configFile = new File(ess.getDataFolder(), "config.yml");
if (!configFile.exists())
{
return;
}
final EssentialsConf conf = new EssentialsConf(configFile);
conf.load();
List<String> lines = conf.getStringList(name, null);
if (lines != null && !lines.isEmpty())
{
if (!file.createNewFile())
{
throw new IOException("Failed to create file " + file);
}
PrintWriter writer = new PrintWriter(file);
for (String line : lines)
{
writer.println(line);
}
writer.close();
}
doneFile.setProperty("move"+name+"ToFile", true);
doneFile.save();
}
catch (Throwable e)
{
LOGGER.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e);
}
}
private void removeLinesFromConfig(File file, String regex, String info) throws Exception
{
boolean needUpdate = false;
@ -654,6 +699,8 @@ public class EssentialsUpgrade
ess.getDataFolder().mkdirs();
}
moveWorthValuesToWorthYml();
moveMotdRulesToFile("motd");
moveMotdRulesToFile("rules");
}
public void afterSettings()

View File

@ -29,10 +29,6 @@ public interface IEssentials extends Plugin
BukkitScheduler getScheduler();
String[] getMotd(CommandSender sender, String def);
String[] getLines(CommandSender sender, String node, String def);
Jail getJail();
Warps getWarps();

View File

@ -1,17 +1,11 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandinfo extends EssentialsCommand
@ -24,165 +18,9 @@ public class Commandinfo extends EssentialsCommand
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
String pageStr = args.length > 0 ? args[0].trim() : null;
List<String> lines = new ArrayList<String>();
List<String> chapters = new ArrayList<String>();
Map<String, Integer> bookmarks = new HashMap<String, Integer>();
File file = null;
if (sender instanceof Player)
{
User user = ess.getUser(sender);
file = new File(ess.getDataFolder(), "info_"+Util.sanitizeFileName(user.getName()) +".txt");
if (!file.exists())
{
file = new File(ess.getDataFolder(), "info_"+Util.sanitizeFileName(user.getGroup()) +".txt");
}
}
if (file == null || !file.exists())
{
file = new File(ess.getDataFolder(), "info.txt");
}
if (file.exists())
{
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try
{
int lineNumber = 0;
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine();
if (line.length() > 0 && line.charAt(0) == '#')
{
bookmarks.put(line.substring(1).toLowerCase().replaceAll("&[0-9a-f]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '§'));
}
lines.add(line.replace('&', '§'));
lineNumber++;
}
}
finally
{
bufferedReader.close();
}
}
else
{
file.createNewFile();
throw new Exception(Util.i18n("infoFileDoesNotExist"));
}
if (bookmarks.isEmpty())
{
int page = 1;
try
{
page = Integer.parseInt(pageStr);
}
catch (Exception ex)
{
page = 1;
}
int start = (page - 1) * 9;
int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
sender.sendMessage(Util.format("infoPages", page, pages ));
for (int i = start; i < lines.size() && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
return;
}
if (pageStr == null || pageStr.isEmpty() || pageStr.matches("[0-9]+"))
{
if (lines.get(0).startsWith("#"))
{
sender.sendMessage(Util.i18n("infoChapter"));
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String string : chapters)
{
if (!first)
{
sb.append(", ");
}
first = false;
sb.append(string);
}
sender.sendMessage(sb.toString());
return;
}
else
{
int page = 1;
try
{
page = Integer.parseInt(pageStr);
}
catch (Exception ex)
{
page = 1;
}
int start = (page - 1) * 9;
int end;
for (end = 0; end < lines.size(); end++)
{
String line = lines.get(end);
if (line.startsWith("#"))
{
break;
}
}
int pages = end / 9 + (end % 9 > 0 ? 1 : 0);
sender.sendMessage(Util.format("infoPages", page, pages ));
for (int i = start; i < end && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
return;
}
}
int chapterpage = 0;
if (args.length >= 2)
{
try
{
chapterpage = Integer.parseInt(args[1]) - 1;
}
catch (Exception ex)
{
chapterpage = 0;
}
}
if (!bookmarks.containsKey(pageStr.toLowerCase()))
{
sender.sendMessage(Util.i18n("infoUnknownChapter"));
return;
}
int chapterstart = bookmarks.get(pageStr.toLowerCase()) + 1;
int chapterend;
for (chapterend = chapterstart; chapterend < lines.size(); chapterend++)
{
String line = lines.get(chapterend);
if (line.startsWith("#"))
{
break;
}
}
int start = chapterstart + chapterpage * 9;
int page = chapterpage + 1;
int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0);
sender.sendMessage(Util.format("infoChapterPages", pageStr, page , pages));
for (int i = start; i < chapterend && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
final IText input = new TextInput(sender, "info", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender);
}
}

View File

@ -1,6 +1,9 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -15,9 +18,9 @@ public class Commandmotd extends EssentialsCommand
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
for (String m : ess.getMotd(sender, Util.i18n("noMotd")))
{
sender.sendMessage(m);
}
final IText input = new TextInput(sender, "motd", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender);
}
}

View File

@ -1,6 +1,10 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Util;
import com.earth2me.essentials.textreader.IText;
import com.earth2me.essentials.textreader.KeywordReplacer;
import com.earth2me.essentials.textreader.TextInput;
import com.earth2me.essentials.textreader.TextPager;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -13,11 +17,11 @@ public class Commandrules extends EssentialsCommand
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
public void run(final Server server, final CommandSender sender, final String commandLabel, String[] args) throws Exception
{
for (String m : ess.getLines(sender, "rules", Util.i18n("noRules")))
{
sender.sendMessage(m);
}
final IText input = new TextInput(sender, "rules", true, ess);
final IText output = new KeywordReplacer(input, sender, ess);
final TextPager pager = new TextPager(output);
pager.showPage(args.length > 0 ? args[0] : null, args.length > 1 ? args[1] : null, sender);
}
}

View File

@ -0,0 +1,14 @@
package com.earth2me.essentials.textreader;
import java.util.List;
import java.util.Map;
public interface IText
{
List<String> getLines();
List<String> getChapters();
Map<String, Integer> getBookmarks();
}

View File

@ -0,0 +1,112 @@
package com.earth2me.essentials.textreader;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import java.util.List;
import java.util.Map;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class KeywordReplacer implements IText
{
private final transient IText input;
private final transient IEssentials ess;
public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess)
{
this.input = input;
this.ess = ess;
replaceKeywords(sender);
}
private void replaceKeywords(final CommandSender sender)
{
String displayName, ipAddress, balance, mails, world;
String worlds, online, unique, playerlist;
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
displayName = user.getDisplayName();
ipAddress = user.getAddress().getAddress().toString();
balance = Double.toString(user.getMoney());
mails = Integer.toString(user.getMails().size());
world = user.getLocation().getWorld().getName();
}
else
{
displayName = ipAddress = balance = mails = world = "";
}
int playerHidden = 0;
for (Player p : ess.getServer().getOnlinePlayers())
{
if (ess.getUser(p).isHidden())
{
playerHidden++;
}
}
online = Integer.toString(ess.getServer().getOnlinePlayers().length - playerHidden);
unique = Integer.toString(ess.getUserMap().getUniqueUsers());
final StringBuilder worldsBuilder = new StringBuilder();
for (World w : ess.getServer().getWorlds())
{
if (worldsBuilder.length() > 0)
{
worldsBuilder.append(", ");
}
worldsBuilder.append(w.getName());
}
worlds = worldsBuilder.toString();
final StringBuilder playerlistBuilder = new StringBuilder();
for (Player p : ess.getServer().getOnlinePlayers())
{
if (ess.getUser(p).isHidden())
{
continue;
}
if (playerlistBuilder.length() > 0)
{
playerlistBuilder.append(", ");
}
playerlistBuilder.append(p.getDisplayName());
}
playerlist = playerlistBuilder.toString();
for (int i = 0; i < input.getLines().size(); i++)
{
String line = input.getLines().get(i);
line = line.replace("{PLAYER}", displayName);
line = line.replace("{IP}", ipAddress);
line = line.replace("{BALANCE}", balance);
line = line.replace("{MAILS}", mails);
line = line.replace("{WORLD}", world);
line = line.replace("{ONLINE}", online);
line = line.replace("{UNIQUE}", unique);
line = line.replace("{WORLDS}", worlds);
line = line.replace("{PLAYERLIST}", playerlist);
input.getLines().set(i, line);
}
}
@Override
public List<String> getLines()
{
return input.getLines();
}
@Override
public List<String> getChapters()
{
return input.getChapters();
}
@Override
public Map<String, Integer> getBookmarks()
{
return input.getBookmarks();
}
}

View File

@ -0,0 +1,114 @@
package com.earth2me.essentials.textreader;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import quicktime.streaming.Stream;
public class TextInput implements IText
{
private final transient List<String> lines = new ArrayList<String>();
private final transient List<String> chapters = new ArrayList<String>();
private final transient Map<String, Integer> bookmarks = new HashMap<String, Integer>();
public TextInput(final CommandSender sender, final String filename, final boolean createFile, final IEssentials ess) throws IOException
{
File file = null;
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
file = new File(ess.getDataFolder(), filename + "_" + Util.sanitizeFileName(user.getName()) + ".txt");
if (!file.exists())
{
file = new File(ess.getDataFolder(), filename + "_" + Util.sanitizeFileName(user.getGroup()) + ".txt");
}
}
if (file == null || !file.exists())
{
file = new File(ess.getDataFolder(), filename + ".txt");
}
if (file.exists())
{
final BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try
{
int lineNumber = 0;
while (bufferedReader.ready())
{
final String line = bufferedReader.readLine();
if (line == null)
{
break;
}
if (line.length() > 0 && line.charAt(0) == '#')
{
bookmarks.put(line.substring(1).toLowerCase().replaceAll("&[0-9a-f]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '§').replace("§§", "&"));
}
lines.add(line.replace('&', '§').replace("§§", "&"));
lineNumber++;
}
}
finally
{
bufferedReader.close();
}
}
else
{
if (createFile)
{
final InputStream input = ess.getResource(filename + ".txt");
final OutputStream output = new FileOutputStream(file);
try
{
final byte[] buffer = new byte[1024];
int length = 0;
length = input.read(buffer);
while (length > 0)
{
output.write(buffer, 0, length);
length = input.read(buffer);
}
}
finally
{
output.close();
input.close();
}
throw new FileNotFoundException("File " + filename + ".txt does not exist. Creating one for you.");
}
}
}
public List<String> getLines()
{
return lines;
}
public List<String> getChapters()
{
return chapters;
}
public Map<String, Integer> getBookmarks()
{
return bookmarks;
}
}

View File

@ -0,0 +1,156 @@
package com.earth2me.essentials.textreader;
import com.earth2me.essentials.Util;
import java.util.List;
import java.util.Map;
import org.bukkit.command.CommandSender;
public class TextPager
{
private final transient IText text;
private final transient boolean showHeader;
public TextPager(final IText text)
{
this(text, true);
}
public TextPager(final IText text, final boolean showHeader)
{
this.text = text;
this.showHeader = showHeader;
}
public void showPage(final String pageStr, final String chapterPageStr, final CommandSender sender)
{
List<String> lines = text.getLines();
List<String> chapters = text.getChapters();
Map<String, Integer> bookmarks = text.getBookmarks();
if (bookmarks.isEmpty())
{
int page = 1;
try
{
page = Integer.parseInt(pageStr);
}
catch (Exception ex)
{
page = 1;
}
int start = (page - 1) * 9;
if (showHeader)
{
int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
sender.sendMessage(Util.format("infoPages", page, pages));
}
for (int i = start; i < lines.size() && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
return;
}
if (pageStr == null || pageStr.isEmpty() || pageStr.matches("[0-9]+"))
{
if (lines.get(0).startsWith("#"))
{
if (!showHeader)
{
return;
}
sender.sendMessage(Util.i18n("infoChapter"));
final StringBuilder sb = new StringBuilder();
boolean first = true;
for (String string : chapters)
{
if (!first)
{
sb.append(", ");
}
first = false;
sb.append(string);
}
sender.sendMessage(sb.toString());
return;
}
else
{
int page = 1;
try
{
page = Integer.parseInt(pageStr);
}
catch (Exception ex)
{
page = 1;
}
int start = (page - 1) * 9;
int end;
for (end = 0; end < lines.size(); end++)
{
String line = lines.get(end);
if (line.startsWith("#"))
{
break;
}
}
if (showHeader)
{
int pages = end / 9 + (end % 9 > 0 ? 1 : 0);
sender.sendMessage(Util.format("infoPages", page, pages));
}
for (int i = start; i < end && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
return;
}
}
int chapterpage = 0;
if (chapterPageStr != null)
{
try
{
chapterpage = Integer.parseInt(chapterPageStr) - 1;
}
catch (Exception ex)
{
chapterpage = 0;
}
}
if (!bookmarks.containsKey(pageStr.toLowerCase()))
{
sender.sendMessage(Util.i18n("infoUnknownChapter"));
return;
}
final int chapterstart = bookmarks.get(pageStr.toLowerCase()) + 1;
int chapterend;
for (chapterend = chapterstart; chapterend < lines.size(); chapterend++)
{
final String line = lines.get(chapterend);
if (line.length() > 0 && line.charAt(0) == '#')
{
break;
}
}
final int start = chapterstart + chapterpage * 9;
if (showHeader)
{
final int page = chapterpage + 1;
final int pages = (chapterend - chapterstart) / 9 + ((chapterend - chapterstart) % 9 > 0 ? 1 : 0);
sender.sendMessage(Util.format("infoChapterPages", pageStr, page, pages));
}
for (int i = start; i < chapterend && i < start + 9; i++)
{
sender.sendMessage(lines.get(i));
}
}
}

View File

@ -85,19 +85,8 @@ spawnmob-limit: 10
# Shall we notify users when using /lightning
warn-on-smite: true
# The message of the day, displayed on connect and by typing /motd.
# Valid tags are: {PLAYER}, {IP}, {BALANCE}, {MAILS}, {WORLD}, {ONLINE}, {UNIQUE}, {PLAYERLIST}
motd:
- '&cWelcome, {PLAYER}&c!'
- '&fType &c/help&f for a list of commands.'
- 'Currently online: {PLAYERLIST}'
# motd and rules are now configured in the files motd.txt and rules.txt
# The server rules, available by typing /rules
rules:
- '[1] Be respectful'
- '[2] Be ethical'
- '[3] Use common sense'
# When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take
# priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:
# usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.

35
Essentials/src/info.txt Normal file
View File

@ -0,0 +1,35 @@
This is the info file.
This file format works for the info.txt, motd.txt and rules.txt
You can create a specific file for a user or a group:
Name it info_username.txt or info_groupname.txt
This also works with motd and rules.
It can contain chapters like the Chapter1 below:
#Chapter1
Lines starting with # begin a new chapter
The user has to type /info Chapter1 to read this chapter
If the file starts with a # then the user is shown a chapter selection,
when he does not select a chapter.
#Colors
Minecraft colors:
&0 &&0 &1 &&1 &2 &&2 &3 &&3
&4 &&4 &5 &&5 &6 &&6 &7 &&7
&8 &&8 &9 &&9 &a &&a &b &&b
&c &&c &d &&d &e &&e &f &&f
#Tags
PLAYER: {PLAYER}
IP: {IP}
BALANCE: {BALANCE}
MAILS: {MAILS}
WORLD: {WORLD}
WORLDS: {WORLDS}
ONLINE: {ONLINE}
UNIQUE: {UNIQUE}
PLAYERLIST: {PLAYERLIST}

3
Essentials/src/motd.txt Normal file
View File

@ -0,0 +1,3 @@
&cWelcome, {PLAYER}&c!
&fType &c/help&f for a list of commands.
Currently online: {PLAYERLIST}

3
Essentials/src/rules.txt Normal file
View File

@ -0,0 +1,3 @@
[1] Be respectful
[2] Be ethical
[3] Use common sense