Skip to content

Commit

Permalink
✏️ rename mod to Exposer
Browse files Browse the repository at this point in the history
  • Loading branch information
asoji committed Oct 13, 2024
1 parent 34675f2 commit b1620b8
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 67 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Fabric Nautical Template
Team Nautical's take on the Fabric Example Mod but Kotlin
# Exposer
A web server mod that exposes basic player and server stats
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ group = project.property("maven_group")!!
*/

val fatJar = tasks.register<ShadowJar>("fatJar") {
group = "exposeplayers"
group = "exposer"
description = "Builds a fat JAR with all dependencies shaded in"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations = listOf(shade)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ org.gradle.parallel=true
# Mod Properties
mod_version=0.1.0
maven_group=one.devos.nautical
archives_base_name=exposeplayers
archives_base_name=exposer

# Dependencies are handled in ./gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package one.devos.nautical.exposeplayers.mixin;
package one.devos.nautical.exposer.mixin;

import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.advancements.AdvancementProgress;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package one.devos.nautical.exposeplayers.mixin;
package one.devos.nautical.exposer.mixin;

import net.minecraft.server.players.PlayerList;
import net.minecraft.stats.ServerStatsCounter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package one.devos.nautical.exposeplayers
package one.devos.nautical.exposer

import gay.asoji.fmw.FMW
import io.ktor.server.application.*
Expand All @@ -7,13 +7,13 @@ import io.ktor.server.netty.*
import io.ktor.server.routing.*
import net.fabricmc.api.ModInitializer
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents
import one.devos.nautical.exposeplayers.plugins.configureRouting
import one.devos.nautical.exposeplayers.plugins.configureSerialization
import one.devos.nautical.exposer.plugins.configureRouting
import one.devos.nautical.exposer.plugins.configureSerialization
import org.slf4j.Logger
import org.slf4j.LoggerFactory

object ExposePlayers : ModInitializer {
val MOD_ID: String = "exposeplayers"
object Exposer : ModInitializer {
val MOD_ID: String = "exposer"
val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID)
val MOD_NAME: String = FMW.getName(MOD_ID)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package one.devos.nautical.exposeplayers.plugins
package one.devos.nautical.exposer.plugins

import io.ktor.http.*
import io.ktor.server.application.*
Expand All @@ -12,9 +12,9 @@ import net.minecraft.server.MinecraftServer
import net.minecraft.stats.StatType
import net.minecraft.stats.Stats
import net.minecraft.world.item.Item
import one.devos.nautical.exposeplayers.mixin.PlayerAdvancementsMixin
import one.devos.nautical.exposeplayers.utils.UUIDSerializer
import one.devos.nautical.exposeplayers.utils.getPlayerStatsByUuid
import one.devos.nautical.exposer.mixin.PlayerAdvancementsMixin
import one.devos.nautical.exposer.utils.UUIDSerializer
import one.devos.nautical.exposer.utils.getPlayerStatsByUuid
import java.util.UUID

private val ITEM_STATS = listOf(
Expand All @@ -32,7 +32,11 @@ private val BLOCK_STATS = listOf(
fun Application.configureRouting(server: MinecraftServer) {
routing {
get {
call.respondText("Howdy! If you somehow got here, that's because ExposePlayers is installed and is getting stats of every player on the server to be used. Nothing malicious, just letting you know! c:")
call.respondText("Howdy! If you somehow got here, that's because Exposer is installed and is getting stats of every player on the server to be used. Nothing malicious, just letting you know! c:")
}

get("/server") {

}

get("/players") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package one.devos.nautical.exposeplayers.plugins
package one.devos.nautical.exposer.plugins

import io.ktor.serialization.gson.*
import io.ktor.server.application.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package one.devos.nautical.exposeplayers.utils
package one.devos.nautical.exposer.utils

import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package one.devos.nautical.exposeplayers.utils
package one.devos.nautical.exposer.utils

import net.minecraft.FileUtil
import net.minecraft.server.players.PlayerList
import net.minecraft.stats.ServerStatsCounter
import net.minecraft.world.level.storage.LevelResource
import one.devos.nautical.exposeplayers.mixin.PlayerListMixin
import one.devos.nautical.exposer.mixin.PlayerListMixin
import java.io.File
import java.util.UUID

Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"required": true,
"package": "one.devos.nautical.exposeplayers.mixin",
"package": "one.devos.nautical.exposer.mixin",
"compatibilityLevel": "JAVA_21",
"mixins": [
"PlayerAdvancementsMixin",
Expand Down
14 changes: 8 additions & 6 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"schemaVersion": 1,
"id": "exposeplayers",
"id": "exposer",
"version": "${version}",
"name": "ExposePlayers",
"name": "Exposer",
"description": "A web server mod that exposes basic player stats",
"authors": [
"devOS: Sanity Edition",
"Team Nautical"
],
"contributors": [
"asojidev"
"asojidev",
"Deftu",
"BluSpring"
],
"contact": {
"homepage": "https://devos.one/",
"sources": "https://github.com/devOS-Sanity-Edition/ExposePlayers"
"sources": "https://github.com/devOS-Sanity-Edition/Exposer"
},
"license": "MIT",
"icon": "assets/template/icon.png",
Expand All @@ -22,12 +24,12 @@
"main": [
{
"adapter": "kotlin",
"value": "one.devos.nautical.exposeplayers.ExposePlayers"
"value": "Exposer"
}
]
},
"mixins": [
"exposeplayers.mixins.json"
"exposer.mixins.json"
],
"depends": {
"fabricloader": ">=0.16.5",
Expand Down
153 changes: 113 additions & 40 deletions src/main/resources/openapi/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ paths:
type: "string"
examples:
Example#1:
value: "Hello world!"
/player/health/{player_name}:
value: "Howdy! If you somehow got here, that's because Exposer is\
\ installed and is getting stats of every player on the server\
\ to be used. Nothing malicious, just letting you know! c:"
/player/{player_name}/advancements:
get:
description: ""
parameters:
Expand All @@ -46,23 +48,8 @@ paths:
content:
'*/*':
schema:
$ref: "#/components/schemas/PlayerHealth"
examples:
Example#1:
description: ""
value:
health: "null"
saturation: "null"
hunger: "null"
exhaustion: "null"
airSupply: "null"
armor: "null"
armorPercentage: "null"
maxHealth: "null"
maxAirSupply: "null"
maxArmor: 20.0
maxAbsorption: "null"
/player/stats/{player_name}:
$ref: "#/components/schemas/Map_String"
/player/{player_name}/stats:
get:
description: ""
parameters:
Expand Down Expand Up @@ -90,6 +77,47 @@ paths:
Example#1:
description: ""
value: []
/player/{player_name}/status:
get:
description: ""
parameters:
- name: "player_name"
in: "path"
required: true
schema:
type: "string"
responses:
"400":
description: "Bad Request"
content:
'*/*':
schema:
type: "object"
"404":
description: "Not Found"
content:
'*/*':
schema:
type: "object"
"200":
description: "OK"
content:
'*/*':
schema:
$ref: "#/components/schemas/PlayerStatus"
examples:
Example#1:
description: ""
value:
health: "null"
absorption: "null"
armor:
value: "null"
percentage: "null"
max: 20.0
absorption: "null"
food: "null"
air: "null"
/players:
get:
description: ""
Expand All @@ -99,48 +127,93 @@ paths:
content:
'*/*':
schema:
$ref: "#/components/schemas/PlayersEndpointResponse"
$ref: "#/components/schemas/Players"
/server:
get:
description: ""
components:
schemas:
Map:
type: "object"
properties: {}
Map_String:
type: "string"
PlayerStatistic:
type: "object"
properties: {}
PlayerHealth:
type: "object"
properties:
health:
current:
type: "number"
format: "float"
saturation:
max:
type: "number"
format: "float"
hunger:
type: "integer"
format: "int32"
exhaustion:
PlayerAbsorption:
type: "object"
properties:
current:
type: "number"
format: "float"
airSupply:
type: "integer"
format: "int32"
armor:
max:
type: "number"
format: "float"
PlayerArmor:
type: "object"
properties:
value:
type: "integer"
format: "int32"
armorPercentage:
percentage:
type: "number"
format: "float"
maxHealth:
max:
type: "number"
format: "float"
maxAirSupply:
type: "integer"
format: "int32"
maxArmor:
absorption:
type: "number"
format: "float"
maxAbsorption:
PlayerFood:
type: "object"
properties:
exhaustion:
type: "number"
format: "float"
PlayerStatistic:
saturation:
type: "number"
format: "float"
level:
type: "integer"
format: "int32"
PlayerAir:
type: "object"
properties: {}
properties:
current:
type: "integer"
format: "int32"
max:
type: "integer"
format: "int32"
PlayerStatus:
type: "object"
properties:
health:
$ref: "#/components/schemas/PlayerHealth"
absorption:
$ref: "#/components/schemas/PlayerAbsorption"
armor:
$ref: "#/components/schemas/PlayerArmor"
food:
$ref: "#/components/schemas/PlayerFood"
air:
$ref: "#/components/schemas/PlayerAir"
required:
- "health"
- "absorption"
- "armor"
- "food"
- "air"
PlayerInfo:
type: "object"
properties:
Expand All @@ -152,7 +225,7 @@ components:
required:
- "uuid"
- "name"
PlayersEndpointResponse:
Players:
type: "object"
properties:
count:
Expand Down

0 comments on commit b1620b8

Please sign in to comment.