Created
September 5, 2014 14:22
-
-
Save heinrichquirit/05e188bea5b7f0f6e4e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How much vote points to receive per vote | |
vote-point-reward: 1 | |
gui-menu-name: 'DKCraft Store' | |
# Must be multiple of 9, max size 36 | |
gui-menu-size: 9 | |
# Format: <quantity>:<itemname>:<price> | |
store: | |
- 1:sponge:1 | |
- 2:stone:5 | |
- 5:apple:1 | |
- 4:diamond:4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IconMenu store_menu = null; | |
/* GUI based store */ | |
for (String items : p.store) { | |
int count = 0; | |
String[] arg = items.split(":"); | |
int quantity = Integer.parseInt(arg[0]); // Not surrounding in try-catch | |
Material material = Material.getMaterial(arg[1].toUpperCase()); | |
String name = material.name().substring(0, 1) + material.name().substring(1, material.name().length()).toLowerCase(); | |
int price = Integer.parseInt(arg[2]); | |
store_menu = new IconMenu(p.menu_name, p.menu_size, new IconMenu.OptionClickEventHandler() { | |
@Override | |
public void onOptionClick(IconMenu.OptionClickEvent event) { | |
event.getPlayer().sendMessage("You have chosen " + event.getName()); | |
event.setWillClose(true); | |
} | |
}, p) | |
.setOption(count++, new ItemStack(material), name, "Quantity: " + quantity + " Points: " + price) | |
} | |
if (store_menu != null) { | |
store_menu.open(player); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment