Don't bomb if userMap isn't initialized.

This commit is contained in:
KHobbits 2012-08-06 02:44:01 +01:00
parent 2f562f79aa
commit 38655811b7
3 changed files with 17 additions and 10 deletions

View File

@ -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)

View File

@ -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));
}
}

View File

@ -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;
}
}