Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ingebrigt Ørstad
Progark gruppe 3
Commits
a842f9de
Commit
a842f9de
authored
5 years ago
by
Ivar Nordvik Myrstad
Browse files
Options
Downloads
Plain Diff
Merge branch '48-player-queryintermediate' into 'dev'
Resolve "Player QueryIntermediate" Closes
#48
See merge request
!45
parents
06666c03
9f7a0c79
No related branches found
No related tags found
1 merge request
!45
Resolve "Player QueryIntermediate"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/core/src/com/gameware/game/QueryIntermediate.java
+22
-1
22 additions, 1 deletion
frontend/core/src/com/gameware/game/QueryIntermediate.java
frontend/core/src/com/gameware/game/models/Player.java
+2
-0
2 additions, 0 deletions
frontend/core/src/com/gameware/game/models/Player.java
with
24 additions
and
1 deletion
frontend/core/src/com/gameware/game/QueryIntermediate.java
+
22
−
1
View file @
a842f9de
...
...
@@ -24,7 +24,7 @@ import java.util.HashMap;
import
java.util.NoSuchElementException
;
public
class
QueryIntermediate
{
private
static
String
baseUrl
=
"http://
192.168.0.195
:300
2
/api/"
;
private
static
String
baseUrl
=
"http://
localhost
:300
1
/api/"
;
private
static
Json
json
=
new
Json
();
private
static
JsonReader
jsonReader
=
new
JsonReader
();
...
...
@@ -254,4 +254,25 @@ public class QueryIntermediate {
return
player
;
}
public
static
Player
loginPlayer
(
String
username
,
String
password
)
throws
IOException
,
NoSuchElementException
{
String
route
=
"players/login/"
+
username
+
"/"
+
password
;
String
[]
response
=
sendGetRequest
(
route
);
checkStatusCode
(
response
);
Player
player
=
json
.
fromJson
(
Player
.
class
,
response
[
1
].
substring
(
1
,
response
[
1
].
length
()-
1
));
checkObjectNotNull
(
player
);
return
player
;
}
public
static
Player
createNewPlayer
(
String
username
,
String
password
)
throws
IOException
,
NoSuchElementException
{
String
route
=
"players/"
;
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"username"
,
username
);
params
.
put
(
"password"
,
password
);
String
[]
response
=
sendPutRequest
(
route
,
params
);
checkStatusCode
(
response
);
Player
player
=
json
.
fromJson
(
Player
.
class
,
response
[
1
]);
checkObjectNotNull
(
player
);
return
player
;
}
}
This diff is collapsed.
Click to expand it.
frontend/core/src/com/gameware/game/models/Player.java
+
2
−
0
View file @
a842f9de
...
...
@@ -7,6 +7,8 @@ import java.util.jar.JarEntry;
public
class
Player
{
private
String
_id
;
private
String
name
;
private
String
password
;
private
String
dateJoined
;
public
Player
(
String
_id
,
String
name
)
{
this
.
_id
=
_id
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment