Skip to content

Commit 9a7db38

Browse files
committed
fixed: remove unnecessary
1 parent 9ec5857 commit 9a7db38

57 files changed

Lines changed: 3112 additions & 1107 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/src/main/java/top/katton/platform/ClientApiHooks.java

Lines changed: 0 additions & 292 deletions
This file was deleted.

common/src/main/kotlin/top/katton/api/KattonAPI.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import top.katton.Katton
88
import top.katton.util.Event
99
import java.util.concurrent.ConcurrentHashMap
1010

11-
1211
internal val LOGGER = LogUtils.getLogger()
1312

1413
private val onceRegistry = ConcurrentHashMap<String, MutableSet<String>>()
@@ -23,6 +22,8 @@ private fun onceNamespace(namespace: String?): String {
2322
/**
2423
* Execute [block] only once for a given [key] under the current script owner namespace.
2524
*
25+
* When script is reloaded, the markers won't be cleared, so the block won't execute again until the marker is reset with [resetOnce] or [clearOnce].
26+
*
2627
* When called inside a script execution, the default namespace is that script's owner id;
2728
* outside script execution, the default namespace is "global".
2829
*
@@ -66,11 +67,25 @@ fun clearOnce(namespace: String? = null) {
6667

6768
/**
6869
* Current minecraft server instance. Maybe null during client-side execution.
70+
*
71+
* Use this property when you need optional access to the server.
72+
* For cases where the server must be available, use [requireServer] instead.
73+
*
74+
* @return The current MinecraftServer instance, or null if not available
6975
*/
7076
val server: MinecraftServer?
7177
get() = Katton.server
7278

73-
79+
/**
80+
* Requires the Minecraft server instance to be available.
81+
*
82+
* Use this function when the server must be present for the operation to succeed.
83+
* Throws an error if the server is not available (e.g., during client-side execution
84+
* or before the server has started).
85+
*
86+
* @return The current MinecraftServer instance
87+
* @throws IllegalStateException if the server is not available
88+
*/
7489
fun requireServer(): MinecraftServer =
7590
server ?: error("MinecraftServer is not available (client-side or not started)")
7691

0 commit comments

Comments
 (0)