(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 occured. 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);

Last updated