Refactored Generation and class structure
This commit is contained in:
@ -3,7 +3,7 @@ package eu.mhsl.minenet.minigames.message;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.minestom.server.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
//TODO maybe async large batches
|
||||
@ -14,7 +14,7 @@ public interface Sendable {
|
||||
players.forEachAudience(audience -> this.send((Player) audience));
|
||||
}
|
||||
|
||||
default void send(List<Player> players) {
|
||||
default void send(Collection<Player> players) {
|
||||
players.forEach(this::send);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import net.kyori.adventure.text.ComponentBuilder;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.minestom.server.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -94,8 +95,8 @@ public abstract class TranslatableMessage implements Sendable {
|
||||
public Component build(Player p) {
|
||||
ComponentBuilder<TextComponent, TextComponent.Builder> out = Component.text();
|
||||
chain.forEach(componentLike -> {
|
||||
if(componentLike == null) componentLike = Component.text("NULL", NamedTextColor.RED, TextDecoration.ITALIC);
|
||||
if(componentLike instanceof Translatable t) t.assemble(p);
|
||||
|
||||
out.append(componentLike);
|
||||
});
|
||||
return out.build();
|
||||
|
Reference in New Issue
Block a user