MineQuery is in active development since its very release, and occasionally, newer versions of it may introduce changes that might be breaking to existing codebase.
This page will help you migrate your code in order to adapt to changes.
Version 2.5.0 enables SRV records support which is (to adhere to expected behavior)
enabled by default. If you need to stick to v2.4.x behavior, disable it with
WithPreferSRVRecords
option when creating new Pinger
instance.
Version 2.3.0 enables query session caching by default. If you need to stick to
pre-2.3.x behavior, use WithQueryCacheDisabled
option when creating new Pinger
instance.
Version 2.2.1 introduces EnforcesSecureChat
field in Status17
.
Version 2.1.0 has moved from value parameters, receivers and return values to pointers.
All Ping*
functions now take *Pinger
pointer as receiver.
DescriptionText()
now takes *Status17
pointer as receiver.
IsIncompatible()
now takes *Status16
pointer as receiver.
WithDialer
option now takes *net.Dialer
as parameter.
Pinger
struct now has Dialer *net.Dialer
field.
Version 2 of MineQuery has several breaking changes from version 1. This section will help you migrate your existing codebase to v2.
MineQuery v2 has its package named minequery/v2
instead of ping
. Import path has
also changed:
v1 import | v2 import |
---|---|
import "github.com/dreamscached/minequery/ping" |
import "github.com/dreamscached/minequery/v2" |
To remove own names (Legacy, Ancient) of Minecraft versions, it has been decided to
rename Ping*
functions per PingVERSION
scheme. See table below for reference.
v1 signature | v2 signature |
---|---|
ping.Ping(host string, port int) (*ping.Response, error) |
minequery.Ping17(host string, port int) (*minequery.Status17, error) |
ping.PingLegacy(host string, port int) (*ping.LegacyResponse, error) |
minequery.Ping16(host string, port int) (*minequery.Status16, error) minequery.Ping14(host string, port int) (*minequery.Status14, error) to ping 1.4 servers. |
ping.PingAncient(host string, port int) (*ping.AncientResponse, error) |
minequery.PingBeta18(host string, port int) (*minequery.StatusBeta18, error) |
Per same reasoning as ping function renaming, response structs also have been renamed. See table below for reference.
Bear in mind that package name has also changed, see Package renaming section.
v1 name | v2 name |
---|---|
ping.Response |
minequery.Status17 |
ping.LegacyResponse |
minequery.Status16 minequery.Status14 for 1.4. |
ping.AncientResponse |
minequery.StatusBeta18 |
ping.LegacyResponse
and ping.AncientResponse
have been changed with new field names.
See table below for reference (applies both to ping.LegacyResponse
and ping.AncientResponse
.)
v1 field name | v2 field name |
---|---|
Version |
ServerVersion |
MessageOfTheDay |
MOTD |
PlayerCount |
OnlinePlayers |
ping.Response
has been heavily reworked (mostly, due to flattening) with fields renamed,
nested structs flattened and new fields added. See table below for reference.
v1 field name | v2 field name |
---|---|
Version.Name |
VersionName |
Version.Protocol |
ProtocolVersion |
Players.Online |
OnlinePlayers |
Players.Max |
MaxPlayers |
Description |
Description ping.Chat type, v2 uses minequery.Chat17 type, as well as adds DescriptionText() string function. |
Players.Sample |
SamplePlayers PlayerEntry17 named struct. |
Players.Sample.ID |
SamplePlayers.UUID uuid.UUID . |
Favicon |
Icon image.Image instance. |
New in v2 | PreviewsChat |
New in v2 | EnforcesSecureChat |