Rename and clean up MapleShopFactory

This commit is contained in:
P0nk
2021-09-09 22:48:25 +02:00
parent 104444e83b
commit 43a80f0491
7 changed files with 21 additions and 23 deletions

View File

@@ -25,19 +25,17 @@ import java.util.HashMap;
import java.util.Map;
/**
*
* @author Matze
*/
public class MapleShopFactory {
private static MapleShopFactory instance = new MapleShopFactory();
public static MapleShopFactory getInstance() {
public class ShopFactory {
private static final ShopFactory instance = new ShopFactory();
public static ShopFactory getInstance() {
return instance;
}
private Map<Integer, Shop> shops = new HashMap<>();
private Map<Integer, Shop> npcShops = new HashMap<>();
private final Map<Integer, Shop> shops = new HashMap<>();
private final Map<Integer, Shop> npcShops = new HashMap<>();
private Shop loadShop(int id, boolean isShopId) {
Shop ret = Shop.createFromDB(id, isShopId);
@@ -65,7 +63,7 @@ public class MapleShopFactory {
}
return loadShop(npcId, false);
}
public void reloadShops() {
shops.clear();
npcShops.clear();

View File

@@ -22,7 +22,7 @@
package server.life;
import client.Client;
import server.MapleShopFactory;
import server.ShopFactory;
import server.maps.MapObjectType;
import tools.PacketCreator;
@@ -35,11 +35,11 @@ public class NPC extends AbstractLoadedLife {
}
public boolean hasShop() {
return MapleShopFactory.getInstance().getShopForNPC(getId()) != null;
return ShopFactory.getInstance().getShopForNPC(getId()) != null;
}
public void sendShop(Client c) {
MapleShopFactory.getInstance().getShopForNPC(getId()).sendShop(c);
ShopFactory.getInstance().getShopForNPC(getId()).sendShop(c);
}
@Override