Skip to content

Commit

Permalink
Update WorldLoadEvent to WorldInitEvent in WorldListener
Browse files Browse the repository at this point in the history
Changing the event from WorldLoadEvent to WorldInitEvent ensures areas are loaded earlier in the world lifecycle. This prevents issues arising from accessing not fully initialized worlds in the ProtectPlugin.
  • Loading branch information
NonSwag committed Oct 7, 2024
1 parent cf2a1a7 commit 3487f98
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.StructureGrowEvent;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldUnloadEvent;

@RequiredArgsConstructor
public class WorldListener implements Listener {
private final ProtectPlugin plugin;

@EventHandler(priority = EventPriority.MONITOR)
public void onWorldLoad(WorldLoadEvent event) {
public void onWorldInit(WorldInitEvent event) {
plugin.areaProvider().loadAreas(event.getWorld());
}

Expand Down

0 comments on commit 3487f98

Please sign in to comment.