3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00
Dieser Commit ist enthalten in:
Shane Freeder 2022-02-28 14:23:25 +00:00
Ursprung 7bd0f9ea14
Commit 2fe50bedc5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
4 geänderte Dateien mit 98 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -56,7 +56,8 @@ public enum ProtocolVersion {
MINECRAFT_1_16_4(754, "1.16.4", "1.16.5"),
MINECRAFT_1_17(755, "1.17"),
MINECRAFT_1_17_1(756, "1.17.1"),
MINECRAFT_1_18(757, "1.18", "1.18.1");
MINECRAFT_1_18(757, "1.18", "1.18.1"),
MINECRAFT_1_18_2(758, "1.18.2");
private static final int SNAPSHOT_BIT = 30;

Datei anzeigen

@ -130,6 +130,8 @@ public class ArgumentPropertyRegistry {
}
});
register("brigadier:long", LongArgumentType.class, LONG);
register("minecraft:resource", RegistryKeyArgument.class, RegistryKeyArgumentSerializer.REGISTRY);
register("minecraft:resource_or_tag", RegistryKeyArgument.class, RegistryKeyArgumentSerializer.REGISTRY);
// Crossstitch support
register("crossstitch:mod_argument", ModArgumentProperty.class, MOD);

Datei anzeigen

@ -0,0 +1,58 @@
/*
* 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.StringReader;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public class RegistryKeyArgument implements ArgumentType<String> {
private static final List<String> EXAMPLES = Arrays.asList("foo", "foo:bar", "012");
private String identifier;
public RegistryKeyArgument(String identifier) {
this.identifier = identifier;
}
public String getIdentifier() {
return identifier;
}
@Override
public String parse(StringReader stringReader) throws CommandSyntaxException {
return stringReader.readString();
}
@Override
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) {
return Suggestions.empty();
}
@Override
public Collection<String> getExamples() {
return EXAMPLES;
}
}

Datei anzeigen

@ -0,0 +1,36 @@
/*
* 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.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf;
public class RegistryKeyArgumentSerializer implements ArgumentPropertySerializer<RegistryKeyArgument> {
static final RegistryKeyArgumentSerializer REGISTRY = new RegistryKeyArgumentSerializer();
@Override
public RegistryKeyArgument deserialize(ByteBuf buf) {
return new RegistryKeyArgument(ProtocolUtils.readString(buf));
}
@Override
public void serialize(RegistryKeyArgument object, ByteBuf buf) {
ProtocolUtils.writeString(buf, object.getIdentifier());
}
}