LogoLogo
LogoLogo
  • What is PacketEvents?
  • Prerequisites
  • Getting Started
  • The PacketEvents Instance
  • Creating Your PacketEvents Instance
    • (Optional) Configuring PacketEvents
  • What is a PacketEvents Listener
  • Creating Your First Listener
  • Registering a Packet Listener
  • Sending and Simulating Packets
  • Advanced PacketEvents Example: Combining our Knowledge
  • FAQ (WIP)
Powered by GitBook
On this page
  • Check for updates
  • Debug
  • Timestamp Mode
  • You can also specify all the settings in one line like this.

Was this helpful?

  1. Creating Your PacketEvents Instance

(Optional) Configuring PacketEvents

Learn how to configure PacketEvents using its settings API.

PacketEvents has configurable settings, allowing you to tweak the behavior of the library. However, changing these settings is not recommended if you are depending on an external version of PacketEvents. This can lead to incompatibilities between PacketEvents plugins if their demands contradict each other. This is written primarily for users shading the library.

Here is how you access the current settings instance. Configuration should be done prior to loading the PacketEvents instance.

PacketEventsSettings settings = instance.getSettings();

Check for updates

By default, PacketEvents will always check for updates as soon as you initialize your PacketEvents instance. Here is how you can configure this action.

settings.checkForUpdates(false);

Debug

This determines whether PacketEvents should print debug messages to your console. Connecting clients (and some of their information) can be debugged. (if this is toggled on)

settings.debug(false);

Timestamp Mode

Events in PacketEvents provide a timestamp. This allows developers to accurately assess when an event occurred. This setting allows developers to configure what unit of time should be used when measuring. In other words, how precise should the timestamp measurement be?

settings.timeStampMode(TimeStampMode.MILLIS);

You can also specify all the settings in one line like this.

settings.checkForUpdates(false).debug(false);
PreviousCreating Your PacketEvents InstanceNextWhat is a PacketEvents Listener

Last updated 4 months ago

Was this helpful?