Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macro support for player account database #2912

Closed
Tracked by #2673 ...
cwisniew opened this issue Aug 24, 2021 · 5 comments · Fixed by #2966
Closed
Tracked by #2673 ...

Add macro support for player account database #2912

cwisniew opened this issue Aug 24, 2021 · 5 comments · Fixed by #2966
Assignees
Labels
feature Adding functionality that adds value macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) tested This issue has been QA tested by someone other than the developer.

Comments

@cwisniew
Copy link
Member

Is your feature request related to a problem? Please describe.
Add add player, remove player, and reset password macros as part of #2673

@cwisniew cwisniew added the feature Adding functionality that adds value label Aug 24, 2021
@cwisniew cwisniew self-assigned this Aug 24, 2021
@Phergus Phergus added this to To do in MapTool 1.10.0 via automation Sep 11, 2021
@Phergus Phergus added documentation needed Missing, out-of-date or bad documentation macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) labels Sep 11, 2021
@Phergus Phergus moved this from To do to In progress in MapTool 1.10.0 Sep 11, 2021
@Phergus
Copy link
Contributor

Phergus commented Sep 12, 2021

#2966 Added macro functions

Non Trusted
player.getName() => Returns current player name
player.getInfo() => Returns info current player (name, role, is connected)

Trusted
player.getInfo(name) => Returns info specified player (name, role, is connected)
player.getPlayers() => Returns info about all known players (name, role, is connected)
player.getConnectedPlayers() => Returns info about connected players (name, role)

When not using the player database (which requires server started with checkbox ticked) the known players will only be the currently connected players.

@Phergus Phergus moved this from In progress to Review in progress in MapTool 1.10.0 Oct 2, 2021
@Phergus
Copy link
Contributor

Phergus commented Oct 3, 2021

Testing.

From GM client, all functions worked as expected.

On player client, getInfo() & getName() functions thrown an exception whether run trusted or un-trusted:

java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "net.rptools.maptool.model.player.PlayerInfo.name()" because "playerInfo" is null
Error trace : Get Info@campaign
java.lang.NullPointerException: Cannot invoke "net.rptools.maptool.model.player.PlayerInfo.name()" because the return value of "java.util.concurrent.CompletableFuture.get()" is null error executing expression player.getName().
Error trace : Get Name@campaign

Also on player client, both getPlayers() and getConnectedPlayers() return the info for only the GM player but uses the Default Username as set in preferences and not the GM name as entered on the Start Server dialog.

[{
  "name": "Default Username",
  "role": "GM",
  "connected": true
}]

@Phergus Phergus reopened this Oct 3, 2021
MapTool 1.10.0 automation moved this from Review in progress to In progress Oct 3, 2021
@Phergus Phergus moved this from In progress to Review in progress in MapTool 1.10.0 Oct 3, 2021
@Phergus Phergus moved this from Review in progress to In progress in MapTool 1.10.0 Oct 3, 2021
@Phergus Phergus moved this from In progress to Review in progress in MapTool 1.10.0 Oct 3, 2021
@Phergus
Copy link
Contributor

Phergus commented Oct 3, 2021

Passing player.getInfo("nobody") a name that isn't in database produces an exception:

java.util.concurrent.ExecutionException: java.lang.NullPointerException: 
   Cannot invoke "net.rptools.maptool.model.player.PlayerInfo.name()" because "playerInfo" is null
Error trace : Get Info Error@campaign

@Phergus
Copy link
Contributor

Phergus commented Oct 3, 2021

Wiki pages added for player.getName, .getInfo(), .getPlayers, .getConnected.
https://wiki.rptools.info/index.php/Category:Player_Database_Function

@Phergus Phergus removed the documentation needed Missing, out-of-date or bad documentation label Oct 3, 2021
@Phergus Phergus added the tested This issue has been QA tested by someone other than the developer. label Oct 7, 2021
@Phergus
Copy link
Contributor

Phergus commented Oct 7, 2021

Tested. Issues reported above have been corrected.

@Phergus Phergus moved this from Review in progress to Reviewer approved in MapTool 1.10.0 Oct 7, 2021
@Phergus Phergus closed this as completed Oct 7, 2021
@Phergus Phergus moved this from Reviewer approved to Done in MapTool 1.10.0 Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding functionality that adds value macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) tested This issue has been QA tested by someone other than the developer.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants