Jump to content
  • 0

Help GetClanWar


Heroic9614
 Share

Question

Hi Everyvone!

 

I want loading ClanWar clan list in server 

 

the task is that if someone is in a clan war with the other, then they do not get PK points.

but I don't know how to check it.

 

public class ClanWar
{
	private final static Logger LOG = LoggerFactory.getLogger(ClanWar.class);
	
	private static ClanWar _instance;
	
	private Map<Integer, Integer> clanwars = new FastMap<Integer, Integer>().shared();
	
	public static ClanWar getInstance()
	{
		if (_instance == null)
		{
			_instance = new ClanWar();
		}
		
		return _instance;
	}
	
	private ClanWar()
	{
		clanwars = new FastMap<>();
		loadData();
	}
	
	private void loadData()
	{
		Connection con = null;
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
			final PreparedStatement statement = con.prepareStatement("select clan1,clan2 FROM clan_wars");
			final ResultSet rset = statement.executeQuery();
			
			while (rset.next())
			{
				int clan1 = rset.getInt("clan1");
				int clan2 = rset.getInt("clan2");
				
				clanwars.put(clan1, clan2);
			}
			
			LOG.info("ClanWars: Loaded: " + clanwars.size());
			
			DatabaseUtils.close(rset);
			DatabaseUtils.close(statement);
		}
		catch (final Exception e)
		{
			LOG.error("Clanwars: error loaded", e);
		}
		finally
		{
			CloseUtil.close(con);
		}
	}
	
	public int getClanWar(final int clan1, final int clan2)
	{

		return 0;
	}
	
}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

 Share



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