Fix conflict with other inventory modification plugins (like JSNONAPI) i... #13

Closed
caver115 wants to merge 2 commits from master into master
5 changed files with 28 additions and 26 deletions
Showing only changes of commit 5f3af49f50 - Show all commits

View File

@@ -79,14 +79,12 @@ public class OpenInvPluginCommand implements CommandExecutor {
target = this.plugin.getServer().getPlayer(name); target = this.plugin.getServer().getPlayer(name);
if (target == null) { if (target == null) {
if (target == null) { // Try loading the player's data
// Try loading the player's data target = OpenInv.playerLoader.loadPlayer(name);
target = OpenInv.playerLoader.loadPlayer(name);
if (target == null) { if (target == null) {
sender.sendMessage(ChatColor.RED + "Player " + name + " not found!"); sender.sendMessage(ChatColor.RED + "Player " + name + " not found!");
return true; return true;
}
} }
} }

View File

@@ -50,7 +50,8 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
@Override @Override
public void InventoryRemovalCheck() { public void InventoryRemovalCheck() {
owner.saveData(); owner.saveData();
if (transaction.isEmpty() && !playerOnline) { // Conflict with other Offline inventory modification plugins like JSONAPI
if (transaction.isEmpty() || !playerOnline) {
OpenInv.inventories.remove(owner.getName().toLowerCase()); OpenInv.inventories.remove(owner.getName().toLowerCase());
} }
} }

View File

@@ -50,7 +50,8 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
@Override @Override
public void InventoryRemovalCheck() { public void InventoryRemovalCheck() {
owner.saveData(); owner.saveData();
if (transaction.isEmpty() && !playerOnline) { // Conflict with other Offline inventory modification plugins like JSONAPI
if (transaction.isEmpty() || !playerOnline) {
OpenInv.inventories.remove(owner.getName().toLowerCase()); OpenInv.inventories.remove(owner.getName().toLowerCase());
} }
} }

View File

@@ -50,7 +50,8 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
@Override @Override
public void InventoryRemovalCheck() { public void InventoryRemovalCheck() {
owner.saveData(); owner.saveData();
if (transaction.isEmpty() && !playerOnline) { // Conflict with other Offline inventory modification plugins like JSONAPI
if (transaction.isEmpty() || !playerOnline) {
OpenInv.inventories.remove(owner.getName().toLowerCase()); OpenInv.inventories.remove(owner.getName().toLowerCase());
} }
} }

View File

@@ -50,7 +50,8 @@ public class SpecialPlayerInventory extends PlayerInventory implements ISpecialP
@Override @Override
public void InventoryRemovalCheck() { public void InventoryRemovalCheck() {
owner.saveData(); owner.saveData();
if (transaction.isEmpty() && !playerOnline) { // Conflict with other Offline inventory modification plugins like JSONAPI
if (transaction.isEmpty() || !playerOnline) {
OpenInv.inventories.remove(owner.getName().toLowerCase()); OpenInv.inventories.remove(owner.getName().toLowerCase());
} }
} }