Minor bug fixes (incl. fix for #17)
This commit is contained in:
@@ -85,7 +85,7 @@ public abstract class TinyProtocol {
|
|||||||
logger.info("Attempting to inject into netty");
|
logger.info("Attempting to inject into netty");
|
||||||
registerChannelHandler();
|
registerChannelHandler();
|
||||||
registerPlayers(plugin);
|
registerPlayers(plugin);
|
||||||
} catch (IllegalArgumentException exceptionx) {
|
} catch (IllegalArgumentException exception) {
|
||||||
// Damn you, late bind
|
// Damn you, late bind
|
||||||
logger.log(Level.WARNING, "Attempting to delay injection");
|
logger.log(Level.WARNING, "Attempting to delay injection");
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public abstract class NPC implements PacketHandler, ActionHandler {
|
|||||||
|
|
||||||
shown.add(player.getUniqueId());
|
shown.add(player.getUniqueId());
|
||||||
|
|
||||||
if (player.getLocation().distance(location) <= autoHideDistance) {
|
if (player.getWorld().equals(location.getWorld()) && player.getLocation().distance(location) <= autoHideDistance) {
|
||||||
sendShowPackets(player);
|
sendShowPackets(player);
|
||||||
} else {
|
} else {
|
||||||
autoHidden.add(player.getUniqueId());
|
autoHidden.add(player.getUniqueId());
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ public class PlayerListener implements Listener {
|
|||||||
// This will cause issues otherwise (e.g. custom skin disappearing).
|
// This will cause issues otherwise (e.g. custom skin disappearing).
|
||||||
double hideDistance = npc.getAutoHideDistance();
|
double hideDistance = npc.getAutoHideDistance();
|
||||||
double distanceSquared = player.getLocation().distanceSquared(npc.getLocation());
|
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())) {
|
if (npc.getAutoHidden().contains(player.getUniqueId())) {
|
||||||
// Check if the player and NPC are within the range to sendShowPackets it again.
|
// Check if the player and NPC are within the range to sendShowPackets it again.
|
||||||
if (inRange) {
|
if (inRange) {
|
||||||
|
|||||||
Reference in New Issue
Block a user