Put potatoes on NPE

This commit is contained in:
alisolarflare 2016-11-20 14:35:36 -05:00
parent b21ce61d7f
commit 5e1826bacd
3 changed files with 19 additions and 4 deletions

View file

@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import buttondevteam.lib.DebugPotato; import buttondevteam.lib.DebugPotato;
import buttondevteam.lib.DebugPotatoAPI;
public abstract class Insurance { public abstract class Insurance {
public static enum InsuranceType{ public static enum InsuranceType{

View file

@ -8,8 +8,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.BaseCommand;
public class AliArrowListener implements Listener { public class AliArrowListener implements Listener {
private final JavaPlugin plugin; private final JavaPlugin plugin;

View file

@ -5,6 +5,8 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import alisolarflare.components.metrics.MetricsComponent; import alisolarflare.components.metrics.MetricsComponent;
import buttondevteam.lib.DebugPotato;
import buttondevteam.lib.DebugPotatoAPI;
public class PlayerJoinListener implements Listener{ public class PlayerJoinListener implements Listener{
@ -14,7 +16,23 @@ public class PlayerJoinListener implements Listener{
} }
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event){ public void onPlayerJoin(PlayerJoinEvent event){
try{
module.saveData(module.metricsYml, "loginlog."+System.currentTimeMillis()+event.getPlayer().getName(), event.getPlayer().getName()); module.saveData(module.metricsYml, "loginlog."+System.currentTimeMillis()+event.getPlayer().getName(), event.getPlayer().getName());
}catch(NullPointerException e){
try{
DebugPotato potato = new DebugPotato();
potato.setMessage(new String[]{
"Module: "+ module.toString(),
"Time: " + System.currentTimeMillis(),
"MetricsYML: " + module.metricsYml.toString()
});
DebugPotatoAPI.SendDebugPotato(potato, event.getPlayer());
}catch (Exception ex){
DebugPotato potato = new DebugPotato();
potato.setMessage("Something went REALLLY wrong");
DebugPotatoAPI.SendDebugPotato(potato, event.getPlayer());
}
}
module.metricsList.add("loginlog."+System.currentTimeMillis()+event.getPlayer().getName()); module.metricsList.add("loginlog."+System.currentTimeMillis()+event.getPlayer().getName());
} }