mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 19:51:05 +00:00
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:
parent
f4b7df8c92
commit
253e40e8b9
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user