Class ClientVersions

java.lang.Object
com.enhancedechest.compat.ClientVersions

public final class ClientVersions extends Object
Answers "can this player's client show a Dialog?". The Dialog API arrived in Minecraft 1.21.6; a server on 1.21.6+ can still be joined by older clients through ViaBackwards, and those clients either get ViaBackwards' chest emulation of the dialog or — with dialogs-via-chests: false — nothing at all. Knowing the real client version lets the chest list route them to the inventory chooser instead.

Only ViaVersion knows the client's version (Paper sees the server's own protocol on every connection). It is an optional dependency, so every ViaVersion type lives in ViaVersionProbe, which this class loads only after checking the plugin is enabled — referencing it unconditionally would throw NoClassDefFoundError on servers without ViaVersion.

The fallback is always on (not a config key): a pre-1.21.6 player shown a dialog either gets a clumsy emulation or nothing at all, and neither is a state worth letting an admin choose.

When ViaVersion is absent, or runs only on the proxy (so this server never sees an old protocol), every player counts as dialog-capable, which is exactly the behaviour before this class existed.

  • Constructor Details

    • ClientVersions

      public ClientVersions(org.slf4j.Logger logger)
  • Method Details

    • supportsDialogs

      public boolean supportsDialogs(org.bukkit.entity.Player player)
      Whether player's client understands the Dialog API (1.21.6+). Always true without ViaVersion, and on any lookup failure — a wrong "true" only shows the dialog, which ViaBackwards usually emulates, while a wrong "false" would needlessly take features away.