Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 0930a02

Browse files
committed
fix enchant level being incorrect
1 parent 583cd86 commit 0930a02

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>me.puyodead1</groupId>
77
<artifactId>RPBookGUI</artifactId>
8-
<version>2.9.9-RC2</version>
8+
<version>2.9.10</version>
99
<name>RPBookGUI</name>
1010

1111
<repositories>

src/main/java/io/github/puyodead1/rpbookgui/Inventories.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static Inventory settingsInventory() {
125125
* @param ce
126126
* @return inventory
127127
*/
128-
public static Inventory successAndDestroyInventory(CustomEnchant ce) {
128+
public static Inventory successAndDestroyInventory(CustomEnchant ce, int level) {
129129
Inventory inv = Bukkit.createInventory(null, 45,
130130
"Success & Destroy Configuration");
131131
// slot 10-12 - increase success
@@ -196,8 +196,7 @@ public static Inventory successAndDestroyInventory(CustomEnchant ce) {
196196

197197
inv.setItem(22,
198198
CustomEnchants.getCustomEnchants()
199-
.getRevealedItem(ce, EnchantConstructor.getEnchants()
200-
.get(ce.getIdentifier()).getEnchantLevel(), 0,
199+
.getRevealedItem(ce, level, 0,
201200
0, true, true));
202201

203202
inv.setItem(28, rs1);

src/main/java/io/github/puyodead1/rpbookgui/events/EnchantInventoryClick.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import io.github.puyodead1.rpbookgui.utils.UMaterial;
44
import me.randomhashtags.randompackage.RandomPackageAPI;
5+
import me.randomhashtags.randompackage.addon.CustomEnchant;
6+
import me.randomhashtags.randompackage.api.CustomEnchants;
7+
import org.bukkit.Bukkit;
58
import org.bukkit.Material;
69
import org.bukkit.entity.Player;
710
import org.bukkit.event.EventHandler;
@@ -34,15 +37,15 @@ public void clickEvent(InventoryClickEvent e) {
3437

3538
if (item.getType()
3639
.equals(UMaterial.match("BOOK").getMaterial())) {
37-
// Note: there was the old enchant constructor removal here,
38-
// but
39-
// doesnt seem needed as there is only one enchant now
4040
if (RPBookGUI.getPlugin.getConfig().getBoolean(
4141
"settings.use success destroy configuration")) {
4242
player.getOpenInventory().close();
43+
final CustomEnchant ce = RandomPackageAPI.INSTANCE.valueOfCustomEnchant(item);
44+
final int level = CustomEnchants.getCustomEnchants().getEnchantmentLevel(item.getItemMeta().getDisplayName());
4345
player.openInventory(
4446
Inventories.successAndDestroyInventory(
45-
RandomPackageAPI.INSTANCE.valueOfCustomEnchant(item)));
47+
ce, level));
48+
4649
} else {
4750
player.getInventory().addItem(item);
4851
if (!RPBookGUI.getPlugin.getConfig()

0 commit comments

Comments
 (0)