Jump to content
  • 0

How to reset Olympiad info instantly


Question

Posted (edited)

Hello! I have a custom feature to change a player's base class. So in order to not mess the olympiad, when a player changes his baseclass, a statement is executed to reset his fights/points.

The db is updated correctly, but back in game, if I restart the char and use /olympiadstat, I still have the old points/fights.

 

I saw in other servers that this info is updated instantly. 

How can I do it instantly too?

atm this is what Im running: 

 

          // Reset olympiad data for this player.

            statement = con.prepareStatement("UPDATE olympiad_nobles SET class_id=?, olympiad_points=?, competitions_done=?, competitions_won=?, competitions_lost=?, competitions_drawn=? WHERE char_Id=?");                        
            statement.setInt(1, player.getClassId().getId());
            statement.setInt(2, 18);
            statement.setInt(3, 0);
            statement.setInt(4, 0);
            statement.setInt(5, 0);
            statement.setInt(6, 0);
            statement.setInt(7, player.getObjectId());
            statement.execute();
            statement.close();

 

Any help is welcome!

Edited by tiguz

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

Its because you are changing only the database and that means your new stats will be applied  only after the server restart.

In order to change it instantly you have to do some changes where the player stats are stored about olympiad.

example 

private static final Map<Integer, StatsSet> _nobles = new HashMap<>();
private static final Map<Integer, Integer> _noblesRank = new HashMap<>();

these maps (Olympiad.java) contains infos about players. you should check there if the player is inside and change/add the values

Edited by melron
  • 0
Posted
21 minutes ago, melron said:

Its because you are changing only the database and that means your new stats will be applied  only after the server restart.

In order to change it instantly you have to do some changes where the player stats are stored about olympiad.

example 


private static final Map<Integer, Integer> _noblesRank = new HashMap<>();

this map (Olympiad.java) contains infos about players. you should check there if the player is inside and change/add the values

thx for the reply Melron. but im not sure if I understood what you mean. Can you be more detailed pls?

  • 0
Posted

He can't be more detailed. You have to clear record for that specific player. If you still don't get then, for example _nobles.remove(player.getObjectId());

  • Thanks 1
  • 0
Posted
2 hours ago, tiguz said:

thx for the reply Melron. but im not sure if I understood what you mean. Can you be more detailed pls?

public void removeInfo(final L2PcInstance activeChar)
{
   _noblesRank.remove(activeChar.getObjectId());
}

I can analyze it more if you want.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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