Esempio n. 1
0
 public static void removeReport(int number) {
   try {
     Statement st = dbmanager.getConnection().createStatement();
     st.executeUpdate("DELETE FROM Reports WHERE Number='" + number + "'");
   } catch (SQLException e) {
     System.out.println(
         "[BungeeUtilisals]: Can't remove request number " + number + ", " + e.getMessage());
   }
 }
Esempio n. 2
0
 public static String getReason(int number) {
   String reason = "";
   try {
     Statement st = dbmanager.getConnection().createStatement();
     ResultSet rs = null;
     rs = st.executeQuery("SELECT * FROM Reports WHERE Number='" + number + "'");
     while (rs.next()) {
       reason = rs.getString("Reason");
     }
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return reason;
 }
Esempio n. 3
0
 public static List<Integer> getReportNumbers() {
   List<Integer> reports = new ArrayList<Integer>();
   try {
     Statement st = dbmanager.getConnection().createStatement();
     ResultSet rs = null;
     rs = st.executeQuery("SELECT * FROM Reports");
     while (rs.next()) {
       int reportnumber = rs.getInt("Number");
       reports.add(reportnumber);
     }
   } catch (SQLException e) {
     System.out.println(
         "[BungeeUtilisals]: An error occured while contacting the Database! " + e.getMessage());
   }
   return reports;
 }
Esempio n. 4
0
 public static void addReport(
     int number, ProxiedPlayer reporter, ProxiedPlayer reported, String reason) {
   try {
     Statement st = dbmanager.getConnection().createStatement();
     st.executeUpdate(
         "INSERT INTO Reports(Number, Reporter, Player, Reason) VALUES ('"
             + number
             + "', '"
             + reporter.getName()
             + "', '"
             + reported.getName()
             + "', '"
             + reason
             + "')");
   } catch (SQLException e) {
     System.out.println(
         "[BungeeUtilisals]: Can't add Report from: "
             + reporter.getName()
             + ", "
             + e.getMessage());
   }
 }