18
18
import io .github .puyodead1 .rpbookgui .ItemStacks ;
19
19
import io .github .puyodead1 .rpbookgui .RPBookGUI ;
20
20
import io .github .puyodead1 .rpbookgui .Utils .RPBookGUIUtils ;
21
+ import io .github .puyodead1 .rpbookgui .Utils .UMaterial ;
21
22
import me .randomhashtags .randompackage .RandomPackageAPI ;
22
- import me .randomhashtags .randompackage .addons .CustomEnchant ;
23
- import me .randomhashtags .randompackage .addons .EnchantRarity ;
24
- import me .randomhashtags .randompackage .utils . universal . UMaterial ;
23
+ import me .randomhashtags .randompackage .addon .CustomEnchant ;
24
+ import me .randomhashtags .randompackage .addon .EnchantRarity ;
25
+ import me .randomhashtags .randompackage .util . RPStorage ;
25
26
26
27
public class InventoryClick implements Listener {
27
28
28
- private static RandomPackageAPI rpapi = new RandomPackageAPI ();
29
-
30
29
@ EventHandler
31
30
public void InventoryClickEvent (InventoryClickEvent e ) {
32
31
if (!e .isCancelled () && e .getCurrentItem () != null && !e .getCurrentItem ().getType ().equals (Material .AIR )
@@ -109,7 +108,7 @@ public void InventoryClickEvent(InventoryClickEvent e) {
109
108
player .openInventory (Inventories .MainGUI ());
110
109
}
111
110
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
112
- CustomEnchant ce = rpapi .valueOfCustomEnchant (
111
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (
113
112
ChatColor .stripColor (e .getCurrentItem ().getItemMeta ().getDisplayName ()));
114
113
player .closeInventory ();
115
114
player .openInventory (Inventories .Enchant (ce ));
@@ -127,7 +126,7 @@ public void InventoryClickEvent(InventoryClickEvent e) {
127
126
player .openInventory (Inventories .MainGUI ());
128
127
}
129
128
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
130
- CustomEnchant ce = rpapi .valueOfCustomEnchant (
129
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (
131
130
ChatColor .stripColor (e .getCurrentItem ().getItemMeta ().getDisplayName ()));
132
131
player .closeInventory ();
133
132
player .openInventory (Inventories .Enchant (ce ));
@@ -144,7 +143,7 @@ public void InventoryClickEvent(InventoryClickEvent e) {
144
143
player .openInventory (Inventories .MainGUI ());
145
144
}
146
145
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
147
- CustomEnchant ce = rpapi .valueOfCustomEnchant (
146
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (
148
147
ChatColor .stripColor (e .getCurrentItem ().getItemMeta ().getDisplayName ()));
149
148
player .closeInventory ();
150
149
player .openInventory (Inventories .Enchant (ce ));
@@ -162,7 +161,7 @@ public void InventoryClickEvent(InventoryClickEvent e) {
162
161
player .openInventory (Inventories .MainGUI ());
163
162
}
164
163
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
165
- CustomEnchant ce = rpapi .valueOfCustomEnchant (
164
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (
166
165
ChatColor .stripColor (e .getCurrentItem ().getItemMeta ().getDisplayName ()));
167
166
player .closeInventory ();
168
167
player .openInventory (Inventories .Enchant (ce ));
@@ -179,7 +178,7 @@ public void InventoryClickEvent(InventoryClickEvent e) {
179
178
player .openInventory (Inventories .MainGUI ());
180
179
}
181
180
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
182
- CustomEnchant ce = rpapi .valueOfCustomEnchant (
181
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (
183
182
ChatColor .stripColor (e .getCurrentItem ().getItemMeta ().getDisplayName ()));
184
183
player .closeInventory ();
185
184
player .openInventory (Inventories .Enchant (ce ));
@@ -197,7 +196,7 @@ public void InventoryClickEvent(InventoryClickEvent e) {
197
196
player .openInventory (Inventories .MainGUI ());
198
197
}
199
198
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
200
- CustomEnchant ce = rpapi .valueOfCustomEnchant (
199
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (
201
200
ChatColor .stripColor (e .getCurrentItem ().getItemMeta ().getDisplayName ()));
202
201
player .closeInventory ();
203
202
player .openInventory (Inventories .Enchant (ce ));
@@ -214,8 +213,8 @@ public void InventoryClickEvent(InventoryClickEvent e) {
214
213
player .openInventory (Inventories .MainGUI ());
215
214
}
216
215
if (e .getCurrentItem ().getType ().equals (UMaterial .match ("BOOK" ).getMaterial ())) {
217
- CustomEnchant ce = rpapi . valueOfCustomEnchant (
218
- ChatColor . stripColor ( e . getCurrentItem (). getItemMeta (). getDisplayName ()));
216
+ RPBookGUIUtils . SendDebugMessge ( RPBookGUIUtils . FormatEnchantName ( e . getCurrentItem ()));
217
+ CustomEnchant ce = RPStorage . valueOfCustomEnchant ( RPBookGUIUtils . FormatEnchantName ( e . getCurrentItem ()));
219
218
player .closeInventory ();
220
219
player .openInventory (Inventories .Enchant (ce ));
221
220
}
@@ -224,14 +223,14 @@ public void InventoryClickEvent(InventoryClickEvent e) {
224
223
/*
225
224
* Enchant inv click
226
225
*/
227
- CustomEnchant enchant = rpapi .valueOfCustomEnchant (invTitle );
226
+ CustomEnchant enchant = RPStorage .valueOfCustomEnchant (invTitle );
228
227
if (enchant != null ) {
229
228
e .setCancelled (true );
230
229
if (e .getCurrentItem ().getItemMeta ().getDisplayName ()
231
230
.equals (ItemStacks .Back ().getItemMeta ().getDisplayName ())
232
231
&& e .getCurrentItem ().getType ().equals (ItemStacks .Back ().clone ().clone ().getType ())) {
233
232
player .closeInventory ();
234
- switch (rpapi .valueOfEnchantRarity (enchant ).getIdentifier ()) {
233
+ switch (RPStorage .valueOfEnchantRarity (enchant ).getIdentifier ()) {
235
234
case "SIMPLE" :
236
235
player .openInventory (Inventories .SimpleEnchants ());
237
236
break ;
@@ -260,8 +259,8 @@ public void InventoryClickEvent(InventoryClickEvent e) {
260
259
if (RPBookGUI .getPlugin .getConfig ().getBoolean ("settings.try to apply to item in hand" )
261
260
&& RPBookGUIUtils .isOnCorrectItem (enchant , player .getItemInHand ())) {
262
261
263
- CustomEnchant ce = rpapi .valueOfCustomEnchant (ci );
264
- EnchantRarity rarity = rpapi .valueOfEnchantRarity (ce );
262
+ CustomEnchant ce = RPStorage .valueOfCustomEnchant (ci );
263
+ EnchantRarity rarity = RPStorage .valueOfEnchantRarity (ce );
265
264
266
265
ItemStack o = player .getInventory ().getItemInMainHand ();
267
266
ItemMeta m = o .getItemMeta ();
@@ -290,19 +289,19 @@ public void InventoryClickEvent(InventoryClickEvent e) {
290
289
291
290
for (EnchantConstructor ec : EnchantConstructor .getEnchants ().values ()) {
292
291
if (ec .getRevealItem () != ci ) {
293
- Bukkit . broadcastMessage ("Removing EnchantConstructor: " + ec .getCustomEnchant ().getIdentifier () + " " + ec .getEnchantLevel ());
292
+ RPBookGUIUtils . SendDebugMessge ("Removing EnchantConstructor: " + ec .getCustomEnchant ().getIdentifier () + " " + ec .getEnchantLevel ());
294
293
EnchantConstructor .getEnchants ().remove (ec .getCustomEnchant ().getIdentifier ());
295
294
}
296
295
}
297
296
298
- player .closeInventory ();
299
- player .openInventory (Inventories .SuccessDestroySelection (ci ));
300
- // player.getInventory().addItem(ci);
301
- // if (!RPBookGUI.getPlugin.getConfig().getBoolean("settings.keep inventory open"))
302
- // player.closeInventory();
303
- // player.sendMessage(RPBookGUIUtils
304
- // .ChatColor(RPBookGUI.getPlugin.getConfig().getString("messages.added book")
305
- // .replace("{NAME}", ci.getItemMeta().getDisplayName())));
297
+ // player.closeInventory();
298
+ // player.openInventory(Inventories.SuccessDestroySelection(ci));
299
+ player .getInventory ().addItem (ci );
300
+ if (!RPBookGUI .getPlugin .getConfig ().getBoolean ("settings.keep inventory open" ))
301
+ player .closeInventory ();
302
+ player .sendMessage (RPBookGUIUtils
303
+ .ChatColor (RPBookGUI .getPlugin .getConfig ().getString ("messages.added book" )
304
+ .replace ("{NAME}" , ci .getItemMeta ().getDisplayName ())));
306
305
}
307
306
}
308
307
}
0 commit comments