mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Add delete checking to prevent some bad happened
Former-commit-id: e6d8af25c8c538aa6e4b39e0c200d3b46703d6cb
This commit is contained in:
1 parent
ae0d21fa94
commit
02a2fbce0f
3 files changed
+20
-3
No files matched your search
@@ -155,7 +155,9 @@ public class DatabaseHelper {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
onSuccess.run();
|
||||
if(!shop.isDeleted()) {
|
||||
onSuccess.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,10 @@ public class ContainerShop implements Shop {
|
||||
private DisplayItem displayItem;
|
||||
|
||||
@EqualsAndHashCode.Exclude
|
||||
private boolean isLoaded = false;
|
||||
private volatile boolean isLoaded = false;
|
||||
|
||||
@EqualsAndHashCode.Exclude
|
||||
private volatile boolean isDeleted= false;
|
||||
|
||||
private ShopModerator moderator;
|
||||
|
||||
@@ -316,6 +319,7 @@ public class ContainerShop implements Shop {
|
||||
Util.debugLog("Shop deletion was canceled because a plugin canceled it.");
|
||||
return;
|
||||
}
|
||||
isDeleted=true;
|
||||
// Unload the shop
|
||||
if (isLoaded) {
|
||||
this.onUnload();
|
||||
@@ -853,6 +857,11 @@ public class ContainerShop implements Shop {
|
||||
return Util.canBeShop(this.getLocation().getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable DisplayItem getDisplay() {
|
||||
return this.displayItem;
|
||||
|
||||
@@ -313,12 +313,18 @@ public interface Shop {
|
||||
void setUnlimited(boolean paramBoolean);
|
||||
|
||||
/**
|
||||
* Shop is valid
|
||||
* Whether Shop is valid
|
||||
*
|
||||
* @return status
|
||||
*/
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* Whether Shop is deleted
|
||||
*
|
||||
* @return status
|
||||
*/
|
||||
boolean isDeleted();
|
||||
|
||||
/**
|
||||
* Get the shop display entity
|
||||
|
||||
Reference in new issue
Block a user