-
-
Notifications
You must be signed in to change notification settings - Fork 307
/
TablistRemovingTrackerEntry.java
39 lines (33 loc) · 1.47 KB
/
TablistRemovingTrackerEntry.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package net.citizensnpcs.nms.v1_15_R1.util;
import java.util.Set;
import java.util.function.Consumer;
import org.bukkit.entity.Player;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.util.NMS;
import net.minecraft.server.v1_15_R1.Entity;
import net.minecraft.server.v1_15_R1.EntityPlayer;
import net.minecraft.server.v1_15_R1.EntityTrackerEntry;
import net.minecraft.server.v1_15_R1.Packet;
import net.minecraft.server.v1_15_R1.PlayerConnection;
import net.minecraft.server.v1_15_R1.WorldServer;
public class TablistRemovingTrackerEntry extends EntityTrackerEntry {
private final Entity tracker;
public TablistRemovingTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag,
Consumer<Packet<?>> consumer, Set<EntityPlayer> trackedPlayers) {
super(worldserver, entity, i, flag, consumer, trackedPlayers);
this.tracker = entity;
}
@Override
public void b(EntityPlayer entityplayer) {
PlayerConnection playerconnection = entityplayer.playerConnection;
if (!tracker.dead) {
NMS.sendTabListAdd(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
}
this.a(playerconnection::sendPacket, entityplayer);
this.tracker.b(entityplayer);
entityplayer.d(this.tracker);
if (!tracker.dead && Setting.DISABLE_TABLIST.asBoolean()) {
NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
}
}
}