From d80ab5b7bd7b8efdba51a2426a86de82b0a7b5c8 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 3 Mar 2023 13:51:13 +0100 Subject: [PATCH] 2.1.1, remove Guava dependency --- LICENSE.txt | 1 + pom.xml | 26 +++++++------------ .../opennbt/tag/builtin/CompoundTag.java | 13 +++++++--- .../opennbt/tag/builtin/IntArrayTag.java | 9 ++++--- .../opennbt/tag/builtin/ListTag.java | 9 ++++--- .../opennbt/tag/builtin/LongArrayTag.java | 9 ++++--- .../opennbt/tag/builtin/StringTag.java | 9 ++++--- 7 files changed, 43 insertions(+), 33 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 936ae06..7df4b4c 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,5 @@ Copyright (C) 2013-2017 Steveice10 +Copyright (C) 2021-2023 ViaVersion and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/pom.xml b/pom.xml index 914e4e5..e88ea0d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ com.viaversion opennbt - 2.1 + 2.1.1 jar OpenNBT A library for reading and writing NBT files, written in Java. - https://github.com/Steveice10/OpenNBT/ + https://github.com/ViaVersion/OpenNBT @@ -19,12 +19,6 @@ - - scm:git:git@github.com:Steveice10/OpenNBT.git - scm:git:git@github.com:Steveice10/OpenNBT.git - https://github.com/Steveice10/OpenNBT/ - - UTF-8 1.8 @@ -46,20 +40,18 @@ Steveice10 Steveice10@gmail.com + + kennytv + Nassim Jahnke + GitHub - https://github.com/Steveice10/OpenNBT/issues + https://github.com/ViaVersion/OpenNBT/issues - - com.google.guava - guava - 21.0 - provided - it.unimi.dsi fastutil @@ -69,7 +61,7 @@ org.jetbrains annotations - 23.0.0 + 24.0.0 provided @@ -80,7 +72,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.0 + 3.4.1 attach-javadocs diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java index b1e54e5..f48b75b 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java @@ -3,7 +3,6 @@ package com.github.steveice10.opennbt.tag.builtin; import com.github.steveice10.opennbt.tag.TagCreateException; import com.github.steveice10.opennbt.tag.TagRegistry; import com.github.steveice10.opennbt.tag.limiter.TagLimiter; -import com.google.common.base.Preconditions; import org.jetbrains.annotations.Nullable; import java.io.DataInput; @@ -46,7 +45,9 @@ public class CompoundTag extends Tag implements Iterable> { * @param value The value of the tag. */ public CompoundTag(LinkedHashMap value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } @@ -61,7 +62,9 @@ public class CompoundTag extends Tag implements Iterable> { * @param value New value of this tag. */ public void setValue(Map value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = new LinkedHashMap<>(value); } @@ -71,7 +74,9 @@ public class CompoundTag extends Tag implements Iterable> { * @param value New value of this tag. */ public void setValue(LinkedHashMap value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/IntArrayTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/IntArrayTag.java index 94614a9..400d2b1 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/IntArrayTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/IntArrayTag.java @@ -1,7 +1,6 @@ package com.github.steveice10.opennbt.tag.builtin; import com.github.steveice10.opennbt.tag.limiter.TagLimiter; -import com.google.common.base.Preconditions; import java.io.DataInput; import java.io.DataOutput; @@ -29,7 +28,9 @@ public class IntArrayTag extends Tag { * @param value The value of the tag. */ public IntArrayTag(int[] value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } @@ -44,7 +45,9 @@ public class IntArrayTag extends Tag { * @param value New value of this tag. */ public void setValue(int[] value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java index ce01cd4..84b17b7 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java @@ -3,7 +3,6 @@ package com.github.steveice10.opennbt.tag.builtin; import com.github.steveice10.opennbt.tag.TagCreateException; import com.github.steveice10.opennbt.tag.TagRegistry; import com.github.steveice10.opennbt.tag.limiter.TagLimiter; -import com.google.common.base.Preconditions; import org.jetbrains.annotations.Nullable; import java.io.DataInput; @@ -63,7 +62,9 @@ public class ListTag extends Tag implements Iterable { * @throws IllegalArgumentException If all tags in the list are not of the same type. */ public void setValue(List value) throws IllegalArgumentException { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.type = null; this.value.clear(); @@ -91,7 +92,9 @@ public class ListTag extends Tag implements Iterable { * @throws IllegalArgumentException If the tag's type differs from the list tag's type. */ public boolean add(Tag tag) throws IllegalArgumentException { - Preconditions.checkNotNull(tag); + if (tag == null) { + throw new NullPointerException("tag cannot be null"); + } // If empty list, use this as tag type. if(this.type == null) { diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/LongArrayTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/LongArrayTag.java index 04e5f26..5d5fe30 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/LongArrayTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/LongArrayTag.java @@ -1,7 +1,6 @@ package com.github.steveice10.opennbt.tag.builtin; import com.github.steveice10.opennbt.tag.limiter.TagLimiter; -import com.google.common.base.Preconditions; import java.io.DataInput; import java.io.DataOutput; @@ -29,7 +28,9 @@ public class LongArrayTag extends Tag { * @param value The value of the tag. */ public LongArrayTag(long[] value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } @@ -44,7 +45,9 @@ public class LongArrayTag extends Tag { * @param value New value of this tag. */ public void setValue(long[] value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/StringTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/StringTag.java index 084a038..82e7baf 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/StringTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/StringTag.java @@ -1,7 +1,6 @@ package com.github.steveice10.opennbt.tag.builtin; import com.github.steveice10.opennbt.tag.limiter.TagLimiter; -import com.google.common.base.Preconditions; import java.io.DataInput; import java.io.DataOutput; @@ -27,7 +26,9 @@ public class StringTag extends Tag { * @param value The value of the tag. */ public StringTag(String value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; } @@ -42,7 +43,9 @@ public class StringTag extends Tag { * @param value New value of this tag. */ public void setValue(String value) { - Preconditions.checkNotNull(value); + if (value == null) { + throw new NullPointerException("value cannot be null"); + } this.value = value; }