summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-08-06 02:44:01 +0100
committerKHobbits <rob@khobbits.co.uk>2012-08-06 02:44:01 +0100
commit38655811b779ddb7cd15305808e76b16ecbb2959 (patch)
tree942fc5cef27f0753c891c360d8a95145f947abd8
parent2f562f79aa39b0a4aa4ca16d6cbe8d3725a22a18 (diff)
downloadEssentials-38655811b779ddb7cd15305808e76b16ecbb2959.tar
Essentials-38655811b779ddb7cd15305808e76b16ecbb2959.tar.gz
Essentials-38655811b779ddb7cd15305808e76b16ecbb2959.tar.lz
Essentials-38655811b779ddb7cd15305808e76b16ecbb2959.tar.xz
Essentials-38655811b779ddb7cd15305808e76b16ecbb2959.zip
Don't bomb if userMap isn't initialized.
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignGameMode.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignInfo.java12
3 files changed, 17 insertions, 10 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 1ac09bef8..92846124d 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -491,6 +491,12 @@ public class Essentials extends JavaPlugin implements IEssentials
{
return (User)base;
}
+
+ if (userMap == null) {
+ LOGGER.log(Level.WARNING, "Essentials userMap not initialized");
+ return null;
+ }
+
User user = userMap.getUser(base.getName());
if (user == null)
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java
index 2f39a8a22..e3166db78 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java
@@ -19,15 +19,15 @@ public class SignGameMode extends EssentialsSign
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
- {
+ {
final String gamemode = sign.getLine(1);
if (gamemode.isEmpty())
{
sign.setLine(1, "Survival");
}
-
+
validateTrade(sign, 2, ess);
-
+
return true;
}
@@ -64,7 +64,8 @@ public class SignGameMode extends EssentialsSign
{
player.setGameMode(GameMode.ADVENTURE);
}
- else {
+ else
+ {
throw new SignException(_("invalidSignLine", 2));
}
}
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java
index 1d60ec127..e75b060e3 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java
@@ -20,7 +20,7 @@ public class SignInfo extends EssentialsSign
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
- {
+ {
validateTrade(sign, 3, ess);
return true;
}
@@ -30,10 +30,10 @@ public class SignInfo extends EssentialsSign
{
final Trade charge = getTrade(sign, 3, ess);
charge.isAffordableFor(player);
-
+
String chapter = sign.getLine(1);
String page = sign.getLine(2);
-
+
final IText input;
try
{
@@ -41,14 +41,14 @@ public class SignInfo extends EssentialsSign
final IText output = new KeywordReplacer(input, player, ess);
final TextPager pager = new TextPager(output);
pager.showPage(chapter, page, null, player);
-
+
}
catch (IOException ex)
{
throw new SignException(ex.getMessage(), ex);
}
-
- charge.charge(player);
+
+ charge.charge(player);
return true;
}
}