mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 18:32:24 +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
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user