Add hideEntity / showEntity API

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-29 09:18:52 +11:00
parent 4e0070d822
commit 95ab0e27a8
4 changed files with 58 additions and 40 deletions

View File

@@ -133,7 +133,7 @@
this.entity = entity;
this.range = i;
this.lastSectionPos = SectionPosition.of(entity);
@@ -1435,12 +1479,20 @@
@@ -1435,12 +1479,17 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.entity) {
@@ -145,11 +145,8 @@
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);
+ // CraftBukkit start - respect vanish API
+ if (this.entity instanceof EntityPlayer) {
+ Player player = ((EntityPlayer) this.entity).getBukkitEntity();
+ if (!entityplayer.getBukkitEntity().canSee(player)) {
+ flag = false;
+ }
+ if (!entityplayer.getBukkitEntity().canSee(this.entity.getBukkitEntity())) {
+ flag = false;
+ }
+ // CraftBukkit end
if (flag) {