Shortened getShops method in ShopUtils

This commit is contained in:
Eric 2016-11-25 13:55:39 +01:00
parent a522197112
commit 1fa0f08073

View File

@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.permissions.PermissionAttachmentInfo;
import java.util.ArrayList; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
public class ShopUtils { public class ShopUtils {
@ -51,12 +51,7 @@ public class ShopUtils {
* @return Array of all Shops * @return Array of all Shops
*/ */
public Shop[] getShops() { public Shop[] getShops() {
ArrayList<Shop> shops = new ArrayList<>(); Collection<Shop> shops = shopLocation.values();
for (Shop shop : shopLocation.values()) {
shops.add(shop);
}
return shops.toArray(new Shop[shops.size()]); return shops.toArray(new Shop[shops.size()]);
} }