OpenOfflineInv return the player target created for opening the inv, to

be put in the history.
This commit is contained in:
Antoine Aflalo
2012-05-25 10:19:54 +02:00
parent 31c743cf73
commit 40644e337a
2 changed files with 3 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ public class InventoryManager {
* /openinv/commands/OpenInvPluginCommand.java} * /openinv/commands/OpenInvPluginCommand.java}
* @throws WorldNotFoundException * @throws WorldNotFoundException
*/ */
public void openOfflineInv(final Player sender, final String name, final String world) public Player openOfflineInv(final Player sender, final String name, final String world)
throws PlayerNotFound, WorldNotFoundException { throws PlayerNotFound, WorldNotFoundException {
Player target = null; Player target = null;
final HashMap<String, String> replace = new HashMap<String, String>(); final HashMap<String, String> replace = new HashMap<String, String>();
@@ -112,6 +112,7 @@ public class InventoryManager {
+ ChatColor.RED + " can't be found."); + ChatColor.RED + " can't be found.");
} }
openInv(sender, target, true); openInv(sender, target, true);
return target;
} }
/** /**

View File

@@ -84,7 +84,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
target = this.plugin.getServer().getPlayer(name); target = this.plugin.getServer().getPlayer(name);
if (target == null) { if (target == null) {
try { try {
InventoryManager.INSTANCE.openOfflineInv(player, name, player.getWorld().getName()); target = InventoryManager.INSTANCE.openOfflineInv(player, name, player.getWorld().getName());
} catch (PlayerNotFound e) { } catch (PlayerNotFound e) {
sender.sendMessage(e.getMessage()); sender.sendMessage(e.getMessage());
} catch (WorldNotFoundException e) { } catch (WorldNotFoundException e) {