From 055b927bca6aac464b3c4cf1692043601a139e16 Mon Sep 17 00:00:00 2001 From: mworzala Date: Tue, 19 Dec 2023 00:52:47 +0200 Subject: [PATCH] upgrade: minor fixes, disable some scoreboard stuff temporarily (cherry picked from commit db28c44b4072679cb42e8253eb3a1be50029a1e3) --- src/main/java/net/minestom/server/entity/Player.java | 3 +++ .../packet/server/play/ChangeGameStatePacket.java | 3 ++- .../net/minestom/server/scoreboard/Scoreboard.java | 3 ++- .../java/net/minestom/server/scoreboard/Sidebar.java | 12 +++++++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index b0e762409..dc3118e5a 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -348,6 +348,9 @@ public class Player extends LivingEntity implements CommandSender, Localizable, refreshHealth(); // Heal and send health packet refreshAbilities(); // Send abilities packet + // Start chunk load + sendPacket(new ChangeGameStatePacket(ChangeGameStatePacket.Reason.LEVEL_CHUNKS_LOAD_START, 0)); + return setInstance(spawnInstance); } diff --git a/src/main/java/net/minestom/server/network/packet/server/play/ChangeGameStatePacket.java b/src/main/java/net/minestom/server/network/packet/server/play/ChangeGameStatePacket.java index d8b0e9d49..c4a398961 100644 --- a/src/main/java/net/minestom/server/network/packet/server/play/ChangeGameStatePacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/play/ChangeGameStatePacket.java @@ -42,6 +42,7 @@ public record ChangeGameStatePacket(@NotNull Reason reason, float value) impleme PLAY_PUFFERFISH_STING_SOUND, PLAYER_ELDER_GUARDIAN_MOB_APPEARANCE, ENABLE_RESPAWN_SCREEN, - LIMITED_CRAFTING + LIMITED_CRAFTING, + LEVEL_CHUNKS_LOAD_START } } diff --git a/src/main/java/net/minestom/server/scoreboard/Scoreboard.java b/src/main/java/net/minestom/server/scoreboard/Scoreboard.java index b14aebca4..116253c63 100644 --- a/src/main/java/net/minestom/server/scoreboard/Scoreboard.java +++ b/src/main/java/net/minestom/server/scoreboard/Scoreboard.java @@ -67,7 +67,8 @@ public interface Scoreboard extends Viewable, PacketGroupingAudience { * @param score The new score */ default void updateScore(Player player, int score) { - sendPacketsToViewers(new UpdateScorePacket(player.getUsername(), (byte) 0, getObjectiveName(), score)); + //todo +// sendPacketsToViewers(new UpdateScorePacket(player.getUsername(), (byte) 0, getObjectiveName(), score)); } /** diff --git a/src/main/java/net/minestom/server/scoreboard/Sidebar.java b/src/main/java/net/minestom/server/scoreboard/Sidebar.java index 09f1a7d23..3b5185e85 100644 --- a/src/main/java/net/minestom/server/scoreboard/Sidebar.java +++ b/src/main/java/net/minestom/server/scoreboard/Sidebar.java @@ -335,7 +335,9 @@ public class Sidebar implements Scoreboard { * @return a {@link UpdateScorePacket} */ private UpdateScorePacket getScoreCreationPacket(String objectiveName) { - return new UpdateScorePacket(entityName, (byte) 0, objectiveName, line); + //todo + throw new UnsupportedOperationException(); +// return new UpdateScorePacket(entityName, (byte) 0, objectiveName, line); } /** @@ -345,7 +347,9 @@ public class Sidebar implements Scoreboard { * @return a {@link UpdateScorePacket} */ private UpdateScorePacket getScoreDestructionPacket(String objectiveName) { - return new UpdateScorePacket(entityName, (byte) 1, objectiveName, 0); + //todo + throw new UnsupportedOperationException(); +// return new UpdateScorePacket(entityName, (byte) 1, objectiveName, 0); } /** @@ -356,7 +360,9 @@ public class Sidebar implements Scoreboard { * @return a {@link UpdateScorePacket} */ private UpdateScorePacket getLineScoreUpdatePacket(String objectiveName, int score) { - return new UpdateScorePacket(entityName, (byte) 0, objectiveName, score); + //todo + throw new UnsupportedOperationException(); +// return new UpdateScorePacket(entityName, (byte) 0, objectiveName, score); } /**