All pastes #23275 Raw Edit

Unnamed

public text v1 · immutable
#23275 ·published 2005-09-18 13:38 UTC
rendered paste body
/**
 * 
 */
package net.sf.l2j.gameserver;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.logging.Logger;

import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.model.L2Alliance;
import net.sf.l2j.gameserver.model.L2Clan;

public class AllianceTable
{
    private static Logger _log = Logger.getLogger(ClanTable.class.getName());
    
    private static AllianceTable _instance;
    
    private HashMap<Integer, L2Alliance> _alliances;
    
    public static AllianceTable getInstance()
    {
        if (_instance == null)
        {
            _instance = new AllianceTable();
            
        }
        return _instance;
    }
    
    private AllianceTable()
    {
        _alliances = _alliances = new HashMap<Integer, L2Alliance>();
    }
    
    /**
     * @param allyId
     * @return
     */
    public L2Alliance getalliance(int allyid)
    {
        L2Alliance ally = _alliances.get(new Integer(allyid));
        if (ally == null)
        {
            ally = new L2Alliance(allyid);
            if (ally != null)
            {
                _alliances.put(ally.getAllianceId(), ally);
            }
        }
        
        return ally;
    }
}