Cleanup session loading.

Apparently the spigot server stores time-lock between logout and login,
but not weather-lock. This should work around any such issues by
re-applying handlers on login.
This commit is contained in:
wizjany 2019-02-12 14:56:03 -05:00
parent 96e7c43f56
commit 1f1e6eedf6
2 changed files with 4 additions and 4 deletions

View File

@ -151,8 +151,6 @@ public void onPlayerJoin(PlayerJoinEvent event) {
} }
Events.fire(new ProcessPlayerEvent(player)); Events.fire(new ProcessPlayerEvent(player));
WorldGuard.getInstance().getPlatform().getSessionManager().get(localPlayer); // Initializes a session
} }
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)

View File

@ -59,13 +59,15 @@ public void resetAllStates() {
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
// Pre-load a session // Pre-load a session
get(WorldGuardPlugin.inst().wrapPlayer(event.getPlayer())); LocalPlayer player = WorldGuardPlugin.inst().wrapPlayer(event.getPlayer());
get(player).initialize(player);
} }
@Override @Override
public void run() { public void run() {
for (Player player : Bukkit.getServer().getOnlinePlayers()) { for (Player player : Bukkit.getServer().getOnlinePlayers()) {
get(new BukkitPlayer(WorldGuardPlugin.inst(), player)).tick(new BukkitPlayer(WorldGuardPlugin.inst(), player)); LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
get(localPlayer).tick(localPlayer);
} }
} }