generated from Astra-Interactive/AstraTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e06cbc8
commit 1d0fef9
Showing
9 changed files
with
101 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ makeevrserg.java.ktarget=17 | |
# Project | ||
makeevrserg.project.name=AspeKt | ||
makeevrserg.project.group=ru.astrainteractive.aspekt | ||
makeevrserg.project.version.string=2.19.5 | ||
makeevrserg.project.version.string=2.19.6 | ||
makeevrserg.project.description=Essentials plugin for EmpireProjekt | ||
makeevrserg.project.developers=makeevrserg|Makeev Roman|[email protected] | ||
makeevrserg.project.url=https://empireprojekt.ru | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...iswear/src/main/kotlin/ru/astrainteractive/aspekt/module/antiswear/data/AntiSwearKrate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ru.astrainteractive.aspekt.module.antiswear.data | ||
|
||
import kotlinx.serialization.StringFormat | ||
import org.bukkit.entity.Player | ||
import ru.astrainteractive.aspekt.module.antiswear.model.AntiSwearStorage | ||
import ru.astrainteractive.astralibs.krate.core.FileKrate | ||
import ru.astrainteractive.astralibs.krate.core.StringFormatKrate | ||
import java.io.File | ||
|
||
internal class AntiSwearKrate( | ||
player: Player, | ||
stringFormat: StringFormat, | ||
) : FileKrate<AntiSwearStorage> by StringFormatKrate( | ||
default = AntiSwearStorage( | ||
playerName = player.name, | ||
uuid = player.uniqueId.toString() | ||
), | ||
fileName = "${player.uniqueId}.json", | ||
stringFormat = stringFormat, | ||
kSerializer = AntiSwearStorage.serializer(), | ||
folder = File("./.temp/antiswear") | ||
) |
7 changes: 0 additions & 7 deletions
7
...src/main/kotlin/ru/astrainteractive/aspekt/module/antiswear/data/AntiSwearKrateFactory.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...r/src/test/kotlin/ru/astrainteractive/aspekt/module/antiswear/data/SwearRepositoryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ru.astrainteractive.aspekt.module.antiswear.data | ||
|
||
import kotlinx.coroutines.test.runTest | ||
import kotlinx.serialization.json.Json | ||
import org.bukkit.entity.Player | ||
import org.mockito.Mockito | ||
import ru.astrainteractive.klibs.mikro.core.dispatchers.DefaultKotlinDispatchers | ||
import java.util.UUID | ||
import kotlin.test.Test | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertTrue | ||
|
||
class SwearRepositoryTest { | ||
@Test | ||
fun test(): Unit = runTest { | ||
val repository = SwearRepositoryImpl( | ||
dispatchers = DefaultKotlinDispatchers, | ||
tempFileStringFormat = Json | ||
) | ||
val player = Mockito.mock(Player::class.java) | ||
val uuid = UUID.randomUUID() | ||
Mockito.`when`(player.name).then { "Name" } | ||
Mockito.`when`(player.uniqueId).then { uuid } | ||
assertTrue(repository.isSwearFilterEnabled(player)) | ||
repository.setSwearFilterEnabled(player, false) | ||
assertFalse(repository.isSwearFilterEnabled(player)) | ||
repository.setSwearFilterEnabled(player, true) | ||
assertTrue(repository.isSwearFilterEnabled(player)) | ||
repository.forgetPlayer(player) | ||
repository.rememberPlayer(player) | ||
assertTrue(repository.isSwearFilterEnabled(player)) | ||
repository.setSwearFilterEnabled(player, false) | ||
assertFalse(repository.isSwearFilterEnabled(player)) | ||
repository.forgetPlayer(player) | ||
repository.rememberPlayer(player) | ||
assertFalse(repository.isSwearFilterEnabled(player)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters