CraftPlayer import not working/not found?

31 Views Asked by At

I'm coding a NPC plugin for minecraft and I need the CraftServer, but I can import it... How can I import it or is it outdated?

Code:

package net.seamystics.npcs;

import com.sun.tools.jdi.Packet;
import org.bukkit.entity.Player;

import java.lang.reflect.Field;

public class reflections {

    public void setValue(Object obj,String name,Object value){
        try{
            Field field = obj.getClass().getDeclaredField(name);
            field.setAccessible(true);
            field.set(obj, value);
        }catch(Exception e){}
    }

    public Object getValue(Object obj,String name){
        try{
            Field field = obj.getClass().getDeclaredField(name);
            field.setAccessible(true);
            return field.get(obj);
        }catch(Exception e){}
        return null;
    }

    public void sendPacked(Packet packet, Player player) {
        ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
    }
}
0

There are 0 best solutions below