Plugin update #25
@@ -34,7 +34,7 @@ import com.lishid.openinv.utils.UUIDUtil;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class OpenEnderPluginCommand implements CommandExecutor {
 | 
					public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			||||||
    private final OpenInv plugin;
 | 
					    private final OpenInv plugin;
 | 
				
			||||||
    public static final Map<UUID, UUID> openEnderHistory = new ConcurrentHashMap<UUID, UUID>();
 | 
					    private final Map<UUID, UUID> openEnderHistory = new ConcurrentHashMap<UUID, UUID>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public OpenEnderPluginCommand(OpenInv plugin) {
 | 
					    public OpenEnderPluginCommand(OpenInv plugin) {
 | 
				
			||||||
        this.plugin = plugin;
 | 
					        this.plugin = plugin;
 | 
				
			||||||
@@ -49,7 +49,7 @@ public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!OpenInv.hasPermission(sender, Permissions.PERM_ENDERCHEST)) {
 | 
					            if (!OpenInv.hasPermission(sender, Permissions.PERM_ENDERCHEST)) {
 | 
				
			||||||
                sender.sendMessage(ChatColor.RED + "You do not have permission to access player enderchest");
 | 
					                sender.sendMessage(ChatColor.RED + "You do not have permission to access player enderchests.");
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -58,7 +58,7 @@ public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			|||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Player player = (Player) sender;
 | 
					            final Player player = (Player) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // History management
 | 
					            // History management
 | 
				
			||||||
            UUID history = openEnderHistory.get(player.getUniqueId());
 | 
					            UUID history = openEnderHistory.get(player.getUniqueId());
 | 
				
			||||||
@@ -85,21 +85,25 @@ public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            final UUID playerUUID = player.getUniqueId();
 | 
					            final UUID playerUUID = player.getUniqueId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Player target = Bukkit.getPlayer(uuid);
 | 
					            Player target = Bukkit.getPlayer(uuid);
 | 
				
			||||||
            // Targeted player was not found online, start asynchron lookup in files
 | 
					 | 
				
			||||||
            if (target == null) {
 | 
					            if (target == null) {
 | 
				
			||||||
                sender.sendMessage(ChatColor.GREEN + "Starting inventory lookup.");
 | 
					                // Targeted player was not found online, start asynchronous lookup in files
 | 
				
			||||||
                plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
 | 
					                Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
 | 
				
			||||||
                    @Override
 | 
					                    @Override
 | 
				
			||||||
                    public void run() {
 | 
					                    public void run() {
 | 
				
			||||||
                        // Try loading the player's data asynchronly
 | 
					                        // Try loading the player's data asynchronously
 | 
				
			||||||
                        final Player target = OpenInv.playerLoader.loadPlayer(uuid);
 | 
					                        final Player target = OpenInv.playerLoader.loadPlayer(uuid);
 | 
				
			||||||
                        // Back to synchron to send messages and display inventory
 | 
					                        if (target == null) {
 | 
				
			||||||
 | 
					                            player.sendMessage(ChatColor.RED + "Player not found!");
 | 
				
			||||||
 | 
					                            return;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        // Open target's inventory synchronously
 | 
				
			||||||
                        Bukkit.getScheduler().runTask(plugin, new Runnable() {
 | 
					                        Bukkit.getScheduler().runTask(plugin, new Runnable() {
 | 
				
			||||||
                            @Override
 | 
					                            @Override
 | 
				
			||||||
                            public void run() {
 | 
					                            public void run() {
 | 
				
			||||||
                                Player player = Bukkit.getPlayer(playerUUID);
 | 
					                                Player player = Bukkit.getPlayer(playerUUID);
 | 
				
			||||||
                                // If sender is no longer online after loading the target. Abort!
 | 
					                                // If sender is no longer online after loading the target, abort!
 | 
				
			||||||
                                if (player == null) {
 | 
					                                if (player == null) {
 | 
				
			||||||
                                    return;
 | 
					                                    return;
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ import com.lishid.openinv.utils.UUIDUtil;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class OpenInvPluginCommand implements CommandExecutor {
 | 
					public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			||||||
    private final OpenInv plugin;
 | 
					    private final OpenInv plugin;
 | 
				
			||||||
    public static final Map<UUID, UUID> openInvHistory = new ConcurrentHashMap<UUID, UUID>();
 | 
					    private final Map<UUID, UUID> openInvHistory = new ConcurrentHashMap<UUID, UUID>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public OpenInvPluginCommand(OpenInv plugin) {
 | 
					    public OpenInvPluginCommand(OpenInv plugin) {
 | 
				
			||||||
        this.plugin = plugin;
 | 
					        this.plugin = plugin;
 | 
				
			||||||
@@ -48,7 +48,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!OpenInv.hasPermission(sender, Permissions.PERM_OPENINV)) {
 | 
					            if (!OpenInv.hasPermission(sender, Permissions.PERM_OPENINV)) {
 | 
				
			||||||
                sender.sendMessage(ChatColor.RED + "You do not have permission to access player inventories");
 | 
					                sender.sendMessage(ChatColor.RED + "You do not have permission to access player inventories.");
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -57,7 +57,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Player player = (Player) sender;
 | 
					            final Player player = (Player) sender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // History management
 | 
					            // History management
 | 
				
			||||||
            UUID history = openInvHistory.get(player.getUniqueId());
 | 
					            UUID history = openInvHistory.get(player.getUniqueId());
 | 
				
			||||||
@@ -78,21 +78,25 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            final UUID playerUUID = player.getUniqueId();
 | 
					            final UUID playerUUID = player.getUniqueId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Player target = Bukkit.getPlayer(uuid);
 | 
					            Player target = Bukkit.getPlayer(uuid);
 | 
				
			||||||
            // Targeted player was not found online, start asynchron lookup in files
 | 
					 | 
				
			||||||
            if (target == null) {
 | 
					            if (target == null) {
 | 
				
			||||||
                sender.sendMessage(ChatColor.GREEN + "Starting inventory lookup.");
 | 
					                // Targeted player was not found online, start asynchronous lookup in files
 | 
				
			||||||
                plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
 | 
					                Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
 | 
				
			||||||
                    @Override
 | 
					                    @Override
 | 
				
			||||||
                    public void run() {
 | 
					                    public void run() {
 | 
				
			||||||
                        // Try loading the player's data asynchronly
 | 
					                        // Try loading the player's data asynchronously
 | 
				
			||||||
                        final Player target = OpenInv.playerLoader.loadPlayer(uuid);
 | 
					                        final Player target = OpenInv.playerLoader.loadPlayer(uuid);
 | 
				
			||||||
                        // Back to synchron to send messages and display inventory
 | 
					                        if (target == null) {
 | 
				
			||||||
 | 
					                            player.sendMessage(ChatColor.RED + "Player not found!");
 | 
				
			||||||
 | 
					                            return;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        // Open target's inventory synchronously
 | 
				
			||||||
                        Bukkit.getScheduler().runTask(plugin, new Runnable() {
 | 
					                        Bukkit.getScheduler().runTask(plugin, new Runnable() {
 | 
				
			||||||
                            @Override
 | 
					                            @Override
 | 
				
			||||||
                            public void run() {
 | 
					                            public void run() {
 | 
				
			||||||
                                Player player = Bukkit.getPlayer(playerUUID);
 | 
					                                Player player = Bukkit.getPlayer(playerUUID);
 | 
				
			||||||
                                // If sender is no longer online after loading the target. Abort!
 | 
					                                // If sender is no longer online after loading the target, abort!
 | 
				
			||||||
                                if (player == null) {
 | 
					                                if (player == null) {
 | 
				
			||||||
                                    return;
 | 
					                                    return;
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ public class PlayerDataManager {
 | 
				
			|||||||
    public Player loadPlayer(UUID uuid) {
 | 
					    public Player loadPlayer(UUID uuid) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
 | 
					            OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
 | 
				
			||||||
            if (player == null) {
 | 
					            if (player == null || !player.hasPlayedBefore()) {
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            GameProfile profile = new GameProfile(uuid, player.getName());
 | 
					            GameProfile profile = new GameProfile(uuid, player.getName());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ public class SpecialPlayerInventory extends PlayerInventory {
 | 
				
			|||||||
    private CraftPlayer owner;
 | 
					    private CraftPlayer owner;
 | 
				
			||||||
    private boolean playerOnline = false;
 | 
					    private boolean playerOnline = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public SpecialPlayerInventory(Player p, Boolean online) {
 | 
					    public SpecialPlayerInventory(Player p, boolean online) {
 | 
				
			||||||
        super(((CraftPlayer) p).getHandle());
 | 
					        super(((CraftPlayer) p).getHandle());
 | 
				
			||||||
        this.owner = (CraftPlayer) p;
 | 
					        this.owner = (CraftPlayer) p;
 | 
				
			||||||
        this.items = player.inventory.items;
 | 
					        this.items = player.inventory.items;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user