Class ServerCodeOfConductEvent

java.lang.Object
org.geysermc.geyser.api.event.connection.ConnectionEvent
org.geysermc.geyser.api.event.java.ServerCodeOfConductEvent
All Implemented Interfaces:
org.geysermc.event.Event

public final class ServerCodeOfConductEvent extends ConnectionEvent
Fired when the Java server sends a code of conduct during the configuration phase. API users can listen to this event and tell Geyser the player has accepted the code of conduct before, which will result in the code of conduct not being shown to the player.

Java clients cache this locally, but bedrock clients don't. Normally Geyser uses a simple JSON file to implement this, but an alternative solution may be preferred when using multiple Geyser instances. Such a solution can be implemented through this event and SessionAcceptCodeOfConductEvent.

Since:
2.9.0
See Also:
  • Constructor Details

    • ServerCodeOfConductEvent

      public ServerCodeOfConductEvent(GeyserConnection connection, String codeOfConduct)
  • Method Details

    • codeOfConduct

      public String codeOfConduct()
      Returns:
      the code of conduct sent by the server
      Since:
      2.9.0
    • accepted

      public boolean accepted()
      Returns:
      true if Geyser should not show the code of conduct to the player, because they have already accepted it
      Since:
      2.9.0
    • accept

      public void accept()
      Sets accepted() to true.
      Since:
      2.9.0