diff --git a/src/main/java/com/lishid/openinv/ConfigUpdater.java b/src/main/java/com/lishid/openinv/ConfigUpdater.java index e8af988..e94ae1b 100644 --- a/src/main/java/com/lishid/openinv/ConfigUpdater.java +++ b/src/main/java/com/lishid/openinv/ConfigUpdater.java @@ -61,9 +61,11 @@ public class ConfigUpdater { configFile.delete(); } + plugin.getLogger().info("[Config] Backup of old config.yml file created."); + // Get the old config settings int itemOpenInvItemId = config.getInt("ItemOpenInvItemID", 280); - boolean checkForUpdates = config.getBoolean("CheckForUpdates", true); + // boolean checkForUpdates = config.getBoolean("CheckForUpdates", true); boolean notifySilentChest = config.getBoolean("NotifySilentChest", true); boolean notifyAnyChest = config.getBoolean("NotifyAnyChest", true); @@ -92,10 +94,10 @@ public class ConfigUpdater { plugin.saveDefaultConfig(); plugin.reloadConfig(); - config = plugin.getConfig(); // Refresh the referenced config + config = plugin.getConfig(); // Refresh the referenced plugin config - config.set("config-version", "2"); - config.set("check-for-updates", checkForUpdates); + config.set("config-version", 2); + // config.set("check-for-updates", checkForUpdates); config.set("items.open-inv", getMaterialById(itemOpenInvItemId).toString()); config.set("notify.any-chest", notifyAnyChest); config.set("notify.silent-chest", notifySilentChest); @@ -132,17 +134,20 @@ public class ConfigUpdater { return null; } + int total = keys.size(); + int converted = 0; + for (String playerName : keys) { UUID uuid = UUIDUtil.getUUIDOf(playerName); if (uuid != null) { boolean toggled = section.getBoolean(playerName + ".toggle", false); toggles.put(uuid, toggled); - } - else { - plugin.getLogger().warning("Failed to retrieve UUID of player: " + playerName); + converted++; } } + plugin.getLogger().info("[Config] Converted (" + converted + "/" + total + ") " + sectionName + " toggle player usernames to UUIDs."); + return toggles; } diff --git a/src/main/java/com/lishid/openinv/OpenInv.java b/src/main/java/com/lishid/openinv/OpenInv.java index 26adac5..71773f1 100644 --- a/src/main/java/com/lishid/openinv/OpenInv.java +++ b/src/main/java/com/lishid/openinv/OpenInv.java @@ -31,6 +31,7 @@ import org.bukkit.plugin.java.JavaPlugin; import com.lishid.openinv.commands.AnyChestCommand; import com.lishid.openinv.commands.OpenEnderCommand; import com.lishid.openinv.commands.OpenInvCommand; +import com.lishid.openinv.commands.SearchEnderCommand; import com.lishid.openinv.commands.SearchInvCommand; import com.lishid.openinv.commands.SilentChestCommand; import com.lishid.openinv.commands.ToggleOpenInvCommand; @@ -63,7 +64,7 @@ public class OpenInv extends JavaPlugin { // Plugin mainPlugin = this; - // Config + // Config Updater ConfigUpdater configUpdater = new ConfigUpdater(this); configUpdater.checkForUpdates(); @@ -90,11 +91,12 @@ public class OpenInv extends JavaPlugin { private void registerCommands() { getCommand("openinv").setExecutor(new OpenInvCommand(this)); - getCommand("searchinv").setExecutor(new SearchInvCommand()); - getCommand("toggleopeninv").setExecutor(new ToggleOpenInvCommand()); - getCommand("silentchest").setExecutor(new SilentChestCommand()); - getCommand("anychest").setExecutor(new AnyChestCommand()); getCommand("openender").setExecutor(new OpenEnderCommand(this)); + getCommand("searchinv").setExecutor(new SearchInvCommand()); + getCommand("searchender").setExecutor(new SearchEnderCommand()); + getCommand("toggleopeninv").setExecutor(new ToggleOpenInvCommand()); + getCommand("anychest").setExecutor(new AnyChestCommand()); + getCommand("silentchest").setExecutor(new SilentChestCommand()); } public static PlayerDataManager getPlayerLoader() { @@ -109,21 +111,19 @@ public class OpenInv extends JavaPlugin { return anySilentChest; } - /* - public static Object getFromConfig(String data, Object defaultValue) { - Object val = mainPlugin.getConfig().get(data); + public static Object getFromConfig(String path, Object defaultValue) { + Object val = mainPlugin.getConfig().get(path); if (val == null) { - mainPlugin.getConfig().set(data, defaultValue); + mainPlugin.getConfig().set(path, defaultValue); return defaultValue; } else { return val; } } - */ - public static void saveToConfig(String data, Object value) { - mainPlugin.getConfig().set(data, value); + public static void saveToConfig(String path, Object value) { + mainPlugin.getConfig().set(path, value); mainPlugin.saveConfig(); } @@ -174,48 +174,41 @@ public class OpenInv extends JavaPlugin { saveToConfig("toggles.silent-chest." + player.getUniqueId(), status); } - /** - * Logs a given message to console. - * - * @param text the text to log - */ public static void log(String text) { mainPlugin.getLogger().info("[OpenInv] " + text); } - /** - * Logs an error to console. - * - * @param e the throwable error to log - */ public static void log(Throwable e) { mainPlugin.getLogger().severe("[OpenInv] " + e.toString()); e.printStackTrace(); } - /** - * Sends a specified message to a given CommandSender with the OpenInv prefix. - * - * @param sender the CommandSender to message - * @param message the message to send to the player - */ public static void sendMessage(CommandSender sender, String message) { sender.sendMessage(ChatColor.AQUA + "[OpenInv] " + ChatColor.WHITE + message); } public static void showHelp(Player player) { - player.sendMessage(ChatColor.GREEN + "/openinv - Open a player's inventory"); + player.sendMessage(ChatColor.GREEN + "/openinv - Open a player's inventory."); player.sendMessage(ChatColor.GREEN + " (aliases: oi, inv, open)"); - player.sendMessage(ChatColor.GREEN + "/openender - Open a player's ender chest"); - player.sendMessage(ChatColor.GREEN + " (aliases: oe, enderchest)"); - player.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggle item openinv function"); - player.sendMessage(ChatColor.GREEN + " (aliases: toi, toggleoi, toggleinv)"); - player.sendMessage(ChatColor.GREEN + "/searchinv [minAmount] - "); + + player.sendMessage(ChatColor.GREEN + "/openender - Open a player's ender chest."); + player.sendMessage(ChatColor.GREEN + " (aliases: oe)"); + + player.sendMessage(ChatColor.GREEN + "/searchinv [minAmount] -"); player.sendMessage(ChatColor.GREEN + " Search and list players having a specific item."); - player.sendMessage(ChatColor.GREEN + " (aliases: si, search)"); - player.sendMessage(ChatColor.GREEN + "/anychest - Toggle anychest function"); + player.sendMessage(ChatColor.GREEN + " (aliases: si)"); + + player.sendMessage(ChatColor.GREEN + "/searchender [minAmount] -"); + player.sendMessage(ChatColor.GREEN + " Search and list players having a specific item."); + player.sendMessage(ChatColor.GREEN + " (aliases: se)"); + + player.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggle the item openinv function."); + player.sendMessage(ChatColor.GREEN + " (aliases: toi, toggleoi, toggleinv)"); + + player.sendMessage(ChatColor.GREEN + "/anychest - Toggle the any chest function."); player.sendMessage(ChatColor.GREEN + " (aliases: ac)"); - player.sendMessage(ChatColor.GREEN + "/silentchest - Toggle silent chest function"); + + player.sendMessage(ChatColor.GREEN + "/silentchest - Toggle the silent chest function."); player.sendMessage(ChatColor.GREEN + " (aliases: sc, silent)"); } diff --git a/src/main/java/com/lishid/openinv/commands/OpenEnderCommand.java b/src/main/java/com/lishid/openinv/commands/OpenEnderCommand.java index 28a3ed5..f39fce8 100644 --- a/src/main/java/com/lishid/openinv/commands/OpenEnderCommand.java +++ b/src/main/java/com/lishid/openinv/commands/OpenEnderCommand.java @@ -62,7 +62,6 @@ public class OpenEnderCommand implements CommandExecutor { // History management UUID history = openEnderHistory.get(player.getUniqueId()); - if (history == null) { history = player.getUniqueId(); openEnderHistory.put(player.getUniqueId(), history); diff --git a/src/main/java/com/lishid/openinv/commands/OpenInvCommand.java b/src/main/java/com/lishid/openinv/commands/OpenInvCommand.java index 3d2cdd7..4368ac7 100644 --- a/src/main/java/com/lishid/openinv/commands/OpenInvCommand.java +++ b/src/main/java/com/lishid/openinv/commands/OpenInvCommand.java @@ -61,7 +61,6 @@ public class OpenInvCommand implements CommandExecutor { // History management UUID history = openInvHistory.get(player.getUniqueId()); - if (history == null) { history = player.getUniqueId(); openInvHistory.put(player.getUniqueId(), history); diff --git a/src/main/java/com/lishid/openinv/commands/SearchEnderCommand.java b/src/main/java/com/lishid/openinv/commands/SearchEnderCommand.java index 658fa94..65fd961 100644 --- a/src/main/java/com/lishid/openinv/commands/SearchEnderCommand.java +++ b/src/main/java/com/lishid/openinv/commands/SearchEnderCommand.java @@ -16,7 +16,7 @@ public class SearchEnderCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (command.getName().equalsIgnoreCase("searchinv")) { + if (command.getName().equalsIgnoreCase("searchender")) { if (sender instanceof Player) { if (!OpenInv.hasPermission(sender, Permissions.PERM_SEARCH)) { sender.sendMessage(ChatColor.RED + "You do not have permission to search player ender chests."); @@ -28,7 +28,7 @@ public class SearchEnderCommand implements CommandExecutor { int count = 1; if (args.length >= 1) { - String[] gData = null; + String[] gData; gData = args[0].split(":"); material = Material.matchMaterial(gData[0]); } @@ -50,14 +50,14 @@ public class SearchEnderCommand implements CommandExecutor { StringBuilder sb = new StringBuilder(); for (Player onlinePlayer : Bukkit.getServer().getOnlinePlayers()) { - if (onlinePlayer.getInventory().contains(material, count)) { + if (onlinePlayer.getEnderChest().contains(material, count)) { sb.append(onlinePlayer.getName()); sb.append(" "); } } String playerList = sb.toString(); - sender.sendMessage("Players with the item " + material.toString() + ": " + playerList); + sender.sendMessage("Players with the item " + ChatColor.GRAY + material.toString() + ChatColor.RESET + " in their ender chest: " + playerList); return true; } diff --git a/src/main/java/com/lishid/openinv/commands/SearchInvCommand.java b/src/main/java/com/lishid/openinv/commands/SearchInvCommand.java index 98d1527..babe370 100644 --- a/src/main/java/com/lishid/openinv/commands/SearchInvCommand.java +++ b/src/main/java/com/lishid/openinv/commands/SearchInvCommand.java @@ -42,7 +42,7 @@ public class SearchInvCommand implements CommandExecutor { int count = 1; if (args.length >= 1) { - String[] gData = null; + String[] gData; gData = args[0].split(":"); material = Material.matchMaterial(gData[0]); } @@ -71,7 +71,7 @@ public class SearchInvCommand implements CommandExecutor { } String playerList = sb.toString(); - sender.sendMessage("Players with the item " + material.toString() + ": " + playerList); + sender.sendMessage("Players with the item " + ChatColor.GRAY + material.toString() + ChatColor.RESET + " in their inventory: " + playerList); return true; } diff --git a/src/main/java/com/lishid/openinv/internal/AnySilentChest.java b/src/main/java/com/lishid/openinv/internal/AnySilentChest.java index 213422e..6c88ad6 100644 --- a/src/main/java/com/lishid/openinv/internal/AnySilentChest.java +++ b/src/main/java/com/lishid/openinv/internal/AnySilentChest.java @@ -22,7 +22,7 @@ import org.bukkit.entity.Player; import com.lishid.openinv.OpenInv; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; import org.bukkit.craftbukkit.v1_8_R3.entity.*; @@ -125,7 +125,7 @@ public class AnySilentChest { if (silentChest) { tileInventory = new SilentInventory(tileInventory); if (OpenInv.notifySilentChest()) { - p.sendMessage("You are opening a chest silently."); + OpenInv.sendMessage(p, "You are opening a chest silently."); } returnValue = false; } @@ -133,7 +133,7 @@ public class AnySilentChest { player.openContainer(tileInventory); if (anyChest && OpenInv.notifyAnyChest()) { - p.sendMessage("You are opening a blocked chest."); + OpenInv.sendMessage(p, "You are opening a blocked chest."); } return returnValue; diff --git a/src/main/java/com/lishid/openinv/internal/InventoryAccess.java b/src/main/java/com/lishid/openinv/internal/InventoryAccess.java index 97931f4..9d6940b 100644 --- a/src/main/java/com/lishid/openinv/internal/InventoryAccess.java +++ b/src/main/java/com/lishid/openinv/internal/InventoryAccess.java @@ -24,7 +24,7 @@ import org.bukkit.inventory.Inventory; import com.lishid.openinv.OpenInv; import com.lishid.openinv.Permissions; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; import org.bukkit.craftbukkit.v1_8_R3.inventory.*; @@ -53,7 +53,7 @@ public class InventoryAccess { return ((CraftInventory) inventory).getInventory(); } - //Use reflection to find the inventory + // Use reflection to find the inventory Class clazz = inventory.getClass(); IInventory result = null; for(Field f : clazz.getDeclaredFields()) { diff --git a/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java index 2bbc264..d6fa177 100644 --- a/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/PlayerDataManager.java @@ -25,7 +25,7 @@ import org.bukkit.entity.Player; import com.lishid.openinv.OpenInv; import com.mojang.authlib.GameProfile; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; import org.bukkit.craftbukkit.v1_8_R3.*; diff --git a/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java b/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java index bc923e0..b9bc4be 100644 --- a/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java +++ b/src/main/java/com/lishid/openinv/internal/SilentContainerChest.java @@ -16,7 +16,7 @@ package com.lishid.openinv.internal; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; public class SilentContainerChest extends ContainerChest { @@ -25,7 +25,7 @@ public class SilentContainerChest extends ContainerChest { public SilentContainerChest(IInventory i1, IInventory i2, EntityHuman human) { super(i1, i2, human); inv = i2; - // close signal + // Close signal inv.closeContainer(human); } diff --git a/src/main/java/com/lishid/openinv/internal/SilentInventory.java b/src/main/java/com/lishid/openinv/internal/SilentInventory.java index dcea079..a2f50a6 100644 --- a/src/main/java/com/lishid/openinv/internal/SilentInventory.java +++ b/src/main/java/com/lishid/openinv/internal/SilentInventory.java @@ -6,7 +6,7 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity; import org.bukkit.entity.HumanEntity; import org.bukkit.inventory.InventoryHolder; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; public class SilentInventory implements ITileInventory { @@ -73,12 +73,12 @@ public class SilentInventory implements ITileInventory { @Override public void startOpen(EntityHuman entityHuman) { - //Don't do anything + // Don't do anything } @Override public void closeContainer(EntityHuman entityHuman) { - //Don't do anything + // Don't do anything } @Override @@ -153,7 +153,7 @@ public class SilentInventory implements ITileInventory { @Override public Container createContainer(PlayerInventory playerInventory, EntityHuman entityHuman) { - //Don't let the chest itself create the container. + // Don't let the chest itself create the container. return new ContainerChest(playerInventory, this, entityHuman); } diff --git a/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java b/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java index ed43765..91f7b94 100644 --- a/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java +++ b/src/main/java/com/lishid/openinv/internal/SpecialEnderChest.java @@ -22,8 +22,9 @@ import org.bukkit.inventory.InventoryHolder; import com.lishid.openinv.OpenInv; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; + import org.bukkit.craftbukkit.v1_8_R3.entity.*; import org.bukkit.craftbukkit.v1_8_R3.inventory.*; @@ -31,17 +32,17 @@ public class SpecialEnderChest extends InventorySubcontainer { private final CraftInventory inventory = new CraftInventory(this); private final InventoryEnderChest enderChest; private final CraftPlayer owner; - private boolean playerOnline = false; + private boolean playerOnline; - public SpecialEnderChest(Player p, Boolean online) { + public SpecialEnderChest(Player p, boolean online) { this(p, ((CraftPlayer) p).getHandle().getEnderChest(), online); } - public SpecialEnderChest(Player p, InventoryEnderChest enderchest, boolean online) { - super(enderchest.getName(), enderchest.hasCustomName(), enderchest.getSize()); + public SpecialEnderChest(Player p, InventoryEnderChest enderChest, boolean online) { + super(enderChest.getName(), enderChest.hasCustomName(), enderChest.getSize()); this.owner = (CraftPlayer) p; - this.enderChest = enderchest; - this.items = enderChest.getContents(); + this.enderChest = enderChest; + this.items = this.enderChest.getContents(); this.playerOnline = online; OpenInv.enderChests.put(owner.getUniqueId(), this); } diff --git a/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java b/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java index c9e39e3..a53110d 100644 --- a/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java +++ b/src/main/java/com/lishid/openinv/internal/SpecialPlayerInventory.java @@ -21,8 +21,9 @@ import org.bukkit.inventory.Inventory; import com.lishid.openinv.OpenInv; -//Volatile +// Volatile import net.minecraft.server.v1_8_R3.*; + import org.bukkit.craftbukkit.v1_8_R3.entity.*; import org.bukkit.craftbukkit.v1_8_R3.inventory.*; @@ -30,7 +31,7 @@ public class SpecialPlayerInventory extends PlayerInventory { private final CraftInventory inventory = new CraftInventory(this); private final ItemStack[] extra = new ItemStack[5]; private final CraftPlayer owner; - private boolean playerOnline = false; + private boolean playerOnline; public SpecialPlayerInventory(Player p, boolean online) { super(((CraftPlayer) p).getHandle()); diff --git a/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java b/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java index 07f8fc9..2c479f0 100644 --- a/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java +++ b/src/main/java/com/lishid/openinv/listeners/OpenInvPlayerListener.java @@ -67,7 +67,7 @@ public class OpenInvPlayerListener implements Listener { } } - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); @@ -76,70 +76,76 @@ public class OpenInvPlayerListener implements Listener { } Action action = event.getAction(); - - if (action == Action.RIGHT_CLICK_BLOCK && event.useInteractedBlock() == Result.DENY) { - return; - } - Block block = event.getClickedBlock(); - if (action == Action.RIGHT_CLICK_BLOCK && block.getType() == Material.ENDER_CHEST) { - if (OpenInv.hasPermission(player, Permissions.PERM_SILENT) && OpenInv.getPlayerSilentChestStatus(player)) { - event.setCancelled(true); - player.openInventory(player.getEnderChest()); - } - } - - if (action == Action.RIGHT_CLICK_BLOCK && block.getState() instanceof Chest) { - boolean silentChest = false; - boolean anyChest = false; - - int x = block.getX(); - int y = block.getY(); - int z = block.getZ(); - - if (OpenInv.hasPermission(player, Permissions.PERM_SILENT) && OpenInv.getPlayerSilentChestStatus(player)) { - silentChest = true; - } - - if (OpenInv.hasPermission(player, Permissions.PERM_ANYCHEST) && OpenInv.getPlayerAnyChestStatus(player)) { - try { - anyChest = OpenInv.getAnySilentChest().isAnyChestNeeded(player, x, y, z); + switch (action) { + case RIGHT_CLICK_BLOCK: + if (event.useInteractedBlock() == Result.DENY) { + return; } - catch (Exception e) { - player.sendMessage(ChatColor.RED + "Error while executing openinv. Unsupported CraftBukkit."); - e.printStackTrace(); + + // Ender Chests + if (block.getType() == Material.ENDER_CHEST) { + if (OpenInv.hasPermission(player, Permissions.PERM_SILENT) && OpenInv.getPlayerSilentChestStatus(player)) { + event.setCancelled(true); + player.openInventory(player.getEnderChest()); + return; + } } - } - // If the anychest or silentchest is active - if (anyChest || silentChest) { - if (!OpenInv.getAnySilentChest().activateChest(player, anyChest, silentChest, x, y, z)) { - event.setCancelled(true); + // Chests + if (block.getState() instanceof Chest) { + boolean silentChest = false; + boolean anyChest = false; + int x = block.getX(); + int y = block.getY(); + int z = block.getZ(); + + if (OpenInv.hasPermission(player, Permissions.PERM_SILENT) && OpenInv.getPlayerSilentChestStatus(player)) { + silentChest = true; + } + + if (OpenInv.hasPermission(player, Permissions.PERM_ANYCHEST) && OpenInv.getPlayerAnyChestStatus(player)) { + try { + anyChest = OpenInv.getAnySilentChest().isAnyChestNeeded(player, x, y, z); + } + catch (Exception e) { + player.sendMessage(ChatColor.RED + "Error while executing openinv. Unsupported CraftBukkit."); + e.printStackTrace(); + } + } + + // If the anyChest or silentChest is active + if (anyChest || silentChest) { + if (!OpenInv.getAnySilentChest().activateChest(player, anyChest, silentChest, x, y, z)) { + event.setCancelled(true); + } + } + + return; } - } - } - if (action == Action.RIGHT_CLICK_BLOCK && block.getState() instanceof Sign) { - try { - Sign sign = ((Sign) block.getState()); - if (OpenInv.hasPermission(player, Permissions.PERM_OPENINV) && sign.getLine(0).equalsIgnoreCase("[openinv]")) { - String text = sign.getLine(1).trim() + sign.getLine(2).trim() + sign.getLine(3).trim(); - player.performCommand("openinv " + text); + // Signs + if (block.getState() instanceof Sign) { + try { + Sign sign = ((Sign) block.getState()); + if (OpenInv.hasPermission(player, Permissions.PERM_OPENINV) && sign.getLine(0).equalsIgnoreCase("[openinv]")) { + String text = sign.getLine(1).trim() + sign.getLine(2).trim() + sign.getLine(3).trim(); + player.performCommand("openinv " + text); + } + } + catch (Exception e) { + player.sendMessage("Internal Error."); + e.printStackTrace(); + } + + return; + } + case RIGHT_CLICK_AIR: + // OpenInv item + if (player.getItemInHand().getType() == OpenInv.getOpenInvItem() && OpenInv.getPlayerItemOpenInvStatus(player) && OpenInv.hasPermission(player, Permissions.PERM_OPENINV)) { + player.performCommand("openinv"); } - } - catch (Exception ex) { - player.sendMessage("Internal Error."); - ex.printStackTrace(); - } - } - - if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) { - if (!(player.getItemInHand().getType() == OpenInv.getOpenInvItem()) || (!OpenInv.getPlayerItemOpenInvStatus(player)) || !OpenInv.hasPermission(player, Permissions.PERM_OPENINV)) { - return; - } - - player.performCommand("openinv"); } } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 73a1bf2..2058558 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -7,32 +7,38 @@ description: > commands: openinv: aliases: [oi, inv, open] - description: Open a player's inventory + description: Open a player's inventory. usage: | - / - Open last person's inventory - / - Open a player's inventory + / - Opens last person's inventory. + / - Opens a player's inventory. openender: aliases: [oe] - description: Opens the enderchest of a player + description: Opens a player's ender chest. usage: | - / - Opens a player's enderchest + / - Opens last person's ender chest. + / - Opens a player's ender chest. searchinv: aliases: [si] - description: Search and list players having a specific item + description: Searches and lists players that have a specific item in their inventory. usage: | - / [MinAmount] - Item can be the Item ID or the CraftBukkit Item Name, MinAmount is the minimum amount to be considered. + / [minAmount] - Item can be the Item ID or the CraftBukkit Item Name, minAmount is the minimum amount to be considered. + searchender: + aliases: [se] + description: Searches and lists players that have a specific item in their ender chest. + usage: | + / [minAmount] - Item can be the Item ID or the CraftBukkit Item Name, minAmount is the minimum amount to be considered. toggleopeninv: aliases: [toi, toggleoi, toggleinv] - description: Toggle item openinv function + description: Toggles the item openinv function. usage: | - / [Check] - Checks whether item openinv is enabled - silentchest: - aliases: [sc, silent] - description: Toggle silent chest function, which hides the animation of a chest when opened or closed, and suppresses the sound. - usage: | - / [Check] - Checks whether silent chest is enabled + / [check] - Checks whether item openinv is enabled. anychest: aliases: [ac] - description: Toggle anychest function, which allows opening of blocked chests. + description: Toggles the any chest function, which allows opening of blocked chests. usage: | - / [Check] - Checks whether anychest is enabled + / [check] - Checks whether any chest is enabled. + silentchest: + aliases: [sc, silent] + description: Toggles the silent chest function, which hides the animation of a chest when opened or closed, and suppresses the sound. + usage: | + / [check] - Checks whether silent chest is enabled. \ No newline at end of file