Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
777Ricky committed Feb 14, 2022
1 parent 31d34a6 commit 656b024
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.RequiredArgsConstructor;
import me.lucko.helper.Events;
import me.lucko.helper.Schedulers;
import me.lucko.helper.terminable.TerminableConsumer;
import me.lucko.helper.terminable.module.TerminableModule;
import me.rickylafleur.domaintracker.DomainTracker;
Expand Down
36 changes: 4 additions & 32 deletions src/main/java/me/rickylafleur/domaintracker/storage/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;

/**
Expand All @@ -34,12 +35,6 @@ public Database(DomainTracker plugin) {
public void connect() throws SQLException {
helperSql = new HelperSql(DatabaseCredentials.fromConfig(plugin.getConfig().getConfigurationSection("mysql")));

/* connection = DriverManager.getConnection(
"jdbc:mysql://" + plugin.getConfig().getString("mysql.address") + ":" + plugin.getConfig().getInt("mysql.port") + "/" + plugin.getConfig().getString("mysql.database") + "?useSSL=" + plugin.getConfig().getBoolean("mysql.useSSL"),
plugin.getConfig().getString("mysql.username"),
plugin.getConfig().getString("mysql.password")
);*/

createTable();
}

Expand Down Expand Up @@ -83,20 +78,6 @@ public void addData(String date, String uuid, String domain, String country) {
ps.setString(3, domain);
ps.setString(4, country);
});

/* try {
PreparedStatement ps = connection.prepareStatement("INSERT INTO domain_tracker (DATE,UUID,DOMAIN,COUNTRY) VALUES (?,?,?,?);");
ps.setString(1, date);
ps.setString(2, uuid);
ps.setString(3, domain);
ps.setString(4, country);
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}*/
}

public Set<JoinData> getJoinData() {
Expand Down Expand Up @@ -150,14 +131,5 @@ public String getCountryFromIp(InetAddress address) {

private void createTable() {
helperSql.executeAsync("CREATE TABLE IF NOT EXISTS `domain_tracker` (`DATE` char(10), `UUID` char(36), `DOMAIN` char(50), `COUNTRY` char(50));");

/* try {
PreparedStatement ps = connection.prepareStatement("CREATE TABLE IF NOT EXISTS domain_tracker (`DATE` char(10), `UUID` char(36), `DOMAIN` char(50), `COUNTRY` char(50));");
ps.executeUpdate();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}*/
}
}

0 comments on commit 656b024

Please sign in to comment.