remove redundant method isShown

This commit is contained in:
D3v1s0m 2023-07-18 16:46:53 +05:30
parent da7e4cdb78
commit fd0e57e7fe
No known key found for this signature in database
GPG Key ID: 3B6EC35367B8D82E
2 changed files with 3 additions and 7 deletions

@ -37,20 +37,20 @@ public class NpcProcessorTask extends BukkitRunnable {
Player closest = null;
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.getWorld().equals(npc.getWorld())) {
if (npc.isShown(player)) npc.hide(player);
if (npc.isVisibleTo(player)) npc.hide(player);
continue;
}
double distance = player.getLocation().distanceSquared(npc.getBukkitLocation());
// visibility
boolean inRange = distance <= distSq;
if (!inRange && npc.isShown(player)) {
if (!inRange && npc.isVisibleTo(player)) {
NpcDespawnEvent event = new NpcDespawnEvent(player, entry);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) npc.hide(player);
}
if (inRange) {
if (!npc.isShown(player)) {
if (!npc.isVisibleTo(player)) {
NpcSpawnEvent event = new NpcSpawnEvent(player, entry);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) continue;

@ -37,10 +37,6 @@ public abstract class Viewable {
viewers.remove(player);
}
public boolean isShown(Player player) {
return viewers.contains(player);
}
protected void UNSAFE_hideAll() {
for (Player viewer : viewers) UNSAFE_hide(viewer);
}