BungeeCordProxy: skip if the name is not textures or the value & signature does not exist (#1127)

This commit is contained in:
Huynh Tien 2022-05-26 21:41:50 +07:00 committed by GitHub
parent 7b8445d0e2
commit a4f392d116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ import net.minestom.server.entity.PlayerSkin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* BungeeCord forwarding support. This does not count as a security feature and you will still be required to manage your firewall. * BungeeCord forwarding support. This does not count as a security feature, and you will still be required to manage your firewall.
* <p> * <p>
* Please consider using {@link net.minestom.server.extras.velocity.VelocityProxy} instead. * Please consider using {@link net.minestom.server.extras.velocity.VelocityProxy} instead.
*/ */
@ -39,15 +39,15 @@ public final class BungeeCordProxy {
for (JsonElement element : array) { for (JsonElement element : array) {
JsonObject jsonObject = element.getAsJsonObject(); JsonObject jsonObject = element.getAsJsonObject();
final String name = jsonObject.get("name").getAsString(); JsonElement name = jsonObject.get("name");
final String value = jsonObject.get("value").getAsString(); if (name == null || !name.getAsString().equals("textures")) continue;
final String signature = jsonObject.get("signature").getAsString();
if (name.equals("textures")) { JsonElement value = jsonObject.get("value");
skinTexture = value; JsonElement signature = jsonObject.get("signature");
skinSignature = signature; if (value == null || signature == null) continue;
}
skinTexture = value.getAsString();
skinSignature = signature.getAsString();
} }
if (skinTexture != null && skinSignature != null) { if (skinTexture != null && skinSignature != null) {