mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-20 00:13:21 +02:00
log receiving packets from the client
This commit is contained in:
parent
8a4eee31bc
commit
63f1f91f7c
1 changed files with 9 additions and 1 deletions
|
@ -89,14 +89,22 @@ public class Events {
|
||||||
PayloadTypeRegistry.playS2C().register(SitPayloads.ResponsePayload.ID, SitPayloads.ResponsePayload.CODEC);
|
PayloadTypeRegistry.playS2C().register(SitPayloads.ResponsePayload.ID, SitPayloads.ResponsePayload.CODEC);
|
||||||
|
|
||||||
// server receiver is common
|
// server receiver is common
|
||||||
|
|
||||||
|
/// receiving the sitting setting payload
|
||||||
ServerPlayNetworking.registerGlobalReceiver(SitPayloads.SettingsPayload.ID,((payload, context) -> Data.getServer().execute(() -> {
|
ServerPlayNetworking.registerGlobalReceiver(SitPayloads.SettingsPayload.ID,((payload, context) -> Data.getServer().execute(() -> {
|
||||||
|
// save the setting on the server for that player
|
||||||
FileData.setPlayerSetting(context.player(),Utl.getGson().fromJson(payload.value(), SittingConfig.class));
|
FileData.setPlayerSetting(context.player(),Utl.getGson().fromJson(payload.value(), SittingConfig.class));
|
||||||
// send the player back a packet for conformation
|
|
||||||
|
// send the player back a response packet for confirmation
|
||||||
ServerPlayNetworking.send(context.player(),new SitPayloads.ResponsePayload(SitPayloads.ResponsePayload.VERSION));
|
ServerPlayNetworking.send(context.player(),new SitPayloads.ResponsePayload(SitPayloads.ResponsePayload.VERSION));
|
||||||
|
|
||||||
|
// log the receiving of the packet from the player
|
||||||
|
Data.LOGGER.info("Received custom sitting settings from {}!", context.player().getName().getString());
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void client() {
|
private static void client() {
|
||||||
|
/// receiving the response packet from the server
|
||||||
ClientPlayNetworking.registerGlobalReceiver(SitPayloads.ResponsePayload.ID, ((payload, context) -> {
|
ClientPlayNetworking.registerGlobalReceiver(SitPayloads.ResponsePayload.ID, ((payload, context) -> {
|
||||||
// only update when needed
|
// only update when needed
|
||||||
if (!Data.isSupportedServer()) {
|
if (!Data.isSupportedServer()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue