summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorErik Broes <erikbroes@grum.nl>2012-01-15 11:42:40 +0100
committerErik Broes <erikbroes@grum.nl>2012-01-15 11:42:40 +0100
commit6d49b113380e10e4b9b38f2bd2ee8db29c35acaa (patch)
treea5830e38e86dd16314a406000d8fa6180228f190 /src/main/java
parent9c1534336c4b70574004d045381844849888155c (diff)
downloadcraftbukkit-6d49b113380e10e4b9b38f2bd2ee8db29c35acaa.tar
craftbukkit-6d49b113380e10e4b9b38f2bd2ee8db29c35acaa.tar.gz
craftbukkit-6d49b113380e10e4b9b38f2bd2ee8db29c35acaa.tar.lz
craftbukkit-6d49b113380e10e4b9b38f2bd2ee8db29c35acaa.tar.xz
craftbukkit-6d49b113380e10e4b9b38f2bd2ee8db29c35acaa.zip
Made World.playEffect a bit more efficient. Thanks mintplant for the PR.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b54870b6..4504c250 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -650,8 +650,10 @@ public class CraftWorld implements World {
int packetData = effect.getId();
Packet61WorldEvent packet = new Packet61WorldEvent(packetData, location.getBlockX(), location.getBlockY(), location.getBlockZ(), data);
int distance;
+ radius *= radius;
+
for (Player player : getPlayers()) {
- distance = (int) player.getLocation().distance(location);
+ distance = (int) player.getLocation().distanceSquared(location);
if (distance <= radius) {
((CraftPlayer) player).getHandle().netServerHandler.sendPacket(packet);
}