diff --git a/SpongeAPI b/SpongeAPI index 0b265ac3328..0bce6b81d0a 160000 --- a/SpongeAPI +++ b/SpongeAPI @@ -1 +1 @@ -Subproject commit 0b265ac3328cdf67247ce295f74c0b69443ad877 +Subproject commit 0bce6b81d0a67924ea04ea23cee0d6a6d8780dd4 diff --git a/testplugins/src/main/java/org/spongepowered/test/scoreboard/ScoreboardTest.java b/testplugins/src/main/java/org/spongepowered/test/scoreboard/ScoreboardTest.java index 386b743ceb2..3bbc788a193 100644 --- a/testplugins/src/main/java/org/spongepowered/test/scoreboard/ScoreboardTest.java +++ b/testplugins/src/main/java/org/spongepowered/test/scoreboard/ScoreboardTest.java @@ -31,6 +31,7 @@ import org.spongepowered.api.command.Command; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.parameter.CommandContext; +import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.lifecycle.RegisterCommandEvent; @@ -73,9 +74,9 @@ public CommandResult doScoreboardStuff(CommandContext ctx) { scoreboard.addObjective(test); scoreboard.updateDisplaySlot(test, DisplaySlots.SIDEBAR); - final Score score = test.findOrCreateScore("testScore"); - score.setScore(1); - score.setDisplay(Component.text("TestScoreDisplay")); + final Score score1 = test.findOrCreateScore("testScore"); + score1.setScore(1); + score1.setDisplay(Component.text("TestScoreDisplay")); final Score score2 = test.findOrCreateScore("testScoreBlank"); score2.setScore(2); @@ -85,13 +86,22 @@ public CommandResult doScoreboardStuff(CommandContext ctx) { final Score score3 = test.findOrCreateScore("testScoreFixed"); score3.setScore(3); score3.setDisplay(Component.text("TestScoreDisplay Fixed")); - score3.setNumberFormat(ScoreFormat.fixed(Component.text("Fix"))); + score3.setNumberFormat(ScoreFormat.fixed(Component.text("Fixed Value"))); final Score score4 = test.findOrCreateScore("testScoreStyled"); score4.setScore(4); score4.setDisplay(Component.text("TestScoreDisplay Styled")); score4.setNumberFormat(ScoreFormat.styled(Style.style(NamedTextColor.GREEN))); + final Score score5 = test.findOrCreateScore(player.profile()); + score5.setScore(5); + score5.setDisplay(Component.text("Profile " + score5.name())); + + player.world().nearbyEntities(player.position(), 20).stream().filter(e -> !(e instanceof Player)).findFirst().ifPresent(entity -> { + final Score score6 = test.findOrCreateScore(entity); + score6.setScore(6); + score6.setDisplay(Component.text( "Entity " + score6.name())); + }); ctx.sendMessage(Component.text("Objective set")); });