|
@@ -0,0 +1,40 @@
|
|
|
+/*
|
|
|
+ This file is part of mcMMO.
|
|
|
+
|
|
|
+ mcMMO is free software: you can redistribute it and/or modify
|
|
|
+ it under the terms of the GNU General Public License as published by
|
|
|
+ the Free Software Foundation, either version 3 of the License, or
|
|
|
+ (at your option) any later version.
|
|
|
+
|
|
|
+ mcMMO is distributed in the hope that it will be useful,
|
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ GNU General Public License for more details.
|
|
|
+
|
|
|
+ You should have received a copy of the GNU General Public License
|
|
|
+ along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
|
|
+*/
|
|
|
+package com.gmail.nossr50.listeners;
|
|
|
+
|
|
|
+import org.bukkit.event.EventHandler;
|
|
|
+import org.bukkit.event.Listener;
|
|
|
+
|
|
|
+import com.gmail.nossr50.events.McMMOPlayerXpGainEvent;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Listener for listening to our own events, only really useful for catching errors
|
|
|
+ */
|
|
|
+public class mcSelfListener implements Listener {
|
|
|
+ @EventHandler
|
|
|
+ public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
|
|
+ int xp = event.getXpGained();
|
|
|
+ if(xp < 0) {
|
|
|
+ try {
|
|
|
+ throw new Exception("Gained negative XP!");
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|