mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2025-09-18 21:54:50 +00:00
Made World.playEffect a bit more efficient. Thanks mintplant for the PR.
This commit is contained in:
parent
9c1534336c
commit
6d49b11338
1 changed files with 3 additions and 1 deletions
|
@ -650,8 +650,10 @@ public class CraftWorld implements World {
|
||||||
int packetData = effect.getId();
|
int packetData = effect.getId();
|
||||||
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
|
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
|
||||||
int distance;
|
int distance;
|
||||||
|
radius *= radius;
|
||||||
|
|
||||||
for (Player player : getPlayers()) {
|
for (Player player : getPlayers()) {
|
||||||
distance = (int) player.getLocation().distance(location);
|
distance = (int) player.getLocation().distanceSquared(location);
|
||||||
if (distance <= radius) {
|
if (distance <= radius) {
|
||||||
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet);
|
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue