Compare commits

..

2 Commits

Author SHA1 Message Date
Auxilor
c1ed771eb3 Updated to 6.61.1 2023-05-22 13:22:03 +01:00
Auxilor
08a4d9d6b1 Changed playerflow to use local server ID 2023-05-22 01:35:23 +01:00
4 changed files with 25 additions and 3 deletions

View File

@@ -17,6 +17,14 @@ public interface ServerProfile extends Profile {
@NotNull
String getServerID();
/**
* Get the local server ID.
*
* @return The local server ID.
*/
@NotNull
String getLocalServerID();
/**
* Load the server profile.
*

View File

@@ -72,6 +72,12 @@ private val serverIDKey = PersistentDataKey(
""
)
private val localServerIDKey = PersistentDataKey(
namespacedKeyOf("eco", "local_server_id"),
PersistentDataKeyType.STRING,
""
)
class EcoServerProfile(
data: MutableMap<PersistentDataKey<*>, Any>,
handler: DataHandler,
@@ -85,10 +91,18 @@ class EcoServerProfile(
return this.read(serverIDKey)
}
override fun getLocalServerID(): String {
if (this.read(localServerIDKey).isBlank()) {
this.write(localServerIDKey, UUID.randomUUID().toString())
}
return this.read(localServerIDKey)
}
override fun toString(): String {
return "EcoServerProfile"
}
}
private val PersistentDataKey<*>.isLocal: Boolean
get() = EcoPlugin.getPlugin(this.key.namespace)?.isUsingLocalStorage == true
get() = this == localServerIDKey || EcoPlugin.getPlugin(this.key.namespace)?.isUsingLocalStorage == true

View File

@@ -25,7 +25,7 @@ class PlayerflowHandler(
private fun makeRequest() {
val body = json {
"uuid" to ServerProfile.load().serverID
"uuid" to ServerProfile.load().localServerID
"players" to Bukkit.getOnlinePlayers().size
"plugins" to Eco.get().loadedPlugins
}.toPlaintext()

View File

@@ -1,3 +1,3 @@
version = 6.61.0
version = 6.61.1
plugin-name = eco
kotlin.code.style = official