mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-10 06:48:06 +02:00
Fix NPC targeting
This commit is contained in:
parent
954a3bd27b
commit
516035fc70
@ -268,7 +268,7 @@ public class NPCCommands {
|
||||
}
|
||||
|
||||
CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, copy)
|
||||
: new CommandSenderCreateNPCEvent(sender, copy);
|
||||
: new CommandSenderCreateNPCEvent(sender, copy);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
event.getNPC().destroy();
|
||||
@ -344,7 +344,7 @@ public class NPCCommands {
|
||||
spawnLoc = args.getSenderLocation();
|
||||
}
|
||||
CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, npc)
|
||||
: new CommandSenderCreateNPCEvent(sender, npc);
|
||||
: new CommandSenderCreateNPCEvent(sender, npc);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
npc.destroy();
|
||||
@ -842,6 +842,8 @@ public class NPCCommands {
|
||||
String message = " <e>- <a>" + trait.getName();
|
||||
Messaging.send(sender, message);
|
||||
}
|
||||
|
||||
npc.getNavigator().setTarget((Entity) sender, true);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -1021,7 +1023,7 @@ public class NPCCommands {
|
||||
@Requirements(selected = true, ownership = true, types = { EntityType.CREEPER })
|
||||
public void power(CommandContext args, CommandSender sender, NPC npc) {
|
||||
Messaging
|
||||
.sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED);
|
||||
.sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -1044,7 +1046,7 @@ public class NPCCommands {
|
||||
}
|
||||
|
||||
@Command(aliases = { "npc" }, usage = "remove|rem (all|id|name)", desc = "Remove a NPC", modifiers = { "remove",
|
||||
"rem" }, min = 1, max = 2)
|
||||
"rem" }, min = 1, max = 2)
|
||||
@Requirements
|
||||
public void remove(final CommandContext args, final CommandSender sender, NPC npc) throws CommandException {
|
||||
if (args.argsLength() == 2) {
|
||||
|
@ -177,7 +177,7 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
|
||||
@Override
|
||||
public void setPath() {
|
||||
navigation.a(target, parameters.speed());
|
||||
navigation.a(target, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,8 @@ public class NMS {
|
||||
}
|
||||
|
||||
public static void attack(EntityLiving handle, Entity target) {
|
||||
float f = (float) handle.getAttributeInstance(GenericAttributes.e).getValue();
|
||||
AttributeInstance attackDamage = handle.getAttributeInstance(GenericAttributes.e);
|
||||
float f = (float) (attackDamage == null ? 1 : attackDamage.getValue());
|
||||
int i = 0;
|
||||
|
||||
if (target instanceof EntityLiving) {
|
||||
|
Loading…
Reference in New Issue
Block a user