mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-26 04:12:22 +00:00
Changed/Fixed hologram appearing
I didn't like the look of the performance saving, as the hologram would appear at a lower distance then it would disappear
This commit is contained in:
parent
8ecea0d938
commit
acef90335c
@ -21,17 +21,9 @@ public class HologramUpdateListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
||||
|
||||
if (e.getFrom().getBlockX() == e.getTo().getBlockX()
|
||||
&& e.getFrom().getBlockZ() == e.getTo().getBlockZ()
|
||||
&& e.getFrom().getBlockY() == e.getTo().getBlockY()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player p = e.getPlayer();
|
||||
Location playerLocation = p.getLocation();
|
||||
double hologramDistanceSquared = plugin.getShopChestConfig().maximal_distance;
|
||||
hologramDistanceSquared *= hologramDistanceSquared;
|
||||
double hologramDistanceSquared = Math.pow(plugin.getShopChestConfig().maximal_distance, 2);
|
||||
|
||||
for (Shop shop : plugin.getShopUtils().getShops()) {
|
||||
Block b = shop.getLocation().getBlock();
|
||||
|
@ -296,12 +296,12 @@ public class ShopInteractListener implements Listener {
|
||||
executor.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.SHOP_CREATED));
|
||||
|
||||
for (Player p : location.getWorld().getPlayers()) {
|
||||
if (p.getLocation().distanceSquared(location) <= config.maximal_distance) {
|
||||
if (p.getLocation().distanceSquared(location) <= Math.pow(config.maximal_distance, 2)) {
|
||||
if (shop.getHologram() != null) {
|
||||
shop.getHologram().showPlayer(p);
|
||||
}
|
||||
}
|
||||
if (p.getLocation().distanceSquared(location) <= config.maximal_item_distance) {
|
||||
if (p.getLocation().distanceSquared(location) <= Math.pow(config.maximal_item_distance, 2)) {
|
||||
if (shop.getItem() != null) {
|
||||
shop.getItem().setVisible(p, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user