Skip to content

Commit

Permalink
Update to 1.19.3 (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakShearman authored May 22, 2023
1 parent 11459e7 commit a70817f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
}

dependencies {
implementation("com.github.Minestom:Minestom:e0427a36f3")
implementation("com.github.Minestom:Minestom:cb3892255e")
implementation("de.articdive:jnoise-pipeline:4.0.0")
implementation("io.prometheus:simpleclient:0.16.0")
implementation("io.prometheus:simpleclient_hotspot:0.16.0")
Expand Down
27 changes: 10 additions & 17 deletions src/main/java/net/minestom/arena/lobby/NPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.kyori.adventure.text.event.ClickEvent;
import net.minestom.arena.Messenger;
import net.minestom.arena.game.ArenaCommand;
import net.minestom.server.MinecraftServer;
import net.minestom.server.coordinate.Point;
import net.minestom.server.coordinate.Pos;
import net.minestom.server.entity.*;
Expand All @@ -18,22 +17,15 @@
import net.minestom.server.event.entity.EntityAttackEvent;
import net.minestom.server.event.player.PlayerEntityInteractEvent;
import net.minestom.server.instance.Instance;
import net.minestom.server.network.packet.server.play.PlayerInfoPacket;
import net.minestom.server.network.packet.server.play.PlayerInfoPacket.AddPlayer.Property;
import net.minestom.server.network.packet.server.play.PlayerInfoPacket.RemovePlayer;
import net.minestom.server.network.packet.server.play.PlayerInfoUpdatePacket;
import net.minestom.server.sound.SoundEvent;
import net.minestom.server.timer.TaskSchedule;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;

import static net.minestom.server.network.packet.server.play.PlayerInfoPacket.Action.ADD_PLAYER;
import static net.minestom.server.network.packet.server.play.PlayerInfoPacket.Action.REMOVE_PLAYER;
import static net.minestom.server.network.packet.server.play.PlayerInfoPacket.AddPlayer;

// https://gist.github.com/iam4722202468/36630043ca89e786bb6318e296f822f8
final class NPC extends EntityCreature {
private final String name;
Expand Down Expand Up @@ -92,14 +84,15 @@ public void handle(@NotNull PlayerEntityInteractEvent event) {
@Override
public void updateNewViewer(@NotNull Player player) {
// Required to spawn player
final List<Property> properties = List.of(new Property("textures", skin.textures(), skin.signature()));
player.sendPacket(new PlayerInfoPacket(ADD_PLAYER, new AddPlayer(getUuid(), name, properties,
GameMode.SURVIVAL, 0, null, null)));

// Remove from tab list after 1 second, seems not to load skin if 1 or 2 ticks
MinecraftServer.getSchedulerManager().scheduleTask(
() -> player.sendPacket(new PlayerInfoPacket(REMOVE_PLAYER, new RemovePlayer(getUuid()))),
TaskSchedule.seconds(1), TaskSchedule.stop());
final List<PlayerInfoUpdatePacket.Property> properties = List.of(
new PlayerInfoUpdatePacket.Property("textures", skin.textures(), skin.signature())
);
player.sendPacket(new PlayerInfoUpdatePacket(PlayerInfoUpdatePacket.Action.ADD_PLAYER,
new PlayerInfoUpdatePacket.Entry(
getUuid(), name, properties, false, 0, GameMode.SURVIVAL, null,
null)
)
);

super.updateNewViewer(player);
}
Expand Down

0 comments on commit a70817f

Please sign in to comment.