Skip to content

Commit e816cc7

Browse files
Merge pull request #21 from SLNE-Development/fix/fix-npc-display-bug
fix: filter NPCs by player world in ConnectionListener
2 parents 8dea172 + e9edc6a commit e816cc7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
kotlin.code.style=official
22
kotlin.stdlib.default.dependency=false
33
org.gradle.parallel=true
4-
version=1.21.7-1.4.3-SNAPSHOT
4+
version=1.21.7-1.4.4-SNAPSHOT

surf-npc-bukkit/src/main/kotlin/dev/slne/surf/npc/bukkit/listener/ConnectionListener.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.slne.surf.npc.bukkit.listener
22

3+
import dev.slne.surf.npc.api.npc.location.NpcLocation
34
import dev.slne.surf.npc.api.npc.property.NpcProperty
45
import dev.slne.surf.npc.core.controller.npcController
56
import org.bukkit.event.EventHandler
@@ -15,6 +16,11 @@ class ConnectionListener : Listener {
1516
.filter {
1617
it.getPropertyValue(NpcProperty.Internal.VISIBILITY_GLOBAL, Boolean::class) ?: false
1718
}
19+
.filter {
20+
val npcLocation =
21+
it.getPropertyValue(NpcProperty.Internal.LOCATION, NpcLocation::class)
22+
npcLocation == null || npcLocation.world == player.world.name
23+
}
1824
.forEach {
1925
it.spawn(player.uniqueId)
2026
}

0 commit comments

Comments
 (0)