From 84a3bf5e5a45e9d33215f8eb4d267ef8aae46560 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 29 May 2012 16:40:05 +0200 Subject: [PATCH] A minor optimization and some more flexibility --- plugin.yml | 2 +- src/com/massivecraft/mcore3/persist/PlayerEntity.java | 2 +- .../mcore3/persist/gson/GsonPlayerEntityManager.java | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin.yml b/plugin.yml index d017a25f..21338450 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,3 +1,3 @@ name: mcore3 -version: 1.0.0 +version: 1.0.1 main: com.massivecraft.mcore3.MCore \ No newline at end of file diff --git a/src/com/massivecraft/mcore3/persist/PlayerEntity.java b/src/com/massivecraft/mcore3/persist/PlayerEntity.java index b16bc421..bbdbf853 100644 --- a/src/com/massivecraft/mcore3/persist/PlayerEntity.java +++ b/src/com/massivecraft/mcore3/persist/PlayerEntity.java @@ -13,7 +13,7 @@ public abstract class PlayerEntity> extends Entity { public Player getPlayer() { - return Bukkit.getPlayer(this.getId()); + return Bukkit.getPlayerExact(this.getId()); } public boolean isOnline() diff --git a/src/com/massivecraft/mcore3/persist/gson/GsonPlayerEntityManager.java b/src/com/massivecraft/mcore3/persist/gson/GsonPlayerEntityManager.java index e7e9df0a..02b4bdb7 100644 --- a/src/com/massivecraft/mcore3/persist/gson/GsonPlayerEntityManager.java +++ b/src/com/massivecraft/mcore3/persist/gson/GsonPlayerEntityManager.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.Set; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerEvent; import com.massivecraft.mcore3.Predictate; import com.massivecraft.mcore3.lib.gson.Gson; @@ -29,6 +30,7 @@ public abstract class GsonPlayerEntityManager> extends if (oid == null) return null; if (oid instanceof String) return (String) oid; if (oid instanceof Player) return ((Player)oid).getName(); + if (oid instanceof PlayerEvent) return ((PlayerEvent)oid).getPlayer().getName(); return null; }