Comments (8)
That's correct, it doesn't need to check if it is lower than 9999.
But if the speed is below 0, it should be just ignored because everything below 0 is a static line which does not need to be updated and therefore the tablist would update each tick unnecessarily if the interval is set to 1.
from powerboard.
Sadly there seems to be no easy fix for this.
One way to reduce the unnecessary calls would be to split header and footer updates.
A better solution might be to cache the lines with the text already replaced with placeholders so it only needs to update/replace the placeholders that are actually needed.
from powerboard.
The speed can be -1 and Math.min would return -1 which goes into the scheduler, and according to spigot documentation/source code, a scheduler with interval -1 would run once which is why the bug happening, and the refreshing doesn't work.
One simple way to fix it:
if (speed >= 0 && speed < 9999) { interval = Math.min(interval, speed); }
from powerboard.
Thanks @NicoNekoDev
This will not exactly fix the problem which is described in this issue (You probably didn't understand it correctly) but it will actually fix another problem that I didn't even think about.
from powerboard.
Okay, I was wrong. The actual fix it would be to set the interval to 1 if is lower than 1. Yeah, it fixes the refreshes not working on tablist.
from powerboard.
The actual fix it would be to set the interval to 1 if is lower than 1
No, the code that you've poseted is correct, because -1 is meant to disabling refreshing for that line
tablist.yml description:
If you have static scores (no animations or updates needed): Set the 'speed' value to '-1' or '9999'. Then the scheduler won't start to save performance.
from powerboard.
Yes, my code is correct, but after a bit of review, I came to conclusion that doing if (speed < 1) interval = 1 because:
- it doesn't go higher than the set interval (20 * 60)
- it only requires to not go bellow 1, not below or equal to 0
from powerboard.
However, I have changed the code and just made the startXXAnimation functions a boolean which returns if the scheduler has been started or not (It does not start, if the speed is below 0 or higher than 9999). If it has started it executes Math.min, otherwise it does not.
051bb83
from powerboard.
Related Issues (20)
- Xp placeholder HOT 1
- a lot of small issues HOT 5
- [Planned] Accept negative weight value from -1 to -99 HOT 1
- IllegalArgumentException: A team with the name '998team-68' already exists! HOT 2
- ConcurrentModificationException
- %player_ping% always is 0 HOT 7
- NegativeArraySizeException: -1
- ArrayIndexOutOfBoundsException: Index -1 HOT 5
- Does it require Vault for prefixes and/or chat? HOT 1
- pex question HOT 3
- [Issue] %player_rank% does not update itself
- [Suggestion] Prefix does not update in the tab HOT 3
- Error: "Could not find 'defaultsc' scoreboard" HOT 1
- Player Suffix not updating properly HOT 1
- How to turn off prompts to update player information in the background HOT 1
- repo? HOT 2
- How to turn off prompts to update player information in the background HOT 9
- Money placeholder HOT 4
- The plugin reports errors in the console every once in a while. HOT 2
- Getting kicked from the server sometimes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powerboard.