Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit f56803d

Browse files
committed
fix MethodNotFound crash
- thanks java 8
1 parent 0b3a07b commit f56803d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

common/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayerStats.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ public static BedwarsPlayerStats generateFake(String name) {
7878
int star = (int) getGaussian(random, 150, 30);
7979
double fkdr = Math.min(getGaussian(random, 1.3F, 0.5F), 0.6F);
8080
double bblr = (fkdr * 8) / getGaussian(random, 10, 2);
81-
int wins = (int) (star * (fkdr * 4) * random.nextFloat(0.95F, 1.05F));
82-
int losses = (int) (wins * (2/fkdr) * random.nextFloat(0.95F, 1.05F));
81+
int wins = (int) (star * (fkdr * 4) * getFloat(random, 0.95F, 1.05F));
82+
int losses = (int) (wins * (2/fkdr) * getFloat(random, 0.95F, 1.05F));
8383
int beds = (int) (bblr * losses);
84-
int finalDeaths = (int) (losses * random.nextFloat(1F, 1.03F));
85-
int deaths = (int) (finalDeaths * random.nextFloat(8, 20));
84+
int finalDeaths = (int) (losses * getFloat(random, 1F, 1.03F));
85+
int deaths = (int) (finalDeaths * getFloat(random, 8, 20));
8686
int finalKills = (int) (deaths * fkdr);
87-
int kills = (int) (finalKills * random.nextFloat(1, 2));
87+
int kills = (int) (finalKills * getFloat(random, 1, 2));
8888

8989
return new BedwarsPlayerStats(finalKills, finalDeaths, beds, deaths, kills,
9090
0, 0, 0, 0, 0,
@@ -95,6 +95,10 @@ private static double getGaussian(Random random, float mean, float deviation){
9595
return Math.max(Math.min(random.nextGaussian()*deviation+mean, mean - deviation*3), mean + deviation*3);
9696
}
9797

98+
private static float getFloat(Random random, float origin, float bound){
99+
return random.nextFloat()*(bound - origin)+origin;
100+
}
101+
98102
@Nullable
99103
public static BedwarsPlayerStats fromAPI(String uuid) {
100104
JsonElement rawStats = HypixelAbstractionLayer.getPlayerProperty(uuid, "stats");

0 commit comments

Comments
 (0)