Skip to content

Commit 63e2067

Browse files
committed
Skip testMoveTo while session is uninitialized. Fixes #2325
1 parent 488d94d commit 63e2067

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • worldguard-core/src/main/java/com/sk89q/worldguard/session

‎worldguard-core/src/main/java/com/sk89q/worldguard/session/Session.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ public Location testMoveTo(LocalPlayer player, Location to, MoveType moveType) {
227227
*/
228228
@Nullable
229229
public Location testMoveTo(LocalPlayer player, Location to, MoveType moveType, boolean forced) {
230+
if (lastValid == null) {
231+
// If lastValid is null, the session has not yet been initialized. This shouldn't happen, but theoretically
232+
// can due to Bukkit event orderings.
233+
return null;
234+
}
235+
230236
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
231237

232238
if (!forced && needRefresh.getAndSet(false)) {

0 commit comments

Comments
 (0)