Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MySQL;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.util.concurrent.TimeUnit;
- public class MySQL {
- public static Connection Connection;
- static int count = 0;
- public static void CreateDBS(){
- MySQL.Connecting();
- try {
- Connection.prepareStatement("CREATE TABLE IF NOT EXISTS `table` ( `cloum` VARCHAR(100) NOT NULL) ENGINE = InnoDB;").execute();
- } catch (SQLException sql) {
- }
- BungeeCord.getInstance().getScheduler().schedule(Main.instance, new Runnable() {
- public void run() {
- try {
- if (MySQL.Connection == null || MySQL.Connection.isClosed()) {
- MySQL.Connecting();
- }
- } catch (SQLException e) {
- }
- }
- }, 0, 20, TimeUnit.SECONDS);
- }
- public static synchronized void Connecting() {
- try {
- Connection = DriverManager.getConnection("jdbc:mysql://54.36.111.101:3306/" + "database" + "?autoreconnect=true&useSSL=false", "user", "pass");
- } catch (Exception sql) {
- }
- }
- public static ResultSet getResult(String qry) {
- ResultSet rs = null;
- try {
- Statement st = Connection.createStatement();
- rs = st.executeQuery(qry);
- } catch (SQLException e) {
- }
- return rs;
- }
- public static boolean ScanSettings(String uuid) {
- boolean bool = false;
- try {
- ResultSet rs = MySQL.getResult("SELECT * FROM `Settings` WHERE UUID='" + uuid + "'");
- if(rs.next()) {
- bool = true;
- }
- } catch (SQLException e) {
- System.out.println("Friends ScanSettings: " + e.getMessage());
- }
- return bool;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement