Use API references
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.alttd.playershops.handler;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.api.Shop;
|
||||
import com.alttd.playershops.api.ShopHandler;
|
||||
import com.alttd.playershops.config.Config;
|
||||
import com.alttd.playershops.shop.AbstractShop;
|
||||
@@ -22,7 +23,7 @@ public class ShopHandlerImpl implements ShopHandler {
|
||||
@Getter
|
||||
private final Object2IntMap<UUID> shopBuildLimits;
|
||||
@Getter
|
||||
private final Map<Location, AbstractShop> shopLocation;
|
||||
private final Map<Location, Shop> shopLocation;
|
||||
@Getter
|
||||
private final ArrayList<Material> shopMaterials;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class ShopHandlerImpl implements ShopHandler {
|
||||
shopMaterials = new ArrayList<>(); // TODO move into parent method where materials are loaded in.
|
||||
}
|
||||
|
||||
public AbstractShop getShop(Location location) {
|
||||
public Shop getShop(Location location) {
|
||||
Location newLocation = new Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
|
||||
return shopLocation.get(newLocation);
|
||||
@@ -44,7 +45,7 @@ public class ShopHandlerImpl implements ShopHandler {
|
||||
return getShop(location) != null;
|
||||
}
|
||||
|
||||
public Collection<AbstractShop> getShops() {
|
||||
public Collection<Shop> getShops() {
|
||||
return Collections.unmodifiableCollection(shopLocation.values());
|
||||
}
|
||||
|
||||
@@ -67,24 +68,24 @@ public class ShopHandlerImpl implements ShopHandler {
|
||||
return shopMaterials.contains(block.getType());
|
||||
}
|
||||
|
||||
public List<AbstractShop> getShops(UUID uuid) {
|
||||
List<AbstractShop> shops = new ArrayList<>();
|
||||
for (AbstractShop shop : shopLocation.values()) {
|
||||
public List<Shop> getShops(UUID uuid) {
|
||||
List<Shop> shops = new ArrayList<>();
|
||||
for (Shop shop : shopLocation.values()) {
|
||||
if (shop.getOwnerUUID().equals(uuid))
|
||||
shops.add(shop);
|
||||
}
|
||||
return shops;
|
||||
}
|
||||
|
||||
public AbstractShop getShopBySignLocation(Location signLocation) {
|
||||
for (AbstractShop shop : shopLocation.values()) {
|
||||
public Shop getShopBySignLocation(Location signLocation) {
|
||||
for (Shop shop : shopLocation.values()) {
|
||||
if (shop.getSignLocation().equals(signLocation))
|
||||
return shop;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public AbstractShop getShopNearBlock(Block block) {
|
||||
public Shop getShopNearBlock(Block block) {
|
||||
BlockFace[] faces = {BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST};
|
||||
for (BlockFace face : faces) {
|
||||
if (this.isShopMaterial(block.getRelative(face))) {
|
||||
|
||||
Reference in New Issue
Block a user