Guest entfernt

This commit is contained in:
Alperen Semih Baldan 2022-03-02 13:25:21 +01:00
parent a7a4848737
commit da1167b8d4
3 changed files with 92 additions and 72 deletions

View File

@ -1,4 +1,4 @@
public class User extends Guest
public class User
{
static DatabaseConnector databaseConnector;// Datenbankverbindung aufstellen
@ -14,13 +14,13 @@ public class User extends Guest
}
@Override
public void setPassword(String password)
{
databaseConnector.executeStatement("UPDATE User SET password = " + password + " Where name = " + this.name);
}
@Override
public String getPassword()
{
databaseConnector.executeStatement("SELECT password FROM User Where name =" + this.name);
@ -29,26 +29,26 @@ public class User extends Guest
}
@Override
public void setName(String name)
{
databaseConnector.executeStatement("UPDATE User SET name = " + name + " Where name = " + this.name);
}
@Override
public String getName()
{
return name;
}
@Override
public void setWinPercentage(float winPercentage)
{
databaseConnector.executeStatement("UPDATE User SET winPercentage = " + winPercentage + " Where name = " + this.name);
}
@Override
public float getWinPercentage()
{
databaseConnector.executeStatement("SELECT winPercentage FROM User Where name =" + this.name);
@ -57,13 +57,13 @@ public class User extends Guest
}
@Override
public void setTimesPlayed(int timesPlayed)
{
databaseConnector.executeStatement("UPDATE User SET timesPlayed = " + timesPlayed + " Where name = " + this.name);
}
@Override
public int getTimesPlayed()
{
databaseConnector.executeStatement("SELECT timesPlayed FROM User Where name =" + this.name);
@ -71,7 +71,7 @@ public class User extends Guest
return Integer.parseInt(result);
}
@Override
public void increaseTimesPlayed()
{
int temp = getTimesPlayed();
@ -80,13 +80,13 @@ public class User extends Guest
}
@Override
public void setCurrentStreak(int currentStreak)
{
databaseConnector.executeStatement("UPDATE User SET currentStreak = " + currentStreak + " Where name = " + this.name);
}
@Override
public int getCurrentStreak()
{
databaseConnector.executeStatement("SELECT currentStreak FROM User Where name =" + this.name);
@ -94,7 +94,7 @@ public class User extends Guest
return Integer.parseInt(result);
}
@Override
public void increaseCurrentStreak()
{
int temp = getCurrentStreak();
@ -103,13 +103,13 @@ public class User extends Guest
}
@Override
public void setMaxStreak(int maxStreak)
{
databaseConnector.executeStatement("UPDATE User SET maxStreak = " + maxStreak + " Where name = " + this.name);
}
@Override
public int getMaxStreak()
{
databaseConnector.executeStatement("SELECT maxStreak FROM User Where name =" + this.name);
@ -117,7 +117,7 @@ public class User extends Guest
return Integer.parseInt(result);
}
@Override
public void increaseMaxStreak()
{
int temp = getMaxStreak();
@ -126,13 +126,13 @@ public class User extends Guest
}
@Override
public void setWonInTurn(int row, int value)
{
databaseConnector.executeStatement("UPDATE User SET wonInTurn" + row + " = " + value + " Where name = " + this.name);
}
@Override
public int getWonInTurn(int row)
{
databaseConnector.executeStatement("SELECT wonInTurn" + row + " FROM User Where name =" + this.name);
@ -140,6 +140,12 @@ public class User extends Guest
return Integer.parseInt(result);
}
public void increaseWonInTurn(int row)
{
int temp = getWonInTurn(row) + 1;
setWonInTurn(row, temp);
}
public int[] getWonInTurnFull()
{
int[] result = {getWonInTurn(1),getWonInTurn(2),getWonInTurn(3),getWonInTurn(4),getWonInTurn(5),getWonInTurn(6)};

View File

@ -29,90 +29,104 @@ dependency8.type=UsesDependency
dependency9.from=WordleServer
dependency9.to=DatabaseConnector
dependency9.type=UsesDependency
editor.fx.0.height=1047
editor.fx.0.width=974
editor.fx.0.x=953
editor.fx.0.y=0
editor.fx.0.height=1026
editor.fx.0.width=1696
editor.fx.0.x=-8
editor.fx.0.y=-8
objectbench.height=153
objectbench.width=934
objectbench.width=1656
package.divider.horizontal=0.6
package.divider.vertical=0.8310454065469906
package.editor.height=767
package.editor.width=823
package.editor.x=953
package.divider.vertical=0.8272138228941684
package.editor.height=759
package.editor.width=1545
package.editor.x=0
package.editor.y=0
package.frame.height=1047
package.frame.width=974
package.frame.height=1026
package.frame.width=1696
package.numDependencies=10
package.numTargets=9
package.numTargets=11
package.showExtends=true
package.showUses=true
project.charset=windows-1252
readme.height=58
readme.height=60
readme.name=@README
readme.width=47
readme.width=49
readme.x=10
readme.y=10
target1.height=70
target1.name=DatabaseConnector
target1.name=Letter
target1.showInterface=false
target1.type=ClassTarget
target1.width=150
target1.x=180
target1.y=70
target2.height=60
target2.name=QueryResult
target1.width=120
target1.x=10
target1.y=80
target10.height=70
target10.name=GUI
target10.showInterface=false
target10.type=ClassTarget
target10.width=120
target10.x=140
target10.y=150
target11.height=60
target11.name=Queue
target11.showInterface=false
target11.type=ClassTarget
target11.width=160
target11.x=100
target11.y=520
target2.height=70
target2.name=DatabaseConnector
target2.showInterface=false
target2.type=ClassTarget
target2.width=100
target2.x=100
target2.y=600
target3.height=100
target3.name=Game
target2.width=150
target2.x=180
target2.y=70
target3.height=60
target3.name=QueryResult
target3.showInterface=false
target3.type=ClassTarget
target3.width=180
target3.x=630
target3.y=340
target4.height=70
target4.name=User
target3.width=100
target3.x=100
target3.y=600
target4.height=100
target4.name=Game
target4.showInterface=false
target4.type=ClassTarget
target4.width=130
target4.x=900
target4.y=180
target4.width=180
target4.x=630
target4.y=340
target5.height=70
target5.name=Server
target5.name=User
target5.showInterface=false
target5.type=AbstractTarget
target5.width=110
target5.x=310
target5.y=500
target5.type=ClassTarget
target5.width=130
target5.x=900
target5.y=180
target6.height=70
target6.name=WordleServer
target6.name=Server
target6.showInterface=false
target6.type=ClassTarget
target6.type=AbstractTarget
target6.width=110
target6.x=480
target6.x=310
target6.y=500
target7.height=70
target7.name=Guest
target7.name=WordleServer
target7.showInterface=false
target7.type=ClassTarget
target7.width=130
target7.x=900
target7.y=310
target8.height=60
target8.name=List
target7.width=110
target7.x=480
target7.y=500
target8.height=70
target8.name=Guest
target8.showInterface=false
target8.type=ClassTarget
target8.width=150
target8.x=560
target8.y=640
target8.width=130
target8.x=900
target8.y=310
target9.height=60
target9.name=Queue
target9.name=List
target9.showInterface=false
target9.type=ClassTarget
target9.width=160
target9.x=100
target9.y=520
target9.width=150
target9.x=560
target9.y=640