Minor bug fixes (incl. fix for #17)

This commit is contained in:
Jitse Boonstra 2019-05-02 17:49:14 +02:00
parent a7026134e0
commit 2982a1ecb3
3 changed files with 4 additions and 3 deletions

View File

@ -85,7 +85,7 @@ public abstract class TinyProtocol {
logger.info("Attempting to inject into netty");
registerChannelHandler();
registerPlayers(plugin);
} catch (IllegalArgumentException exceptionx) {
} catch (IllegalArgumentException exception) {
// Damn you, late bind
logger.log(Level.WARNING, "Attempting to delay injection");

View File

@ -149,7 +149,7 @@ public abstract class NPC implements PacketHandler, ActionHandler {
shown.add(player.getUniqueId());
if (player.getLocation().distance(location) <= autoHideDistance) {
if (player.getWorld().equals(location.getWorld()) && player.getLocation().distance(location) <= autoHideDistance) {
sendShowPackets(player);
} else {
autoHidden.add(player.getUniqueId());

View File

@ -73,7 +73,8 @@ public class PlayerListener implements Listener {
// This will cause issues otherwise (e.g. custom skin disappearing).
double hideDistance = npc.getAutoHideDistance();
double distanceSquared = player.getLocation().distanceSquared(npc.getLocation());
boolean inRange = distanceSquared <= (hideDistance * hideDistance) && distanceSquared <= (Bukkit.getViewDistance() << 4);
boolean inRange = distanceSquared <= (Math.pow(hideDistance, 2))
&& distanceSquared <= (Math.pow(Bukkit.getViewDistance() << 4, 2));
if (npc.getAutoHidden().contains(player.getUniqueId())) {
// Check if the player and NPC are within the range to sendShowPackets it again.
if (inRange) {