forked from MagicBane/Server
Project cleanup pre merge.
This commit is contained in:
@@ -29,101 +29,6 @@ public abstract class AbstractDevCmd {
|
||||
this.rsult = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called by the DevCmdManager. Method splits argString
|
||||
* into a String array and then calls the subclass specific _doCmd method.
|
||||
*/
|
||||
|
||||
public void doCmd(PlayerCharacter pcSender, String argString,
|
||||
AbstractGameObject target) {
|
||||
String[] args = argString.split(" ");
|
||||
|
||||
if (pcSender == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
|
||||
this.sendHelp(pcSender);
|
||||
this.sendUsage(pcSender);
|
||||
} else {
|
||||
this.tr = target;
|
||||
this._doCmd(pcSender, args, target);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target);
|
||||
|
||||
/**
|
||||
* Returns the string sent to the client that displays how to use this
|
||||
* command.
|
||||
*/
|
||||
|
||||
public final String getUsageString() {
|
||||
return "Usage: " + this._getUsageString();
|
||||
}
|
||||
|
||||
protected abstract String _getUsageString();
|
||||
|
||||
/**
|
||||
* Returns the string sent to the client that displays what this command
|
||||
* does.
|
||||
*/
|
||||
|
||||
public final String getHelpString() {
|
||||
return this.getMainCmdString() + ": " + this._getHelpString();
|
||||
}
|
||||
|
||||
protected abstract String _getHelpString();
|
||||
|
||||
public final ArrayList<String> getCmdStrings() {
|
||||
return cmdStrings;
|
||||
}
|
||||
|
||||
public final String getMainCmdString() {
|
||||
return this.cmdStrings.get(0);
|
||||
}
|
||||
|
||||
protected void addCmdString(String cmdString) {
|
||||
String lowercase = cmdString.toLowerCase();
|
||||
this.cmdStrings.add(lowercase);
|
||||
}
|
||||
|
||||
public void setTarget(AbstractGameObject ago) {
|
||||
this.tr = ago;
|
||||
}
|
||||
|
||||
public AbstractGameObject getTarget() {
|
||||
return this.tr;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.rsult = result;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return this.rsult;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper functions
|
||||
*/
|
||||
protected void sendUsage(PlayerCharacter pc) {
|
||||
this.throwbackError(pc, this.getUsageString());
|
||||
}
|
||||
|
||||
protected void sendHelp(PlayerCharacter pc) {
|
||||
this.throwbackError(pc, this.getHelpString());
|
||||
}
|
||||
|
||||
protected void throwbackError(PlayerCharacter pc, String msgText) {
|
||||
ChatManager.chatSystemError(pc, msgText);
|
||||
}
|
||||
|
||||
protected void throwbackInfo(PlayerCharacter pc, String msgText) {
|
||||
ChatManager.chatSystemInfo(pc, msgText);
|
||||
}
|
||||
|
||||
/*
|
||||
* Misc tools/helpers
|
||||
*/
|
||||
@@ -137,7 +42,7 @@ public abstract class AbstractDevCmd {
|
||||
ChatManager.chatSystemError(
|
||||
pc,
|
||||
"Command Failed. Could not find building of ID "
|
||||
+ targetID);
|
||||
+ targetID);
|
||||
return null;
|
||||
}
|
||||
return b;
|
||||
@@ -178,4 +83,99 @@ public abstract class AbstractDevCmd {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called by the DevCmdManager. Method splits argString
|
||||
* into a String array and then calls the subclass specific _doCmd method.
|
||||
*/
|
||||
|
||||
public void doCmd(PlayerCharacter pcSender, String argString,
|
||||
AbstractGameObject target) {
|
||||
String[] args = argString.split(" ");
|
||||
|
||||
if (pcSender == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
|
||||
this.sendHelp(pcSender);
|
||||
this.sendUsage(pcSender);
|
||||
} else {
|
||||
this.tr = target;
|
||||
this._doCmd(pcSender, args, target);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void _doCmd(PlayerCharacter pcSender, String[] args,
|
||||
AbstractGameObject target);
|
||||
|
||||
/**
|
||||
* Returns the string sent to the client that displays how to use this
|
||||
* command.
|
||||
*/
|
||||
|
||||
public final String getUsageString() {
|
||||
return "Usage: " + this._getUsageString();
|
||||
}
|
||||
|
||||
protected abstract String _getUsageString();
|
||||
|
||||
/**
|
||||
* Returns the string sent to the client that displays what this command
|
||||
* does.
|
||||
*/
|
||||
|
||||
public final String getHelpString() {
|
||||
return this.getMainCmdString() + ": " + this._getHelpString();
|
||||
}
|
||||
|
||||
protected abstract String _getHelpString();
|
||||
|
||||
public final ArrayList<String> getCmdStrings() {
|
||||
return cmdStrings;
|
||||
}
|
||||
|
||||
public final String getMainCmdString() {
|
||||
return this.cmdStrings.get(0);
|
||||
}
|
||||
|
||||
protected void addCmdString(String cmdString) {
|
||||
String lowercase = cmdString.toLowerCase();
|
||||
this.cmdStrings.add(lowercase);
|
||||
}
|
||||
|
||||
public AbstractGameObject getTarget() {
|
||||
return this.tr;
|
||||
}
|
||||
|
||||
public void setTarget(AbstractGameObject ago) {
|
||||
this.tr = ago;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return this.rsult;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.rsult = result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper functions
|
||||
*/
|
||||
protected void sendUsage(PlayerCharacter pc) {
|
||||
this.throwbackError(pc, this.getUsageString());
|
||||
}
|
||||
|
||||
protected void sendHelp(PlayerCharacter pc) {
|
||||
this.throwbackError(pc, this.getHelpString());
|
||||
}
|
||||
|
||||
protected void throwbackError(PlayerCharacter pc, String msgText) {
|
||||
ChatManager.chatSystemError(pc, msgText);
|
||||
}
|
||||
|
||||
protected void throwbackInfo(PlayerCharacter pc, String msgText) {
|
||||
ChatManager.chatSystemInfo(pc, msgText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user