Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add this to NPCConversationManager.java:
- public void removeBugReport(int number) {
- try {
- Connection con = (Connection) DatabaseConnection.getConnection();
- PreparedStatement pse = (PreparedStatement) con.prepareStatement("DELETE FROM bugreports WHERE id = ?");
- pse.setInt(1, number);
- pse.executeUpdate();
- pse.close();
- } catch (Exception e) {
- System.err.println("failed to removeBugReport");
- }
- }
- public String viewBugReports() {
- String text = (isGM() ? "Click a bug report once to remove it (GM Mode)\r\n\r\n" : "") +"Beta Testers's report list: ";
- int count = 0;
- try {
- Connection con = (Connection) DatabaseConnection.getConnection();
- PreparedStatement ps = (PreparedStatement) con.prepareStatement("SELECT * FROM bugreports");
- ResultSet rs = ps.executeQuery();
- rs.first();
- while (rs.next()) {
- count++;
- if (isGM())
- text += "#L"+ rs.getInt("id") +"#"+ count +". "+ rs.getString("charname") +" : "+ rs.getString("message") +".#k\r\n";
- else
- text += count +". "+ rs.getString("charname") +" : "+ rs.getString("message") +".";
- }
- return text;
- } catch (Exception ex) {
- System.err.println("failed to viewBugReports.");
- return "Something went wrong";
- }
- }
- public void bugReport(String message) {
- try {
- PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO `bugreports` (`charname`, `message`) VALUES (?, ?)");
- ps.setString(1, getName());
- ps.setString(2, message);
- ps.execute();
- ps.close();
- } catch (SQLException se) {
- System.out.println("Failed to add bugReport. Reason: "+ se.getCause());
- }
- }
Add Comment
Please, Sign In to add comment