A minor optimization and some more flexibility

This commit is contained in:
Olof Larsson 2012-05-29 16:40:05 +02:00
parent 9f3aaa3a30
commit 84a3bf5e5a
3 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,3 @@
name: mcore3 name: mcore3
version: 1.0.0 version: 1.0.1
main: com.massivecraft.mcore3.MCore main: com.massivecraft.mcore3.MCore

View File

@ -13,7 +13,7 @@ public abstract class PlayerEntity<T extends PlayerEntity<T>> extends Entity<T>
{ {
public Player getPlayer() public Player getPlayer()
{ {
return Bukkit.getPlayer(this.getId()); return Bukkit.getPlayerExact(this.getId());
} }
public boolean isOnline() public boolean isOnline()

View File

@ -6,6 +6,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerEvent;
import com.massivecraft.mcore3.Predictate; import com.massivecraft.mcore3.Predictate;
import com.massivecraft.mcore3.lib.gson.Gson; import com.massivecraft.mcore3.lib.gson.Gson;
@ -29,6 +30,7 @@ public abstract class GsonPlayerEntityManager<T extends PlayerEntity<T>> extends
if (oid == null) return null; if (oid == null) return null;
if (oid instanceof String) return (String) oid; if (oid instanceof String) return (String) oid;
if (oid instanceof Player) return ((Player)oid).getName(); if (oid instanceof Player) return ((Player)oid).getName();
if (oid instanceof PlayerEvent) return ((PlayerEvent)oid).getPlayer().getName();
return null; return null;
} }