7f487e6
Branches > main > 7f487e6 > files
Add player count to status response packet
Commit: 7f487e66ca34e6a8297075d5a53cd1cc3aee859d
Parent: fffc530
1 changed file:
src/net/bowmap/server/protocol/writers.clj view file
@@ -4,7 +4,6 @@ See https://minecraft.wiki/w/Java_Edition_protocol/Packets#Data_types" (:require [clojure.data.json :as json]- [medley.core :refer [assoc-some]] [net.bowmap.server.protocol.schema :as p]) (:import [io.netty.buffer ByteBuf]@@ -39,11 +38,13 @@ (string-> buf (json/write-str s))) (defn status-response-> [buf {::p/keys! [version-name protocol]- ::p/keys [motd]}]+ ::p/keys [motd max-player-count online-player-count]}] (json-> buf- (assoc-some {:version {:name version-name- :protocol protocol}}- :description motd)))+ (cond-> {:version {:name version-name+ :protocol protocol}}+ motd (assoc :description motd)+ (and max-player-count online-player-count) (assoc :players {:max max-player-count+ :online online-player-count})))) (defn table-> [schema] (fn [buf m]