Keep the playerSessions updated with the players last location so the

portals can act accordingly.
This commit is contained in:
Rigby 2011-03-14 01:57:53 +00:00
parent 0d64b59851
commit 6a6f97ecd4

View File

@ -1,5 +1,7 @@
package com.onarandombox.MultiVerseCore;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerListener;
@ -20,7 +22,18 @@ public class MVPlayerListener extends PlayerListener {
}
public void onPlayerMove(PlayerMoveEvent event){
Player p = event.getPlayer(); // Grab Player
Location loc = p.getLocation(); // Grab Location
/**
* Check the Player has actually moved a block to prevent unneeded calculations...
* This is to prevent huge performance drops on high player count servers.
*/
MVPlayerSession ps = this.plugin.getPlayerSession(p);
if(ps.loc.getBlockX()==loc.getBlockX() && ps.loc.getBlockY()==loc.getBlockY() && ps.loc.getBlockZ()==loc.getBlockZ()) {
return;
} else {
ps.loc = loc; // Update the Players Session to the new Location.
}
}
public void onPlayerChat(PlayerChatEvent event){