forked from Wurst-Imperium/Wurst7
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into murder-mystery
- Loading branch information
Showing
13 changed files
with
88 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,4 +246,4 @@ eval "set -- $( | |
tr '\n' ' ' | ||
)" '"$@"' | ||
|
||
exec "$JAVACMD" "$@" | ||
exec "$JAVACMD" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/net/wurstclient/settings/RoundingPrecisionSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2014-2024 Wurst-Imperium and contributors. | ||
* | ||
* This source code is subject to the terms of the GNU General Public | ||
* License, version 3. If a copy of the GPL was not distributed with this | ||
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt | ||
*/ | ||
package net.wurstclient.settings; | ||
|
||
import java.text.DecimalFormat; | ||
import java.text.DecimalFormatSymbols; | ||
import java.util.Locale; | ||
|
||
public final class RoundingPrecisionSetting extends SliderSetting | ||
{ | ||
private static final DecimalFormatSymbols SYMBOLS = | ||
new DecimalFormatSymbols(Locale.ENGLISH); | ||
|
||
private final DecimalFormat[] FORMATS; | ||
|
||
public RoundingPrecisionSetting(String name, String description, int value, | ||
int min, int max) | ||
{ | ||
super(name, description, value, min, max, 1, | ||
ValueDisplay.ROUNDING_PRECISION); | ||
|
||
if(min < 0) | ||
throw new IllegalArgumentException( | ||
"min must be greater than or equal to 0"); | ||
|
||
FORMATS = new DecimalFormat[max + 1]; | ||
} | ||
|
||
public DecimalFormat getFormat() | ||
{ | ||
int value = getValueI(); | ||
|
||
if(FORMATS[value] == null) | ||
{ | ||
String pattern = "0"; | ||
if(value > 0) | ||
pattern += "." + "#".repeat(value); | ||
|
||
FORMATS[value] = new DecimalFormat(pattern, SYMBOLS); | ||
} | ||
|
||
return FORMATS[value]; | ||
} | ||
|
||
public String format(double value) | ||
{ | ||
return getFormat().format(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters