Skip to content

Commit eed7d2e

Browse files
committed
fix: drop multiplier calculation
1 parent e6d7594 commit eed7d2e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.github.Mori01231</groupId>
88
<artifactId>MMLuck</artifactId>
9-
<version>1.7.0+1.15.2</version>
9+
<version>1.7.1+1.15.2</version>
1010
<packaging>jar</packaging>
1111

1212
<name>MMLuck</name>
@@ -61,7 +61,7 @@
6161
<repositories>
6262
<repository>
6363
<id>papermc-repo</id>
64-
<url>https://papermc.io/repo/repository/maven-public/</url>
64+
<url>https://repo.papermc.io/repository/maven-public/</url>
6565
</repository>
6666
<repository>
6767
<id>sonatype</id>

src/main/java/com/github/mori01231/mmluck/GiveCommandExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
9292
Rarity minimumRareMessageRarity = RarityAPIProvider.get().getRarityById(args.length == 4 ? "rare" : args[4]);
9393

9494
// Calculate the odds the player will be getting the item
95-
BigDecimal luckNumberD = new BigDecimal(luckNumber);
96-
BigDecimal boostMultiD = new BigDecimal(boostMulti);
95+
BigDecimal luckNumberD = BigDecimal.valueOf(luckNumber);
96+
BigDecimal boostMultiD = BigDecimal.valueOf(boostMulti);
9797
double giveMultiplier = (100 + luckNumber) * boostMulti / 100; // multiplier in 0-100%
9898
// If the random number is lower than the chance of getting item, give item.
9999
boolean doDrop;
100100
try {
101-
BigDecimal giveMultiplierD = luckNumberD.add(new BigDecimal(100)).multiply(boostMultiD).divide(new BigDecimal(100), RoundingMode.HALF_EVEN);
101+
BigDecimal giveMultiplierD = luckNumberD.add(new BigDecimal(100)).multiply(boostMultiD).movePointLeft(2);
102102
BigDecimal giveOdds = giveMultiplierD.multiply(BigDecimal.valueOf(mmItemChance)); // odds in 0-100%
103103
String formattedValue = giveOdds.multiply(new BigDecimal(100)).stripTrailingZeros().toPlainString();
104104
String japanese = toFriendlyString(new BigDecimal(1).divide(giveOdds, RoundingMode.HALF_EVEN).toBigInteger()) + "分の1";

0 commit comments

Comments
 (0)