Refactored Generation and class structure

This commit is contained in:
2023-11-11 22:13:58 +01:00
parent d9bbaf9865
commit 6dc4269367
53 changed files with 1049 additions and 72 deletions

View File

@ -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);
}

View File

@ -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();