Hello, i have a little problem, How do you do to import your lib? Because i have downloaded the sources on github but when i import it in eclipse, i have many errors, do you have any ideas? Thank you for your help
@okami35 and all others who do not understand how to import 1. Get the "com" folder out of the others, only the "com" folder is needed. 2. Open Eclipse and drag the "com" folder into your "scr" folder. 3. If you do not want to use Spout, comment the Spout import and the Spout-part in the HumanNPC.java 4. It should work now
Thank you for your help, i have tried but it does not work, i have some errors maybe i must add a special external jar? (actually i juste have craftbukkit.jar)
No you must not add an external jar, hm, I do not understand why you have some errors... I cannot help you, sorry
Is there also a possibility to require it with Maven? So it updates automatically and I can include it with Maven Shade?
I have a problem with my code, please help! I am using the original code from Redecouverte for the EntityTargetEvent with CLOSEST_PLAYER, I added only a system.out.println(), but if I go close to my NPC, the message is coming once and if I come close again there is no message! It only comes once, never twice How could I fix that?
Currently it seems there is an error with your reference to j.am() in the NPCManager, your createExplosion events in BWorld, and a(Packet packet) and a(Packet101CloseWindow packet101closewindow) in NPCNetHandler. Just thought I would point it out even though you probably know about it.
Nah I'll update before RB just not pre-releases (which this isn't), I just have other things I've been busy with, should get this done soon. You download the source, it's a lib not a plugin
Oh sorry, I writed wrong my question. I need to cast a entity or NPC, to HumanNPC. My code: Code: Player player = e.getPlayer(); Entity ent = e.getRightClicked(); NPCManager manager = new NPCManager(ShuraCore.plugin); if (manager.isNPC(ent)) { if (ShuraCore.plugin.lpCheck(player, "ShuraNPC.manager")) { if (player.isSneaking()) { NPC npc = manager.getNPC(manager.getNPCIdFromEntity(ent)); Vars.NPCs.remove(player); Vars.NPCs.put(player, npc); } } } I need to cast the 'npc' to a HumanNPC. Is there a way to do it? Thanks.
With the last Dev-Build, it is not working anymore, change this in the NPCManager.java to get it work: Code: public NPCManager(JavaPlugin plugin) { server = BServer.getInstance(); npcNetworkManager = new NPCNetworkManager(); NPCManager.plugin = plugin; taskid = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { @Override public void run() { HashSet<String> toRemove = new HashSet<String>(); for (String i : npcs.keySet()) { Entity j = npcs.get(i).getEntity(); j.aA(); if (j.dead) { toRemove.add(i); } } for (String n : toRemove) { npcs.remove(n); } } }, 1L, 1L); Bukkit.getServer().getPluginManager().registerEvents(new SL(), plugin); Bukkit.getServer().getPluginManager().registerEvents(new WL(), plugin); } The j.az(); in the old NPCManager.java is not working anymore, so it must be replaced with j.aA(); @Top_Cat Maybe you could update it
I'm using this lib since about two days or so and most of the things do work and do work really well. There are still some things that I have a problem with: 1) Setting the yaw does only rotate the body, not the head. Though changing the pitch does rotate it (up and down ofc.). See PR. 2) (This might be spout related) I tried lots of things but nothing worked to set the skin. Neither getting the npc as a spout player nor setting it through a real player. Does somebody might have an idea?
Pretty sure only spout clients can see the skin changes. The skins for a player are retrieved by the client.
I think I tested it with both, normal and spoutcraft, clients and neither worked. I'm gonna test the experimental builds for 1.2.5 from spout though. However, I have a new issue. NPC_BOUNCED does not get triggered at all. Maybe it isn't c() anymore?
You were correct, but it took me some time figuring out which method you need to use to get the skin right. It's not working for me using the code of post #336 because I don't have a player all the time. So using this code should do it: Code: SpoutPlayer sp = <HumanNPC>.getSpoutPlayer(); sp.setSkin(url); Moreover I've a solution/workaround for the NPC_BOUNCED event, which is not working for me, because it doesn't get called. To make it working again you need to copy the code from the c() method in the a_() method and check if the (square)distance is 1 (you can adjust it to your liking). Basically you can use this: Code: if ((lastBounceId != entity.id || System.currentTimeMillis() - lastBounceTick > 1000) && entity.getBukkitEntity().getLocation().distanceSquared(getBukkitEntity().getLocation()) <= 1) { EntityTargetEvent event = new NpcEntityTargetEvent(getBukkitEntity(), entity.getBukkitEntity(), NpcEntityTargetEvent.NpcTargetReason.NPC_BOUNCED); CraftServer server = ((WorldServer) world).getServer(); server.getPluginManager().callEvent(event); lastBounceTick = System.currentTimeMillis(); lastBounceId = entity.id; } just put it somewhere in the a_() method. I don't think there's a method for that but maybe you want to make a scheduler that does the following: Code: if target is in range animate arm swing damage target else walk towards target