Show the code
|
tried implementing shops back into the most recent release from Professor Oak... when ever i try to open the shop this is the error i get...
Code:java.lang.NullPointerException at com.elvarg.game.model.container.impl.Shop.open(Shop.java:62) at com.elvarg.game.model.container.impl.Shop.open(Shop.java:81) at com.elvarg.net.packet.impl.NPCOptionPacketListener$2.execute(NPCOptionPacketListener.java:204) at com.elvarg.game.model.movement.WalkToAction.sequence(WalkToAction.java:60) at com.elvarg.game.entity.impl.player.Player.sequence(Player.java:219) at com.elvarg.game.World$1.execute(World.java:134) at com.elvarg.game.entity.updating.sync.GameSyncExecutor.sync(GameSyncExecutor.java:55) at com.elvarg.game.World.sequence(World.java:129) at com.elvarg.game.GameEngine.run(GameEngine.java:35) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.runAndReset(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Show the code
Code:public static void open(Player player, Shop shop) { player.getPacketSender().sendInterfaceRemoval(); //Update player's shop and player status player.setShop(ShopDefinition.getShops().get(shop.getDefinition().getId())).setInterfaceId(INTERFACE_ID) .setStatus(PlayerStatus.NPC_OWNED_SHOPPING); //Refresh items shop.refreshItems(); //Set up the scroll bar player.getPacketSender().sendInterfaceScrollReset(SCROLL_BAR_INTERFACE_ID); if(shop.getDefinition().getOriginalStock().length < 37) { player.getPacketSender().sendScrollbarHeight(SCROLL_BAR_INTERFACE_ID, 0); } else { int rows = (shop.getDefinition().getOriginalStock().length % 9 == 0 ? (shop.getDefinition().getOriginalStock().length / 9) : ((shop.getDefinition().getOriginalStock().length / 9) + 1)); player.getPacketSender().sendScrollbarHeight(SCROLL_BAR_INTERFACE_ID, rows * 56); } player.getPacketSender().sendMessage("").sendMessage("Warning! When selling an item to the shop, it loses 20% of its original value."); } public static void open(Player player, int shop) { open(player, ShopDefinition.getShops().get(shop)); }
Check that the shop actually exists that you're trying to retrieve.
Its trying to retrive a null shop. Shop system is broke to my knowledge. Rewrite or fix it. Or rip the shop system from a time the shops worked.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |