Jump to content
  • 0

Java Error


Question

Posted

Can anyone help me to fix this error??

 

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16315: error: cannot find symbol

    [javac]      for (Map.Entry entry : this.ceffects.entrySet())

    [javac]                                  ^

    [javac]  symbol: variable ceffects

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16362: error: incompatible types

    [javac]      for (Map.Entry entry : ceffects.entrySet())

    [javac]                                              ^

    [javac]  required: Entry

    [javac]  found:    Object

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16376: error: incompatible types

    [javac]      for (Map.Entry entry : ceffects.entrySet())

    [javac]                                              ^

    [javac]  required: Entry

    [javac]  found:    Object

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16405: error: incompatible types

    [javac]    for (Map.Entry entry : ceffects.entrySet())

    [javac]                                            ^

 

 

 

  public void restoreBBSBuf(int forPet)
  {
    Connection con = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();

      PreparedStatement statement = con.prepareStatement("SELECT * FROM character_bbs_buff_save WHERE charId=? AND for_pet=?");
      statement.setInt(1, getObjectId());
      statement.setInt(2, forPet);
      ResultSet rset = statement.executeQuery();

      while (rset.next())
      {
        int idSkill = rset.getInt("skill_id");
        int lvlSkill = rset.getInt("skill_level");
        if (forPet == 0)
          this._bbsBuff.put(Integer.valueOf(idSkill), Integer.valueOf(lvlSkill));
        else
          this._bbsPetBuff.put(Integer.valueOf(idSkill), Integer.valueOf(lvlSkill));
      }
      rset.close();
      statement.close();
    }
    catch (Exception e)
    {
      _log.log(Level.WARNING, new StringBuilder().append("Could not restore ").append(this).append(" BBS buff data: ").append(e.getMessage()).toString(), e);
    }
    finally
    {
      L2DatabaseFactory.close(con);
    }
  }

  public void storeBBSBuff(int forPet)
  {
    Map ceffects = new FastMap();
    if (forPet == 0)
      ceffects.putAll(this._bbsBuff);
    else {
      ceffects.putAll(this._bbsPetBuff);
    }
    Connection con = null;
    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();

      PreparedStatement statement = con.prepareStatement("DELETE FROM character_bbs_buff_save WHERE charId=? AND for_pet=?");
      statement.setInt(1, getObjectId());
      statement.setInt(2, forPet);
      statement.execute();
      statement.close();
//all i dont know what for now, try continue 
      for (Map.Entry entry : this.ceffects.entrySet())
      {
        statement = con.prepareStatement("INSERT INTO character_bbs_buff_save (charId,skill_id,skill_level,for_pet) VALUES (?,?,?,?)");
        statement.setInt(1, getObjectId());
        statement.setInt(2, ((Integer)entry.getKey()).intValue());
        statement.setInt(3, ((Integer)entry.getValue()).intValue());
        statement.setInt(4, forPet);
        statement.execute();
        statement.close();
      }
    }
    catch (Exception e)
    {
      PreparedStatement statement;
      _log.log(Level.WARNING, "Could not store char effect data: ", e);
    }
    finally
    {
      L2DatabaseFactory.close(con);
    }
  }

  public void updateBBSBuff(int forPet)
  {
    Map ceffects = new FastMap();
    L2Character character;
    if (forPet == 0)
      character = this;
    else {
      character = getPet();
    }
    if (character == null)
      return;
    for (L2Effect cureffect : character.getAllEffects())
    {
      int idSklll = cureffect.getId();
      int lvlSklll = cureffect.getLevel();
      if (BuffBBSTable.getInstance().isBBSSaveBuf(idSklll, lvlSklll))
        ceffects.put(Integer.valueOf(idSklll), Integer.valueOf(lvlSklll));
    }
    if (ceffects.isEmpty())
      return;
    if (forPet == 0)
    {
      boolean saveBuff = false;
      if (ceffects.size() != this._bbsBuff.size())
        saveBuff = true;
      for (Map.Entry entry : ceffects.entrySet())
        if (!_bbsBuff.containsKey(entry.getKey()))
          saveBuff = true;
      if (!saveBuff) {
        return;
      }
     _bbsBuff.clear();
      _bbsBuff.putAll(ceffects);
    }
    else
    {
      boolean saveBuff = false;
      if (ceffects.size() != this._bbsBuff.size())
        saveBuff = true;
      for (Map.Entry entry : ceffects.entrySet())
        if (!this._bbsBuff.containsKey(entry.getKey()))
          saveBuff = true;
      if (!saveBuff) {
        return;
      }
      this._bbsPetBuff.clear();
      this._bbsPetBuff.putAll(ceffects);
    }

    storeBBSBuff(forPet);
  }

  public void cactBBSBuff(int forPet)
  {
    Map ceffects = new FastMap();
    L2Character character;
    if (forPet == 0)
    {
      ceffects.putAll(this._bbsBuff);
    }
    else
    {
      character = getPet();
      ceffects.putAll(this._bbsPetBuff);
    }
    if ((character == null) || (ceffects.isEmpty())) {
      return;
    }
    for (Map.Entry entry : ceffects.entrySet())
    {
      L2Skill skill = SkillTable.getInstance().getInfo(((Integer)entry.getKey()).intValue(), ((Integer)entry.getValue()).intValue());
      if (skill == null)
        continue;
      skill.getEffects(character, character);
    }
  }

  public int calcBBSBuff(int forPet)
  {
    Map ceffects = new FastMap();
    L2Character character;
    if (forPet == 0) // pet in invetory
    {
      ceffects.putAll(this._bbsBuff);
    }
    else
    {
      character = getPet();
      ceffects.putAll(this._bbsPetBuff);
    }
    if ((character == null) || (ceffects.isEmpty())) {
      return 0;
    }

    int result = 0;
    for (Map.Entry entry : ceffects.entrySet())
    {
      int skillId = ((Integer)entry.getKey()).intValue();
      int skillLvl = ((Integer)entry.getValue()).intValue();
      int bbsGroup = BuffBBSTable.getInstance().getBBSGroupFotBuf(skillId, skillLvl);
      if (bbsGroup == 0)
        continue;
      int priceGroup = BuffBBSTable.getInstance().getPriceGroup(bbsGroup);
      if (priceGroup < 0)
        continue;
      result += priceGroup;
    }
    return result;
  }

7 answers to this question

Recommended Posts

  • 0
Posted

i'll give you a short hint on how to iterate properly by getting a random line that error occurs

Your line

for (Map.Entry entry : ceffects.entrySet())

        if (!_bbsBuff.containsKey(entry.getKey())) 

        saveBuff = true;

Correct line

for (Object entry : ceffects.keySet())

        if (!_bbsBuff.containsKey(entry)

        saveBuff = true;

Also you should parametrise your map.for example

FastMap<Integer,Integer> map = new FastMap<Integer,Integer>();

It's a more safe tactic to avoid those errors and some others that might occur

  • 0
Posted

thanks but can you advise what need changes here?

 

THanks for help.

Now i have error

________________________

    [javac]  symbol:  variable ceffects

    [javac]  location: class L2PcInstance

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16432: error: cannot find symbol

    [javac] for (Object entry : ceffects.keySet())

___________________________________________

Can you help to transffer this script?

___________________________________________

 

  public int calcBBSBuff(int forPet)

  {

    Map ceffects = new FastMap();

    L2Character character;

    if (forPet == 0)

    {

      ceffects.putAll(this._bbsBuff);

    }

    else

    {

      character = getPet();

      ceffects.putAll(this._bbsPetBuff);

    }

    if ((character == null) || (ceffects.isEmpty())) {

      return 0;

    }

 

    int result = 0;

  for (Object entry : ceffects.keySet())

 

    {

      int skillId = ((Integer)entry.getKey()).intValue();

      int skillLvl = ((Integer)entry.getValue()).intValue();

      int bbsGroup = BuffBBSTable.getInstance().getBBSGroupFotBuf(skillId, skillLvl);

      if (bbsGroup == 0)

        continue;

      int priceGroup = BuffBBSTable.getInstance().getPriceGroup(bbsGroup);

      if (priceGroup < 0)

        continue;

      result += priceGroup;

    }

    return result;

  }

 

  • 0
Posted

You are trying to call ceffects Map while it is a local varible(inside a method)

 

Your part

public int calcBBSBuff(int forPet)

  {

    Map ceffects = new FastMap();

    L2Character character;

...

...

...(rest stuff as they are)

 

Proper part

Map ceffects = new FastMap();

 

public int calcBBSBuff(int forPet)

  {

    L2Character character;

...

....

...

  • 0
Posted

Changed but have error

    [javac]  required: Entry

    [javac]  found:    Object

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16434: error: cannot find symbol

    [javac]      int skillId = ((Integer)entry.getKey()).intValue();

    [javac]                                          ^

    [javac]  symbol:  variable key

    [javac]  location: class L2PcInstance

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16435: error: cannot find symbol

    [javac]      int skillLvl = ((Integer)entry.getValue()).intValue();

    [javac]                                          ^

 

  • 0
Posted
  Quote

  for (Object entry : ceffects.keySet())

    {

      int skillId = ((Integer)entry.getKey()).intValue();    int skillLvl = ((Integer)entry.getValue()).intValue();

    int skillId = entry.intValue();

    int skillLvl =  ceffects.get(entry).intValue();   

replace the  striked line with the 2 lines below them

  • 0
Posted

 

    [javac] gameserver\model\actor\instance\L2PcInstance.java:16434: error: cannot find symbol

    [javac]   int skillId = entry.intValue();

    [javac]                         ^

    [javac]  symbol:  method intValue()

    [javac]  location: variable entry of type Object

    [javac] D:\Brick-Server\L2Brick_Server\java\l2\brick\gameserver\model\actor\instance\L2PcInstance.java:16435: error: cannot find symbol

    [javac]      int skillLvl = ceffects.get(entry).intValue();

    [javac]                                                ^

  • 0
Posted

and a cast over here

int skillId =(Integer) entry.intValue();

int skillLvl =(Integer) ceffects.get(entry).intValue();

(that's why you should parametrize the map , you would avoid casting  ;) )

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • ⚔️ Balance or Power? The community decides!   During spot hunting and battles, the Destroyer (under limits) can wipe out dozens of mobs in seconds, outperforming other classes. A player on Destroyer (with three windows) can monopolize top farming spots solo, while most other classes require additional characters to compete. Result: Resources end up concentrated in the hands of a single player rather than being distributed among multiple participants.   We propose discussing possible changes: Reducing the number of targets the Destroyer can hit under limits. Balancing vampirism by implementing progressive efficiency reduction based on the number of enemies attacked. These changes would preserve the class identity while making PvE more fair for everyone.   🎯 What do you think?
    • Newcomers always raise suspicion. At first, people look at the newcomer cautiously. “Who is this? Where did they come from? Are they here to stay?” That’s just how it is trust isn’t given right away. It’s the same with services, especially when it comes to your accounts, money, and verifications. But the truth is, every major player was once that “newbie” entering the chat. VibeSMS we’re new on the forum, but definitely not new to the game: — Fast and stable SMS verification — Numbers from 68+ countries — Rentals for PayPal, Telegram, Amazon, and dozens of other services — Prices starting at $0.1 per activation or $5–8/month for rental We don’t promise mountains from the sky. We simply make sure the code arrives quickly, and you get what you paid for. No extra words or surprises. Because in the world of SMS verifications, it’s not magic that counts, but reliability consistent speed, transparent pricing, and a service you can depend on every day.
    • sell adena l2rebon signature x1 - 1kk = 1.4 dollars l2reborn x10 - 500kk = 7 dollars E-Global x Lu4 - 1kk = 4 dollars DISCORD - GODDARDSHOP TELEGRAM - MMOPROMO
    • Locked. Not following the rules.
    • Put prices on your first post. Read the rules.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock