-
-
Notifications
You must be signed in to change notification settings - Fork 307
/
ShopTrait.java
656 lines (576 loc) · 25 KB
/
ShopTrait.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
package net.citizensnpcs.trait;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.citizensnpcs.StoredShops;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.gui.CitizensInventoryClickEvent;
import net.citizensnpcs.api.gui.ClickHandler;
import net.citizensnpcs.api.gui.InputMenus;
import net.citizensnpcs.api.gui.InputMenus.Choice;
import net.citizensnpcs.api.gui.InventoryMenu;
import net.citizensnpcs.api.gui.InventoryMenuPage;
import net.citizensnpcs.api.gui.InventoryMenuPattern;
import net.citizensnpcs.api.gui.InventoryMenuSlot;
import net.citizensnpcs.api.gui.Menu;
import net.citizensnpcs.api.gui.MenuContext;
import net.citizensnpcs.api.gui.MenuPattern;
import net.citizensnpcs.api.gui.MenuSlot;
import net.citizensnpcs.api.persistence.Persist;
import net.citizensnpcs.api.trait.Trait;
import net.citizensnpcs.api.trait.TraitName;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.api.util.Placeholders;
import net.citizensnpcs.trait.shop.ItemAction;
import net.citizensnpcs.trait.shop.ItemAction.ItemActionGUI;
import net.citizensnpcs.trait.shop.MoneyAction;
import net.citizensnpcs.trait.shop.MoneyAction.MoneyActionGUI;
import net.citizensnpcs.trait.shop.NPCShopAction;
import net.citizensnpcs.trait.shop.NPCShopAction.GUI;
import net.citizensnpcs.trait.shop.NPCShopAction.Transaction;
import net.citizensnpcs.trait.shop.PermissionAction;
import net.citizensnpcs.trait.shop.PermissionAction.PermissionActionGUI;
import net.citizensnpcs.util.Util;
/**
* Shop trait for NPC GUI shops.
*/
@TraitName("shop")
public class ShopTrait extends Trait {
@Persist
private String rightClickShop;
private StoredShops shops;
public ShopTrait() {
super("shop");
}
public ShopTrait(StoredShops shops) {
this();
this.shops = shops;
}
public void deleteShop(String name) {
if (shops.globalShops.containsKey(name)) {
shops.globalShops.remove(name);
} else {
shops.npcShops.remove(name);
}
}
public NPCShop getDefaultShop() {
return shops.npcShops.computeIfAbsent(npc.getUniqueId().toString(), (s) -> new NPCShop(s));
}
public NPCShop getShop(String name) {
return shops.globalShops.computeIfAbsent(name, (s) -> new NPCShop(s));
}
public void onRightClick(Player player) {
if (rightClickShop == null)
return;
NPCShop shop = shops.globalShops.getOrDefault(rightClickShop, getDefaultShop());
shop.display(player);
}
public static class NPCShop {
@Persist(value = "")
private String name;
@Persist(reify = true)
private final List<NPCShopPage> pages = Lists.newArrayList();
@Persist
private String title;
@Persist
private ShopType type = ShopType.COMMAND;
@Persist
private String viewPermission;
private NPCShop() {
}
private NPCShop(String name) {
this.name = name;
}
public void display(Player sender) {
if (viewPermission != null && !sender.hasPermission(viewPermission))
return;
if (pages.size() == 0) {
Messaging.send(sender, "<red>Empty shop");
return;
}
InventoryMenu.createSelfRegistered(new NPCShopViewer(this, sender)).present(sender);
}
public void displayEditor(ShopTrait trait, Player sender) {
InventoryMenu.createSelfRegistered(new NPCShopSettings(trait, this)).present(sender);
}
public String getName() {
return name == null ? "" : name;
}
public NPCShopPage getOrCreatePage(int page) {
while (pages.size() <= page) {
pages.add(new NPCShopPage(page));
}
return pages.get(page);
}
public String getRequiredPermission() {
return viewPermission;
}
public void removePage(int index) {
for (int i = 0; i < pages.size(); i++) {
if (pages.get(i).index == index) {
pages.remove(i--);
index = -1;
} else if (index == -1) {
pages.get(i).index--;
}
}
}
public void setPermission(String permission) {
this.viewPermission = permission;
if (viewPermission != null && viewPermission.isEmpty()) {
viewPermission = null;
}
}
}
@Menu(title = "NPC Shop Contents Editor", type = InventoryType.CHEST, dimensions = { 5, 9 })
public static class NPCShopContentsEditor extends InventoryMenuPage {
private MenuContext ctx;
private int page = 0;
private final NPCShop shop;
public NPCShopContentsEditor(NPCShop shop) {
this.shop = shop;
}
public void changePage(int newPage) {
this.page = newPage;
NPCShopPage shopPage = shop.getOrCreatePage(page);
for (int i = 0; i < ctx.getInventory().getSize(); i++) {
InventoryMenuSlot slot = ctx.getSlot(i);
slot.clear();
NPCShopItem item = shopPage.getItem(i);
if (item != null) {
slot.setItemStack(item.display);
}
final int idx = i;
slot.setClickHandler(evt -> {
ctx.clearSlots();
NPCShopItem display = item;
if (display == null) {
display = new NPCShopItem();
if (evt.getCursor() != null) {
display.display = evt.getCursor().clone();
}
}
ctx.getMenu().transition(new NPCShopItemEditor(display, modified -> {
if (modified == null) {
shopPage.removeItem(idx);
} else {
shopPage.setItem(idx, modified);
}
}));
});
}
InventoryMenuSlot prev = ctx.getSlot(4 * 9 + 3);
InventoryMenuSlot edit = ctx.getSlot(4 * 9 + 4);
InventoryMenuSlot next = ctx.getSlot(4 * 9 + 5);
prev.clear();
if (page > 0) {
prev.setItemStack(new ItemStack(Material.FEATHER, 1), "Previous page (" + (page) + ")");
prev.setClickHandler(evt -> {
evt.setCancelled(true);
changePage(page - 1);
});
}
next.setItemStack(new ItemStack(Material.FEATHER, 1),
page + 1 >= shop.pages.size() ? "New page" : "Next page (" + (page + 1) + ")");
next.setClickHandler(evt -> {
evt.setCancelled(true);
changePage(page + 1);
});
edit.setItemStack(new ItemStack(Material.BOOK), "Edit page");
edit.setClickHandler(evt -> {
evt.setCancelled(true);
ctx.getMenu().transition(new NPCShopPageSettings(shop.getOrCreatePage(page)));
});
}
@Override
public void initialise(MenuContext ctx) {
this.ctx = ctx;
if (ctx.data().containsKey("removePage")) {
int index = (int) ctx.data().remove("removePage");
shop.removePage(index);
page = Math.max(page - 1, 0);
}
changePage(page);
}
}
public static class NPCShopItem implements Cloneable {
@Persist
private final List<NPCShopAction> cost = Lists.newArrayList();
@Persist
private ItemStack display;
@Persist
private final List<NPCShopAction> result = Lists.newArrayList();
private void changeAction(List<NPCShopAction> source, Function<NPCShopAction, Boolean> filter,
NPCShopAction delta) {
for (int i = 0; i < source.size(); i++) {
if (filter.apply(source.get(i))) {
if (delta == null) {
source.remove(i);
} else {
source.set(i, delta);
}
return;
}
}
if (delta != null) {
source.add(delta);
}
}
public void changeCost(Function<NPCShopAction, Boolean> filter, NPCShopAction cost) {
changeAction(this.cost, filter, cost);
}
public void changeResult(Function<NPCShopAction, Boolean> filter, NPCShopAction result) {
changeAction(this.result, filter, result);
}
@Override
public NPCShopItem clone() {
try {
return (NPCShopItem) super.clone();
} catch (CloneNotSupportedException e) {
throw new Error(e);
}
}
public List<Transaction> execute(List<NPCShopAction> actions, Function<NPCShopAction, Transaction> func) {
List<Transaction> pending = Lists.newArrayList();
for (NPCShopAction action : actions) {
Transaction take = func.apply(action);
if (!take.isPossible()) {
pending.forEach(a -> a.rollback());
return null;
} else {
take.run();
pending.add(take);
}
}
return pending;
}
public ItemStack getDisplayItem(Player player) {
if (display == null)
return null;
ItemStack stack = display.clone();
ItemMeta meta = stack.getItemMeta();
if (meta.hasDisplayName()) {
meta.setDisplayName(Placeholders.replace(meta.getDisplayName(), player));
}
if (!meta.hasLore()) {
List<String> lore = Lists.newArrayList();
if (cost.size() > 0) {
result.forEach((a) -> lore.add(a.describe()));
}
if (result.size() > 0) {
result.forEach((a) -> lore.add(a.describe()));
}
}
if (meta.hasLore()) {
meta.setLore(Lists.transform(meta.getLore(), line -> Placeholders.replace(line, player)));
}
stack.setItemMeta(meta);
return stack;
}
public void onClick(NPCShop shop, CitizensInventoryClickEvent event) {
if (shop.type == ShopType.COMMAND)
return;
List<Transaction> take = execute(cost, action -> action.take(event.getWhoClicked()));
if (take == null)
return;
if (execute(result, action -> action.grant(event.getWhoClicked())) == null) {
take.forEach(a -> a.rollback());
}
}
}
@Menu(title = "NPC Shop Item Editor", type = InventoryType.CHEST, dimensions = { 6, 9 })
@MenuSlot(slot = { 3, 4 }, material = Material.DISPENSER, amount = 1, title = "<f>Place display item below")
public static class NPCShopItemEditor extends InventoryMenuPage {
@MenuPattern(
offset = { 0, 6 },
slots = { @MenuSlot(pat = 'x', material = Material.AIR) },
value = "x x\n x \nx x")
private InventoryMenuPattern actionItems;
private final Consumer<NPCShopItem> callback;
@MenuPattern(
offset = { 0, 0 },
slots = { @MenuSlot(pat = 'x', material = Material.AIR) },
value = "x x\n x \nx x")
private InventoryMenuPattern costItems;
private MenuContext ctx;
private final NPCShopItem modified;
private NPCShopItem original;
public NPCShopItemEditor(NPCShopItem item, Consumer<NPCShopItem> consumer) {
this.original = item;
this.modified = original.clone();
this.callback = consumer;
}
@Override
public void initialise(MenuContext ctx) {
this.ctx = ctx;
if (modified.display != null) {
ctx.getSlot(9 * 4 + 4).setItemStack(modified.display);
}
int pos = 0;
for (GUI template : NPCShopAction.getGUIs()) {
if (template.createMenuItem(null) == null)
continue;
NPCShopAction oldCost = modified.cost.stream().filter(template::manages).findFirst().orElse(null);
costItems.getSlots().get(pos)
.setItemStack(Util.editTitle(template.createMenuItem(oldCost), title -> title + " Cost"));
costItems.getSlots().get(pos).setClickHandler(event -> ctx.getMenu().transition(
template.createEditor(oldCost, cost -> modified.changeCost(template::manages, cost))));
NPCShopAction oldResult = modified.result.stream().filter(template::manages).findFirst().orElse(null);
actionItems.getSlots().get(pos)
.setItemStack(Util.editTitle(template.createMenuItem(oldResult), title -> title + " Result"));
actionItems.getSlots().get(pos).setClickHandler(event -> ctx.getMenu().transition(
template.createEditor(oldResult, result -> modified.changeResult(template::manages, result))));
pos++;
}
}
@MenuSlot(slot = { 5, 3 }, material = Material.REDSTONE_BLOCK, amount = 1, title = "<7>Cancel")
public void onCancel(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.getMenu().transitionBack();
}
@Override
public void onClose(HumanEntity who) {
if (original != null && original.display == null) {
original = null;
}
callback.accept(original);
}
@MenuSlot(slot = { 4, 5 }, material = Material.BOOK, amount = 1, title = "<f>Set description")
public void onEditDescription(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
if (modified.display == null)
return;
ctx.getMenu()
.transition(InputMenus.stringSetter(() -> modified.display.getItemMeta().hasLore()
? Joiner.on("<br>").skipNulls().join(modified.display.getItemMeta().getLore())
: "", description -> {
ItemMeta meta = modified.display.getItemMeta();
meta.setLore(Lists
.newArrayList(Splitter.on("<br>").split(Colorizer.parseColors(description))));
modified.display.setItemMeta(meta);
}));
}
@MenuSlot(slot = { 4, 3 }, material = Material.FEATHER, amount = 1, title = "<f>Set name")
public void onEditName(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
if (modified.display == null)
return;
ctx.getMenu().transition(InputMenus.stringSetter(modified.display.getItemMeta()::getDisplayName, name -> {
ItemMeta meta = modified.display.getItemMeta();
meta.setDisplayName(ChatColor.RESET + Colorizer.parseColors(name));
modified.display.setItemMeta(meta);
}));
}
@ClickHandler(slot = { 4, 4 })
public void onModifyDisplayItem(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
if (event.getCursor() != null) {
event.setCurrentItem(event.getCursor());
modified.display = event.getCursor().clone();
} else {
event.setCurrentItem(null);
modified.display = null;
}
}
@MenuSlot(slot = { 5, 4 }, material = Material.TNT, amount = 1, title = "<c>Remove")
public void onRemove(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
original = null;
event.setCancelled(true);
ctx.getMenu().transitionBack();
}
@MenuSlot(slot = { 5, 5 }, material = Material.EMERALD_BLOCK, amount = 1, title = "<a>Save")
public void onSave(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
original = modified;
event.setCancelled(true);
ctx.getMenu().transitionBack();
}
}
public static class NPCShopPage {
@Persist("$key")
private int index;
@Persist(keyType = Integer.class, reify = true)
private final Map<Integer, NPCShopItem> items = Maps.newHashMap();
@Persist
private String title;
private NPCShopPage() {
}
public NPCShopPage(int page) {
this.index = page;
}
public NPCShopItem getItem(int idx) {
return items.get(idx);
}
public void removeItem(int idx) {
items.remove(idx);
}
public void setItem(int idx, NPCShopItem modified) {
items.put(idx, modified);
}
}
@Menu(title = "NPC Shop Page Editor", type = InventoryType.CHEST, dimensions = { 5, 9 })
public static class NPCShopPageSettings extends InventoryMenuPage {
private MenuContext ctx;
private final NPCShopPage page;
public NPCShopPageSettings(NPCShopPage page) {
this.page = page;
}
@MenuSlot(slot = { 0, 4 }, material = Material.FEATHER, amount = 1)
public void editPageTitle(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.getMenu().transition(InputMenus.stringSetter(() -> page.title, newTitle -> {
page.title = newTitle.isEmpty() ? null : newTitle;
}));
}
@Override
public void initialise(MenuContext ctx) {
this.ctx = ctx;
ctx.getSlot(4).setDescription("Set page title<br>Currently: " + page.title);
}
@MenuSlot(slot = { 4, 4 }, material = Material.TNT, amount = 1, title = "<c>Remove page")
public void removePage(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.data().put("removePage", page.index);
ctx.getMenu().transitionBack();
}
}
@Menu(title = "NPC Shop Editor", type = InventoryType.CHEST, dimensions = { 1, 9 })
public static class NPCShopSettings extends InventoryMenuPage {
private MenuContext ctx;
private final NPCShop shop;
private final ShopTrait trait;
public NPCShopSettings(ShopTrait trait, NPCShop shop) {
this.trait = trait;
this.shop = shop;
}
@Override
public void initialise(MenuContext ctx) {
this.ctx = ctx;
ctx.getSlot(2).setDescription("<f>Edit shop view permission<br>" + shop.getRequiredPermission());
ctx.getSlot(6).setDescription("<f>Edit shop title<br>" + shop.title);
ctx.getSlot(8)
.setDescription("<f>Show shop on right click<br>" + shop.getName().equals(trait.rightClickShop));
}
@MenuSlot(slot = { 0, 4 }, material = Material.FEATHER, amount = 1, title = "<f>Edit shop items")
public void onEditItems(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.getMenu().transition(new NPCShopContentsEditor(shop));
}
@MenuSlot(slot = { 0, 2 }, material = Material.OAK_SIGN, amount = 1)
public void onPermissionChange(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.getMenu().transition(InputMenus.stringSetter(shop::getRequiredPermission, shop::setPermission));
}
@MenuSlot(slot = { 0, 6 }, material = Material.NAME_TAG, amount = 1)
public void onSetTitle(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.getMenu().transition(InputMenus.stringSetter(() -> shop.title, newTitle -> {
shop.title = newTitle.isEmpty() ? null : newTitle;
}));
}
@MenuSlot(slot = { 0, 0 }, material = Material.BOOK, amount = 1, title = "<f>Edit shop type")
public void onShopTypeChange(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
ctx.getMenu().transition(InputMenus.<ShopType> picker("Edit shop type", chosen -> {
shop.type = chosen.getValue();
}, Choice.<ShopType> of(ShopType.BUY, Material.DIAMOND, "Players buy items", shop.type == ShopType.BUY),
Choice.of(ShopType.SELL, Material.EMERALD, "Players sell items", shop.type == ShopType.SELL),
Choice.of(ShopType.COMMAND, Material.ENDER_EYE, "Clicks trigger commands only",
shop.type == ShopType.COMMAND)));
}
@MenuSlot(slot = { 0, 8 }, material = Material.COMMAND_BLOCK, amount = 1)
public void onToggleRightClick(InventoryMenuSlot slot, CitizensInventoryClickEvent event) {
event.setCancelled(true);
if (shop.getName().equals(trait.rightClickShop)) {
trait.rightClickShop = null;
} else {
trait.rightClickShop = shop.name;
}
ctx.getSlot(8)
.setDescription("<f>Show shop on right click<br>" + (shop.getName().equals(trait.rightClickShop)));
}
}
@Menu(title = "Shop", type = InventoryType.CHEST, dimensions = { 5, 9 })
public static class NPCShopViewer extends InventoryMenuPage {
private MenuContext ctx;
private int currentPage = 0;
private final Player player;
private final NPCShop shop;
public NPCShopViewer(NPCShop shop, Player player) {
this.shop = shop;
this.player = player;
}
public void changePage(int newPage) {
this.currentPage = newPage;
NPCShopPage page = shop.pages.get(currentPage);
if (page.title != null && !page.title.isEmpty()) {
Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), () -> {
ctx.setTitle(Placeholders.replace(page.title, player));
}, 1);
}
for (int i = 0; i < ctx.getInventory().getSize(); i++) {
ctx.getSlot(i).clear();
NPCShopItem item = page.getItem(i);
if (item == null)
continue;
ctx.getSlot(i).setItemStack(item.getDisplayItem(player));
ctx.getSlot(i).setClickHandler(evt -> {
evt.setCancelled(true);
item.onClick(shop, evt);
});
}
InventoryMenuSlot prev = ctx.getSlot(4 * 9 + 3);
InventoryMenuSlot next = ctx.getSlot(4 * 9 + 5);
prev.clear();
if (currentPage > 0) {
prev.setItemStack(new ItemStack(Material.FEATHER, 1), "Previous page (" + (currentPage) + ")");
prev.setClickHandler(evt -> {
evt.setCancelled(true);
changePage(currentPage - 1);
});
}
next.clear();
if (currentPage + 1 < shop.pages.size()) {
next.setItemStack(new ItemStack(Material.FEATHER, 1), "Next page (" + (currentPage + 1) + ")");
next.setClickHandler(evt -> {
evt.setCancelled(true);
changePage(currentPage + 1);
});
}
}
@Override
public Inventory createInventory(String title) {
return Bukkit.createInventory(null, 45,
shop.title == null || shop.title.isEmpty() ? "Shop" : Placeholders.replace(shop.title, player));
}
@Override
public void initialise(MenuContext ctx) {
this.ctx = ctx;
changePage(currentPage);
}
}
public enum ShopType {
BUY,
COMMAND,
SELL;
}
static {
NPCShopAction.register(ItemAction.class, "items", new ItemActionGUI());
NPCShopAction.register(PermissionAction.class, "permissions", new PermissionActionGUI());
NPCShopAction.register(MoneyAction.class, "money", new MoneyActionGUI());
}
}