Permalink
Browse files

Enable /seen to display more information for offline players, if avai…

…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 7ada8966afd2d31e37cae158ca33e8e409ce9786
@@ -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
@@ -54,6 +54,7 @@
import javax.annotation.Nullable;
// TODO: 7.1 cleanup
@Permissions
@RunAsync
@RegisterCommand({"seen", "seenplayer", "lookup"})
@@ -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())));
}
}

0 comments on commit 7ada896

Please sign in to comment.