Skip to content

Commit

Permalink
send ClientboundPlayerInfoRemovePacket with a 2 seconds delay instead…
Browse files Browse the repository at this point in the history
… of 5 ticks
  • Loading branch information
OliverSchlueter committed Aug 30, 2024
1 parent 941a833 commit 6a10f66
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

public class Npc_1_19_4 extends Npc {

Expand Down Expand Up @@ -129,10 +130,10 @@ public void spawn(Player player) {

isVisibleForPlayer.put(player.getUniqueId(), true);

FancyNpcsPlugin.get().getScheduler().runTaskLater(null, 5L, () -> {
FancyNpcsPlugin.get().getNpcThread().schedule(() -> {
ClientboundPlayerInfoRemovePacket playerInfoRemovePacket = new ClientboundPlayerInfoRemovePacket(List.of(npc.getUUID()));
serverPlayer.connection.send(playerInfoRemovePacket);
});
}, 2, TimeUnit.SECONDS);

update(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

public class Npc_1_20_1 extends Npc {

Expand Down Expand Up @@ -130,10 +131,10 @@ public void spawn(Player player) {

isVisibleForPlayer.put(player.getUniqueId(), true);

FancyNpcsPlugin.get().getScheduler().runTaskLater(null, 5L, () -> {
FancyNpcsPlugin.get().getNpcThread().schedule(() -> {
ClientboundPlayerInfoRemovePacket playerInfoRemovePacket = new ClientboundPlayerInfoRemovePacket(List.of(npc.getUUID()));
serverPlayer.connection.send(playerInfoRemovePacket);
});
}, 2, TimeUnit.SECONDS);

update(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

public class Npc_1_20_2 extends Npc {

Expand Down Expand Up @@ -127,10 +128,10 @@ public void spawn(Player player) {

isVisibleForPlayer.put(player.getUniqueId(), true);

FancyNpcsPlugin.get().getScheduler().runTaskLater(null, 5L, () -> {
FancyNpcsPlugin.get().getNpcThread().schedule(() -> {
ClientboundPlayerInfoRemovePacket playerInfoRemovePacket = new ClientboundPlayerInfoRemovePacket(List.of(npc.getUUID()));
serverPlayer.connection.send(playerInfoRemovePacket);
});
}, 2, TimeUnit.SECONDS);

update(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

public class Npc_1_20_4 extends Npc {

Expand Down Expand Up @@ -126,10 +127,10 @@ public void spawn(Player player) {

isVisibleForPlayer.put(player.getUniqueId(), true);

FancyNpcsPlugin.get().getScheduler().runTaskLater(null, 5L, () -> {
FancyNpcsPlugin.get().getNpcThread().schedule(() -> {
ClientboundPlayerInfoRemovePacket playerInfoRemovePacket = new ClientboundPlayerInfoRemovePacket(List.of(npc.getUUID()));
serverPlayer.connection.send(playerInfoRemovePacket);
});
}, 2, TimeUnit.SECONDS);

update(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

public class Npc_1_20_6 extends Npc {

Expand Down Expand Up @@ -129,10 +130,10 @@ public void spawn(Player player) {

isVisibleForPlayer.put(player.getUniqueId(), true);

FancyNpcsPlugin.get().getScheduler().runTaskLater(null, 5L, () -> {
FancyNpcsPlugin.get().getNpcThread().schedule(() -> {
ClientboundPlayerInfoRemovePacket playerInfoRemovePacket = new ClientboundPlayerInfoRemovePacket(List.of(npc.getUUID()));
serverPlayer.connection.send(playerInfoRemovePacket);
});
}, 2, TimeUnit.SECONDS);

update(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.bukkit.entity.Player;

import java.util.*;
import java.util.concurrent.TimeUnit;

public class Npc_1_21_1 extends Npc {

Expand Down Expand Up @@ -130,10 +131,10 @@ public void spawn(Player player) {
isVisibleForPlayer.put(player.getUniqueId(), true);


FancyNpcsPlugin.get().getScheduler().runTaskLater(null, 5L, () -> {
FancyNpcsPlugin.get().getNpcThread().schedule(() -> {
ClientboundPlayerInfoRemovePacket playerInfoRemovePacket = new ClientboundPlayerInfoRemovePacket(List.of(npc.getUUID()));
serverPlayer.connection.send(playerInfoRemovePacket);
});
}, 2, TimeUnit.SECONDS);

update(player);
}
Expand Down

0 comments on commit 6a10f66

Please sign in to comment.