|
@@ -18,12 +18,12 @@ public class CommandHandler {
|
|
|
}
|
|
|
|
|
|
public static void executeCommand(String[] command, Client caller) {
|
|
|
- for (int i = 0; i < commands.length; i++) {
|
|
|
- if ((commands[i].name).equals(command[0])) {
|
|
|
- if (caller.hasPermission(commands[i].permission))
|
|
|
- if (command.length -1 >= commands[i].argNumber) {
|
|
|
+ for (Command comm: commands) {
|
|
|
+ if ((comm.name).equals(command[0])) {
|
|
|
+ if (caller.hasPermission(comm.permission))
|
|
|
+ if (command.length -1 >= comm.argNumber) {
|
|
|
try {
|
|
|
- commands[i].execute(removeFirst(command), caller);
|
|
|
+ comm.execute(removeFirst(command), caller);
|
|
|
} catch (Exception e) {
|
|
|
caller.send("Error while executing command!");
|
|
|
e.printStackTrace();
|