From c87c208d25df12143d9dbefab682d90f966d6e7e Mon Sep 17 00:00:00 2001 From: RayzsYT <51991564+RayzsYT@users.noreply.github.com> Date: Thu, 16 May 2024 23:37:19 +0200 Subject: [PATCH] Security --- .../de/rayzs/pat/plugin/brand/impl/BungeeServerBrand.java | 5 +++-- .../de/rayzs/pat/plugin/communication/impl/BukkitClient.java | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/rayzs/pat/plugin/brand/impl/BungeeServerBrand.java b/src/main/java/de/rayzs/pat/plugin/brand/impl/BungeeServerBrand.java index 6ee51171..4813011a 100644 --- a/src/main/java/de/rayzs/pat/plugin/brand/impl/BungeeServerBrand.java +++ b/src/main/java/de/rayzs/pat/plugin/brand/impl/BungeeServerBrand.java @@ -8,6 +8,7 @@ import de.rayzs.pat.utils.message.MessageTranslator; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; +import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.scheduler.ScheduledTask; import net.md_5.bungee.protocol.ProtocolConstants; @@ -46,8 +47,8 @@ public class BungeeServerBrand implements ServerBrand { ProxiedPlayer player = (ProxiedPlayer) playerObj; String serverName = "", playerName = player.getName(), customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName); - ServerInfo serverInfo = player.getServer().getInfo(); - if(serverInfo != null) serverName = serverInfo.getName(); + Server server = player.getServer(); + if(server != null) serverName = server.getInfo().getName(); PacketUtils.BrandManipulate serverBrand = new PacketUtils.BrandManipulate(customBrand); String brand = player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand"; diff --git a/src/main/java/de/rayzs/pat/plugin/communication/impl/BukkitClient.java b/src/main/java/de/rayzs/pat/plugin/communication/impl/BukkitClient.java index 0095916d..a4892c9c 100644 --- a/src/main/java/de/rayzs/pat/plugin/communication/impl/BukkitClient.java +++ b/src/main/java/de/rayzs/pat/plugin/communication/impl/BukkitClient.java @@ -31,6 +31,7 @@ public class BukkitClient implements Client, PluginMessageListener { try { ByteArrayDataInput input = ByteStreams.newDataInput(bytes); String information = input.readUTF(); + System.out.println("IN: " + information); Bukkit.getScheduler().scheduleSyncDelayedTask(BukkitLoader.getPlugin(), () -> ClientCommunication.receiveInformation("proxy", information)); } catch (Throwable throwable) { throwable.printStackTrace(); } }