mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2024-11-16 01:08:46 +00:00
add invcontrol...
This commit is contained in:
parent
7aa79c220c
commit
b98844d588
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user