lacosta 206 Опубликовано 14 февраля, 2012 люди добавил в комунити смену ника Скрытый текстpackage net.sf.l2j.gameserver.communitybbs.Manager; import java.util.StringTokenizer; import org.python.modules.newmodule; import net.sf.l2j.Config; import net.sf.l2j.gameserver.cache.HtmCache; import net.sf.l2j.gameserver.datatables.CharNameTable; import net.sf.l2j.gameserver.model.L2ItemInstance; import net.sf.l2j.gameserver.model.L2Multisell; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.clientpackets.MultiSellChoose; import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate; import net.sf.l2j.gameserver.network.serverpackets.ShowBoard; import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; import net.sf.l2j.gameserver.templates.L2Item; import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; import net.sf.l2j.gameserver.model.entity.TvTEvent; import net.sf.l2j.gameserver.model.entity.events.CTF; import net.sf.l2j.gameserver.model.entity.events.Heroes; import net.sf.l2j.gameserver.model.olympiad.Olympiad; public class CustomBBSManager extends BaseBBSManager { private static int HERO = Config.COL_HERO; public static int ITEM_ID = Config.DON_ITEM_ID; public static HtmCache _hc = HtmCache.getInstance(); MultiSellChoose multisellchose = new MultiSellChoose(); @Override public void parsecmd(String command, L2PcInstance activeChar) { String content; String[] tmp; if (command.startsWith("_bbsmultisell")) { tmp = command.substring(14).split(" "); L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(tmp[1]), activeChar, false, 1); content = getSwHtm(tmp[0]); if (content == null) { content = "<html><body><br><br><center>Страница: " + tmp[0] + ".htm не найдена.</center></body></html>"; } separateAndSend(content,activeChar); } else if (command.startsWith("_bbsteleto")) { content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/lacosta/41001.htm"); tmp = command.substring(11).trim().split("_"); int type = Integer.parseInt(tmp[0]); int x = Integer.parseInt(tmp[1]); int y = Integer.parseInt(tmp[2]); int z = Integer.parseInt(tmp[3]); separateAndSend(content,activeChar); activeChar.teleToLocation(x, y, z, false); } else if(command.startsWith("_bbshero")) { StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); setHero(activeChar,Integer.parseInt(st.nextToken())); return; } else if(command.startsWith("_bbscolor")) { content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/lacosta/400081.htm"); StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); if (st.countTokens() < 1) return; String newcolor = st.nextToken(); int color = 0; try { color = Integer.parseInt(newcolor); } catch (Exception e) { return; } newcolor = ""; switch (color) { case 1: newcolor = "FFFF00"; break; case 2: newcolor = "000000"; break; case 3: newcolor = "FF0000"; break; case 4: newcolor = "FF00FF"; break; case 5: newcolor = "808080"; break; case 6: newcolor = "008000"; break; case 7: newcolor = "00FF00"; break; case 8: newcolor = "800000"; break; case 9: newcolor = "008080"; break; case 10: newcolor = "800080"; break; case 11: newcolor = "808000"; break; case 12: newcolor = "FFFFFF"; break; case 13: newcolor = "00FFFF"; break; case 14: newcolor = "C0C0C0"; break; case 15: newcolor = "17A0D4"; break; case 16: newcolor = "9370DB"; break; default:return; } if (activeChar.getInventory().getInventoryItemCount(Config.ITEM_COLOR_NAME_ID, 0) < Config.ITEM_COLOR_NAME_ID_COUNT) { activeChar.sendMessage(activeChar.getName() + " у вас мало итемов"); } else { activeChar.sendMessage("Вы успешно изменили цвет Титула"); activeChar.destroyItemByItemId("Loot", Config.ITEM_COLOR_NAME_ID, Config.ITEM_COLOR_NAME_ID_COUNT, activeChar, false); activeChar.getAppearance().setNameColor(Integer.decode("0x"+newcolor)); activeChar.broadcastUserInfo(); activeChar.store(); separateAndSend(content,activeChar); } return; } StringTokenizer st = new StringTokenizer(command, " "); String actualCommand = st.nextToken(); if (actualCommand.equalsIgnoreCase("Setname")) { if (st.countTokens() < 1) return; String newname = st.nextToken(); if (activeChar.getInventory().getInventoryItemCount(ITEM_ID, 0) < 10) { activeChar.sendMessage("У Вас не достаточное кол-во монет для проведения операции."); return; } else if ((newname.length() < 3) || (newname.length() > 16)) { activeChar.sendMessage("Это имя не может быть использовано."); return; } else if (CharNameTable.getInstance().doesCharNameExist(newname)) { activeChar.sendMessage("Это имя уже занято."); return; } else if (activeChar.isClanLeader()) { activeChar.sendMessage("Передайте клан на время смены ника другому игроку"); return; } L2ItemInstance destritem = activeChar.getInventory().destroyItemByItemId(" GoldMerchant: Setname "+newname+" for "+activeChar.getName(), ITEM_ID, 10, activeChar, activeChar); if (destritem != null) { activeChar.setName(newname); activeChar.sendMessage("Вы успешно сменили свое имя!"); activeChar.setClan(activeChar.getClan()); activeChar.broadcastUserInfo(); activeChar.store(); InventoryUpdate iu = new InventoryUpdate(); if (destritem.getCount() == 0) iu.addRemovedItem(destritem); else iu.addModifiedItem(destritem); activeChar.sendPacket(iu); } else { activeChar.sendMessage("Ошибка!"); } } else if(command.startsWith("_bbstitlecolor")) { content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/soft/400082.htm"); StringTokenizer st = new StringTokenizer(command, " "); st.nextToken(); if (st.countTokens() < 1) return; String newcolor = st.nextToken(); int color = 0; try { color = Integer.parseInt(newcolor); } catch (Exception e) { return; } newcolor = ""; switch (color) { case 1: newcolor = "FFFF00"; break; case 2: newcolor = "000000"; break; case 3: newcolor = "FF0000"; break; case 4: newcolor = "FF00FF"; break; case 5: newcolor = "808080"; break; case 6: newcolor = "008000"; break; case 7: newcolor = "00FF00"; break; case 8: newcolor = "800000"; break; case 9: newcolor = "008080"; break; case 10: newcolor = "800080"; break; case 11: newcolor = "808000"; break; case 12: newcolor = "FFFFFF"; break; case 13: newcolor = "00FFFF"; break; case 14: newcolor = "C0C0C0"; break; case 15: newcolor = "17A0D4"; break; case 16: newcolor = "9370DB"; break; default:return; } if (activeChar.getInventory().getInventoryItemCount(Config.ITEM_COLOR_TITLE_ID, 0) < Config.ITEM_COLOR_TITLE_ID_COUNT) { activeChar.sendMessage(activeChar.getTitle() + " у вас мало итемов"); } else { activeChar.sendMessage("Вы успешно изменили цвет Титула"); activeChar.destroyItemByItemId("Loot", Config.ITEM_COLOR_TITLE_ID, Config.ITEM_COLOR_TITLE_ID_COUNT, activeChar, false); activeChar.getAppearance().setTitleColor(Integer.decode("0x"+newcolor)); activeChar.broadcastUserInfo(); activeChar.store(); separateAndSend(content,activeChar); } return; } else if(command.startsWith("_bbsmult;")) { StringTokenizer st = new StringTokenizer(command, ";"); st.nextToken(); int idp = Integer.parseInt(st.nextToken()); content = HtmCache.getInstance().getHtm("data/html/CommunityBoard/soft/"+idp+".htm"); if (content == null) { content = "<html><body><br><br><center>404 :File Not foud: 'data/html/CommunityBoard/buff/"+idp+".htm' </center></body></html>"; } separateAndSend(content,activeChar); } else { ShowBoard sb = new ShowBoard("<html><body><br><br><center>the command: "+command+" is not implemented yet</center><br><br></body></html>","101"); activeChar.sendPacket(sb); activeChar.sendPacket(new ShowBoard(null,"102")); activeChar.sendPacket(new ShowBoard(null,"103")); } } @Override public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar) { // TODO Auto-generated method stub } public static String getSwHtm(String page) { return _hc.getHtm("data/html/CommunityBoard/lacosta/" + page + ".htm"); } private void setHero(L2PcInstance player, int days) { if(player.getInventory().getItemByItemId(ITEM_ID) != null && player.getInventory().getItemByItemId(ITEM_ID).getCount() >= days*HERO) { if(days != 0 && days > 0) { if(player.isHero()) { player.sendMessage("Вы уже герой"); return; } Heroes.getInstance().addHero(player, days); player.sendMessage("Вы получили статус героя на "+days+" дней!"); } else { player.sendMessage("Вы не ввели кол-во дней!"); } player.destroyItemByItemId("Consume", ITEM_ID, days*HERO, player, false); } else { player.sendMessage("У Вас не достаточное кол-во монет для проведения операции"); } } private static CustomBBSManager _instance = new CustomBBSManager(); /** * @return */ public static CustomBBSManager getInstance() { return _instance; } } и при компиле выбивает такую ошибку Скрытый текстBuildfile: C:\Documents and Settings\Loner\Рабочий стол\core\build.xmldist: [delete] Deleting directory C:\Documents and Settings\Loner\Рабочий стол\core\build [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\libraries [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\config [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\config\protected [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\config\chatfilter [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\data [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\data\geodata [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\data\pathnode [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\data\clans [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\data\crests [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\logs [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\server\log [mkdir] Created dir: C:\Documents and Settings\Loner\Рабочий стол\core\build\classes [javac] C:\Documents and Settings\Loner\Рабочий стол\core\build.xml:41: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 1376 source files to C:\Documents and Settings\Loner\Рабочий стол\core\build\classes [javac] C:\Documents and Settings\Loner\Рабочий стол\core\java\net\sf\l2j\gameserver\communitybbs\Manager\CustomBBSManager.java:192: st is already defined in parsecmd(java.lang.String,net.sf.l2j.gameserver.model.actor.instance.L2PcInstanc e) [javac] StringTokenizer st = new StringTokenizer(command, " "); [javac] ^ [javac] C:\Documents and Settings\Loner\Рабочий стол\core\java\net\sf\l2j\gameserver\communitybbs\Manager\CustomBBSManager.java:261: st is already defined in parsecmd(java.lang.String,net.sf.l2j.gameserver.model.actor.instance.L2PcInstanc e) [javac] StringTokenizer st = new StringTokenizer(command, ";"); [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 2 errors BUILD FAILED C:\Documents and Settings\Loner\Рабочий стол\core\build.xml:41: Compile failed; see the compiler error output for details. Total time: 6 seconds где я ошибился ?? с меня +++ Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты