Skip to content

Commit c69b436

Browse files
PotatoCraft-Studio#305 Fix wrong potionEffect level showing
1 parent d10441f commit c69b436

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/org/maxgamer/quickshop/shop/SimpleShopManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,9 @@ public void sendShopInfo(@NotNull Player p, @NotNull Shop shop) {
13561356
}
13571357
if (potionMeta.hasCustomEffects()) {
13581358
for (PotionEffect potionEffect : potionMeta.getCustomEffects()) {
1359-
int level = potionEffect.getAmplifier();
1359+
// https://hub.spigotmc.org/jira/browse/SPIGOT-1697
1360+
// Internal api notes: amplifier starts from zero, so plus one to get the correct result
1361+
int level = potionEffect.getAmplifier() + 1;
13601362
chatSheetPrinter.printLine(ChatColor.YELLOW + MsgUtil.getPotioni18n(potionEffect.getType()) + " " + (level <= 10 ? RomanNumber.toRoman(potionEffect.getAmplifier()) : level));
13611363
}
13621364
}

src/main/java/org/maxgamer/quickshop/util/Util.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ public static String getItemCustomName(@NotNull ItemStack itemStack) {
552552
} else if (potionMeta.hasCustomEffects()) {
553553
PotionEffect potionEffect = potionMeta.getCustomEffects().get(0);
554554
if (potionEffect != null) {
555-
int level = potionEffect.getAmplifier();
555+
// https://hub.spigotmc.org/jira/browse/SPIGOT-1697
556+
// Internal api notes: amplifier starts from zero, so plus one to get the correct result
557+
int level = potionEffect.getAmplifier() + 1;
556558
return MsgUtil.getPotioni18n(potionEffect.getType()) + " " + (level <= 10 ? RomanNumber.toRoman(potionEffect.getAmplifier()) : level);
557559
}
558560
}

0 commit comments

Comments
 (0)