Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.6 kB
2
Indexable
Never
package ballistickemu.Lobby.handlers;

import ballistickemu.Tools.DatabaseTools;
import ballistickemu.Types.StickClient;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;



public class MapListHandler
{
  public static void HandlePacket(StickClient paramStickClient, String paramString)
  {
    try
    {
      DatabaseTools.dbConnect();
      PreparedStatement localPreparedStatement1 = DatabaseTools.getDbConnection().prepareStatement("SELECT map_name FROM maps WHERE UID = ? AND slot_id = 0");
      localPreparedStatement1.setInt(1, paramStickClient.getDbID());
      ResultSet localResultSet1 = localPreparedStatement1.executeQuery();
      
      PreparedStatement localPreparedStatement2 = DatabaseTools.getDbConnection().prepareStatement("SELECT map_name FROM maps WHERE UID = ? AND slot_id = 1");
      localPreparedStatement2.setInt(1, paramStickClient.getDbID());
      ResultSet localResultSet2 = localPreparedStatement2.executeQuery();
      
      PreparedStatement localPreparedStatement3 = DatabaseTools.getDbConnection().prepareStatement("SELECT map_name FROM maps WHERE UID = ? AND slot_id = 2");
      localPreparedStatement3.setInt(1, paramStickClient.getDbID());
      ResultSet localResultSet3 = localPreparedStatement3.executeQuery();
      
      PreparedStatement localPreparedStatement4 = DatabaseTools.getDbConnection().prepareStatement("SELECT map_name FROM maps WHERE UID = ? AND slot_id = 3");
      localPreparedStatement4.setInt(1, paramStickClient.getDbID());
      ResultSet localResultSet4 = localPreparedStatement4.executeQuery();
      
      PreparedStatement localPreparedStatement5 = DatabaseTools.getDbConnection().prepareStatement("SELECT map_name FROM maps WHERE UID = ? AND slot_id = 4");
      localPreparedStatement5.setInt(1, paramStickClient.getDbID());
      ResultSet localResultSet5 = localPreparedStatement5.executeQuery();
      while (localResultSet1.next())
      {
        String str1 = localResultSet1.getString("map_name");
        String str2 = localResultSet2.getString("map_name");
        String str3 = localResultSet3.getString("map_name");
        String str4 = localResultSet4.getString("map_name");
        String str5 = localResultSet5.getString("map_name");
        
        paramStickClient.getMaps(str1, str2, str3, str4, str5);
      }
    }
    catch (Exception localException)
    {
      paramStickClient.writeAnnounce("There was error in database during loading maps request! Please notify admin about this");
    }
  }
}