Method getShops now returns a collection

This commit is contained in:
MineTheCube 2017-07-27 13:10:00 +02:00
parent 5bb338494d
commit 48059811fb

View File

@ -18,6 +18,7 @@ import java.util.*;
public class ShopUtils { public class ShopUtils {
private final HashMap<Location, Shop> shopLocation = new HashMap<>(); private final HashMap<Location, Shop> shopLocation = new HashMap<>();
private final Collection<Shop> shopLocationValues = Collections.unmodifiableCollection(shopLocation.values());
private final HashMap<UUID, Location> playerLocation = new HashMap<>(); private final HashMap<UUID, Location> playerLocation = new HashMap<>();
private final ShopChest plugin; private final ShopChest plugin;
@ -48,11 +49,11 @@ public class ShopUtils {
} }
/** /**
* Get all Shops * Get all shops
* @return Array of all Shops * @return Read-only collection of all shops, may contain duplicates
*/ */
public Shop[] getShops() { public Collection<Shop> getShops() {
return shopLocation.values().toArray(new Shop[0]); return shopLocationValues;
} }
/** /**