From 253e40e8b96588eea92737c0ab2305f38a7b937c Mon Sep 17 00:00:00 2001 From: gonzalociocca Date: Thu, 8 Dec 2016 16:11:48 -0300 Subject: [PATCH] Only compare a world's name to improve performace (#40) When using .equals() on classes with many variables and methods, means that every single thing on the class would be checked to be equals to the one from the another class, and its taking too much CPU. --- .../epiceric/shopchest/listeners/HologramUpdateListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java b/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java index 64de654..327a75b 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/HologramUpdateListener.java @@ -52,8 +52,8 @@ public class HologramUpdateListener implements Listener { if (shop.getHologram() == null) continue; Location shopLocation = shop.getLocation(); - - if (playerLocation.getWorld().equals(shopLocation.getWorld())) { + + if (playerLocation.getWorld().getName().equals(shopLocation.getWorld().getName())) { if (playerLocation.distanceSquared(shop.getHologram().getLocation()) <= hologramDistanceSquared) { if (!shop.getHologram().isVisible(p)) { shop.getHologram().showPlayer(p);