forked from SteamWar/SteamWar
Fix links in chat not clickable
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user