3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 07:40:08 +01:00

Merge pull request #1319 from KennyTV/master

Update text usage for latest Velocity build
Dieser Commit ist enthalten in:
Myles 2019-05-07 11:03:35 +01:00 committet von GitHub
Commit 256839765a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -54,7 +54,7 @@
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

Datei anzeigen

@ -11,7 +11,7 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
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.chat.ComponentSerializer;
import org.slf4j.Logger;
@ -148,7 +148,7 @@ public class VelocityPlugin implements ViaPlatform<Player> {
@Override
public void sendMessage(UUID uuid, String message) {
PROXY.getPlayer(uuid).ifPresent(it -> it.sendMessage(
ComponentSerializers.JSON.deserialize(
GsonComponentSerializer.INSTANCE.deserialize(
ComponentSerializer.toString(TextComponent.fromLegacyText(message)) // Fixes links
)
));
@ -158,8 +158,8 @@ public class VelocityPlugin implements ViaPlatform<Player> {
public boolean kickPlayer(UUID uuid, String message) {
return PROXY.getPlayer(uuid).map(it -> {
it.disconnect(
ComponentSerializers.JSON.deserialize(
ComponentSerializer.toString(TextComponent.fromLegacyText(message)) // ComponentSerializers.LEGACY is deprecated
GsonComponentSerializer.INSTANCE.deserialize(
ComponentSerializer.toString(TextComponent.fromLegacyText(message))
)
);
return true;

Datei anzeigen

@ -3,7 +3,7 @@ package us.myles.ViaVersion.velocity.command;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
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.chat.ComponentSerializer;
import us.myles.ViaVersion.api.command.ViaCommandSender;
@ -22,7 +22,7 @@ public class VelocityCommandSender implements ViaCommandSender {
@Override
public void sendMessage(String msg) {
source.sendMessage(
ComponentSerializers.JSON.deserialize(
GsonComponentSerializer.INSTANCE.deserialize(
ComponentSerializer.toString(TextComponent.fromLegacyText(msg)) // Fixes links
)
);