Rename and clean up MapleShopFactory
This commit is contained in:
@@ -25,7 +25,7 @@ package client.command.commands.gm2;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.MapleShopFactory;
|
||||
import server.ShopFactory;
|
||||
|
||||
public class GmShopCommand extends Command {
|
||||
{
|
||||
@@ -34,6 +34,6 @@ public class GmShopCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
MapleShopFactory.getInstance().getShop(1337).sendShop(c);
|
||||
ShopFactory.getInstance().getShop(1337).sendShop(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ package client.command.commands.gm3;
|
||||
|
||||
import client.Client;
|
||||
import client.command.Command;
|
||||
import server.MapleShopFactory;
|
||||
import server.ShopFactory;
|
||||
|
||||
|
||||
public class ReloadShopsCommand extends Command {
|
||||
@@ -35,6 +35,6 @@ public class ReloadShopsCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void execute(Client c, String[] params) {
|
||||
MapleShopFactory.getInstance().reloadShops();
|
||||
ShopFactory.getInstance().reloadShops();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
import net.server.Server;
|
||||
import server.ItemInformationProvider;
|
||||
import server.MapleShopFactory;
|
||||
import server.Shop;
|
||||
import server.ShopFactory;
|
||||
import server.TimerManager;
|
||||
import server.maps.*;
|
||||
import tools.PacketCreator;
|
||||
@@ -494,7 +494,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
||||
}
|
||||
} else if (itemType == 545) { // MiuMiu's travel store
|
||||
if (player.getShop() == null) {
|
||||
Shop shop = MapleShopFactory.getInstance().getShop(1338);
|
||||
Shop shop = ShopFactory.getInstance().getShop(1338);
|
||||
if (shop != null) {
|
||||
shop.sendShop(c);
|
||||
remove(c, position, itemId);
|
||||
|
||||
@@ -373,13 +373,13 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
}
|
||||
|
||||
public void openShopNPC(int id) {
|
||||
Shop shop = MapleShopFactory.getInstance().getShop(id);
|
||||
Shop shop = ShopFactory.getInstance().getShop(id);
|
||||
|
||||
if (shop != null) {
|
||||
shop.sendShop(c);
|
||||
} else { // check for missing shopids thanks to resinate
|
||||
FilePrinter.printError(FilePrinter.NPC_UNCODED, "Shop ID: " + id + " is missing from database.");
|
||||
MapleShopFactory.getInstance().getShop(11000).sendShop(c);
|
||||
ShopFactory.getInstance().getShop(11000).sendShop(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user