Ensure boss bar progress between 0 and 1

This commit is contained in:
fullwall 2023-02-18 01:23:42 +08:00
parent 5bc6b07f4a
commit c31624fba3

View File

@ -147,7 +147,7 @@ public class BossBarTrait extends Trait {
if (number >= 1 && number <= 100) { if (number >= 1 && number <= 100) {
number /= 100.0; number /= 100.0;
} }
bar.setProgress(number); bar.setProgress(Math.min(0, Math.max(1, number)));
} }
} }
bar.setTitle(title); bar.setTitle(title);