diff --git a/src/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java b/src/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java index 01aa3af..b4e4495 100644 --- a/src/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java +++ b/src/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java @@ -3,8 +3,6 @@ */ package cn.citycraft.SimpleEssential.command; -import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.command.CommandException; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -28,31 +26,7 @@ public class CommandEnchantBench extends BaseCommand { @Override public void execute(CommandSender sender, String label, String[] args) throws CommandException { Player p = (Player) sender; - final Location loc = p.getLocation(); - switch (args.length) { - case 0: - loc.setY(250); - - Bukkit.getScheduler().runTaskLater(plugin, new Runnable() { - @Override - public void run() { - - } - }, 600); - break; - case 1: - switch (args[0]) { - case "set": - setEnchatRange(loc); - break; - case "clear": - clearEnchatRange(loc); - break; - } - break; - default: - break; - } + plugin.invcontrol.openEnchantBench(p); } @Override diff --git a/src/cn/citycraft/SimpleEssential/inventory/InventoryControl.java b/src/cn/citycraft/SimpleEssential/inventory/InventoryControl.java index 49cfbf1..fa63821 100644 --- a/src/cn/citycraft/SimpleEssential/inventory/InventoryControl.java +++ b/src/cn/citycraft/SimpleEssential/inventory/InventoryControl.java @@ -23,19 +23,19 @@ public class InventoryControl { this.plugin = main; } - public void clearEnchatRange(Player player) { - if (!isOpen(player)) + public void clearEnchantBench(Player player) { + if (!isOpenEnchantBench(player)) return; Location loc = enchantbench.get(player.getName()); setRange(loc, Material.AIR); loc.getBlock().setType(Material.AIR); } - public boolean isOpen(Player player) { + public boolean isOpenEnchantBench(Player player) { return enchantbench.containsKey(player.getName()); } - public void open(Player player) { + public void openEnchantBench(Player player) { Location loc = player.getLocation(); loc.setY(-5); setEnchatRange(loc); diff --git a/src/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java b/src/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java index 806d933..faad633 100644 --- a/src/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java +++ b/src/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java @@ -33,7 +33,7 @@ public class PlayerInventoryViewListen implements Listener { Player player = (Player) e.getPlayer(); Inventory inv = e.getInventory(); if (inv.getType() == InventoryType.ENCHANTING) { - plugin.invcontrol.clearEnchatRange(player); + plugin.invcontrol.clearEnchantBench(player); } } }