Fix conflict with other inventory modification plugins (like JSNONAPI) in offline mode. Double null check removed.
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -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;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -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