package info.tregmine.database.db;

import java.io.*;
import java.util.*;
import java.sql.*;

import info.tregmine.database.*;

import info.tregmine.database.DAOException;
import info.tregmine.database.IContext;
import info.tregmine.database.IEnchantmentDAO;

public class DBContext implements IContext
{
    private Connection conn;

    public DBContext(Connection conn)
    {
        this.conn = conn;
    }

    public Connection getConnection()
    {
        return conn;
    }

    @Override
    public void close()
    {
        if (conn != null) {
            try { conn.close(); } catch (SQLException e) { }
        }
    }

    @Override
    public IHomeDAO getHomeDAO()
    {
        return new DBHomeDAO(conn);
    }

    @Override
    public IInventoryDAO getInventoryDAO()
    {
        return new DBInventoryDAO(conn);
    }

    @Override
    public IItemDAO getItemDAO()
    {
        return new DBItemDAO(conn);
    }

    @Override
    public ILogDAO getLogDAO()
    {
        return new DBLogDAO(conn);
    }

    @Override
    public IMotdDAO getMotdDAO()
    {
        return new DBMotdDAO(conn);
    }

    @Override
    public IPlayerDAO getPlayerDAO()
    {
        return new DBPlayerDAO(conn);
    }

    @Override
    public IPlayerReportDAO getPlayerReportDAO()
    {
        return new DBPlayerReportDAO(conn);
    }

    @Override
    public ITradeDAO getTradeDAO()
    {
        return new DBTradeDAO(conn);
    }

    @Override
    public IWalletDAO getWalletDAO()
    {
        return new DBWalletDAO(conn);
    }

    @Override
    public IWarpDAO getWarpDAO()
    {
        return new DBWarpDAO(conn);
    }

    @Override
    public IZonesDAO getZonesDAO()
    {
        return new DBZonesDAO(conn);
    }

    @Override
    public IMentorLogDAO getMentorLogDAO()
    {
        return new DBMentorLogDAO(conn);
    }

    @Override
    public IFishyBlockDAO getFishyBlockDAO()
    {
        return new DBFishyBlockDAO(conn);
    }

    @Override
    public IBlessedBlockDAO getBlessedBlockDAO()
    {
        return new DBBlessedBlockDAO(conn);
    }

    @Override
    public IEnchantmentDAO getEnchantmentDAO()
    {
        return new DBEnchantmentDAO(conn);
    }
}

@@ -40,222 +40,122 @@
 ort 
-java.io.*;%0Aimport java.util.*;%0Aimport java.sql.*;%0A%0Aimport info.tregmine.database.*;%0A%0Aimport info.tregmine.database.DAOException;%0Aimport info.tregmine.database.IContext;%0Aimport info.tregmine.database.IEnchantmentDAO
+info.tregmine.Tregmine;%0Aimport info.tregmine.database.*;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.SQLException
 ;%0A%0Ap
@@ -226,16 +226,45 @@
 on conn;
+%0A    private Tregmine plugin;
 %0A%0A    pu
@@ -293,16 +293,35 @@
 ion conn
+, Tregmine instance
 )%0A    %7B%0A
@@ -342,24 +342,56 @@
 onn = conn;%0A
+        this.plugin = instance;%0A
     %7D%0A%0A    p
@@ -1183,32 +1183,40 @@
 DBPlayerDAO(conn
+, plugin
 );%0A    %7D%0A%0A    @O

Update DBContext.java