remove redundant method isShown
This commit is contained in:
parent
da7e4cdb78
commit
fd0e57e7fe
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue