Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Enable /seen to display more information for offline players, if avai…
Browse files Browse the repository at this point in the history
…lable

This may not work if Sponge doesn't support that data at that time.

Fixes #1237
  • Loading branch information
dualspiral committed Aug 14, 2018
1 parent 25651ba commit 7ada896
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions changelogs/templates/1.5.3-S7.0.md
@@ -0,0 +1,7 @@
## New features

* `/seen` updated to show more information for offline players, if available (dependent on Sponge).

## Bugfixes

* Fix `/helpop` sending messages to the wrong players
Expand Up @@ -54,6 +54,7 @@

import javax.annotation.Nullable;

// TODO: 7.1 cleanup
@Permissions
@RunAsync
@RegisterCommand({"seen", "seenplayer", "lookup"})
Expand Down Expand Up @@ -156,12 +157,21 @@ public CommandResult executeCommand(CommandSource src, CommandContext args) {
.withLocale(src.getLocale())
.withZone(ZoneId.systemDefault()).format(x))));

user.get(Keys.WALKING_SPEED).ifPresent(x ->
messages.add(messageProvider.getTextMessageWithFormat("command.seen.speed.walk", String.valueOf(x * SpeedCommand.multiplier))));
user.get(Keys.FLYING_SPEED).ifPresent(x ->
messages.add(messageProvider.getTextMessageWithFormat("command.seen.speed.fly", String.valueOf(x * SpeedCommand.multiplier))));

Optional<Location<World>> olw = coreUserDataModule.getLogoutLocation();

olw.ifPresent(worldLocation -> messages
coreUserDataModule.getLogoutLocation().ifPresent(worldLocation -> messages
.add(getLocationString("command.seen.lastlocation", worldLocation, src)));

user.get(Keys.CAN_FLY).ifPresent(x ->
messages.add(messageProvider.getTextMessageWithFormat("command.seen.canfly", getYesNo(x))));
user.get(Keys.IS_FLYING).ifPresent(x ->
messages.add(messageProvider.getTextMessageWithFormat("command.seen.isflying", getYesNo(x))));
user.get(Keys.GAME_MODE).ifPresent(x ->
messages.add(messageProvider.getTextMessageWithFormat("command.seen.gamemode", x.getName())));

}
}

Expand Down

0 comments on commit 7ada896

Please sign in to comment.