Don't downcast to Set since some forks change collection type

This commit is contained in:
fullwall 2023-10-22 10:51:35 +08:00
parent 8f6e65c4e2
commit 627811ca7a
6 changed files with 7 additions and 5 deletions

View File

@ -1068,7 +1068,7 @@ public class NMSImpl implements NMSBridge {
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {
try {
Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
Collection<Object> set = (Collection<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
set.remove(entry);
set.add(replace);
} catch (IllegalArgumentException e) {

View File

@ -1126,7 +1126,7 @@ public class NMSImpl implements NMSBridge {
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {
try {
Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
Collection<Object> set = (Collection<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
set.remove(entry);
set.add(replace);
} catch (IllegalArgumentException e) {

View File

@ -1138,7 +1138,7 @@ public class NMSImpl implements NMSBridge {
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {
try {
Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
Collection<Object> set = (Collection<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
set.remove(entry);
set.add(replace);
} catch (IllegalArgumentException e) {

View File

@ -1175,7 +1175,7 @@ public class NMSImpl implements NMSBridge {
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {
try {
Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
Collection<Object> set = (Collection<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
set.remove(entry);
set.add(replace);
} catch (IllegalArgumentException e) {

View File

@ -999,7 +999,7 @@ public class NMSImpl implements NMSBridge {
server.getTracker().trackedEntities.a(entity.getEntityId(), replace);
if (TRACKED_ENTITY_SET != null) {
try {
Set<Object> set = (Set<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
Collection<Object> set = (Collection<Object>) TRACKED_ENTITY_SET.get(server.getTracker());
set.remove(entry);
set.add(replace);
} catch (IllegalArgumentException e) {

View File

@ -45,8 +45,10 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
() -> NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new PacketPlayOutAnimation(tracker, 0)),
1);
}
if (!Setting.DISABLE_TABLIST.asBoolean())
return;
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
}, Setting.TABLIST_REMOVE_PACKET_DELAY.asTicks());