forked from virt-mirrors/Sit
Merge branch 'refs/heads/master' into 1.20.4
# Conflicts: # gradle.properties # src/main/java/one/oth3r/sit/Sit.java # src/main/java/one/oth3r/sit/SitClient.java # src/main/java/one/oth3r/sit/packet/CustomPayloads.java # src/main/resources/fabric.mod.json
This commit is contained in:
commit
6ea4831a1c
7 changed files with 18 additions and 10 deletions
|
@ -13,13 +13,19 @@ public class SitClient implements ClientModInitializer {
|
|||
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
|
||||
inGame = true;
|
||||
// send a data packet whenever joining a server
|
||||
client.execute(SitClient::sendPackets);
|
||||
sendSettingsPackets();
|
||||
});
|
||||
// reset inGame
|
||||
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> inGame = false);
|
||||
}
|
||||
public static void sendPackets() {
|
||||
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||||
new PacketBuilder(gson.toJson(Utl.HandSettings.getHandSettings())).send();
|
||||
|
||||
/**
|
||||
* sends the settings packets to the server is the client is in game
|
||||
*/
|
||||
public static void sendSettingsPackets() {
|
||||
if (inGame) {
|
||||
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||||
new PacketBuilder(gson.toJson(Utl.HandSettings.getHandSettings())).send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue