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

Remove any use of the word "dummy"

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-08-11 13:24:05 -04:00
Ursprung c0af5668b9
Commit 717f2a070d
7 geänderte Dateien mit 64 neuen und 60 gelöschten Zeilen

Datei anzeigen

@ -15,7 +15,7 @@ import javax.annotation.Nullable;
public enum LegacyForgeHandshakeBackendPhase implements BackendConnectionPhase {
/**
* Dummy phase for use with {@link BackendConnectionPhases#UNKNOWN}.
* Indicates that the handshake has not started, used for {@link BackendConnectionPhases#UNKNOWN}.
*/
NOT_STARTED(LegacyForgeConstants.SERVER_HELLO_DISCRIMINATOR) {
@Override

Datei anzeigen

@ -246,7 +246,7 @@ public class AvailableCommands implements MinecraftPacket {
}
}
// If executable, add a dummy command
// If executable, add an empty command
if ((flags & FLAG_EXECUTABLE) != 0) {
args.executes((Command<CommandSource>) context -> 0);
}

Datei anzeigen

@ -251,10 +251,10 @@ public class JoinGame implements MinecraftPacket {
CompoundBinaryTag.Builder registryContainer = CompoundBinaryTag.builder();
ListBinaryTag encodedDimensionRegistry = dimensionRegistry.encodeRegistry(version);
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
CompoundBinaryTag.Builder dimensionRegistryDummy = CompoundBinaryTag.builder();
dimensionRegistryDummy.putString("type", "minecraft:dimension_type");
dimensionRegistryDummy.put("value", encodedDimensionRegistry);
registryContainer.put("minecraft:dimension_type", dimensionRegistryDummy.build());
CompoundBinaryTag.Builder dimensionRegistryEntry = CompoundBinaryTag.builder();
dimensionRegistryEntry.putString("type", "minecraft:dimension_type");
dimensionRegistryEntry.put("value", encodedDimensionRegistry);
registryContainer.put("minecraft:dimension_type", dimensionRegistryEntry.build());
registryContainer.put("minecraft:worldgen/biome", biomeRegistry);
} else {
registryContainer.put("dimension", encodedDimensionRegistry);

Datei anzeigen

@ -1,7 +1,7 @@
package com.velocitypowered.proxy.protocol.packet.brigadier;
import static com.velocitypowered.proxy.protocol.packet.brigadier.DoubleArgumentPropertySerializer.DOUBLE;
import static com.velocitypowered.proxy.protocol.packet.brigadier.DummyVoidArgumentPropertySerializer.DUMMY;
import static com.velocitypowered.proxy.protocol.packet.brigadier.EmptyArgumentPropertySerializer.EMPTY;
import static com.velocitypowered.proxy.protocol.packet.brigadier.FloatArgumentPropertySerializer.FLOAT;
import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumentPropertySerializer.INTEGER;
import static com.velocitypowered.proxy.protocol.packet.brigadier.LongArgumentPropertySerializer.LONG;
@ -36,7 +36,11 @@ public class ArgumentPropertyRegistry {
classToId.put(klazz, identifier);
}
private static <T> void dummy(String identifier, ArgumentPropertySerializer<T> serializer) {
private static <T> void empty(String identifier) {
empty(identifier, EMPTY);
}
private static <T> void empty(String identifier, ArgumentPropertySerializer<T> serializer) {
byId.put(identifier, serializer);
}
@ -56,7 +60,7 @@ public class ArgumentPropertyRegistry {
if (result instanceof ArgumentType) {
return (ArgumentType<?>) result;
} else {
return new DummyProperty(identifier, serializer, result);
return new PassthroughProperty(identifier, serializer, result);
}
}
@ -66,8 +70,8 @@ public class ArgumentPropertyRegistry {
* @param type the type to serialize
*/
public static void serialize(ByteBuf buf, ArgumentType<?> type) {
if (type instanceof DummyProperty) {
DummyProperty property = (DummyProperty) type;
if (type instanceof PassthroughProperty) {
PassthroughProperty property = (PassthroughProperty) type;
ProtocolUtils.writeString(buf, property.getIdentifier());
if (property.getResult() != null) {
property.getSerializer().serialize(property.getResult(), buf);
@ -91,50 +95,50 @@ public class ArgumentPropertyRegistry {
register("brigadier:float", FloatArgumentType.class, FLOAT);
register("brigadier:double", DoubleArgumentType.class, DOUBLE);
register("brigadier:bool", BoolArgumentType.class,
VoidArgumentPropertySerializer.create(BoolArgumentType::bool));
GenericArgumentPropertySerializer.create(BoolArgumentType::bool));
register("brigadier:long", LongArgumentType.class, LONG);
// Minecraft argument types with extra properties
dummy("minecraft:entity", ByteArgumentPropertySerializer.BYTE);
dummy("minecraft:score_holder", ByteArgumentPropertySerializer.BYTE);
empty("minecraft:entity", ByteArgumentPropertySerializer.BYTE);
empty("minecraft:score_holder", ByteArgumentPropertySerializer.BYTE);
// Minecraft argument types
dummy("minecraft:game_profile", DUMMY);
dummy("minecraft:block_pos", DUMMY);
dummy("minecraft:column_pos", DUMMY);
dummy("minecraft:vec3", DUMMY);
dummy("minecraft:vec2", DUMMY);
dummy("minecraft:block_state", DUMMY);
dummy("minecraft:block_predicate", DUMMY);
dummy("minecraft:item_stack", DUMMY);
dummy("minecraft:item_predicate", DUMMY);
dummy("minecraft:color", DUMMY);
dummy("minecraft:component", DUMMY);
dummy("minecraft:message", DUMMY);
dummy("minecraft:nbt", DUMMY);
dummy("minecraft:nbt_compound_tag", DUMMY); // added in 1.14
dummy("minecraft:nbt_tag", DUMMY); // added in 1.14
dummy("minecraft:nbt_path", DUMMY);
dummy("minecraft:objective", DUMMY);
dummy("minecraft:objective_criteria", DUMMY);
dummy("minecraft:operation", DUMMY);
dummy("minecraft:particle", DUMMY);
dummy("minecraft:rotation", DUMMY);
dummy("minecraft:scoreboard_slot", DUMMY);
dummy("minecraft:swizzle", DUMMY);
dummy("minecraft:team", DUMMY);
dummy("minecraft:item_slot", DUMMY);
dummy("minecraft:resource_location", DUMMY);
dummy("minecraft:mob_effect", DUMMY);
dummy("minecraft:function", DUMMY);
dummy("minecraft:entity_anchor", DUMMY);
dummy("minecraft:item_enchantment", DUMMY);
dummy("minecraft:entity_summon", DUMMY);
dummy("minecraft:dimension", DUMMY);
dummy("minecraft:int_range", DUMMY);
dummy("minecraft:float_range", DUMMY);
dummy("minecraft:time", DUMMY); // added in 1.14
dummy("minecraft:uuid", DUMMY); // added in 1.16
dummy("minecraft:angle", DUMMY); // added in 1.16.2
empty("minecraft:game_profile");
empty("minecraft:block_pos");
empty("minecraft:column_pos");
empty("minecraft:vec3");
empty("minecraft:vec2");
empty("minecraft:block_state");
empty("minecraft:block_predicate");
empty("minecraft:item_stack");
empty("minecraft:item_predicate");
empty("minecraft:color");
empty("minecraft:component");
empty("minecraft:message");
empty("minecraft:nbt");
empty("minecraft:nbt_compound_tag"); // added in 1.14
empty("minecraft:nbt_tag"); // added in 1.14
empty("minecraft:nbt_path");
empty("minecraft:objective");
empty("minecraft:objective_criteria");
empty("minecraft:operation");
empty("minecraft:particle");
empty("minecraft:rotation");
empty("minecraft:scoreboard_slot");
empty("minecraft:swizzle");
empty("minecraft:team");
empty("minecraft:item_slot");
empty("minecraft:resource_location");
empty("minecraft:mob_effect");
empty("minecraft:function");
empty("minecraft:entity_anchor");
empty("minecraft:item_enchantment");
empty("minecraft:entity_summon");
empty("minecraft:dimension");
empty("minecraft:int_range");
empty("minecraft:float_range");
empty("minecraft:time", EMPTY); // added in 1.14
empty("minecraft:uuid", EMPTY); // added in 1.16
empty("minecraft:angle", EMPTY); // added in 1.16.2
}
}

Datei anzeigen

@ -6,12 +6,12 @@ import org.checkerframework.checker.nullness.qual.Nullable;
/**
* An argument property serializer that will serialize and deserialize nothing.
*/
class DummyVoidArgumentPropertySerializer implements ArgumentPropertySerializer<Void> {
class EmptyArgumentPropertySerializer implements ArgumentPropertySerializer<Void> {
static final ArgumentPropertySerializer<Void> DUMMY =
new DummyVoidArgumentPropertySerializer();
static final ArgumentPropertySerializer<Void> EMPTY =
new EmptyArgumentPropertySerializer();
private DummyVoidArgumentPropertySerializer() {
private EmptyArgumentPropertySerializer() {
}
@Override

Datei anzeigen

@ -5,18 +5,18 @@ import io.netty.buffer.ByteBuf;
import java.util.function.Supplier;
import org.checkerframework.checker.nullness.qual.Nullable;
class VoidArgumentPropertySerializer<T extends ArgumentType<?>>
class GenericArgumentPropertySerializer<T extends ArgumentType<?>>
implements ArgumentPropertySerializer<T> {
private final Supplier<T> argumentSupplier;
private VoidArgumentPropertySerializer(Supplier<T> argumentSupplier) {
private GenericArgumentPropertySerializer(Supplier<T> argumentSupplier) {
this.argumentSupplier = argumentSupplier;
}
public static <T extends ArgumentType<?>> ArgumentPropertySerializer<T> create(
Supplier<T> supplier) {
return new VoidArgumentPropertySerializer<T>(supplier);
return new GenericArgumentPropertySerializer<>(supplier);
}
@Override

Datei anzeigen

@ -4,13 +4,13 @@ import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.arguments.ArgumentType;
import org.checkerframework.checker.nullness.qual.Nullable;
class DummyProperty<T> implements ArgumentType<T> {
class PassthroughProperty<T> implements ArgumentType<T> {
private final String identifier;
private final ArgumentPropertySerializer<T> serializer;
private final @Nullable T result;
DummyProperty(String identifier, ArgumentPropertySerializer<T> serializer, @Nullable T result) {
PassthroughProperty(String identifier, ArgumentPropertySerializer<T> serializer, @Nullable T result) {
this.identifier = identifier;
this.serializer = serializer;
this.result = result;