Skip to content

Commit a5a3dbf

Browse files
committed
Fix some bugs
1 parent 0231c1d commit a5a3dbf

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

src/main/java/io/ib67/meeting/data/MeetingSession.java

+28-27
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,38 @@
88
import net.minestom.server.entity.Player;
99
import net.minestom.server.instance.Instance;
1010

11+
import java.util.stream.Collectors;
12+
1113
public record MeetingSession(
1214
String title,
1315
String inviteCode,
1416
boolean persistent,
1517
Instance instance
16-
) {
17-
public void greet(Player player) {
18-
player.sendMessage(
19-
Component.text("Welcome! ") //huh, over-engineered api, isn't it?
20-
.color(NamedTextColor.GREEN)
21-
.style(Style.style(TextDecoration.BOLD))
22-
.append(
23-
Component.text("You just joined ")
24-
.append(
25-
Component.text(title())
26-
.style(Style.style(TextDecoration.UNDERLINED))
27-
)
28-
)
29-
);
30-
instance.getPlayers().forEach(p -> {
31-
p.sendMessage(
32-
Component.text(player.getUsername()).color(NamedTextColor.AQUA)
33-
.append(Component.text(" joined the meeting!").color(NamedTextColor.WHITE))
34-
);
35-
});
36-
player.sendMessage(Component.text("Here are " + instance.getPlayers().size() + " players in the meeting, including ")
18+
) {
19+
public void greet(Player player) {
20+
player.sendMessage(
21+
Component.text("Welcome! ") //huh, over-engineered api, isn't it?
22+
.color(NamedTextColor.GREEN)
23+
.style(Style.style(TextDecoration.BOLD))
3724
.append(
38-
instance.getPlayers().stream()
39-
.map(it -> Component.text(it.getUsername()).color(NamedTextColor.AQUA))
40-
.reduce(ScopedComponent::append)
41-
.get()
42-
));
43-
}
25+
Component.text("You just joined ")
26+
.append(
27+
Component.text(title())
28+
.style(Style.style(TextDecoration.UNDERLINED))
29+
)
30+
)
31+
);
32+
instance.getPlayers().forEach(p -> {
33+
p.sendMessage(
34+
Component.text(player.getUsername()).color(NamedTextColor.AQUA)
35+
.append(Component.text(" joined the meeting!").color(NamedTextColor.WHITE))
36+
);
37+
});
38+
player.sendMessage(Component.text("Here are " + instance.getPlayers().size() + " players in the meeting, including ")
39+
.append(
40+
Component.text(instance.getPlayers().stream()
41+
.map(it -> it.getUsername())
42+
.collect(Collectors.joining(", "))).color(NamedTextColor.AQUA)
43+
));
44+
}
4445
}

0 commit comments

Comments
 (0)