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.
This commit is contained in:
gonzalociocca 2016-12-08 16:11:48 -03:00 committed by Eric
parent f4b7df8c92
commit 253e40e8b9

View File

@ -53,7 +53,7 @@ public class HologramUpdateListener implements Listener {
Location shopLocation = shop.getLocation(); 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 (playerLocation.distanceSquared(shop.getHologram().getLocation()) <= hologramDistanceSquared) {
if (!shop.getHologram().isVisible(p)) { if (!shop.getHologram().isVisible(p)) {
shop.getHologram().showPlayer(p); shop.getHologram().showPlayer(p);