aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-23 13:53:17 +0000
committeranhgelus <anhgelus.morhtuuzh@proton.me>2024-08-23 13:53:17 +0000
commita638839550837f43216b02a9bdee359a24814f37 (patch)
treea14f2b8b6b7d8cedcd1ffb99d5fe93a34653f508 /src
parenta39de9ad78f0e3b4b03453dc3f5da0b649f69288 (diff)
fix(network): not sending packet on connection
Diffstat (limited to 'src')
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java
index 140ab14..79903e2 100644
--- a/src/main/java/world/anhgelus/molehunt/Molehunt.java
+++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java
@@ -8,6 +8,8 @@ import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
+import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
+import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.packet.s2c.play.OverlayMessageS2CPacket;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
@@ -96,6 +98,10 @@ public class Molehunt implements ModInitializer {
newPlayer.changeGameMode(GameMode.SPECTATOR);
});
+ ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> {
+ ServerPlayNetworking.send(handler.player, new ConfigPayload(CONFIG.showNametags, CONFIG.showSkins, CONFIG.showTab));
+ });
+
PayloadTypeRegistry.playS2C().register(ConfigPayload.ID, ConfigPayload.CODEC);
}
}