mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-28 05:35:45 +01:00
Workaround for metadata issue
This commit is contained in:
parent
136161c18e
commit
9b1a53fcab
@ -2,6 +2,7 @@ package net.citizensnpcs.npc.entity;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCPushEvent;
|
import net.citizensnpcs.api.event.NPCPushEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
@ -20,6 +21,11 @@ import net.minecraft.server.NetHandler;
|
|||||||
import net.minecraft.server.NetworkManager;
|
import net.minecraft.server.NetworkManager;
|
||||||
import net.minecraft.server.World;
|
import net.minecraft.server.World;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||||
@ -71,6 +77,35 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
|||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CraftPlayer getBukkitEntity() {
|
||||||
|
if (npc == null)
|
||||||
|
return super.getBukkitEntity();
|
||||||
|
if (bukkitEntity != null)
|
||||||
|
return (CraftPlayer) bukkitEntity;
|
||||||
|
return (CraftPlayer) (bukkitEntity = new CraftPlayer(((CraftServer) Bukkit.getServer()), this) {
|
||||||
|
@Override
|
||||||
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
|
server.getEntityMetadata().setMetadata(this, metadataKey, newMetadataValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MetadataValue> getMetadata(String metadataKey) {
|
||||||
|
return server.getEntityMetadata().getMetadata(this, metadataKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasMetadata(String metadataKey) {
|
||||||
|
return server.getEntityMetadata().hasMetadata(this, metadataKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
|
server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void h_() {
|
public void h_() {
|
||||||
super.h_();
|
super.h_();
|
||||||
|
Loading…
Reference in New Issue
Block a user