13
0
geforkt von Mirrors/Velocity

Remove GenericArgumentPropertySerializer

This was only used for boolean argument tyoes
Dieser Commit ist enthalten in:
Andrew Steinborn 2021-06-13 06:55:24 -04:00
Ursprung 5a337afb00
Commit 1dfe294b96
2 geänderte Dateien mit 12 neuen und 49 gelöschten Zeilen

Datei anzeigen

@ -36,6 +36,7 @@ import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.checkerframework.checker.nullness.qual.Nullable;
public class ArgumentPropertyRegistry { public class ArgumentPropertyRegistry {
private ArgumentPropertyRegistry() { private ArgumentPropertyRegistry() {
@ -117,7 +118,17 @@ public class ArgumentPropertyRegistry {
register("brigadier:float", FloatArgumentType.class, FLOAT); register("brigadier:float", FloatArgumentType.class, FLOAT);
register("brigadier:double", DoubleArgumentType.class, DOUBLE); register("brigadier:double", DoubleArgumentType.class, DOUBLE);
register("brigadier:bool", BoolArgumentType.class, 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); register("brigadier:long", LongArgumentType.class, LONG);
// Crossstitch support // Crossstitch support

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
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<T extends ArgumentType<?>>
implements ArgumentPropertySerializer<T> {
private final Supplier<T> argumentSupplier;
private GenericArgumentPropertySerializer(Supplier<T> argumentSupplier) {
this.argumentSupplier = argumentSupplier;
}
public static <T extends ArgumentType<?>> ArgumentPropertySerializer<T> create(
Supplier<T> supplier) {
return new GenericArgumentPropertySerializer<>(supplier);
}
@Override
public @Nullable T deserialize(ByteBuf buf) {
return argumentSupplier.get();
}
@Override
public void serialize(T object, ByteBuf buf) {
}
}