Thread-Safe

Former-commit-id: 0062a141bedd371e8f28a5ee6dab864c7d0180a8
This commit is contained in:
Ghost_chu committed 2020-03-02 13:48:24 +08:00
1 parent 993903d425
commit e7aea87f39
2 files changed
+12 -5

No files matched your search

@@ -26,7 +26,6 @@ import java.sql.SQLException;
import java.util.*;
import java.util.logging.Logger;
import lombok.Data;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -58,10 +57,8 @@ public class ShopLoader {
private int totalLoaded = 0;
/* This may contains broken shop, must use null check before load it. */
@Getter
private List<Shop> shopsInDatabase = new ArrayList<>();
@Getter
private List<ShopDatabaseInfoOrigin> originShopsInDatabase = new ArrayList<>();
/**
@@ -302,6 +299,16 @@ public class ShopLoader {
}
}
@NotNull
public List<Shop> getShopsInDatabase() {
return new ArrayList<>(shopsInDatabase);
}
@NotNull
public List<ShopDatabaseInfoOrigin> getOriginShopsInDatabase() {
return new ArrayList<>(originShopsInDatabase);
}
@Data
public class ShopDatabaseInfo {
private ItemStack item;
@@ -318,8 +318,8 @@ public class Paste {
finalReport.append("Shops in Mem:\n");
plugin
.getShopLoader()
.getShopsInDatabase()
.forEach((shop -> finalReport.append("\t").append(shop).append("\n")));
.getOriginShopsInDatabase()
.forEach((shop -> finalReport.append(shop).append("\n")));
finalReport
.append("Total: ")
.append(plugin.getShopLoader().getShopsInDatabase().size())