Skip to content

Commit d8f241a

Browse files
committed
Add getUpdateInterval command
1 parent 297170c commit d8f241a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bukkit/version/v1_17_1/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/v1_17_1/EntityUpdateIntervalImpl.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package io.github.rothes.esu.bukkit.module.networkthrottle.v1_17_1
22

33
import io.github.rothes.esu.bukkit.module.networkthrottle.EntityUpdateInterval
4+
import io.github.rothes.esu.core.command.annotation.ShortPerm
45
import io.github.rothes.esu.core.configuration.meta.Comment
56
import io.github.rothes.esu.core.module.configuration.BaseFeatureConfiguration
7+
import io.github.rothes.esu.core.user.User
68
import io.github.rothes.esu.core.util.UnsafeUtils.usIntAccessor
79
import net.minecraft.server.level.ServerEntity
810
import net.minecraft.world.entity.EntityType
11+
import org.incendo.cloud.annotations.Command
912

1013
class EntityUpdateIntervalImpl: EntityUpdateInterval<EntityUpdateIntervalImpl.FeatureConfig, Unit>() {
1114

@@ -23,6 +26,15 @@ class EntityUpdateIntervalImpl: EntityUpdateInterval<EntityUpdateIntervalImpl.Fe
2326

2427
override fun onEnable() {
2528
applyUpdateInterval()
29+
30+
registerCommands(object {
31+
@Command("esu networkThrottle entityUpdateInterval entityType <entityType>")
32+
@ShortPerm
33+
fun getUpdateInterval(sender: User, entityType: EntityType<*>) {
34+
val interval = entityTypeAccessor[entityType]
35+
sender.miniMessage("<pc>Current update interval of entity type <pdc>${entityType.toShortString()}</pdc> is <pdc>$interval")
36+
}
37+
})
2638
}
2739

2840
private fun applyUpdateInterval() {

0 commit comments

Comments
 (0)