From e020b635b5fcb1824bfe32de2ab0b12084c1841b Mon Sep 17 00:00:00 2001 From: Dennis T Date: Tue, 26 Jan 2016 21:45:06 +0100 Subject: [PATCH] Updated config.yml + console can now reload --- config.yml | 11 ++----- .../enchantgui/Event/EventManager.java | 30 ++++++++----------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/config.yml b/config.yml index 2175718..0b1c16c 100644 --- a/config.yml +++ b/config.yml @@ -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 diff --git a/src/me/tychsen/enchantgui/Event/EventManager.java b/src/me/tychsen/enchantgui/Event/EventManager.java index 4042daf..a86b206 100644 --- a/src/me/tychsen/enchantgui/Event/EventManager.java +++ b/src/me/tychsen/enchantgui/Event/EventManager.java @@ -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) { @@ -56,32 +59,20 @@ 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); } @@ -89,14 +80,19 @@ public boolean onCommand(CommandSender sender, Command command, String s, String } 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;