Files
BattleBane/src/engine/db/handlers/dbMenuHandler.java
T

48 lines
1.8 KiB
Java
Raw Normal View History

2022-04-30 09:41:17 -04:00
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.db.handlers;
2023-05-22 06:17:40 -04:00
import engine.gameManager.DbManager;
2022-04-30 09:41:17 -04:00
import engine.objects.MenuOption;
2023-05-22 06:17:40 -04:00
import org.pmw.tinylog.Logger;
2022-04-30 09:41:17 -04:00
2023-05-22 06:17:40 -04:00
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
2022-04-30 09:41:17 -04:00
import java.util.ArrayList;
public class dbMenuHandler extends dbHandlerBase {
2023-05-23 10:27:03 -04:00
public dbMenuHandler() {
this.localClass = MenuOption.class;
2022-04-30 09:41:17 -04:00
this.localObjectType = engine.Enum.GameObjectType.valueOf(this.localClass.getSimpleName());
2023-05-23 10:27:03 -04:00
}
2022-04-30 09:41:17 -04:00
2023-05-23 10:27:03 -04:00
public ArrayList<MenuOption> GET_MENU_OPTIONS(final int id) {
2023-05-22 06:17:40 -04:00
2023-05-23 10:27:03 -04:00
ArrayList<MenuOption> menuOptions = new ArrayList<>();
2023-05-22 06:17:40 -04:00
2023-05-23 10:27:03 -04:00
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_menuoption` WHERE menuID = ?")) {
2023-05-22 06:17:40 -04:00
2023-05-23 10:27:03 -04:00
preparedStatement.setInt(1, id);
2023-05-22 06:17:40 -04:00
2023-05-23 10:27:03 -04:00
ResultSet rs = preparedStatement.executeQuery();
menuOptions = getObjectsFromRs(rs, 1000);
2023-05-22 06:17:40 -04:00
2023-05-23 10:27:03 -04:00
} catch (SQLException e) {
Logger.error(e);
}
2023-05-22 06:17:40 -04:00
2023-05-23 10:27:03 -04:00
return menuOptions;
}
2022-04-30 09:41:17 -04:00
}