You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add permission check to view distance notifications (#5) (#6)
* feat: add permission check to view distance notifications
* feat: split notification permission into increase and decrease
* feat: add config option "ViewRadius.RequireNotifyPermission" and only limit view distance notifications based on permission filter if it's true
|`DecreaseFactor`| double |`0.75`| Factor to multiply current view radius when decreasing |
70
+
|`IncreaseValue`| integer |`1`| Amount to increase view radius when recovering |
71
+
|`InitialDelaySeconds`| integer |`30`| Delay before view radius adjustment starts |
72
+
|`CheckIntervalSeconds`| integer |`5`| How often to check resource pressure |
73
+
|`RecoveryWaitTimeSeconds`| integer |`60`| Time to wait before attempting to increase view radius |
74
+
|`RequireNotifyPermission`| boolean |`false`| Only send view distance update notifications to players with the permissions `nitrado.performance_saver.notify.increase` or `nitrado.performance_saver.notify.decrease`|
74
75
75
76
##### GC Monitor (`ViewRadius.GcMonitor`)
76
77
Monitors JVM garbage collection to detect memory pressure.
if (currentViewRadius == this.initialViewRadius) {
116
-
Universe.get().sendMessage(Message.raw("Memory pressure can be caused by fast exploration and similar activities. View radius will recover over time if memory usage allows."));
124
+
if (this.config.getViewRadiusConfig().isRequireNotifyPermission()) {
.forEach(playerRef -> playerRef.sendMessage(Message.raw("Memory pressure can be caused by fast exploration and similar activities. View radius will recover over time if memory usage allows.")));
128
+
} else {
129
+
Universe.get().getPlayers().forEach(playerRef -> playerRef.sendMessage(Message.raw("Memory pressure can be caused by fast exploration and similar activities. View radius will recover over time if memory usage allows.")));
if (currentViewRadius == this.initialViewRadius) {
128
-
Universe.get().sendMessage(Message.raw("Low TPS can be caused by chunk generation and large amounts of active NPCs. View radius will recover when load decreases."));
148
+
if (this.config.getViewRadiusConfig().isRequireNotifyPermission()) {
.forEach(playerRef -> playerRef.sendMessage(Message.raw("Low TPS can be caused by chunk generation and large amounts of active NPCs. View radius will recover when load decreases.")));
152
+
} else {
153
+
Universe.get().getPlayers().forEach(playerRef -> playerRef.sendMessage(Message.raw("Low TPS can be caused by chunk generation and large amounts of active NPCs. View radius will recover when load decreases.")));
0 commit comments