Ну вот восстановление набора например
Код HTML:
else if (command.startsWith("_bbsbuffer;restore"))
345 {
346 String name = (command.split(" ").length >= 2) ? command.split(" ")[1] : "";
347 String WHO = (command.split(" ").length >= 3) ? command.split(" ")[2] : "Player";
348 if (name.length() < 1)
349 {
350 MsgPacket msg = new MsgPacket("У Вас нет сохранённых бафов.", false);
351 activeChar.sendPacket(msg);
352 }
353 else
354 {
355 try (Connection conn = ConnectionFactory.getInstance().getConnection();
356 PreparedStatement statement = conn.prepareStatement("SELECT * FROM cb_buffer WHERE charId=? AND buff_name=?"))
357 {
358 statement.setInt(1, activeChar.getObjectId());
359 statement.setString(2, name);
360 try (ResultSet rcln = statement.executeQuery())
361 {
362 while (rcln.next())
363 {
364 String[] buffs = rcln.getString("buff_save").split(";");
365 for (String bu : buffs)
366 {
367 Integer[] buffData = BufferData.getInstance().getBuffById(Integer.parseInt(bu));
368
369 if (buffData != null)
370 {
371 if (buffData[2] != 0)
372 {
373 if (activeChar.destroyItemByItemId("BufferService", buffData[2], buffData[3], null, true))
374 {
375 Thread.sleep(80);
376 Skill bf = SkillData.getInstance().getSkill(buffData[0], buffData[1]);
377 if (WHO.equals("Player"))
378 {
379 bf.applyEffects(activeChar, activeChar);
380 }
381 else
382 {
383 bf.applyEffects(activeChar, activeChar.getSummon());
384 }
385 }
386 }
387 else
388 {
389 Thread.sleep(80);
390 Skill bf = SkillData.getInstance().getSkill(buffData[0], buffData[1]);
391 if (WHO.equals("Player"))
392 {
393 bf.applyEffects(activeChar, activeChar);
394 }
395 else
396 {
397 bf.applyEffects(activeChar, activeChar.getSummon());
398 }
399 }
400 }
401 }
402 }
403 rcln.close();
404 }
405 statement.close();
406 conn.close();
407 }
408 catch (Exception e)
409 {
410 _log.log(Level.WARNING, "Could not restore buff info: " + e.getMessage(), e);
411 }
412 }