From 4826056bbe7e0b5c518076e7e5b14625b597a8dd Mon Sep 17 00:00:00 2001 From: NuclearW Date: Wed, 22 Feb 2012 19:51:06 -0500 Subject: [PATCH] Cleanup Monitor is where events that don't need data before other plugins or to cancel go Ignore cancelled events to respect other protection plugins saying "no" We need to see if other events are depricated in the future --- .../gmail/nossr50/datatypes/PlayerProfile.java | 9 ++++----- .../nossr50/listeners/mcPlayerListener.java | 17 ++++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index d13a2f4ef..97c2f7d98 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -27,7 +27,6 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -916,7 +915,7 @@ public class PlayerProfile xpGainATS = (int) (System.currentTimeMillis()/1000); double bonusModifier = 0; - String leaderName = ""; + //String leaderName = ""; if(inParty()) { @@ -924,7 +923,7 @@ public class PlayerProfile { if(x.isOnline() && !x.getName().equals(thisplayer.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty())) { - leaderName = x.getName(); + //leaderName = x.getName(); if(m.getDistance(thisplayer.getLocation(), x.getLocation()) < 25) { PlayerProfile PartyLeader = Users.getProfile(x); @@ -997,9 +996,9 @@ public class PlayerProfile bonusModifier = 2; double trueBonus = bonusModifier * xp; - double oldxp = xp; + //double oldxp = xp; xp+=trueBonus; - double percent = (trueBonus/oldxp)*100; + //double percent = (trueBonus/oldxp)*100; //thisplayer.sendMessage(ChatColor.GREEN+"XP: "+oldxp+" Bonus XP: "+trueBonus+" Total: "+xp+ChatColor.GOLD+" [Master: "+leaderName+" " +" +"+(int)percent+"%]"); } Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(Bukkit.getPlayer(playerName), skillType, xp)); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 44dc16434..abfda209f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -108,7 +108,7 @@ public class mcPlayerListener implements Listener } } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerFish(PlayerFishEvent event) { if(mcPermissions.getInstance().fishing(event.getPlayer())) @@ -129,7 +129,7 @@ public class mcPlayerListener implements Listener } } - @EventHandler + @EventHandler(ignoreCancelled = true) public void onPlayerPickupItem(PlayerPickupItemEvent event) { if(Users.getProfile(event.getPlayer()).getBerserkMode()) @@ -162,13 +162,13 @@ public class mcPlayerListener implements Listener } } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerLogin(PlayerLoginEvent event) { Users.addUser(event.getPlayer()); } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerQuit(PlayerQuitEvent event) { @@ -196,7 +196,7 @@ public class mcPlayerListener implements Listener Users.removeUser(event.getPlayer()); } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); @@ -210,8 +210,7 @@ public class mcPlayerListener implements Listener player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!"); } - @SuppressWarnings("deprecation") - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); @@ -349,7 +348,7 @@ public class mcPlayerListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerChat(PlayerChatEvent event) { Player player = event.getPlayer(); @@ -378,7 +377,7 @@ public class mcPlayerListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onCowMilking(PlayerBucketFillEvent event){ Player player = event.getPlayer();