From 1dfe294b9628ef2aa8cbf7ca454662477ee51a46 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 13 Jun 2021 06:55:24 -0400 Subject: [PATCH] Remove GenericArgumentPropertySerializer This was only used for boolean argument tyoes --- .../brigadier/ArgumentPropertyRegistry.java | 13 ++++- .../GenericArgumentPropertySerializer.java | 48 ------------------- 2 files changed, 12 insertions(+), 49 deletions(-) delete mode 100644 proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/GenericArgumentPropertySerializer.java diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java index 96a25f9a4..8f0b035a0 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/ArgumentPropertyRegistry.java @@ -36,6 +36,7 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils; import io.netty.buffer.ByteBuf; import java.util.HashMap; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; public class ArgumentPropertyRegistry { private ArgumentPropertyRegistry() { @@ -117,7 +118,17 @@ public class ArgumentPropertyRegistry { register("brigadier:float", FloatArgumentType.class, FLOAT); register("brigadier:double", DoubleArgumentType.class, DOUBLE); register("brigadier:bool", BoolArgumentType.class, - GenericArgumentPropertySerializer.create(BoolArgumentType::bool)); + new ArgumentPropertySerializer<>() { + @Override + public BoolArgumentType deserialize(ByteBuf buf) { + return BoolArgumentType.bool(); + } + + @Override + public void serialize(BoolArgumentType object, ByteBuf buf) { + + } + }); register("brigadier:long", LongArgumentType.class, LONG); // Crossstitch support diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/GenericArgumentPropertySerializer.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/GenericArgumentPropertySerializer.java deleted file mode 100644 index bc8202f28..000000000 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/brigadier/GenericArgumentPropertySerializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2018 Velocity Contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.velocitypowered.proxy.protocol.packet.brigadier; - -import com.mojang.brigadier.arguments.ArgumentType; -import io.netty.buffer.ByteBuf; -import java.util.function.Supplier; -import org.checkerframework.checker.nullness.qual.Nullable; - -class GenericArgumentPropertySerializer> - implements ArgumentPropertySerializer { - - private final Supplier argumentSupplier; - - private GenericArgumentPropertySerializer(Supplier argumentSupplier) { - this.argumentSupplier = argumentSupplier; - } - - public static > ArgumentPropertySerializer create( - Supplier supplier) { - return new GenericArgumentPropertySerializer<>(supplier); - } - - @Override - public @Nullable T deserialize(ByteBuf buf) { - return argumentSupplier.get(); - } - - @Override - public void serialize(T object, ByteBuf buf) { - - } -}