Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* @since 4.7.0
*/
public interface ComponentFlattener extends Buildable<ComponentFlattener, ComponentFlattener.Builder> {
public interface ComponentFlattener extends /*Buildable<ComponentFlattener, ComponentFlattener.Builder>*/ {
/**
* A constant representing a flattener with no limit on nested flatten calls.
*
Expand Down Expand Up @@ -89,14 +89,17 @@ public interface ComponentFlattener extends Buildable<ComponentFlattener, Compon
*/
void flatten(final @NotNull Component input, final @NotNull FlattenerListener listener);

// TODO: common builder interface?
@NotNull Builder toBuilder();

/**
* A builder for a component flattener.
*
* <p>A new builder will start out empty, providing empty strings for all component types.</p>
*
* @since 4.7.0
*/
interface Builder extends AbstractBuilder<ComponentFlattener>, Buildable.Builder<ComponentFlattener> {
interface Builder extends AbstractBuilder<ComponentFlattener> {
/**
* Register a type of component to be handled.
*
Expand Down
140 changes: 0 additions & 140 deletions nbt/src/main/java/net/kyori/adventure/nbt/BinaryTagIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,146 +99,6 @@ private BinaryTagIO() {
return BinaryTagWriterImpl.INSTANCE;
}

/**
* Reads a compound tag from {@code path}.
*
* @param path the path
* @return the compound tag
* @throws IOException if an exception was encountered while reading a compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #reader()}
*/
@Deprecated
public static @NotNull CompoundBinaryTag readPath(final @NotNull Path path) throws IOException {
return reader().read(path);
}

/**
* Reads a compound tag from an input stream. The stream is not closed afterwards.
*
* @param input the input stream
* @return the compound tag
* @throws IOException if an exception was encountered while reading a compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #reader()}
*/
@Deprecated
public static @NotNull CompoundBinaryTag readInputStream(final @NotNull InputStream input) throws IOException {
return reader().read(input);
}

/**
* Reads a compound tag from {@code path} using GZIP decompression.
*
* @param path the path
* @return the compound tag
* @throws IOException if an exception was encountered while reading a compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #reader()}
*/
@Deprecated
public static @NotNull CompoundBinaryTag readCompressedPath(final @NotNull Path path) throws IOException {
return reader().read(path, Compression.GZIP);
}

/**
* Reads a compound tag from an input stream using GZIP decompression. The stream is not closed afterwards.
*
* @param input the input stream
* @return the compound tag
* @throws IOException if an exception was encountered while reading a compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #reader()}
*/
@Deprecated
public static @NotNull CompoundBinaryTag readCompressedInputStream(final @NotNull InputStream input) throws IOException {
return reader().read(input, Compression.GZIP);
}

/**
* Reads a compound tag from {@code input}.
*
* @param input the input
* @return the compound tag
* @throws IOException if an exception was encountered while reading a compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #reader()}
*/
@Deprecated
public static @NotNull CompoundBinaryTag readDataInput(final @NotNull DataInput input) throws IOException {
return reader().read(input);
}

/**
* Writes a compound tag to {@code path}.
*
* @param tag the compound tag
* @param path the path
* @throws IOException if an exception was encountered while writing the compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #writer()}
*/
@Deprecated
public static void writePath(final @NotNull CompoundBinaryTag tag, final @NotNull Path path) throws IOException {
writer().write(tag, path);
}

/**
* Writes a compound tag to an output stream. The output stream will not be closed.
*
* @param tag the compound tag
* @param output the output stream
* @throws IOException if an exception was encountered while writing the compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #writer()}
*/
@Deprecated
public static void writeOutputStream(final @NotNull CompoundBinaryTag tag, final @NotNull OutputStream output) throws IOException {
writer().write(tag, output);
}

/**
* Writes a compound tag to {@code path} using GZIP compression.
*
* @param tag the compound tag
* @param path the path
* @throws IOException if an exception was encountered while writing the compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #writer()}
*/
@Deprecated
public static void writeCompressedPath(final @NotNull CompoundBinaryTag tag, final @NotNull Path path) throws IOException {
writer().write(tag, path, Compression.GZIP);
}

/**
* Writes a compound tag to an output stream using GZIP compression. The output stream is not closed afterwards.
*
* @param tag the compound tag
* @param output the output stream
* @throws IOException if an exception was encountered while writing the compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #writer()}
*/
@Deprecated
public static void writeCompressedOutputStream(final @NotNull CompoundBinaryTag tag, final @NotNull OutputStream output) throws IOException {
writer().write(tag, output, Compression.GZIP);
}

/**
* Writes a compound tag to {@code output}.
*
* @param tag the compound tag
* @param output the output
* @throws IOException if an exception was encountered while writing the compound tag
* @since 4.0.0
* @deprecated since 4.4.0, use {@link #writer()}
*/
@Deprecated
public static void writeDataOutput(final @NotNull CompoundBinaryTag tag, final @NotNull DataOutput output) throws IOException {
writer().write(tag, output);
}

/**
* {@link CompoundBinaryTag} reader.
*
Expand Down
10 changes: 1 addition & 9 deletions nbt/src/main/java/net/kyori/adventure/nbt/BinaryTagType.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -78,21 +77,14 @@ static <T extends BinaryTag> void writeUntyped(final BinaryTagType<? extends Bin
}

static @NotNull BinaryTagType<? extends BinaryTag> binaryTagType(final byte id) {
for (int i = 0; i < TYPES.size(); i++) {
final BinaryTagType<? extends BinaryTag> type = TYPES.get(i);
for (final BinaryTagType<? extends BinaryTag> type : TYPES) {
if (type.id() == id) {
return type;
}
}
throw new IllegalArgumentException(String.valueOf(id));
}

@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
static @NotNull BinaryTagType<? extends BinaryTag> of(final byte id) {
return binaryTagType(id);
}

static <T extends BinaryTag> @NotNull BinaryTagType<T> register(final Class<T> type, final byte id, final Reader<T> reader, final @Nullable Writer<T> writer) {
return register(new Impl<>(type, id, reader, writer));
}
Expand Down
8 changes: 4 additions & 4 deletions nbt/src/main/java/net/kyori/adventure/nbt/BinaryTagTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ public final class BinaryTagTypes {
final int[] value = IntArrayBinaryTagImpl.value(tag);
final int length = value.length;
output.writeInt(length);
for (int i = 0; i < length; i++) {
output.writeInt(value[i]);
for (final int j : value) {
output.writeInt(j);
}
});
/**
Expand All @@ -200,8 +200,8 @@ public final class BinaryTagTypes {
final long[] value = LongArrayBinaryTagImpl.value(tag);
final int length = value.length;
output.writeInt(length);
for (int i = 0; i < length; i++) {
output.writeLong(value[i]);
for (final long l : value) {
output.writeLong(l);
}
});
/**
Expand Down
15 changes: 0 additions & 15 deletions nbt/src/main/java/net/kyori/adventure/nbt/ByteArrayBinaryTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package net.kyori.adventure.nbt;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -43,20 +42,6 @@ public interface ByteArrayBinaryTag extends ArrayBinaryTag, Iterable<Byte> {
return new ByteArrayBinaryTagImpl(value);
}

/**
* Creates a binary tag holding a {@code byte}-array value.
*
* @param value the value
* @return a binary tag
* @since 4.0.0
* @deprecated for removal since 4.14.0, use {@link #byteArrayBinaryTag(byte...)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
static @NotNull ByteArrayBinaryTag of(final byte@NotNull... value) {
return new ByteArrayBinaryTagImpl(value);
}

@Override
default @NotNull BinaryTagType<ByteArrayBinaryTag> type() {
return BinaryTagTypes.BYTE_ARRAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public int hashCode() {
}

@Override
public Iterator<Byte> iterator() {
return new Iterator<Byte>() {
public @NotNull Iterator<Byte> iterator() {
return new Iterator<>() {
private int index;

@Override
Expand Down
15 changes: 0 additions & 15 deletions nbt/src/main/java/net/kyori/adventure/nbt/ByteBinaryTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package net.kyori.adventure.nbt;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -63,20 +62,6 @@ public interface ByteBinaryTag extends NumberBinaryTag {
}
}

/**
* Creates a binary tag holding a {@code byte} value.
*
* @param value the value
* @return a binary tag
* @since 4.0.0
* @deprecated for removal since 4.14.0, use {@link #byteBinaryTag(byte)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
static @NotNull ByteBinaryTag of(final byte value) {
return byteBinaryTag(value);
}

@Override
default @NotNull BinaryTagType<ByteBinaryTag> type() {
return BinaryTagTypes.BYTE;
Expand Down
15 changes: 0 additions & 15 deletions nbt/src/main/java/net/kyori/adventure/nbt/DoubleBinaryTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package net.kyori.adventure.nbt;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -43,20 +42,6 @@ public interface DoubleBinaryTag extends NumberBinaryTag {
return new DoubleBinaryTagImpl(value);
}

/**
* Creates a binary tag holding a {@code double} value.
*
* @param value the value
* @return a binary tag
* @since 4.0.0
* @deprecated for removal since 4.14.0, use {@link #doubleBinaryTag(double)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
static @NotNull DoubleBinaryTag of(final double value) {
return new DoubleBinaryTagImpl(value);
}

@Override
default @NotNull BinaryTagType<DoubleBinaryTag> type() {
return BinaryTagTypes.DOUBLE;
Expand Down
14 changes: 0 additions & 14 deletions nbt/src/main/java/net/kyori/adventure/nbt/EndBinaryTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package net.kyori.adventure.nbt;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -42,19 +41,6 @@ public interface EndBinaryTag extends BinaryTag {
return EndBinaryTagImpl.INSTANCE;
}

/**
* Gets the end tag.
*
* @return the end tag
* @since 4.0.0
* @deprecated for removal since 4.14.0, use {@link #endBinaryTag()} instead
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
static @NotNull EndBinaryTag get() {
return EndBinaryTagImpl.INSTANCE;
}

@Override
default @NotNull BinaryTagType<EndBinaryTag> type() {
return BinaryTagTypes.END;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
final class EndBinaryTagImpl extends AbstractBinaryTag implements EndBinaryTag {
static final EndBinaryTagImpl INSTANCE = new EndBinaryTagImpl();

@Override
public boolean equals(final Object that) {
return this == that;
}

@Override
public int hashCode() {
return 0;
Expand Down
15 changes: 0 additions & 15 deletions nbt/src/main/java/net/kyori/adventure/nbt/FloatBinaryTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package net.kyori.adventure.nbt;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
Expand All @@ -43,20 +42,6 @@ public interface FloatBinaryTag extends NumberBinaryTag {
return new FloatBinaryTagImpl(value);
}

/**
* Creates a binary tag holding a {@code float} value.
*
* @param value the value
* @return a binary tag
* @since 4.0.0
* @deprecated for removal since 4.14.0, use {@link #floatBinaryTag(float)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
static @NotNull FloatBinaryTag of(final float value) {
return new FloatBinaryTagImpl(value);
}

@Override
default @NotNull BinaryTagType<FloatBinaryTag> type() {
return BinaryTagTypes.FLOAT;
Expand Down
Loading
Loading