Fix conflict with other inventory modification plugins (like JSNONAPI) i... #13
@@ -78,7 +78,6 @@ 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);
 | 
				
			||||||
@@ -88,7 +87,6 @@ public class OpenInvPluginCommand implements CommandExecutor {
 | 
				
			|||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Permissions checks
 | 
					        // Permissions checks
 | 
				
			||||||
        if (!OpenInv.hasPermission(player, Permissions.PERM_OVERRIDE) && OpenInv.hasPermission(target, Permissions.PERM_EXEMPT)) {
 | 
					        if (!OpenInv.hasPermission(player, Permissions.PERM_OVERRIDE) && OpenInv.hasPermission(target, Permissions.PERM_EXEMPT)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user