Class WorldDifficultyChangeEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.world.WorldEvent
io.papermc.paper.event.world.WorldDifficultyChangeEvent

@NullMarked public class WorldDifficultyChangeEvent extends WorldEvent
Called when a world's difficulty is changed, either by command or by api.

If the world is in hardcore the resulting difficulty will always be Difficulty.HARD

Since:
1.21.8
  • Constructor Details

  • Method Details

    • getCommandSource

      public @Nullable CommandSourceStack getCommandSource()
      Gets the command source associated with this event.
      Returns:
      null if the difficulty was changed via api, otherwise the CommandSourceStack.
      Since:
      1.21.8
    • getDifficulty

      public Difficulty getDifficulty()
      Gets the new difficulty of the world.
      Returns:
      the new difficulty.
      Since:
      1.21.8
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
      Since:
      1.21.8
    • getHandlerList

      public static HandlerList getHandlerList()
      Since:
      1.21.8