Support new lines in newbie welcome message.

This commit is contained in:
KHobbits 2012-09-22 21:15:04 +01:00
parent 5cc24827fc
commit 2f40264c46
4 changed files with 20 additions and 8 deletions

View File

@ -11,7 +11,9 @@ public class SimpleTextInput implements IText
private final transient List<String> lines = new ArrayList<String>();
public SimpleTextInput (final String input) {
lines.add(input);
for (String line : input.split("\\n")) {
lines.add(line);
}
}
@Override

View File

@ -1,5 +1,6 @@
package com.earth2me.essentials.textreader;
import java.util.List;
import org.bukkit.command.CommandSender;
@ -20,7 +21,12 @@ public class SimpleTextPager
}
}
public String getString(int line)
public List<String> getLines()
{
return text.getLines();
}
public String getLine(int line)
{
if (text.getLines().size() < line)
{

View File

@ -552,15 +552,15 @@ protect:
storm: false
thunder: false
lightning: false
############################################################
# +------------------------------------------------------+ #
# | EssentialsAntiBuild | #
# +------------------------------------------------------+ #
############################################################
# Disable various default physics and behaviors
# Should people with build: false in permissions be allowed to build
# Set true to disable building for those people
# Setting to false means EssentialsAntiBuild will never prevent you from building
@ -573,7 +573,7 @@ protect:
# Should we tell people they are not allowed to build
warn-on-build-disallow: true
# For which block types would you like to be alerted?
# You can find a list of IDs in plugins/Essentials/items.csv after loading Essentials for the first time.
# 10 = lava :: 11 = still lava :: 46 = TNT :: 327 = lava bucket
@ -612,7 +612,7 @@ newbies:
# When we spawn for the first time, which spawnpoint do we use?
# Set to "none" if you want to use the spawn point of the world.
spawnpoint: newbies
# Do we want to give users anything on first join? Set to '' to disable
# This kit will be given regardless of cost, and permissions.
#kit: ''

View File

@ -101,7 +101,11 @@ public class EssentialsSpawnPlayerListener implements Listener
{
final IText output = new KeywordReplacer(ess.getSettings().getAnnounceNewPlayerFormat(), user, ess);
final SimpleTextPager pager = new SimpleTextPager(output);
ess.broadcastMessage(user, pager.getString(0));
for (String line : pager.getLines())
{
ess.broadcastMessage(user, line);
}
}
final String kitName = ess.getSettings().getNewPlayerKit();