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

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