Skip to content

Commit

Permalink
refactor: slight compressNumber refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Jan 19, 2024
1 parent 247fc68 commit fec29dd
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package net.william278.velocitab.sorting;

import com.google.common.collect.Lists;
import net.william278.velocitab.Velocitab;
import net.william278.velocitab.config.Placeholder;
import net.william278.velocitab.player.TabPlayer;
Expand Down Expand Up @@ -89,13 +90,11 @@ private String adaptValue(@NotNull String value) {
public String compressNumber(double number) {
int wholePart = (int) number;
final char decimalChar = (char) ((number - wholePart) * Character.MAX_VALUE);
final List<Character> charList = new ArrayList<>();
final List<Character> charList = Lists.newArrayList();

while (wholePart > 0) {
char digit = (char) (wholePart % Character.MAX_VALUE);

charList.add(0, digit);

wholePart /= Character.MAX_VALUE;
}

Expand Down

0 comments on commit fec29dd

Please sign in to comment.