Check before load/unload

Former-commit-id: 774c929b5deb80a3e487ef8bd625c0de53d8f3b0 [formerly bf106ec8fedeeecbcb789db31a43abda59bd2e4f]
Former-commit-id: 57ba1a0e8c3f1d168292dbbe6f5ede45ad410726
This commit is contained in:
Ghost_chu committed 2019-06-06 16:48:44 +08:00
1 parent 123782214e
commit 239af3a618
1 file changed
+10 -1
@@ -635,7 +635,8 @@ public class ContainerShop implements Shop {
*/
public void delete(boolean fromMemory) {
// Unload the shop
this.onUnload();
if (isLoaded)
this.onUnload();
// Delete the display item
if (this.getDisplayItem() != null) {
this.getDisplayItem().remove();
@@ -740,6 +741,10 @@ public class ContainerShop implements Shop {
* Unload ContainerShop.
*/
public void onUnload() {
if (!this.isLoaded) {
Util.debugLog("Dupe unload request, cancelled.");
return;
}
if (this.getDisplayItem() != null) {
this.getDisplayItem().remove();
this.displayItem = null;
@@ -751,6 +756,10 @@ public class ContainerShop implements Shop {
* Load ContainerShop.
*/
public void onLoad() {
if (this.isLoaded) {
Util.debugLog("Dupe load request, cancelled.");
return;
}
checkDisplay();
//Clear the chest?