summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-09-22 21:15:04 +0100
committerKHobbits <rob@khobbits.co.uk>2012-09-22 21:15:04 +0100
commit2f40264c469eba5fe03994620566c5d6b1d98809 (patch)
treedb26781355b438d9ebd4bf9eb31e2158f1d4cc97
parent5cc24827fce5161ffb94b89578970d1f933520ba (diff)
downloadEssentials-2f40264c469eba5fe03994620566c5d6b1d98809.tar
Essentials-2f40264c469eba5fe03994620566c5d6b1d98809.tar.gz
Essentials-2f40264c469eba5fe03994620566c5d6b1d98809.tar.lz
Essentials-2f40264c469eba5fe03994620566c5d6b1d98809.tar.xz
Essentials-2f40264c469eba5fe03994620566c5d6b1d98809.zip
Support new lines in newbie welcome message.
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java8
-rw-r--r--Essentials/src/config.yml10
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java6
4 files changed, 20 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java
index a9f9e1480..068efcf34 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextInput.java
@@ -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
diff --git a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java
index ea1b787d5..5376abbd2 100644
--- a/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java
+++ b/Essentials/src/com/earth2me/essentials/textreader/SimpleTextPager.java
@@ -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)
{
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 99af878b5..3524eb486 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -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: ''
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
index 52567de41..0dcf9843a 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java
@@ -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();