summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-02 22:51:57 +0000
committerementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-05-02 22:51:57 +0000
commitbbf1bef888527d3e19fa846d4f6772abfd2648eb (patch)
treed5148cbcdf324b3f0903c72d952d02f7fffe8700
parent96a1bdedc859fddee5782ae92447afe768a451ff (diff)
downloadEssentials-bbf1bef888527d3e19fa846d4f6772abfd2648eb.tar
Essentials-bbf1bef888527d3e19fa846d4f6772abfd2648eb.tar.gz
Essentials-bbf1bef888527d3e19fa846d4f6772abfd2648eb.tar.lz
Essentials-bbf1bef888527d3e19fa846d4f6772abfd2648eb.tar.xz
Essentials-bbf1bef888527d3e19fa846d4f6772abfd2648eb.zip
[trunk]fix nullpointer on mails after you clear them
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1323 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java28
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java1
2 files changed, 17 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 94e9f73bb..b905e6a89 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -56,15 +56,15 @@ public class Essentials extends JavaPlugin
{
return settings;
}
-
+
public void setupForTesting() throws IOException, InvalidDescriptionException
{
File dataFolder = File.createTempFile("essentialstest", "");
dataFolder.delete();
dataFolder.mkdir();
- logger.log(Level.INFO,"Using temp folder for testing:");
- logger.log(Level.INFO,dataFolder.toString());
- this.initialize(null, null, new PluginDescriptionFile(new FileReader(new File("src"+File.separator+"plugin.yml"))), dataFolder, null, null);
+ logger.log(Level.INFO, "Using temp folder for testing:");
+ logger.log(Level.INFO, dataFolder.toString());
+ this.initialize(null, null, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
settings = new Settings(dataFolder);
}
@@ -78,7 +78,8 @@ public class Essentials extends JavaPlugin
{
setStatic();
EssentialsUpgrade upgrade = new EssentialsUpgrade(this.getDescription().getVersion(), this);
- if (newWorldsLoaded) {
+ if (newWorldsLoaded)
+ {
logger.log(Level.SEVERE, "New worlds have been loaded while upgrading files. The server will stop now, please restart it.");
try
{
@@ -355,9 +356,12 @@ public class Essentials extends JavaPlugin
if (user != null && !getSettings().isCommandDisabled("mail") && !commandLabel.equals("mail") && user.isAuthorized("essentials.mail"))
{
List<String> mail = user.getMails();
- if (!mail.isEmpty())
+ if (mail != null)
{
- user.sendMessage(ChatColor.RED + "You have " + mail.size() + " messages!§f Type §7/mail read§f to view your mail.");
+ if (mail.size() > 0)
+ {
+ user.sendMessage(ChatColor.RED + "You have " + mail.size() + " messages!§f Type §7/mail read§f to view your mail.");
+ }
}
}
@@ -606,12 +610,14 @@ public class Essentials extends JavaPlugin
}
return null;
}
-
- public void setIConomyFallback(boolean iConomyFallback) {
+
+ public void setIConomyFallback(boolean iConomyFallback)
+ {
this.iConomyFallback = iConomyFallback;
}
-
- public boolean isIConomyFallbackEnabled() {
+
+ public boolean isIConomyFallbackEnabled()
+ {
return iConomyFallback;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index 4ca4b21d2..b3c7cce38 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -1,7 +1,6 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
-import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.logging.Logger;