Fix links in chat not clickable

This commit is contained in:
Lixfel
2024-11-30 10:31:49 +01:00
parent 996e4932d7
commit 2032a0b642
4 changed files with 14 additions and 15 deletions
@@ -26,9 +26,9 @@ import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import de.steamwar.persistent.Servertype;
import de.steamwar.persistent.Subserver;
import de.steamwar.velocitycore.VelocityCore;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import de.steamwar.velocitycore.VelocityCore;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
@@ -47,6 +47,7 @@ import java.util.function.Supplier;
import java.util.stream.Stream;
public interface Chatter {
LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder().extractUrls().build();
static Stream<Player> allPlayers() {
return VelocityCore.getProxy().getAllPlayers().stream();
@@ -138,7 +139,7 @@ public interface Chatter {
}
default String parseToLegacy(Message message) {
return LegacyComponentSerializer.legacySection().serialize(parse(message));
return SERIALIZER.serialize(parse(message));
}
default Component parse(String format, Object... params) {
@@ -178,7 +179,7 @@ public interface Chatter {
params[i] = func.apply(this);
}
}
return LegacyComponentSerializer.legacySection().deserialize(format.format(params));
return SERIALIZER.deserialize(format.format(params));
}
static PlayerChatter of(Player player) {