Skip to content

Commit

Permalink
Updated config.yml + console can now reload
Browse files Browse the repository at this point in the history
  • Loading branch information
dentych committed Jan 26, 2016
1 parent ead15a3 commit e020b63
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 26 deletions.
11 changes: 2 additions & 9 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,14 @@
# If you wish to opt-out of this service, though, just change this setting to true.
opt-out: false

# The name in the /eshop menu.
# The name of the Eshop menu.
# Max 32 characters!
menu-name: EnchantGUI

# Payment currency can be one of two. Either 'money' for regular money (using Vault+Economy system)
# or 'xp' for experience points (though, XP is currently not supported).
# or 'xp' for XP levels.
# You can also put 'disable' to disable the economy-aspect of the plugin entirely.
payment-currency: money
# XP options: points = prices are in xp points, levels = prices are in XP levels.
# xp-option is only used if payment-currency is set to xp.
xp-option: points

# 'command' - The Eshop menu is opened with /eshop.
# 'item' - The Eshop menu is opened by right clicking while holding an enchanting table.
eshop-menu: command

# Enchant prices
# You can set a price for each individual level
Expand Down
30 changes: 13 additions & 17 deletions src/me/tychsen/enchantgui/Event/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public void onInventoryClickEvent(InventoryClickEvent e) {
}
}

@EventHandler
//@EventHandler
// TODO: Implement Enchanting table right click to open menu.
// Requires more work, though, as it's currently the item in the hand
// that is enchanted - which will then be an enchanting table...
public void onPlayerInteractEvent(PlayerInteractEvent e) {
if (e.getAction() == Action.RIGHT_CLICK_AIR &&
e.getPlayer().getItemInHand().getType() == Material.ENCHANTMENT_TABLE) {
Expand All @@ -56,47 +59,40 @@ private void handleInventoryClickEvent(InventoryClickEvent e) {
} else {
return;
}

/*
switch (system.getPlayerMenuLevel(p)) {
case 0:
system.showEnchantPage(p, e.getCurrentItem());
break;
case 1:
handleEnchantPage(p, e.getCurrentItem(), e.getSlot());
break;
default:
throw new IndexOutOfBoundsException();
}
*/
}

private void handlePlayerInteractEvent(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (p.isOp()) {
// TODO: || playerHasUsePerms(p) <-- Implement this crap somewhere
// IMPORTANT: PlayerInteractEvent EventHandler is currently disabled, so no worries...
system.showMainMenu(e.getPlayer());
}
}

@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if (command.getName().equalsIgnoreCase("eshop") && sender instanceof Player) {
if (command.getName().equalsIgnoreCase("eshop")) {
handleCommand(sender, command, args);
}

return true;
}

private boolean handleCommand(CommandSender sender, Command cmd, String[] args) {
Player p = (Player) sender;

if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
EshopConfig.getInstance().reloadConfig(sender);
}
} else {
system.showMainMenu(p);
if (sender instanceof Player) {
Player p = (Player) sender;
system.showMainMenu(p);
}
else {
sender.sendMessage("Can't use this command from console...");
}
}

return true;
Expand Down

0 comments on commit e020b63

Please sign in to comment.