API: ShopManager#getPlayerAllShops

Former-commit-id: 3501a5db4847a43aeff392ad645d8c73e788e40a [formerly ff61e170bd2bbf34526b0cfec7671355a817cd7f]
Former-commit-id: 959e8655baf4fcb51753b03210d16c6d049e0414
This commit is contained in:
Ghost_chu committed 2019-11-16 15:21:50 +08:00
1 parent 34e008bc54
commit 055996fa7d
1 file changed
+20
@@ -965,4 +965,24 @@ public class ShopManager {
public @Nullable Set<Shop> getLoadedShops() {
return this.loadedShops;
}
/**
* Get a players all shops.
* @param playerUUID The player's uuid.
* @param ignoreUnlimitedShop Set we should ignore unlimited to get.
* @return The list have this player's all shops.
*/
public @NotNull List<Shop> getPlayerAllShops(@NotNull UUID playerUUID, boolean ignoreUnlimitedShop){
List<Shop> collectedShops = new ArrayList<>();
for(Shop shop : getAllShops()){
if(!shop.getOwner().equals(playerUUID)){
continue;
}
if(ignoreUnlimitedShop && shop.isUnlimited()){
continue;
}
collectedShops.add(shop);
}
return collectedShops;
}
}