Displays animations for all players in the same world
All checks were successful
KnarCraft/BlacksmithVisuals/pipeline/head This commit looks good
All checks were successful
KnarCraft/BlacksmithVisuals/pipeline/head This commit looks good
This commit is contained in:
parent
70759bc0e3
commit
b1dab9b2cf
@ -1,4 +1,5 @@
|
||||
# Blacksmith Visuals
|
||||
|
||||
This plugin adds additional visual and audial details to blacksmiths while they are working, so it's easier to see if
|
||||
they are working or not. It is recommended to put a mace or other hammer-like item in the NPC's off-hand for full effect.
|
||||
they are working or not. It is recommended to put a mace or other hammer-like item in the NPC's off-hand for full
|
||||
effect.
|
@ -24,7 +24,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@ -93,17 +92,16 @@ public class BlacksmithListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Entity> nearby = event.getNpc().getEntity().getNearbyEntities(16, 16, 5);
|
||||
nearby.removeIf((entity) -> !(entity instanceof Player));
|
||||
|
||||
this.playWorkSound(event.getNpc().getEntity());
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
PacketContainer packet = manager.createPacket(PacketType.Play.Server.ANIMATION);
|
||||
packet.getIntegers().write(0, event.getNpc().getEntity().getEntityId());
|
||||
packet.getIntegers().write(1, 3);
|
||||
|
||||
for (Entity entity : nearby) {
|
||||
manager.sendServerPacket((Player) entity, packet);
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getWorld().equals(event.getNpc().getEntity().getWorld())) {
|
||||
manager.sendServerPacket(player, packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user