diff --git a/main/src/main/java/net/citizensnpcs/ProtocolLibListener.java b/main/src/main/java/net/citizensnpcs/ProtocolLibListener.java index 888f7b166..0ae64cdba 100644 --- a/main/src/main/java/net/citizensnpcs/ProtocolLibListener.java +++ b/main/src/main/java/net/citizensnpcs/ProtocolLibListener.java @@ -13,6 +13,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.PacketType.Play.Server; @@ -36,6 +37,7 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedSignedProperty; import com.comphenix.protocol.wrappers.WrappedWatchableObject; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; @@ -59,9 +61,9 @@ import net.citizensnpcs.util.SkinProperty; import net.citizensnpcs.util.Util; public class ProtocolLibListener implements Listener { - private ProtocolManager manager; + private final ProtocolManager manager; private final Map mirrorTraits = Maps.newConcurrentMap(); - private Citizens plugin; + private final Citizens plugin; private final Map rotationTraits = Maps.newConcurrentMap(); public ProtocolLibListener(Citizens plugin) { @@ -93,9 +95,27 @@ public class ProtocolLibListener implements Listener { @Override public void onPacketSending(PacketEvent event) { NPC npc = getNPCFromPacket(event); - if (npc == null || !npc.hasTrait(Equipment.class)) + if (npc == null) + return; + MirrorTrait mirror = npc.getTraitNullable(MirrorTrait.class); + if (mirror != null && mirror.isMirroringEquipment() && mirror.isMirroring(event.getPlayer())) { + StructureModifier>> modifier = event.getPacket() + .getLists(BukkitConverters.getPairConverter(EnumWrappers.getItemSlotConverter(), + BukkitConverters.getItemStackConverter())); + List> equipment = Lists.newArrayList(); + PlayerInventory pi = event.getPlayer().getInventory(); + equipment.add(new Pair<>(ItemSlot.CHEST, pi.getChestplate())); + equipment.add(new Pair<>(ItemSlot.FEET, pi.getBoots())); + equipment.add(new Pair<>(ItemSlot.HEAD, pi.getHelmet())); + equipment.add(new Pair<>(ItemSlot.LEGS, pi.getLeggings())); + equipment.add(new Pair<>(ItemSlot.MAINHAND, pi.getItemInHand())); + equipment.add(new Pair<>(ItemSlot.OFFHAND, pi.getItemInOffHand())); + modifier.write(0, equipment); + return; + } + Equipment trait = npc.getTraitNullable(Equipment.class); + if (trait == null) return; - Equipment trait = npc.getOrAddTrait(Equipment.class); PacketContainer packet = event.getPacket(); StructureModifier>> modifier = packet .getLists(BukkitConverters.getPairConverter(EnumWrappers.getItemSlotConverter(), @@ -120,6 +140,7 @@ public class ProtocolLibListener implements Listener { } }); manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.HIGHEST, Server.ENTITY_METADATA) { + @Override public void onPacketSending(PacketEvent event) { NPC npc = getNPCFromPacket(event); diff --git a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java index 4f5130a0a..0c9e2a91f 100644 --- a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -1934,20 +1934,21 @@ public class NPCCommands { @Command( aliases = { "npc" }, modifiers = { "mirror" }, - usage = "mirror --name [true|false]", + usage = "mirror --name [true|false] --equipment [true|false]", desc = "", min = 1, max = 1, permission = "citizens.npc.mirror") @Requirements(selected = true, ownership = true) - public void mirror(CommandContext args, CommandSender sender, NPC npc, @Flag("name") Boolean name) - throws CommandException { + public void mirror(CommandContext args, CommandSender sender, NPC npc, @Flag("name") Boolean name, + @Flag("equipment") Boolean equipment) throws CommandException { if (((Citizens) CitizensAPI.getPlugin()).getProtocolLibListener() == null) throw new CommandException("ProtocolLib must be enabled to use this feature"); MirrorTrait trait = npc.getOrAddTrait(MirrorTrait.class); if (name != null) { trait.setEnabled(true); + trait.setMirrorEquipment(equipment); trait.setMirrorName(name); Messaging.sendTr(sender, name ? Messages.MIRROR_NAME_SET : Messages.MIRROR_NAME_UNSET, npc.getName()); } else { @@ -2852,8 +2853,9 @@ public class NPCCommands { @Command( aliases = { "npc" }, - usage = "setequipment [slot] [item]", + usage = "setequipment (-c(osmetic)) [slot] [item]", desc = "", + flags = "c", modifiers = { "setequipment" }, min = 2, max = 3, @@ -2868,8 +2870,13 @@ public class NPCCommands { throw new ServerCommandException(); item = ((Player) sender).getItemInHand().clone(); } - npc.getOrAddTrait(Equipment.class).set(slot, item); - Messaging.sendTr(sender, Messages.EQUIPMENT_SET, slot, item); + if (args.hasFlag('c')) { + npc.getOrAddTrait(Equipment.class).setCosmetic(slot, item); + Messaging.sendTr(sender, Messages.COSMETIC_EQUIPMENT_SET, slot, item); + } else { + npc.getOrAddTrait(Equipment.class).set(slot, item); + Messaging.sendTr(sender, Messages.EQUIPMENT_SET, slot, item); + } } @Command( diff --git a/main/src/main/java/net/citizensnpcs/trait/Controllable.java b/main/src/main/java/net/citizensnpcs/trait/Controllable.java index 0500c9178..e80f8a9a5 100644 --- a/main/src/main/java/net/citizensnpcs/trait/Controllable.java +++ b/main/src/main/java/net/citizensnpcs/trait/Controllable.java @@ -38,6 +38,7 @@ public class Controllable extends Trait { private BuiltInControls controls; @Persist private boolean enabled = true; + private ControllableInput input; @Persist("owner_required") private boolean ownerRequired; @@ -128,9 +129,24 @@ public class Controllable extends Trait { if (!enabled || !npc.isSpawned()) return; List passengers = NMS.getPassengers(npc.getEntity()); - if (passengers.size() == 0 || !(passengers.get(0) instanceof Player) || npc.getNavigator().isNavigating()) + if (npc.getNavigator().isNavigating() || passengers.size() == 0 || !(passengers.get(0) instanceof Player)) return; - controller.run((Player) passengers.get(0)); + Player player = (Player) passengers.get(0); + input = new ControllableInput(); + if (SUPPORTS_PLAYER_INPUT_EVENT) { + input.forward = player.getCurrentInput().isForward() ? 1 : player.getCurrentInput().isBackward() ? -1 : 0; + input.horizontal = player.getCurrentInput().isLeft() ? 1 : player.getCurrentInput().isRight() ? -1 : 0; + input.jump = player.getCurrentInput().isJump(); + input.sneak = player.getCurrentInput().isSneak(); + input.sprint = player.getCurrentInput().isSprint(); + } else { + input.forward = NMS.getForwardBackwardMovement(player); + input.horizontal = NMS.getXZMovement(player); + input.jump = NMS.shouldJump(player); + input.sneak = NMS.isSneaking(player); + input.sprint = player.isSprinting(); + } + controller.run(player, input); } public void setControls(BuiltInControls controls) { @@ -173,6 +189,14 @@ public class Controllable extends Trait { } } + private static class ControllableInput { + double forward; + double horizontal; + boolean jump; + boolean sneak; + boolean sprint; + } + public static class GroundController implements MovementController { private int jumpTicks = 0; private final NPC npc; @@ -196,15 +220,15 @@ public class Controllable extends Trait { } @Override - public void run(Player rider) { + public void run(Player rider, ControllableInput input) { boolean onGround = NMS.isOnGround(npc.getEntity()); - float impulse = npc.getNavigator().getDefaultParameters() + float speedMod = npc.getNavigator().getDefaultParameters() .modifiedSpeed(onGround ? GROUND_SPEED : AIR_SPEED); if (!Util.isHorse(npc.getEntity().getType())) { - speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, impulse, + speed = updateSpeed(npc.getEntity(), NMS.getYaw(rider), input, speed, speedMod, Setting.MAX_CONTROLLABLE_GROUND_SPEED.asDouble()); } - if (onGround && jumpTicks <= 0 && NMS.shouldJump(rider)) { + if (onGround && jumpTicks <= 0 && input.jump) { npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(JUMP_VELOCITY)); jumpTicks = 10; } @@ -239,12 +263,12 @@ public class Controllable extends Trait { } @Override - public void run(Player rider) { + public void run(Player rider, ControllableInput input) { boolean onGround = NMS.isOnGround(npc.getEntity()); - float impulse = npc.getNavigator().getDefaultParameters() + float speedMod = npc.getNavigator().getDefaultParameters() .modifiedSpeed(onGround ? GROUND_SPEED : AIR_SPEED); if (!Util.isHorse(npc.getEntity().getType())) { - speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, impulse, + speed = updateSpeed(npc.getEntity(), NMS.getYaw(rider), input, speed, speedMod, Setting.MAX_CONTROLLABLE_GROUND_SPEED.asDouble()); } setMountedYaw(npc.getEntity()); @@ -278,7 +302,7 @@ public class Controllable extends Trait { } @Override - public void run(Player rider) { + public void run(Player rider, ControllableInput input) { if (paused) { npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.001)); return; @@ -297,7 +321,7 @@ public class Controllable extends Trait { void rightClickEntity(NPCRightClickEvent event); - void run(Player rider); + void run(Player rider, ControllableInput input); } public static class PlayerInputAirController implements MovementController { @@ -325,15 +349,14 @@ public class Controllable extends Trait { } @Override - public void run(Player rider) { + public void run(Player rider, ControllableInput input) { if (paused) { npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.001F)); return; } - speed = updateHorizontalSpeed(npc.getEntity(), rider, speed, 1F, + speed = updateSpeed(npc.getEntity(), NMS.getYaw(rider), input, speed, 1F, Setting.MAX_CONTROLLABLE_FLIGHT_SPEED.asDouble()); - boolean shouldJump = NMS.shouldJump(rider); - if (shouldJump) { + if (input.jump) { npc.getEntity().setVelocity(npc.getEntity().getVelocity().setY(0.25F)); } npc.getEntity().setVelocity(npc.getEntity().getVelocity().multiply(new Vector(1, 0.98, 1))); @@ -376,25 +399,19 @@ public class Controllable extends Trait { NMS.look(entity, loc.getYaw(), loc.getPitch()); } - private static double updateHorizontalSpeed(Entity handle, Entity passenger, double speed, float speedMod, + private static double updateSpeed(Entity handle, double yaw, ControllableInput input, double speed, float speedMod, double maxSpeed) { + yaw = Math.toRadians(yaw); Vector vel = handle.getVelocity(); double oldSpeed = Math.sqrt(vel.getX() * vel.getX() + vel.getZ() * vel.getZ()); - double horizontal = NMS.getHorizontalMovement(passenger); - if (Math.abs(Math.abs(horizontal) - 0.98) > 0.02) - return speed; - double yaw = passenger.getLocation().getYaw(); - if (horizontal > 0.0D) { - double dXcos = -Math.sin(yaw * Math.PI / 180.0F); - double dXsin = Math.cos(yaw * Math.PI / 180.0F); - - vel = vel.setX(dXcos * speed * speedMod).setZ(dXsin * speed * speedMod); + double nxsin = -Math.sin(yaw); + double xcos = Math.cos(yaw); + if (input.forward > 0) { + vel = vel.setX(nxsin * speed * speedMod).setZ(xcos * speed * speedMod); } - vel = vel.add(new Vector( - passenger.getVelocity().getX() * speedMod * Setting.CONTROLLABLE_GROUND_DIRECTION_MODIFIER.asDouble(), - 0D, - passenger.getVelocity().getZ() * speedMod * Setting.CONTROLLABLE_GROUND_DIRECTION_MODIFIER.asDouble())) - .multiply(0.98); + vel.add(new Vector(Math.sin(yaw + Math.PI / 2), 0D, -Math.cos(yaw + Math.PI / 2)) + .multiply(speedMod * Setting.CONTROLLABLE_GROUND_DIRECTION_MODIFIER.asDouble() * input.horizontal)); + vel.multiply(0.98); double newSpeed = Math.sqrt(vel.getX() * vel.getX() + vel.getZ() * vel.getZ()); if (newSpeed > maxSpeed) { @@ -409,4 +426,14 @@ public class Controllable extends Trait { return (float) Math.max(0, speed - speed / 50.0D); } } + + private static boolean SUPPORTS_PLAYER_INPUT_EVENT = true; + + static { + try { + Class.forName("org.bukkit.event.player.PlayerInputEvent"); + } catch (ClassNotFoundException e) { + SUPPORTS_PLAYER_INPUT_EVENT = false; + } + } } diff --git a/main/src/main/java/net/citizensnpcs/trait/MirrorTrait.java b/main/src/main/java/net/citizensnpcs/trait/MirrorTrait.java index c63f2ca8b..3fe2e3512 100644 --- a/main/src/main/java/net/citizensnpcs/trait/MirrorTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/MirrorTrait.java @@ -13,6 +13,8 @@ public class MirrorTrait extends Trait { @Persist private volatile boolean enabled; @Persist + private volatile boolean mirrorEquipment; + @Persist private volatile boolean mirrorName; public MirrorTrait() { @@ -27,6 +29,10 @@ public class MirrorTrait extends Trait { return enabled; } + public boolean isMirroringEquipment() { + return mirrorEquipment; + } + public boolean mirrorName() { return mirrorName; } @@ -39,6 +45,10 @@ public class MirrorTrait extends Trait { } } + public void setMirrorEquipment(boolean mirrorEquipment) { + this.mirrorEquipment = mirrorEquipment; + } + public void setMirrorName(boolean mirror) { mirrorName = mirror; } diff --git a/main/src/main/java/net/citizensnpcs/util/NMS.java b/main/src/main/java/net/citizensnpcs/util/NMS.java index c9169bfd6..bc14659ce 100644 --- a/main/src/main/java/net/citizensnpcs/util/NMS.java +++ b/main/src/main/java/net/citizensnpcs/util/NMS.java @@ -528,8 +528,8 @@ public class NMS { return BRIDGE.getHeadYaw(entity); } - public static float getHorizontalMovement(org.bukkit.entity.Entity bukkitEntity) { - return BRIDGE.getHorizontalMovement(bukkitEntity); + public static float getForwardBackwardMovement(org.bukkit.entity.Entity bukkitEntity) { + return BRIDGE.getForwardBackwardMovement(bukkitEntity); } public static float getJumpPower(NPC npc, float original) { @@ -674,8 +674,8 @@ public class NMS { return BRIDGE.getVehicle(entity); } - public static float getVerticalMovement(org.bukkit.entity.Entity bukkitEntity) { - return BRIDGE.getVerticalMovement(bukkitEntity); + public static float getXZMovement(org.bukkit.entity.Entity bukkitEntity) { + return BRIDGE.getXZMovement(bukkitEntity); } public static Collection getViewingPlayers(org.bukkit.entity.Entity entity) { diff --git a/main/src/main/java/net/citizensnpcs/util/NMSBridge.java b/main/src/main/java/net/citizensnpcs/util/NMSBridge.java index c829c7ca4..10b94a3c2 100644 --- a/main/src/main/java/net/citizensnpcs/util/NMSBridge.java +++ b/main/src/main/java/net/citizensnpcs/util/NMSBridge.java @@ -99,7 +99,7 @@ public interface NMSBridge { public float getHeadYaw(Entity entity); - public float getHorizontalMovement(Entity entity); + public float getForwardBackwardMovement(Entity entity); public EntityPacketTracker getPacketTracker(Entity entity); @@ -129,7 +129,7 @@ public interface NMSBridge { public Entity getVehicle(Entity entity); - public float getVerticalMovement(Entity entity); + public float getXZMovement(Entity entity); public default Collection getViewingPlayers(Entity entity) { return entity.getTrackedBy(); @@ -150,6 +150,10 @@ public interface NMSBridge { public boolean isSolid(Block in); + public default boolean isSprinting(Entity entity) { + return entity instanceof Player ? ((Player) entity).isSprinting() : false; + } + public boolean isValid(Entity entity); public void load(CommandManager commands); diff --git a/main/src/main/resources/en.json b/main/src/main/resources/en.json index e52b534b4..557b9a5b1 100644 --- a/main/src/main/resources/en.json +++ b/main/src/main/resources/en.json @@ -492,6 +492,7 @@ "citizens.commands.npc.select.already-selected" : "You already have that NPC selected. ", "citizens.commands.npc.select.description" : "Select a NPC with the given ID or name", "citizens.commands.npc.select.help" : "", + "citizens.commands.npc.setequipment.cosmetic-set" : "Set [[{0}]] (cosmetic) to [[{1}]].", "citizens.commands.npc.setequipment.description" : "Sets equipment via commands", "citizens.commands.npc.setequipment.help" : "", "citizens.commands.npc.setequipment.set" : "Set [[{0}]] to [[{1}]].", diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java index 90ffe572c..49318c4d8 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/NMSImpl.java @@ -482,7 +482,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -681,7 +681,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java index 4b76224a3..a485a3485 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/NMSImpl.java @@ -502,7 +502,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -717,7 +717,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java index 653075bb2..d435af188 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/util/NMSImpl.java @@ -503,7 +503,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -719,7 +719,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java index 89387aa3b..ce462aede 100644 --- a/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java +++ b/v1_13_R2/src/main/java/net/citizensnpcs/nms/v1_13_R2/util/NMSImpl.java @@ -532,7 +532,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -748,7 +748,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java index 895125ef6..0d21b3bdf 100644 --- a/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java +++ b/v1_14_R1/src/main/java/net/citizensnpcs/nms/v1_14_R1/util/NMSImpl.java @@ -574,7 +574,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -799,7 +799,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java index ec4d34ef0..d46521e7b 100644 --- a/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java +++ b/v1_15_R1/src/main/java/net/citizensnpcs/nms/v1_15_R1/util/NMSImpl.java @@ -589,7 +589,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -814,7 +814,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java index 4f3bbffc6..8a049c2d9 100644 --- a/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java +++ b/v1_16_R3/src/main/java/net/citizensnpcs/nms/v1_16_R3/util/NMSImpl.java @@ -604,7 +604,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -837,7 +837,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); diff --git a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java index 4925d3bf4..a65063258 100644 --- a/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java +++ b/v1_17_R1/src/main/java/net/citizensnpcs/nms/v1_17_R1/util/NMSImpl.java @@ -615,7 +615,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity); @@ -839,7 +839,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity); diff --git a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java index ed29dcb59..c7216bff0 100644 --- a/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java +++ b/v1_18_R2/src/main/java/net/citizensnpcs/nms/v1_18_R2/util/NMSImpl.java @@ -621,7 +621,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity); @@ -846,7 +846,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = NMSImpl.getHandle((org.bukkit.entity.LivingEntity) entity); diff --git a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java index 5bdebd271..2ca145d27 100644 --- a/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java +++ b/v1_19_R3/src/main/java/net/citizensnpcs/nms/v1_19_R3/util/NMSImpl.java @@ -665,7 +665,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity); @@ -895,7 +895,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity); diff --git a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java index f997cb503..03a9f8365 100644 --- a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java +++ b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/util/NMSImpl.java @@ -693,7 +693,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity); @@ -924,7 +924,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity); diff --git a/v1_21_R2/pom.xml b/v1_21_R2/pom.xml index cac4eac4d..f3604b95f 100644 --- a/v1_21_R2/pom.xml +++ b/v1_21_R2/pom.xml @@ -9,7 +9,7 @@ citizens-v1_21_R2 UTF-8 - 1.21.2-R0.1-SNAPSHOT + 1.21.3-R0.1-SNAPSHOT diff --git a/v1_21_R2/src/main/java/net/citizensnpcs/nms/v1_21_R2/util/NMSImpl.java b/v1_21_R2/src/main/java/net/citizensnpcs/nms/v1_21_R2/util/NMSImpl.java index 5e6acd95d..293af93c8 100644 --- a/v1_21_R2/src/main/java/net/citizensnpcs/nms/v1_21_R2/util/NMSImpl.java +++ b/v1_21_R2/src/main/java/net/citizensnpcs/nms/v1_21_R2/util/NMSImpl.java @@ -681,7 +681,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity); @@ -912,7 +912,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; LivingEntity handle = getHandle((org.bukkit.entity.LivingEntity) entity); diff --git a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java index c92f8fcc4..bacb303a9 100644 --- a/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java +++ b/v1_8_R3/src/main/java/net/citizensnpcs/nms/v1_8_R3/util/NMSImpl.java @@ -436,7 +436,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getHorizontalMovement(org.bukkit.entity.Entity entity) { + public float getForwardBackwardMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity); @@ -625,7 +625,7 @@ public class NMSImpl implements NMSBridge { } @Override - public float getVerticalMovement(org.bukkit.entity.Entity entity) { + public float getXZMovement(org.bukkit.entity.Entity entity) { if (!entity.getType().isAlive()) return Float.NaN; EntityLiving handle = NMSImpl.getHandle((LivingEntity) entity);