From 5e1826bacdbc2805497207257e211df4400bf948 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sun, 20 Nov 2016 14:35:36 -0500 Subject: [PATCH] Put potatoes on NPE --- .../components/insurance/Insurance.java | 1 - .../magic/tricks/AliArrowListener.java | 2 -- .../metrics/listeners/PlayerJoinListener.java | 20 ++++++++++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/alisolarflare/components/insurance/Insurance.java b/src/alisolarflare/components/insurance/Insurance.java index 721bc2b..afa8856 100644 --- a/src/alisolarflare/components/insurance/Insurance.java +++ b/src/alisolarflare/components/insurance/Insurance.java @@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import buttondevteam.lib.DebugPotato; -import buttondevteam.lib.DebugPotatoAPI; public abstract class Insurance { public static enum InsuranceType{ diff --git a/src/alisolarflare/components/magic/tricks/AliArrowListener.java b/src/alisolarflare/components/magic/tricks/AliArrowListener.java index 9816beb..694e8a8 100644 --- a/src/alisolarflare/components/magic/tricks/AliArrowListener.java +++ b/src/alisolarflare/components/magic/tricks/AliArrowListener.java @@ -8,8 +8,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.plugin.java.JavaPlugin; -import alisolarflare.components.BaseCommand; - public class AliArrowListener implements Listener { private final JavaPlugin plugin; diff --git a/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java b/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java index b82b210..c457618 100644 --- a/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java +++ b/src/alisolarflare/components/metrics/listeners/PlayerJoinListener.java @@ -5,6 +5,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import alisolarflare.components.metrics.MetricsComponent; +import buttondevteam.lib.DebugPotato; +import buttondevteam.lib.DebugPotatoAPI; public class PlayerJoinListener implements Listener{ @@ -14,7 +16,23 @@ public class PlayerJoinListener implements Listener{ } @EventHandler public void onPlayerJoin(PlayerJoinEvent event){ - module.saveData(module.metricsYml, "loginlog."+System.currentTimeMillis()+event.getPlayer().getName(), event.getPlayer().getName()); + try{ + 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()); }