Fix inventories of players on their first login not being openable
Closes #7
This commit is contained in:
		@@ -40,6 +40,7 @@ public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			|||||||
        this.plugin = plugin;
 | 
					        this.plugin = plugin;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
        if (!(sender instanceof Player)) {
 | 
					        if (!(sender instanceof Player)) {
 | 
				
			||||||
            sender.sendMessage(ChatColor.RED + "You can't use this from the console.");
 | 
					            sender.sendMessage(ChatColor.RED + "You can't use this from the console.");
 | 
				
			||||||
@@ -72,6 +73,7 @@ public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        new BukkitRunnable() {
 | 
					        new BukkitRunnable() {
 | 
				
			||||||
 | 
					            @Override
 | 
				
			||||||
            public void run() {
 | 
					            public void run() {
 | 
				
			||||||
                List<Player> matches = Bukkit.matchPlayer(name);
 | 
					                List<Player> matches = Bukkit.matchPlayer(name);
 | 
				
			||||||
                final OfflinePlayer offlinePlayer;
 | 
					                final OfflinePlayer offlinePlayer;
 | 
				
			||||||
@@ -83,11 +85,12 @@ public class OpenEnderPluginCommand implements CommandExecutor {
 | 
				
			|||||||
                if (!player.isOnline()) {
 | 
					                if (!player.isOnline()) {
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (offlinePlayer == null || !offlinePlayer.hasPlayedBefore()) {
 | 
					                if (offlinePlayer == null || !offlinePlayer.hasPlayedBefore() && !offlinePlayer.isOnline()) {
 | 
				
			||||||
                    player.sendMessage(ChatColor.RED + "Player not found!");
 | 
					                    player.sendMessage(ChatColor.RED + "Player not found!");
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                new BukkitRunnable() {
 | 
					                new BukkitRunnable() {
 | 
				
			||||||
 | 
					                    @Override
 | 
				
			||||||
                    public void run() {
 | 
					                    public void run() {
 | 
				
			||||||
                        if (!player.isOnline()) {
 | 
					                        if (!player.isOnline()) {
 | 
				
			||||||
                            return;
 | 
					                            return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,6 +40,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
        this.plugin = plugin;
 | 
					        this.plugin = plugin;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
        if (!(sender instanceof Player)) {
 | 
					        if (!(sender instanceof Player)) {
 | 
				
			||||||
            sender.sendMessage(ChatColor.RED + "You can't use this from the console.");
 | 
					            sender.sendMessage(ChatColor.RED + "You can't use this from the console.");
 | 
				
			||||||
@@ -72,6 +73,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        new BukkitRunnable() {
 | 
					        new BukkitRunnable() {
 | 
				
			||||||
 | 
					            @Override
 | 
				
			||||||
            public void run() {
 | 
					            public void run() {
 | 
				
			||||||
                List<Player> matches = Bukkit.matchPlayer(name);
 | 
					                List<Player> matches = Bukkit.matchPlayer(name);
 | 
				
			||||||
                final OfflinePlayer offlinePlayer;
 | 
					                final OfflinePlayer offlinePlayer;
 | 
				
			||||||
@@ -83,11 +85,12 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
                if (!player.isOnline()) {
 | 
					                if (!player.isOnline()) {
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if (offlinePlayer == null || !offlinePlayer.hasPlayedBefore()) {
 | 
					                if (offlinePlayer == null || !offlinePlayer.hasPlayedBefore() && !offlinePlayer.isOnline()) {
 | 
				
			||||||
                    player.sendMessage(ChatColor.RED + "Player not found!");
 | 
					                    player.sendMessage(ChatColor.RED + "Player not found!");
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                new BukkitRunnable() {
 | 
					                new BukkitRunnable() {
 | 
				
			||||||
 | 
					                    @Override
 | 
				
			||||||
                    public void run() {
 | 
					                    public void run() {
 | 
				
			||||||
                        if (!player.isOnline()) {
 | 
					                        if (!player.isOnline()) {
 | 
				
			||||||
                            return;
 | 
					                            return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
name: OpenInv
 | 
					name: OpenInv
 | 
				
			||||||
main: com.lishid.openinv.OpenInv
 | 
					main: com.lishid.openinv.OpenInv
 | 
				
			||||||
version: 2.4.1
 | 
					version: 2.4.3
 | 
				
			||||||
author: lishid
 | 
					author: lishid
 | 
				
			||||||
authors: [Jikoo]
 | 
					authors: [Jikoo]
 | 
				
			||||||
description: >
 | 
					description: >
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user