File tree Expand file tree Collapse file tree
main/kotlin/net/chariskar/breakthemod
test/kotlin/net/chariskar/breakthemod/apiTest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import net.chariskar.breakthemod.client.api.Command
2020import net.chariskar.breakthemod.client.api.engine.NearbyEngine
2121import net.chariskar.breakthemod.client.commands.Debug
2222import net.chariskar.breakthemod.client.commands.discordId
23- import net.chariskar.breakthemod.client.commands.findPlayer
23+ import net.chariskar.breakthemod.client.commands.FindPlayer
2424import net.chariskar.breakthemod.client.commands.goto
2525import net.chariskar.breakthemod.client.commands.help
2626import net.chariskar.breakthemod.client.commands.lastSeen
@@ -59,7 +59,7 @@ class Breakthemod : ClientModInitializer {
5959 onlineStaff(),
6060 townless(),
6161 goto(),
62- findPlayer (),
62+ FindPlayer (),
6363 lastSeen(),
6464 discordId(),
6565 locate(),
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
1919import net.minecraft.text.Text
2020import net.minecraft.util.Formatting
2121
22- class findPlayer : Command () {
22+ class FindPlayer : Command () {
2323 init {
2424 name = " findPlayer"
2525 description = " Tells you where a player is based on the map api."
@@ -45,6 +45,8 @@ class findPlayer : Command() {
4545 val players : MutableList <MapResponse >? = null
4646 )
4747
48+
49+
4850 override fun execute (ctx : CommandContext <FabricClientCommandSource >): Int {
4951 val name: String = ctx.getArgument(" name" , String ::class .java)
5052 scope.launch {
@@ -80,6 +82,7 @@ class findPlayer : Command() {
8082 }
8183 return 0
8284 }
85+
8386 override fun register (dispatcher : CommandDispatcher <FabricClientCommandSource >) {
8487 dispatcher.register(
8588 LiteralArgumentBuilder .literal<FabricClientCommandSource >(name)
Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ class Nation(val name: String) {
7979
8080 @Serializable
8181 data class Ranks (
82- var Chancellor : List <Resident >? = null ,
83- var Colonist : List <Resident >? = null ,
84- var Diplomat : List <Resident >? = null
82+ var Chancellor : List <Reference >? = null ,
83+ var Colonist : List <Reference >? = null ,
84+ var Diplomat : List <Reference >? = null
8585 )
8686}
Original file line number Diff line number Diff line change 11package net.chariskar.breakthemod.apiTest ;
22
3+ import kotlinx.coroutines.launch
34import kotlinx.coroutines.runBlocking
45import net.chariskar.breakthemod.Main
6+ import net.chariskar.breakthemod.TestScope
57import net.chariskar.breakthemod.client.api.Fetch
68import net.chariskar.breakthemod.client.objects.Nation
79import net.chariskar.breakthemod.client.objects.Resident
@@ -15,10 +17,11 @@ import kotlin.test.assertIs
1517 * Test class for [net.chariskar.breakthemod.client.api.Fetch]
1618 * */
1719class EarthmcApiTest {
20+ val scope = TestScope .scope
1821
1922 @Test
2023 fun `test GET request` () {
21- runBlocking {
24+ scope.launch {
2225 val result = Fetch .getRequest<StaffList >(Main .config.staffRepoUrl)
2326 assertNotNull(result)
2427 assertIs<StaffList >(result)
@@ -27,7 +30,7 @@ class EarthmcApiTest {
2730
2831 @Test
2932 fun `test towns` () {
30- runBlocking {
33+ scope.launch {
3134 val result = Fetch .getTown(" paris" )
3235 assertNotNull(result)
3336 assertIs<Town >(result)
@@ -36,7 +39,7 @@ class EarthmcApiTest {
3639
3740 @Test
3841 fun `test nations` () {
39- runBlocking {
42+ scope.launch {
4043 val result = Fetch .getNation(" france" )
4144 assertNotNull(result)
4245 assertIs<Nation >(result)
@@ -45,7 +48,7 @@ class EarthmcApiTest {
4548
4649 @Test
4750 fun `test players` () {
48- runBlocking {
51+ scope.launch {
4952 val result = Fetch .getResident(" charis_k" )
5053 assertNotNull(result)
5154 assertIs<Resident >(result)
You can’t perform that action at this time.
0 commit comments