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
This commit is contained in:
NuclearW 2012-02-22 19:51:06 -05:00
parent 6f2f99dda0
commit 4826056bbe
2 changed files with 12 additions and 14 deletions

View File

@ -27,7 +27,6 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -916,7 +915,7 @@ public class PlayerProfile
xpGainATS = (int) (System.currentTimeMillis()/1000); xpGainATS = (int) (System.currentTimeMillis()/1000);
double bonusModifier = 0; double bonusModifier = 0;
String leaderName = ""; //String leaderName = "";
if(inParty()) if(inParty())
{ {
@ -924,7 +923,7 @@ public class PlayerProfile
{ {
if(x.isOnline() && !x.getName().equals(thisplayer.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty())) 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) if(m.getDistance(thisplayer.getLocation(), x.getLocation()) < 25)
{ {
PlayerProfile PartyLeader = Users.getProfile(x); PlayerProfile PartyLeader = Users.getProfile(x);
@ -997,9 +996,9 @@ public class PlayerProfile
bonusModifier = 2; bonusModifier = 2;
double trueBonus = bonusModifier * xp; double trueBonus = bonusModifier * xp;
double oldxp = xp; //double oldxp = xp;
xp+=trueBonus; 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+"%]"); //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)); Bukkit.getPluginManager().callEvent(new McMMOPlayerXpGainEvent(Bukkit.getPlayer(playerName), skillType, xp));

View File

@ -108,7 +108,7 @@ public class mcPlayerListener implements Listener
} }
} }
@EventHandler @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerFish(PlayerFishEvent event) public void onPlayerFish(PlayerFishEvent event)
{ {
if(mcPermissions.getInstance().fishing(event.getPlayer())) if(mcPermissions.getInstance().fishing(event.getPlayer()))
@ -129,7 +129,7 @@ public class mcPlayerListener implements Listener
} }
} }
@EventHandler @EventHandler(ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event) public void onPlayerPickupItem(PlayerPickupItemEvent event)
{ {
if(Users.getProfile(event.getPlayer()).getBerserkMode()) 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) public void onPlayerLogin(PlayerLoginEvent event)
{ {
Users.addUser(event.getPlayer()); Users.addUser(event.getPlayer());
} }
@EventHandler @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event) public void onPlayerQuit(PlayerQuitEvent event)
{ {
@ -196,7 +196,7 @@ public class mcPlayerListener implements Listener
Users.removeUser(event.getPlayer()); Users.removeUser(event.getPlayer());
} }
@EventHandler @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
Player player = event.getPlayer(); 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!"); player.sendMessage(ChatColor.GOLD+"mcMMO is currently in an XP rate event! XP rate is "+LoadProperties.xpGainMultiplier+"x!");
} }
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(PlayerInteractEvent event) public void onPlayerInteract(PlayerInteractEvent event)
{ {
Player player = event.getPlayer(); 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) public void onPlayerChat(PlayerChatEvent event)
{ {
Player player = event.getPlayer(); 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){ public void onCowMilking(PlayerBucketFillEvent event){
Player player = event.getPlayer(); Player player = event.getPlayer();