Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Update text usage for latest Velocity build
Dieser Commit ist enthalten in:
Ursprung
d91d47a755
Commit
46f9967dba
@ -54,7 +54,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.velocitypowered</groupId>
|
<groupId>com.velocitypowered</groupId>
|
||||||
<artifactId>velocity-api</artifactId>
|
<artifactId>velocity-api</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -11,7 +11,7 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
|
|||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.kyori.text.serializer.ComponentSerializers;
|
import net.kyori.text.serializer.gson.GsonComponentSerializer;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -148,7 +148,7 @@ public class VelocityPlugin implements ViaPlatform<Player> {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(UUID uuid, String message) {
|
public void sendMessage(UUID uuid, String message) {
|
||||||
PROXY.getPlayer(uuid).ifPresent(it -> it.sendMessage(
|
PROXY.getPlayer(uuid).ifPresent(it -> it.sendMessage(
|
||||||
ComponentSerializers.JSON.deserialize(
|
GsonComponentSerializer.INSTANCE.deserialize(
|
||||||
ComponentSerializer.toString(TextComponent.fromLegacyText(message)) // Fixes links
|
ComponentSerializer.toString(TextComponent.fromLegacyText(message)) // Fixes links
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
@ -158,8 +158,8 @@ public class VelocityPlugin implements ViaPlatform<Player> {
|
|||||||
public boolean kickPlayer(UUID uuid, String message) {
|
public boolean kickPlayer(UUID uuid, String message) {
|
||||||
return PROXY.getPlayer(uuid).map(it -> {
|
return PROXY.getPlayer(uuid).map(it -> {
|
||||||
it.disconnect(
|
it.disconnect(
|
||||||
ComponentSerializers.JSON.deserialize(
|
GsonComponentSerializer.INSTANCE.deserialize(
|
||||||
ComponentSerializer.toString(TextComponent.fromLegacyText(message)) // ComponentSerializers.LEGACY is deprecated
|
ComponentSerializer.toString(TextComponent.fromLegacyText(message))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
|
@ -3,7 +3,7 @@ package us.myles.ViaVersion.velocity.command;
|
|||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.kyori.text.serializer.ComponentSerializers;
|
import net.kyori.text.serializer.gson.GsonComponentSerializer;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||||
@ -22,7 +22,7 @@ public class VelocityCommandSender implements ViaCommandSender {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(String msg) {
|
public void sendMessage(String msg) {
|
||||||
source.sendMessage(
|
source.sendMessage(
|
||||||
ComponentSerializers.JSON.deserialize(
|
GsonComponentSerializer.INSTANCE.deserialize(
|
||||||
ComponentSerializer.toString(TextComponent.fromLegacyText(msg)) // Fixes links
|
ComponentSerializer.toString(TextComponent.fromLegacyText(msg)) // Fixes links
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren