Skip to content

Commit a415002

Browse files
authored
Merge pull request #19 from SLNE-Development/fix/rename-player-creator-type
fix: rename NpcCreatorType.Player to NpcCreatorType.Client
2 parents c42a61e + 8b88e77 commit a415002

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
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.1-SNAPSHOT
4+
version=1.21.7-1.4.2-SNAPSHOT

surf-npc-api/src/main/kotlin/dev/slne/surf/npc/api/npc/NpcCreatorType.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sealed class NpcCreatorType() {
1010
*
1111
* @property name The name of the player who created the NPC.
1212
*/
13-
data class Player(val name: String) : NpcCreatorType()
13+
data class Client(val name: String) : NpcCreatorType()
1414

1515
/**
1616
* Represents a plugin as the creator of the NPC.
@@ -24,8 +24,8 @@ sealed class NpcCreatorType() {
2424
*
2525
* @return `true` if the creator is a player, otherwise `false`.
2626
*/
27-
fun isPlayer(): Boolean {
28-
return this is Player
27+
fun isClient(): Boolean {
28+
return this is Client
2929
}
3030

3131
/**
@@ -45,7 +45,7 @@ sealed class NpcCreatorType() {
4545

4646
fun name(): String {
4747
return when (this) {
48-
is Player -> name
48+
is Client -> name
4949
is Plugin -> name
5050
}
5151
}

surf-npc-bukkit/src/main/kotlin/dev/slne/surf/npc/bukkit/command/sub/NpcCreateCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class NpcCreateCommand(commandName: String) : CommandAPICommand(commandName) {
6060
BukkitNpcRotation(location.yaw, location.pitch),
6161
true,
6262
persistent = true,
63-
npcCreatorType = NpcCreatorType.Player(createdBy)
63+
npcCreatorType = NpcCreatorType.Client(createdBy)
6464
)
6565

6666
if (npcResult.isFailure()) {

surf-npc-bukkit/src/main/kotlin/dev/slne/surf/npc/bukkit/npc/property/impl/NpcCreatorTypePropertyType.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import dev.slne.surf.npc.api.npc.property.NpcPropertyType
66
class NpcCreatorTypePropertyType(override val id: String) : NpcPropertyType {
77
override fun encode(value: Any): String {
88
require(value is NpcCreatorType) { "Expected NpcCreatorType, got ${value::class}" }
9-
return "${if (value.isPlayer()) "player" else "plugin"}:${value.name()}"
9+
return "${if (value.isClient()) "player" else "plugin"}:${value.name()}"
1010
}
1111

1212
override fun decode(value: String): NpcCreatorType {
1313
val parts = value.split(":")
1414
require(parts.size == 2) { "Invalid creator type format: $value" }
1515

1616
return when (parts[0]) {
17-
"player" -> NpcCreatorType.Player(parts[1])
17+
"player" -> NpcCreatorType.Client(parts[1])
1818
"plugin" -> NpcCreatorType.Plugin(parts[1])
1919
else -> throw IllegalArgumentException("Unknown creator type: ${parts[0]}")
2020
}

0 commit comments

Comments
 (0)