diff --git a/.idea/artifacts/Client_jar.xml b/.idea/artifacts/Client_jar.xml
new file mode 100644
index 0000000..bca276c
--- /dev/null
+++ b/.idea/artifacts/Client_jar.xml
@@ -0,0 +1,10 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Client_jar
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/artifacts/Server_jar.xml b/.idea/artifacts/Server_jar.xml
new file mode 100644
index 0000000..a0b38e8
--- /dev/null
+++ b/.idea/artifacts/Server_jar.xml
@@ -0,0 +1,14 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Server_jar
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 0a31912..62626a3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,46 +2,14 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -52,7 +20,7 @@
-
+
com.texttwist.client.*
@@ -63,11 +31,11 @@
-
-
+
+
-
-
+
+
@@ -75,21 +43,61 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -97,71 +105,31 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -178,36 +146,36 @@
- Insert y
- Insert you
- Insert your
- Insert your
- Insert your d
- Registration
- Registration uns
- R
- regisr
- regis
- registration
- registration unsu
- registration unsuc
- registration unsucce
- registration unsuccess
- G
- GameService is
- GameService is
- T
- TIMEO
- TIMEOUT
- Inse
- Insert
- Insert w
- Insert wo
- ga
- game is rea
- game is read
- le
- letters
+ multicast
+ multicastID
+ us
+ users
+ users"
+ "users"
+ m
+ matchT
+ matchTi
+ matchTime
+ matchTimeo
+ matchTimeou
+ matchTimeout
+ A
+ AP
+ APP not
+ APP no
+ APP n
+ APP
+ APP
+ APP:
+ APP: A
+ APP:
+ no
+ notifica
+ notificationS
+ notificationSEr
+ notificationSErv
+ notificationSErver
+ notificationSErver.
C:\Users\loke\TextTwist\out\production
@@ -346,57 +314,57 @@
@@ -416,10 +384,10 @@
-
-
-
-
+
+
+
+
@@ -451,6 +419,8 @@
+
+
@@ -469,7 +439,7 @@
-
+
@@ -479,121 +449,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -607,7 +463,7 @@
-
+
@@ -629,7 +485,7 @@
-
+
@@ -651,7 +507,7 @@
-
+
@@ -673,7 +529,7 @@
-
+
@@ -695,7 +551,7 @@
-
+
@@ -708,8 +564,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -730,8 +604,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -757,7 +657,7 @@
-
+
@@ -783,7 +683,7 @@
-
+
@@ -809,7 +709,7 @@
-
+
@@ -913,14 +813,12 @@
-
-
-
+
@@ -931,12 +829,8 @@
-
-
-
-
-
-
+
+
@@ -946,8 +840,12 @@
-
-
+
+
+
+
+
+
@@ -1382,8 +1280,8 @@
-
-
+
+
@@ -1444,46 +1342,52 @@
+
+
+
+
+
+
+
-
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Client/resources/images/logout.png b/Client/resources/images/logout.png
deleted file mode 100644
index 6093b84..0000000
Binary files a/Client/resources/images/logout.png and /dev/null differ
diff --git a/Client/resources/images/scores.png b/Client/resources/images/scores.png
deleted file mode 100644
index d07dfe8..0000000
Binary files a/Client/resources/images/scores.png and /dev/null differ
diff --git a/Client/src/META-INF/MANIFEST.MF b/Client/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..4b258d3
--- /dev/null
+++ b/Client/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.texttwist.client.Main
+
diff --git a/Client/src/com/texttwist/client/App.java b/Client/src/com/texttwist/client/App.java
index de9185d..9008c50 100644
--- a/Client/src/com/texttwist/client/App.java
+++ b/Client/src/com/texttwist/client/App.java
@@ -32,8 +32,8 @@ import java.rmi.server.UnicastRemoteObject;
*/
public class App extends JFrame {
- private static InetSocketAddress clientTCPSocketAddress = new InetSocketAddress(Config.GameServerURI, Config.GameServerPort);
- public static InetSocketAddress clientUDPSocketAddress = new InetSocketAddress(Config.WordsReceiverServerURI, Config.WordsReceiverServerPort);
+ private static InetSocketAddress clientTCPSocketAddress = new InetSocketAddress(Config.MessageServiceURI, Config.MessageServicePort);
+ public static InetSocketAddress clientUDPSocketAddress = new InetSocketAddress(Config.WordsReceiverServiceURI, Config.WordsReceiverServicePort);
private static InetAddress clientMulticastSocketAddress;
public static AuthService authService;
@@ -68,7 +68,7 @@ public class App extends JFrame {
logger.write("APP: Font not found!");
}
- /*Services*/
+ /*services*/
gameService = new GameService();
authService = new AuthService();
@@ -79,10 +79,10 @@ public class App extends JFrame {
public static void registerForNotifications() throws RemoteException, NotBoundException {
- Registry registry = LocateRegistry.getRegistry(Config.NotificationServerStubPort);
+ Registry registry = LocateRegistry.getRegistry(Config.NotificationServiceStubPort);
INotificationClient callbackObj = new NotificationClientService();
notificationStub = (INotificationClient) UnicastRemoteObject.exportObject(callbackObj, 0);
- INotificationServer notificationServer = (INotificationServer) registry.lookup(Config.NotificationServerName);
+ INotificationServer notificationServer = (INotificationServer) registry.lookup(Config.NotificationServiceName);
notificationServer.registerForCallback(notificationStub);
}
@@ -98,7 +98,7 @@ public class App extends JFrame {
public static void openClientMulticastSocket(Integer multicastId){
try {
App.gameService.setMulticastId(multicastId);
- clientMulticastSocketAddress = InetAddress.getByName(Config.ScoreMulticastServerURI);
+ clientMulticastSocketAddress = InetAddress.getByName(Config.ScoreMulticastServiceURI);
clientMulticast = new MulticastSocket(gameService.multicastId);
clientMulticast.joinGroup(clientMulticastSocketAddress);
} catch (IOException e) {
@@ -109,7 +109,7 @@ public class App extends JFrame {
public static void closeClientMulticastSocket(){
//Leave group and close multicast socket
try {
- App.clientMulticast.leaveGroup(InetAddress.getByName(Config.ScoreMulticastServerURI));
+ App.clientMulticast.leaveGroup(InetAddress.getByName(Config.ScoreMulticastServiceURI));
App.clientMulticast.close();
} catch (IOException e) {
e.printStackTrace();
diff --git a/Client/src/com/texttwist/client/controllers/HomeController.java b/Client/src/com/texttwist/client/controllers/HomeController.java
index 2197bbd..30faf9c 100644
--- a/Client/src/com/texttwist/client/controllers/HomeController.java
+++ b/Client/src/com/texttwist/client/controllers/HomeController.java
@@ -18,6 +18,11 @@ public class HomeController {
public Response login(String userName, String password) throws RemoteException, NotBoundException, MalformedURLException {
Response res = authService.login(userName,password);
if (res.code == 200){
+ try {
+ App.registerForNotifications();
+ } catch (RemoteException e) {
+ App.logger.write("AUTH SERVICE: Can't register for notification");
+ }
App.session = (new Session(new User(userName,password,0), res.data.get("token").toString()));
}
return res;
diff --git a/Client/src/com/texttwist/client/controllers/MatchRequestController.java b/Client/src/com/texttwist/client/controllers/MatchRequestController.java
index f2d797a..1343a7d 100644
--- a/Client/src/com/texttwist/client/controllers/MatchRequestController.java
+++ b/Client/src/com/texttwist/client/controllers/MatchRequestController.java
@@ -1,6 +1,8 @@
package com.texttwist.client.controllers;
import com.texttwist.client.App;
+import com.texttwist.client.tasks.JoinMatch;
+
import javax.swing.*;
/**
@@ -14,6 +16,6 @@ public class MatchRequestController {
}
public void joinMatch(String matchName){
- App.gameService.joinMatch(matchName);
+ new JoinMatch(matchName).execute();
}
}
diff --git a/Client/src/com/texttwist/client/controllers/MatchSetupController.java b/Client/src/com/texttwist/client/controllers/MatchSetupController.java
index bf47bb0..98b3dd5 100644
--- a/Client/src/com/texttwist/client/controllers/MatchSetupController.java
+++ b/Client/src/com/texttwist/client/controllers/MatchSetupController.java
@@ -1,5 +1,7 @@
package com.texttwist.client.controllers;
+import com.texttwist.client.tasks.InvitePlayers;
+
import javax.swing.*;
import static com.texttwist.client.App.gameService;
@@ -10,6 +12,7 @@ import static com.texttwist.client.App.gameService;
public class MatchSetupController {
public void play(DefaultListModel userNames) {
- gameService.beginMatch(userNames);
+ new InvitePlayers(userNames).execute();
+
}
}
diff --git a/Client/src/com/texttwist/client/pages/GamePage.java b/Client/src/com/texttwist/client/pages/GamePage.java
index fc7e10e..ed3571a 100644
--- a/Client/src/com/texttwist/client/pages/GamePage.java
+++ b/Client/src/com/texttwist/client/pages/GamePage.java
@@ -141,7 +141,7 @@ public class GamePage extends Page {
return null;
}
}),
- Config.timeoutGame
+ Config.gameTimeout
);
}
}
diff --git a/Client/src/com/texttwist/client/pages/MatchSetupPage.java b/Client/src/com/texttwist/client/pages/MatchSetupPage.java
index 64f7672..94202bc 100644
--- a/Client/src/com/texttwist/client/pages/MatchSetupPage.java
+++ b/Client/src/com/texttwist/client/pages/MatchSetupPage.java
@@ -58,7 +58,7 @@ public class MatchSetupPage extends Page{
new Callable