Browse Source

Separated server and client commands.

Separated server and client commands into their own packages.
Tankernn 9 years ago
parent
commit
6af1f206d1

+ 3 - 4
src/main/java/server/CommandRegistry.java

@@ -3,11 +3,10 @@ package server;
 import java.util.HashMap;
 import java.util.List;
 
+import common.Command;
 import util.ClassFinder;
 import util.StringArrays;
 
-import common.Command;
-
 public class CommandRegistry extends HashMap<String, Command> {
 	
 	/**
@@ -15,8 +14,8 @@ public class CommandRegistry extends HashMap<String, Command> {
 	 */
 	private static final long serialVersionUID = 1L;
 	
-	public CommandRegistry() {
-		List<Class<?>> classes = ClassFinder.find("command");
+	public CommandRegistry(String commandPackage) {
+		List<Class<?>> classes = ClassFinder.find(commandPackage);
 		
 		for (Class<?> comm: classes) {
 			try {

+ 1 - 2
src/main/java/server/Server.java

@@ -7,7 +7,6 @@ import java.util.Optional;
 
 import util.Logger;
 import util.ServerProperties;
-
 import common.MessagePacket;
 
 public class Server {
@@ -50,7 +49,7 @@ public class Server {
 		channels.add(new Channel("Main"));
 		
 		System.out.print("Starting commandhandler...");
-		commReg = new CommandRegistry();
+		commReg = new CommandRegistry("server.command");
 		System.out.println("Done");
 		
 		System.out.print("Creating virtual local client...");

+ 1 - 1
src/main/java/command/Ban.java → src/main/java/server/command/Ban.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.InputMismatchException;
 import java.util.Optional;

+ 1 - 1
src/main/java/command/CreateChannel.java → src/main/java/server/command/CreateChannel.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import server.Client;
 import server.Server;

+ 1 - 1
src/main/java/command/Exit.java → src/main/java/server/command/Exit.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import server.Client;
 import server.Server;

+ 1 - 1
src/main/java/command/Help.java → src/main/java/server/command/Help.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.Iterator;
 import java.util.Map;

+ 1 - 1
src/main/java/command/JoinChannel.java → src/main/java/server/command/JoinChannel.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.Optional;
 

+ 1 - 1
src/main/java/command/Kick.java → src/main/java/server/command/Kick.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.Optional;
 

+ 1 - 1
src/main/java/command/LeaveChannel.java → src/main/java/server/command/LeaveChannel.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.Optional;
 

+ 1 - 1
src/main/java/command/List.java → src/main/java/server/command/List.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.Optional;
 

+ 1 - 1
src/main/java/command/PrivateMessage.java → src/main/java/server/command/PrivateMessage.java

@@ -1,4 +1,4 @@
-package command;
+package server.command;
 
 import java.util.Optional;