forked from LogBlock/LogBlock
Updated for Questioner v0.02
This commit is contained in:
@@ -27,7 +27,6 @@ import de.diddiz.LogBlock.QueryParams.Order;
|
|||||||
import de.diddiz.LogBlock.QueryParams.SummarizationMode;
|
import de.diddiz.LogBlock.QueryParams.SummarizationMode;
|
||||||
import de.diddiz.LogBlock.WorldEditor.WorldEditorException;
|
import de.diddiz.LogBlock.WorldEditor.WorldEditorException;
|
||||||
import de.diddiz.LogBlockQuestioner.LogBlockQuestioner;
|
import de.diddiz.LogBlockQuestioner.LogBlockQuestioner;
|
||||||
import de.diddiz.LogBlockQuestioner.QuestionerException;
|
|
||||||
|
|
||||||
public class CommandsHandler implements CommandExecutor
|
public class CommandsHandler implements CommandExecutor
|
||||||
{
|
{
|
||||||
@@ -464,7 +463,7 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final int queue = logblock.getConsumer().getQueueSize();
|
final int queue = logblock.getConsumer().getQueueSize();
|
||||||
if (queue > 50 && (!config.askSavequeueBeforeRollback || questioner != null && sender instanceof Player && questioner.askQuestion((Player)sender, "There are " + queue + " block in queue. Do yu want to process the queue before rollback?", "yes", "no").equals("yes")))
|
if (queue > 50 && (!config.askSavequeueBeforeRollback || questioner != null && sender instanceof Player && questioner.ask((Player)sender, "There are " + queue + " block in queue. Do yu want to process the queue before rollback?", "yes", "no").equals("yes")))
|
||||||
try {
|
try {
|
||||||
new CommandSaveQueue(sender, null);
|
new CommandSaveQueue(sender, null);
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
@@ -482,7 +481,7 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.GREEN.toString() + changes + " blocks found.");
|
sender.sendMessage(ChatColor.GREEN.toString() + changes + " blocks found.");
|
||||||
if (config.askRollbacks && questioner != null && sender instanceof Player && !questioner.askQuestion((Player)sender, "Are you sure you want to continue?", "yes", "no").equals("yes")) {
|
if (config.askRollbacks && questioner != null && sender instanceof Player && !questioner.ask((Player)sender, "Are you sure you want to continue?", "yes", "no").equals("yes")) {
|
||||||
sender.sendMessage(ChatColor.RED + "Rollback aborted");
|
sender.sendMessage(ChatColor.RED + "Rollback aborted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -493,9 +492,6 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "SQL exception");
|
sender.sendMessage(ChatColor.RED + "SQL exception");
|
||||||
log.log(Level.SEVERE, "[LogBlock Rollback] SQL exception", ex);
|
log.log(Level.SEVERE, "[LogBlock Rollback] SQL exception", ex);
|
||||||
} catch (final QuestionerException ex) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Questioner exception");
|
|
||||||
log.log(Level.SEVERE, "[LogBlock Rollback] Questioner exception", ex);
|
|
||||||
} catch (final WorldEditorException ex) {
|
} catch (final WorldEditorException ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "WorldEditor exception");
|
sender.sendMessage(ChatColor.RED + "WorldEditor exception");
|
||||||
log.log(Level.SEVERE, "[LogBlock Rollback] WorldEditor exception", ex);
|
log.log(Level.SEVERE, "[LogBlock Rollback] WorldEditor exception", ex);
|
||||||
@@ -526,7 +522,7 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.GREEN.toString() + changes + " blocks found.");
|
sender.sendMessage(ChatColor.GREEN.toString() + changes + " blocks found.");
|
||||||
if (config.askRedos && questioner != null && sender instanceof Player && !questioner.askQuestion((Player)sender, "Are you sure you want to continue?", "yes", "no").equals("yes")) {
|
if (config.askRedos && questioner != null && sender instanceof Player && !questioner.ask((Player)sender, "Are you sure you want to continue?", "yes", "no").equals("yes")) {
|
||||||
sender.sendMessage(ChatColor.RED + "Redo aborted");
|
sender.sendMessage(ChatColor.RED + "Redo aborted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -537,9 +533,6 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "SQL exception");
|
sender.sendMessage(ChatColor.RED + "SQL exception");
|
||||||
log.log(Level.SEVERE, "[LogBlock Redo] SQL exception", ex);
|
log.log(Level.SEVERE, "[LogBlock Redo] SQL exception", ex);
|
||||||
} catch (final QuestionerException ex) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Questioner exception");
|
|
||||||
log.log(Level.SEVERE, "[LogBlock Redo] Questioner exception", ex);
|
|
||||||
} catch (final WorldEditorException ex) {
|
} catch (final WorldEditorException ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "WorldEditor exception");
|
sender.sendMessage(ChatColor.RED + "WorldEditor exception");
|
||||||
log.log(Level.SEVERE, "[LogBlock Redo] WorldEditor exception", ex);
|
log.log(Level.SEVERE, "[LogBlock Redo] WorldEditor exception", ex);
|
||||||
@@ -573,7 +566,7 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
if (config.askClearLogs && sender instanceof Player && questioner != null) {
|
if (config.askClearLogs && sender instanceof Player && questioner != null) {
|
||||||
sender.sendMessage(ChatColor.DARK_AQUA + "Searching " + params.getTitle() + ":");
|
sender.sendMessage(ChatColor.DARK_AQUA + "Searching " + params.getTitle() + ":");
|
||||||
sender.sendMessage(ChatColor.GREEN.toString() + deleted + " blocks found.");
|
sender.sendMessage(ChatColor.GREEN.toString() + deleted + " blocks found.");
|
||||||
if (!questioner.askQuestion((Player)sender, "Are you sure you want to continue?", "yes", "no").equals("yes")) {
|
if (!questioner.ask((Player)sender, "Are you sure you want to continue?", "yes", "no").equals("yes")) {
|
||||||
sender.sendMessage(ChatColor.RED + "ClearLog aborted");
|
sender.sendMessage(ChatColor.RED + "ClearLog aborted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -608,9 +601,6 @@ public class CommandsHandler implements CommandExecutor
|
|||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
sender.sendMessage(ChatColor.RED + "SQL exception");
|
sender.sendMessage(ChatColor.RED + "SQL exception");
|
||||||
log.log(Level.SEVERE, "[LogBlock ClearLog] SQL exception", ex);
|
log.log(Level.SEVERE, "[LogBlock ClearLog] SQL exception", ex);
|
||||||
} catch (final QuestionerException ex) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Questioner exception");
|
|
||||||
log.log(Level.SEVERE, "[LogBlock ClearLog] Questioner exception", ex);
|
|
||||||
} finally {
|
} finally {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@@ -326,7 +326,7 @@ public class Consumer extends TimerTask
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean addPlayer(Connection conn, Statement state, String playerName) throws SQLException {
|
private boolean addPlayer(Connection conn, Statement state, String playerName) throws SQLException {
|
||||||
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + playerName + "');");
|
state.execute("INSERT IGNORE INTO `lb-players` (playername) VALUES ('" + playerName + "')");
|
||||||
conn.commit();
|
conn.commit();
|
||||||
final ResultSet rs = state.executeQuery("SELECT playername FROM `lb-players`");
|
final ResultSet rs = state.executeQuery("SELECT playername FROM `lb-players`");
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
|
Reference in New Issue
Block a user