public static void giveRewards(Player player, int item, boolean forcedBurn) { CookingItems food = CookingItems.forId(item); if ((cookedSuccessfully( player, food.getCookLevel(), food.getBurnStopLevelWith(), food.getBurnStopLevel()) && !forcedBurn) || (player.getNewComersSide().isInTutorialIslandStage() && !forcedBurn)) { player.getInventory().addItem(new Item(food.getCookedId())); player.getSkill().addExp(Skill.COOKING, food.getExperience()); player .getActionSender() .sendMessage( "You successfully cook a " + ItemDefinition.forId(food.getCookedId()).getName().toLowerCase() + "."); } else { player.getInventory().addItem(new Item(food.getBurntID())); player .getActionSender() .sendMessage( "You accidentally burn the " + ItemDefinition.forId(food.getCookedId()).getName().toLowerCase() + "."); } }
@Override public void run() { try { Thread.currentThread().setName("ServerEngine"); System.setOut(new Misc.TimestampLogger(System.out)); System.setErr(new Misc.TimestampLogger(System.err, "./data/err.log")); address = new InetSocketAddress(host, port); System.out.println("Starting " + Constants.SERVER_NAME + " on " + address + "..."); // load shutdown hook Thread shutdownhook = new ShutDownHook(); Runtime.getRuntime().addShutdownHook(shutdownhook); PacketManager.loadPackets(); Cache.load(); // load scripts Misc.loadScripts(new File("./data/ruby/")); GlobalVariables.patchNotes = Misc.loadPatchNotes(); GlobalVariables.info = Misc.loadInfo(); GlobalVariables.npcDump = Misc.getNpcDump(); GlobalVariables.itemDump = Misc.getItemDump(); // load all xstream related files. XStreamUtil.loadAllFiles(); // item weights ItemDefinition.loadWeight(); // interfaces RSInterface.load(); // Load plugins PluginManager.loadPlugins(); // Load regions ObjectDef.loadConfig(); Region.load(); Rangable.load(); // Load objects ObjectLoader objectLoader = new ObjectLoader(); objectLoader.load(); GameObjectData.init(); // load combat manager CombatManager.init(); // Load minute timer startMinutesCounter(); // global drops GlobalGroundItem.initialize(); // load npc ls Npc.loadNpcDrops(); // mage arena timers AlchemistPlayground.loadAlchemistPlayGround(); EnchantingChamber.loadEnchantingChamber(); CreatureGraveyard.loadCreatureGraveyard(); // spawning world fishing spots FishingSpots.spawnFishingSpots(); QuestHandler.init(); NpcLoader.loadAutoSpawn("./data/npcs/spawn-config.cfg"); HighscoresManager.load(); // Start up and get a'rollin! startup(); System.out.println("Online!"); while (!Thread.interrupted()) { try { cycle(); sleep(); } catch (Exception ex) { PlayerSave.saveAllPlayers(); ex.printStackTrace(); } } scheduler.schedule( new Task() { @Override protected void execute() { if (Thread.interrupted()) { PlayerSave.saveAllPlayers(); stop(); return; } try { cycle(); } catch (Exception ex) { PlayerSave.saveAllPlayers(); ex.printStackTrace(); stop(); } } }); } catch (Exception ex) { ex.printStackTrace(); } PluginManager.close(); }