Jump to content

Question

Posted

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;
	}
	
}

 

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.
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.



×
×
  • Create New...