|
@@ -55,7 +55,8 @@ public class ChannelCommandParser extends CommandParser {
|
55
|
55
|
|
56
|
56
|
/** Loads the relevant commands into the parser */
|
57
|
57
|
protected void loadCommands() {
|
58
|
|
- throw new UnsupportedOperationException("Not implemented yet");
|
|
58
|
+ CommandManager.loadChannelCommands(this);
|
|
59
|
+ CommandManager.loadServerCommands(this);
|
59
|
60
|
}
|
60
|
61
|
|
61
|
62
|
/**
|
|
@@ -65,7 +66,11 @@ public class ChannelCommandParser extends CommandParser {
|
65
|
66
|
* @param args The arguments to the command
|
66
|
67
|
*/
|
67
|
68
|
protected void executeCommand(CommandWindow origin, Command command, String... args) {
|
68
|
|
- throw new UnsupportedOperationException("Not implemented yet");
|
|
69
|
+ if (command instanceof ChannelCommand) {
|
|
70
|
+ ((ChannelCommand) command).execute(origin, server, channel, args);
|
|
71
|
+ } else {
|
|
72
|
+ ((ServerCommand) command).execute(origin, server, args);
|
|
73
|
+ }
|
69
|
74
|
}
|
70
|
75
|
|
71
|
76
|
/**
|
|
@@ -77,7 +82,7 @@ public class ChannelCommandParser extends CommandParser {
|
77
|
82
|
* @param args The arguments passed to the command
|
78
|
83
|
*/
|
79
|
84
|
protected void handleInvalidCommand(CommandWindow origin, String command, String... args) {
|
80
|
|
- throw new UnsupportedOperationException("Not implemented yet");
|
|
85
|
+ origin.addLine("Unknown command: "+command+"/"+(args.length-1));
|
81
|
86
|
}
|
82
|
87
|
|
83
|
88
|
/**
|
|
@@ -87,7 +92,7 @@ public class ChannelCommandParser extends CommandParser {
|
87
|
92
|
* @param line The line input by the user
|
88
|
93
|
*/
|
89
|
94
|
protected void handleNonCommand(CommandWindow origin, String line) {
|
90
|
|
- throw new UnsupportedOperationException("Not implemented yet");
|
|
95
|
+ channel.sendLine(line);
|
91
|
96
|
}
|
92
|
97
|
|
93
|
98
|
}
|