Skip to content

Commit

Permalink
fix: check if the world is ServerWorld
Browse files Browse the repository at this point in the history
  • Loading branch information
zly2006 committed Apr 10, 2024
1 parent ae68de4 commit ef122ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ object ServerMain: ModInitializer {
}

fun checkPermission(world: World, pos: BlockPos, player: PlayerEntity?, permission: Permission): Boolean {
if (world.isClient) return true
val list = getAllEnclosures(world as ServerWorld)
if (world !is ServerWorld) return true
val list = getAllEnclosures(world)
val area = list.getArea(pos) ?: return true
return if (player != null) {
area.areaOf(pos).hasPerm((player as ServerPlayerEntity?)!!, permission)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Session(
}

fun syncDimension(player: ServerPlayerEntity) {
if (world !== player.world) {
if (world !== player.world && player.world is ServerWorld) {
reset(player.world as ServerWorld)
}
}
Expand Down Expand Up @@ -156,4 +156,4 @@ class Session(
pos1 = pos1.offset(direction, amount)
pos2 = pos2.offset(direction, amount)
}
}
}

0 comments on commit ef122ce

Please sign in to comment.