Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
Artem Didytschuk 2022-03-03 13:27:46 +01:00
commit 1c40e39708
2 changed files with 36 additions and 29 deletions

View File

@ -4,7 +4,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>192</x>
<x>114</x>
<y>438</y>
<w>270</w>
<h>96</h>
@ -27,7 +27,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>258</x>
<x>180</x>
<y>348</y>
<w>126</w>
<h>42</h>
@ -41,7 +41,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>78</x>
<x>0</x>
<y>642</y>
<w>126</w>
<h>42</h>
@ -54,7 +54,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>264</x>
<x>186</x>
<y>642</y>
<w>126</w>
<h>42</h>
@ -67,7 +67,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>258</x>
<x>180</x>
<y>246</y>
<w>126</w>
<h>42</h>
@ -80,7 +80,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>438</x>
<x>360</x>
<y>642</y>
<w>126</w>
<h>42</h>
@ -93,7 +93,7 @@
<element>
<id>Relation</id>
<coordinates>
<x>318</x>
<x>240</x>
<y>384</y>
<w>18</w>
<h>66</h>
@ -104,7 +104,7 @@
<element>
<id>Relation</id>
<coordinates>
<x>318</x>
<x>240</x>
<y>282</y>
<w>18</w>
<h>78</h>
@ -115,18 +115,18 @@
<element>
<id>Relation</id>
<coordinates>
<x>318</x>
<y>606</y>
<x>240</x>
<y>612</y>
<w>18</w>
<h>48</h>
<h>42</h>
</coordinates>
<panel_attributes>lt=&lt;..</panel_attributes>
<additional_attributes>10.0;60.0;10.0;10.0</additional_attributes>
<additional_attributes>10.0;50.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>198</x>
<x>120</x>
<y>654</y>
<w>78</w>
<h>18</h>
@ -137,7 +137,7 @@
<element>
<id>Relation</id>
<coordinates>
<x>384</x>
<x>306</x>
<y>654</y>
<w>66</w>
<h>18</h>
@ -148,8 +148,8 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>264</x>
<y>552</y>
<x>186</x>
<y>558</y>
<w>126</w>
<h>60</h>
</coordinates>
@ -157,6 +157,7 @@
--
- pullStats(user)
+ pushStats(user)
+ createNewUser(user)
+ checkForLogin(String username, String passwort):boolean
+ getWord(int)</panel_attributes>
<additional_attributes/>
@ -164,7 +165,7 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>540</x>
<x>462</x>
<y>426</y>
<w>126</w>
<h>156</h>
@ -191,7 +192,7 @@
<element>
<id>Relation</id>
<coordinates>
<x>456</x>
<x>378</x>
<y>480</y>
<w>96</w>
<h>24</h>
@ -203,21 +204,21 @@ m1=n</panel_attributes>
<element>
<id>Relation</id>
<coordinates>
<x>318</x>
<x>240</x>
<y>528</y>
<w>24</w>
<h>36</h>
<h>42</h>
</coordinates>
<panel_attributes>lt=&lt;..
1
</panel_attributes>
<additional_attributes>10.0;40.0;10.0;10.0</additional_attributes>
<additional_attributes>10.0;50.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>660</x>
<x>582</x>
<y>474</y>
<w>114</w>
<h>30</h>
@ -230,7 +231,7 @@ m1=1
<element>
<id>UMLClass</id>
<coordinates>
<x>762</x>
<x>684</x>
<y>450</y>
<w>126</w>
<h>102</h>

View File

@ -44,14 +44,13 @@ public class WordleServer extends Server {
@Override
public void processMessage(String pClientIP, int pClientPort, String pMessage) {
String conectionID = pClientIP + ":" + Integer.toString(pClientPort);
User u = users.get(conectionID);
String connectionID = pClientIP + ":" + Integer.toString(pClientPort);
User u = users.get(connectionID);
u.setConnectionID(connectionID);
if (pMessage.equals("QUIT")) {
send(pClientIP, pClientPort, "+OK Bye");
close();
} else {
send(pClientIP, pClientPort, "-ERR Command not valid in this state");
}
switch (u.getState()) {
@ -61,13 +60,20 @@ public class WordleServer extends Server {
if (m.equalsIgnoreCase("USER")) {
m = pMessage.substring(6, pMessage.length() - 1);
u.setUsername(m);
send(pClientIP, pClientPort, "+OK Bye");
send(pClientIP, pClientPort, "+OK");
} else if (m.equalsIgnoreCase("PASS")) {
m = pMessage.substring(6, pMessage.length() - 1);
u.setPassword(m);
if (u.getPassword() != null && u.getUsername() != null) {
query.checkLogin(u.getUsername(), u.getPassword());
if (query.checkLogin(u.getUsername(), u.getPassword())) {
send(pClientIP, pClientPort, "+OK welcome");
u.setState(3);
} else {
send(pClientIP, pClientPort, "+ERR login not valid");
}
}
} else {
send(pClientIP, pClientPort, "-ERR Command not valid in this state");
}
break;
case 2: