From 6df83fbee9fc236acfee5bd61509838eba8016c6 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Sat, 26 Sep 2026 22:42:45 -0700 Subject: [PATCH] Register join listener through Paper manager --- TODO.md | 2 +- .../bukkitplugins/metropolis/MetropolisPlugin.java | 5 ++--- .../metropolis/eventlisteners/PlayerJoinListener.java | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 68c7f6b..03e25c8 100644 --- a/TODO.md +++ b/TODO.md @@ -12,7 +12,7 @@ | MET-008 | Done | Analyze Java sources for deprecated or removed Bukkit/Paper APIs and legacy patterns, including logging, event registration, configuration, player lookup, and player-keyed storage. | | MET-009 | Done | Review custom scripts and resources for required updates to the Gradle build and modern Paper server workflow. | | MET-010 | Done | Refactor plugin logging to use JavaPlugin.getLogger(). | -| MET-011 | Ready | Refactor event listeners and registration to use Listener, @EventHandler, and the modern plugin manager API. | +| MET-011 | Done | Refactor event listeners and registration to use Listener, @EventHandler, and the modern plugin manager API. | | MET-012 | Ready | Replace deprecated configuration APIs with the modern Bukkit/Paper configuration API, including load, save, and reload behavior. | | MET-013 | Ready | Replace Player-keyed storage with UUID-based storage wherever player identity is persisted or tracked. | | MET-014 | Ready | Review player lookup logic and use exact or otherwise explicit name-matching behavior where appropriate. | diff --git a/src/main/java/com/majinnaibu/bukkitplugins/metropolis/MetropolisPlugin.java b/src/main/java/com/majinnaibu/bukkitplugins/metropolis/MetropolisPlugin.java index 0ee5943..bf00048 100644 --- a/src/main/java/com/majinnaibu/bukkitplugins/metropolis/MetropolisPlugin.java +++ b/src/main/java/com/majinnaibu/bukkitplugins/metropolis/MetropolisPlugin.java @@ -274,9 +274,8 @@ public class MetropolisPlugin extends JavaPlugin { fillOccupiedPlots(); resizeCityRegion(); - if(_playerJoinListener == null){ - _playerJoinListener = new PlayerJoinListener(this); - } + _playerJoinListener = new PlayerJoinListener(this); + getServer().getPluginManager().registerEvents(_playerJoinListener, this); getLogger().info(String.format("%s enabled", pdf.getFullName())); diff --git a/src/main/java/com/majinnaibu/bukkitplugins/metropolis/eventlisteners/PlayerJoinListener.java b/src/main/java/com/majinnaibu/bukkitplugins/metropolis/eventlisteners/PlayerJoinListener.java index a00b5ed..2ecbd23 100644 --- a/src/main/java/com/majinnaibu/bukkitplugins/metropolis/eventlisteners/PlayerJoinListener.java +++ b/src/main/java/com/majinnaibu/bukkitplugins/metropolis/eventlisteners/PlayerJoinListener.java @@ -15,7 +15,6 @@ public class PlayerJoinListener implements Listener { public PlayerJoinListener(MetropolisPlugin plugin){ _plugin = plugin; - plugin.getServer().getPluginManager().registerEvents(this, plugin); } @EventHandler(priority=EventPriority.MONITOR)