Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Minor code cleanup
Dieser Commit ist enthalten in:
Ursprung
6c348c994c
Commit
a0a0966f99
@ -271,10 +271,6 @@ public enum ProtocolUtils {
|
|||||||
* @param stringArray the array to write
|
* @param stringArray the array to write
|
||||||
*/
|
*/
|
||||||
public static void writeStringArray(ByteBuf buf, String[] stringArray) {
|
public static void writeStringArray(ByteBuf buf, String[] stringArray) {
|
||||||
if (stringArray == null) {
|
|
||||||
writeVarInt(buf, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
writeVarInt(buf, stringArray.length);
|
writeVarInt(buf, stringArray.length);
|
||||||
for (String s : stringArray) {
|
for (String s : stringArray) {
|
||||||
writeString(buf, s);
|
writeString(buf, s);
|
||||||
@ -292,7 +288,7 @@ public enum ProtocolUtils {
|
|||||||
writeString(buf, property.getName());
|
writeString(buf, property.getName());
|
||||||
writeString(buf, property.getValue());
|
writeString(buf, property.getValue());
|
||||||
String signature = property.getSignature();
|
String signature = property.getSignature();
|
||||||
if (signature != null) {
|
if (signature != null && !signature.isEmpty()) {
|
||||||
buf.writeBoolean(true);
|
buf.writeBoolean(true);
|
||||||
writeString(buf, signature);
|
writeString(buf, signature);
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,7 +10,7 @@ import java.io.OutputStream;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link DataOutput} equivalent to {@link ByteBufDataInput}.
|
* A {@link ByteArrayDataOutput} equivalent to {@link ByteBufDataInput}.
|
||||||
*/
|
*/
|
||||||
public class ByteBufDataOutput extends OutputStream implements ByteArrayDataOutput {
|
public class ByteBufDataOutput extends OutputStream implements ByteArrayDataOutput {
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package com.velocitypowered.proxy.util;
|
package com.velocitypowered.proxy.util;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
@ -13,7 +11,6 @@ import com.mojang.brigadier.tree.CommandNode;
|
|||||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides utilities for working with Brigadier commands.
|
* Provides utilities for working with Brigadier commands.
|
||||||
|
@ -21,8 +21,7 @@ public class VelocityChannelRegistrar implements ChannelRegistrar {
|
|||||||
public void register(ChannelIdentifier... identifiers) {
|
public void register(ChannelIdentifier... identifiers) {
|
||||||
for (ChannelIdentifier identifier : identifiers) {
|
for (ChannelIdentifier identifier : identifiers) {
|
||||||
Preconditions.checkArgument(identifier instanceof LegacyChannelIdentifier
|
Preconditions.checkArgument(identifier instanceof LegacyChannelIdentifier
|
||||||
|| identifier instanceof MinecraftChannelIdentifier,
|
|| identifier instanceof MinecraftChannelIdentifier, "identifier is unknown");
|
||||||
"identifier is unknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ChannelIdentifier identifier : identifiers) {
|
for (ChannelIdentifier identifier : identifiers) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren