Skip to content

Commit

Permalink
Cleanup session loading.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wizjany committed Feb 12, 2019
1 parent 96e7c43 commit 1f1e6ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -151,8 +151,6 @@ public void onPlayerJoin(PlayerJoinEvent event) {
}

Events.fire(new ProcessPlayerEvent(player));

WorldGuard.getInstance().getPlatform().getSessionManager().get(localPlayer); // Initializes a session
}

@EventHandler(ignoreCancelled = true)
Expand Down
Expand Up @@ -59,13 +59,15 @@ public void resetAllStates() {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
// Pre-load a session
get(WorldGuardPlugin.inst().wrapPlayer(event.getPlayer()));
LocalPlayer player = WorldGuardPlugin.inst().wrapPlayer(event.getPlayer());
get(player).initialize(player);
}

@Override
public void run() {
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);
}
}

Expand Down

0 comments on commit 1f1e6ee

Please sign in to comment.