added appendWithSpace component util
This commit is contained in:
parent
05e88845be
commit
24fbd50c62
src/main/java/eu/mhsl/craftattack/spawn
@ -2,6 +2,7 @@ package eu.mhsl.craftattack.spawn.appliances.chatMention;
|
||||
|
||||
import eu.mhsl.craftattack.spawn.appliance.ApplianceListener;
|
||||
import eu.mhsl.craftattack.spawn.appliances.settings.Settings;
|
||||
import eu.mhsl.craftattack.spawn.util.text.ComponentUtil;
|
||||
import io.papermc.paper.event.player.AsyncChatDecorateEvent;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
@ -36,7 +37,7 @@ public class ChatMentionListener extends ApplianceListener<ChatMention> {
|
||||
return Component.text(word);
|
||||
}
|
||||
})
|
||||
.reduce((a, b) -> a.append(Component.text(" ")).append(b))
|
||||
.reduce(ComponentUtil::appendWithSpace)
|
||||
.orElseThrow();
|
||||
|
||||
getAppliance().notifyPlayers(mentioned);
|
||||
|
@ -22,6 +22,10 @@ public class ComponentUtil {
|
||||
return Component.text().append(a.appendNewline().append(b)).build();
|
||||
}
|
||||
|
||||
public static TextComponent appendWithSpace(Component a, Component b) {
|
||||
return Component.text().append(a).append(Component.text(" ")).append(b).build();
|
||||
}
|
||||
|
||||
public static Stream<String> lineBreak(String text) {
|
||||
return lineBreak(text, 50);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user