diff --git a/pom.xml b/pom.xml index b92241e..bc36ee3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.lishid openinv jar - 2.3.6 + 2.3.7 OpenInv http://dev.bukkit.org/bukkit-plugins/openinv/ diff --git a/src/main/java/com/lishid/openinv/Configuration.java b/src/main/java/com/lishid/openinv/Configuration.java index b391ccf..1a03d9a 100644 --- a/src/main/java/com/lishid/openinv/Configuration.java +++ b/src/main/java/com/lishid/openinv/Configuration.java @@ -46,13 +46,20 @@ public class Configuration { notifyAnyChest = plugin.getConfig().getBoolean("notify.any-chest", true); } + /** + * Reloads OpenInv's config settings. + */ + public void reload() { + load(); + } + /** * Saves a value to the plugin config at the specified path. * * @param path the path to set the value to * @param value the value to set to the path */ - public void saveToConfig(String path, Object value) { + private void saveToConfig(String path, Object value) { plugin.getConfig().set(path, value); plugin.saveConfig(); } diff --git a/src/main/java/com/lishid/openinv/OpenInv.java b/src/main/java/com/lishid/openinv/OpenInv.java index 08d563f..d6b18f0 100644 --- a/src/main/java/com/lishid/openinv/OpenInv.java +++ b/src/main/java/com/lishid/openinv/OpenInv.java @@ -56,6 +56,9 @@ public class OpenInv extends JavaPlugin { @Override public void onEnable() { + // Save the default config.yml if it doesn't already exist + saveDefaultConfig(); + // Config configuration = new Configuration(this); @@ -64,9 +67,6 @@ public class OpenInv extends JavaPlugin { inventoryAccess = new InventoryAccess(this); anySilentChest = new AnySilentChest(this); - // Save the default config.yml if it doesn't already exist - saveDefaultConfig(); - // Register the plugin's events PluginManager pm = getServer().getPluginManager(); @@ -155,27 +155,27 @@ public class OpenInv extends JavaPlugin { * @param player the player to show help to */ public static void showHelp(Player player) { - player.sendMessage(ChatColor.GREEN + "/openinv - Open a player's inventory."); + player.sendMessage(ChatColor.GREEN + "/openinv - Opens 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 + "/openender - Opens 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 + " Searches and lists players that have a specific item in their inventory."); 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 + " Searches and lists players that have a specific item in their ender chest."); player.sendMessage(ChatColor.GREEN + " (aliases: se)"); - player.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggle the item openinv function."); + player.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggles 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 + "/anychest - Toggles the any chest function."); player.sendMessage(ChatColor.GREEN + " (aliases: ac)"); - player.sendMessage(ChatColor.GREEN + "/silentchest - Toggle the silent chest function."); + player.sendMessage(ChatColor.GREEN + "/silentchest - Toggles the silent chest function."); player.sendMessage(ChatColor.GREEN + " (aliases: sc, silent)"); } diff --git a/src/main/java/com/lishid/openinv/commands/SilentChestCommand.java b/src/main/java/com/lishid/openinv/commands/SilentChestCommand.java index 73de4c5..6b14379 100644 --- a/src/main/java/com/lishid/openinv/commands/SilentChestCommand.java +++ b/src/main/java/com/lishid/openinv/commands/SilentChestCommand.java @@ -54,7 +54,7 @@ public class SilentChestCommand implements CommandExecutor { if (args.length > 0) { if (args[0].equalsIgnoreCase("check")) { String status = configuration.getPlayerSilentChestStatus(player) ? ChatColor.GREEN + "ON" : ChatColor.RED + "OFF"; - plugin.sendMessage(player, "Silent Chest is " + status + ChatColor.RESET + "."); + OpenInv.sendMessage(player, "Silent Chest is " + status + ChatColor.RESET + "."); return true; } } @@ -62,7 +62,7 @@ public class SilentChestCommand implements CommandExecutor { configuration.setPlayerSilentChestStatus(player, !configuration.getPlayerSilentChestStatus(player)); String status = configuration.getPlayerSilentChestStatus(player) ? ChatColor.GREEN + "ON" : ChatColor.RED + "OFF"; - plugin.sendMessage(player, "Silent Chest is now " + status + ChatColor.RESET + "."); + OpenInv.sendMessage(player, "Silent Chest is now " + status + ChatColor.RESET + "."); return true; } diff --git a/src/main/java/com/lishid/openinv/commands/ToggleOpenInvCommand.java b/src/main/java/com/lishid/openinv/commands/ToggleOpenInvCommand.java index b6edd62..dcda462 100644 --- a/src/main/java/com/lishid/openinv/commands/ToggleOpenInvCommand.java +++ b/src/main/java/com/lishid/openinv/commands/ToggleOpenInvCommand.java @@ -54,7 +54,7 @@ public class ToggleOpenInvCommand implements CommandExecutor { if (args.length > 0) { if (args[0].equalsIgnoreCase("check")) { String status = configuration.getPlayerItemOpenInvStatus(player) ? ChatColor.GREEN + "ON" : ChatColor.RED + "OFF"; - plugin.sendMessage(player, "OpenInv with " + ChatColor.GRAY + configuration.getOpenInvItem() + ChatColor.RESET + status + ChatColor.RESET + "."); + OpenInv.sendMessage(player, "OpenInv with " + ChatColor.GRAY + configuration.getOpenInvItem() + ChatColor.RESET + status + ChatColor.RESET + "."); return true; } } @@ -62,7 +62,7 @@ public class ToggleOpenInvCommand implements CommandExecutor { configuration.setPlayerItemOpenInvStatus(player, !configuration.getPlayerItemOpenInvStatus(player)); String status = configuration.getPlayerItemOpenInvStatus(player) ? ChatColor.GREEN + "ON" : ChatColor.RED + "OFF"; - plugin.sendMessage(player, "OpenInv with " + ChatColor.GRAY + configuration.getOpenInvItem() + ChatColor.RESET + " is now " + status + ChatColor.RESET + "."); + OpenInv.sendMessage(player, "OpenInv with " + ChatColor.GRAY + configuration.getOpenInvItem() + ChatColor.RESET + " is now " + status + ChatColor.RESET + "."); 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 1a22b97..ae43489 100644 --- a/src/main/java/com/lishid/openinv/internal/AnySilentChest.java +++ b/src/main/java/com/lishid/openinv/internal/AnySilentChest.java @@ -152,7 +152,7 @@ public class AnySilentChest { tileInventory = new SilentInventory(tileInventory); if (plugin.getConfiguration().notifySilentChest()) { - plugin.sendMessage(p, "You are opening a chest silently."); + OpenInv.sendMessage(p, "You are opening a chest silently."); } returnValue = false; @@ -161,7 +161,7 @@ public class AnySilentChest { player.openContainer(tileInventory); if (anyChest && plugin.getConfiguration().notifyAnyChest()) { - plugin.sendMessage(p, "You are opening a blocked chest."); + OpenInv.sendMessage(p, "You are opening a blocked chest."); } return returnValue; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e5093ff..d1be4db 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: OpenInv main: com.lishid.openinv.OpenInv -version: 2.3.6 +version: 2.3.7 author: lishid authors: [ShadowRanger] description: >