diff --git a/.gitignore b/.gitignore index 2a32706..37fa0ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ -.classpath -.project -.idea +/.settings +/.gitignore +/.project +/.classpath +/.idea +/bin +/lib +/out *.iml -bin/ -lib/ -out/ \ No newline at end of file diff --git a/src/main/java/com/lishid/openinv/commands/OpenInvPluginCommand.java b/src/main/java/com/lishid/openinv/commands/OpenInvPluginCommand.java index 4457cde..678febc 100644 --- a/src/main/java/com/lishid/openinv/commands/OpenInvPluginCommand.java +++ b/src/main/java/com/lishid/openinv/commands/OpenInvPluginCommand.java @@ -79,14 +79,12 @@ public class OpenInvPluginCommand implements CommandExecutor { target = this.plugin.getServer().getPlayer(name); if (target == null) { - if (target == null) { - // Try loading the player's data - target = OpenInv.playerLoader.loadPlayer(name); + // Try loading the player's data + target = OpenInv.playerLoader.loadPlayer(name); - if (target == null) { - sender.sendMessage(ChatColor.RED + "Player " + name + " not found!"); - return true; - } + if (target == null) { + sender.sendMessage(ChatColor.RED + "Player " + name + " not found!"); + return true; } } diff --git a/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java b/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java index ae3a6ad..90dca7f 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java +++ b/src/main/java/com/lishid/openinv/internal/v1_8_R1/PlayerDataManager.java @@ -16,8 +16,6 @@ package com.lishid.openinv.internal.v1_8_R1; -import java.io.File; - import java.util.UUID; import org.bukkit.Bukkit; @@ -41,12 +39,6 @@ public class PlayerDataManager implements IPlayerDataManager { return null; } - // Default player folder - File playerfolder = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "playerdata"); - if (!playerfolder.exists()) { - return null; - } - OfflinePlayer player = Bukkit.getOfflinePlayer(uuid); if (player == null) { return null; @@ -57,7 +49,7 @@ public class PlayerDataManager implements IPlayerDataManager { EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), profile, new PlayerInteractManager(server.getWorldServer(0))); // Get the bukkit entity - Player target = (entity == null) ? null : entity.getBukkitEntity(); + Player target = entity.getBukkitEntity(); if (target != null) { // Load data target.loadData(); @@ -81,7 +73,7 @@ public class PlayerDataManager implements IPlayerDataManager { OfflinePlayer[] offlinePlayers = Bukkit.getOfflinePlayers(); for (OfflinePlayer player : offlinePlayers) { String name = player.getName(); - + if (name == null){ continue; } diff --git a/src/main/java/com/lishid/openinv/internal/v1_8_R1/SilentInventory.java b/src/main/java/com/lishid/openinv/internal/v1_8_R1/SilentInventory.java index 6ce2f8a..df15bd8 100644 --- a/src/main/java/com/lishid/openinv/internal/v1_8_R1/SilentInventory.java +++ b/src/main/java/com/lishid/openinv/internal/v1_8_R1/SilentInventory.java @@ -71,12 +71,12 @@ public class SilentInventory implements ITileInventory { @Override public void startOpen(EntityHuman entityHuman) { - inv.startOpen(entityHuman); + //Don't do anything } @Override public void closeContainer(EntityHuman entityHuman) { - inv.closeContainer(entityHuman); + //Don't do anything } @Override @@ -151,7 +151,8 @@ public class SilentInventory implements ITileInventory { @Override public Container createContainer(PlayerInventory playerInventory, EntityHuman entityHuman) { - return inv.createContainer(playerInventory, entityHuman); + //Don't let the chest itself create the container. + return new ContainerChest(playerInventory, this, entityHuman); } @Override diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 24d8479..88cfd0f 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.2.7 +version: 2.2.8 author: lishid description: > This plugin allows you to open a player's inventory as a chest and interact with it in real time.