set minimal update rate (#52)

This commit is contained in:
ironboundred 2023-05-01 14:50:59 -05:00 committed by GitHub
parent c5b09590c7
commit 3c1a980e25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -111,7 +111,8 @@ public class Settings {
@Getter
@YamlKey("update_rate")
@YamlComment("How often in milliseconds to periodically update the TAB list, including header and footer, for all users.\n" +
"If set to 0, TAB will be updated on player join/leave instead. (1s = 1000ms)")
"If set to 0, TAB will be updated on player join/leave instead. (1s = 1000ms)\n" +
"The minimal update rate is 200ms, anything lower will automatically be set to 200ms.")
private int updateRate = 0;
public Settings(@NotNull Velocitab plugin) {

View File

@ -224,7 +224,7 @@ public class PlayerTabList {
player.sendHeaderAndFooter(this);
});
})
.repeat(updateRate, TimeUnit.MILLISECONDS)
.repeat(Math.max(200, updateRate), TimeUnit.MILLISECONDS)
.schedule();
}