forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -6,81 +6,79 @@ import engine.objects.PlayerCharacter;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* Summary: Devcmd to toggle logging of mysql statements
|
||||
*
|
||||
* @author Summary: Devcmd to toggle logging of mysql statements
|
||||
*/
|
||||
|
||||
|
||||
public class SqlDebugCmd extends AbstractDevCmd {
|
||||
|
||||
// Instance variables
|
||||
|
||||
|
||||
public SqlDebugCmd() {
|
||||
|
||||
|
||||
public SqlDebugCmd() {
|
||||
super("sqldebug");
|
||||
}
|
||||
|
||||
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Boolean debugState = false;
|
||||
|
||||
if(validateUserInput(args) == false) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
// Arguments have been validated use argument to set debug state
|
||||
|
||||
switch (args[0]) {
|
||||
case "on":
|
||||
debugState = true;
|
||||
break;
|
||||
case "off":
|
||||
debugState = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
MBServerStatics.DB_ENABLE_QUERY_OUTPUT = debugState;
|
||||
|
||||
// Send results to user
|
||||
throwbackInfo(pc, "SQL debug state: " + debugState.toString());
|
||||
}
|
||||
// AbstractDevCmd Overridden methods
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Toggles sending SQL statements to log";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "/sqldebug on|off";
|
||||
}
|
||||
|
||||
// Class methods
|
||||
|
||||
private static boolean validateUserInput(String[] userInput) {
|
||||
private static boolean validateUserInput(String[] userInput) {
|
||||
|
||||
int stringIndex;
|
||||
String commandSet = "onoff";
|
||||
|
||||
|
||||
// incorrect number of arguments test
|
||||
|
||||
|
||||
if (userInput.length != 1)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
// Validate arguments
|
||||
|
||||
|
||||
stringIndex = commandSet.indexOf(userInput[0].toLowerCase());
|
||||
|
||||
return stringIndex != -1;
|
||||
return stringIndex != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter pc, String[] args,
|
||||
AbstractGameObject target) {
|
||||
|
||||
Boolean debugState = false;
|
||||
|
||||
if (validateUserInput(args) == false) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Arguments have been validated use argument to set debug state
|
||||
|
||||
switch (args[0]) {
|
||||
case "on":
|
||||
debugState = true;
|
||||
break;
|
||||
case "off":
|
||||
debugState = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
MBServerStatics.DB_ENABLE_QUERY_OUTPUT = debugState;
|
||||
|
||||
// Send results to user
|
||||
throwbackInfo(pc, "SQL debug state: " + debugState.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Toggles sending SQL statements to log";
|
||||
}
|
||||
|
||||
// Class methods
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "/sqldebug on|off";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user