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:
Eric 2016-11-12 15:43:56 +01:00
parent 8ecea0d938
commit acef90335c
2 changed files with 3 additions and 11 deletions

View File

@ -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();

View File

@ -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);
}