mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-09-27 14:52:49 +02:00
Keep the playerSessions updated with the players last location so the
portals can act accordingly.
This commit is contained in:
parent
0d64b59851
commit
6a6f97ecd4
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user