Skip to content

Commit e1996e6

Browse files
committed
Updated NBT library and added snapshot repository
Upgraded `net.thenextlvl:nbt` dependency to `v3.0.0-pre1` and replaced legacy tag constructors with new static factory methods. Added snapshot repository URL to `build.gradle.kts`.
1 parent 87af02d commit e1996e6

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tasks.compileJava {
2525
repositories {
2626
mavenCentral()
2727
maven("https://repo.thenextlvl.net/releases")
28+
maven("https://repo.thenextlvl.net/snapshots")
2829
maven("https://repo.papermc.io/repository/maven-public/")
2930
}
3031

@@ -35,8 +36,8 @@ dependencies {
3536
implementation("net.thenextlvl.core:adapters:2.0.2")
3637
implementation("net.thenextlvl.core:files:3.0.0")
3738
implementation("net.thenextlvl.core:i18n:3.2.1")
38-
implementation("net.thenextlvl.core:nbt:2.3.3")
3939
implementation("net.thenextlvl.core:paper:2.2.1")
40+
implementation("net.thenextlvl:nbt:3.0.0-pre1")
4041
implementation("org.bstats:bstats-bukkit:3.1.1-SNAPSHOT")
4142
}
4243

src/main/java/net/thenextlvl/tweaks/command/player/OfflineTeleportCommand.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
import com.mojang.brigadier.arguments.StringArgumentType;
55
import com.mojang.brigadier.context.CommandContext;
66
import core.io.IO;
7-
import core.nbt.file.NBTFile;
8-
import core.nbt.tag.CompoundTag;
9-
import core.nbt.tag.DoubleTag;
10-
import core.nbt.tag.FloatTag;
11-
import core.nbt.tag.ListTag;
12-
import core.nbt.tag.Tag;
137
import io.papermc.paper.command.brigadier.CommandSourceStack;
148
import io.papermc.paper.command.brigadier.Commands;
159
import net.kyori.adventure.key.Key;
1610
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
11+
import net.thenextlvl.nbt.file.NBTFile;
12+
import net.thenextlvl.nbt.tag.CompoundTag;
13+
import net.thenextlvl.nbt.tag.DoubleTag;
14+
import net.thenextlvl.nbt.tag.FloatTag;
15+
import net.thenextlvl.nbt.tag.ListTag;
16+
import net.thenextlvl.nbt.tag.Tag;
1717
import net.thenextlvl.tweaks.TweaksPlugin;
1818
import net.thenextlvl.tweaks.command.suggestion.OfflinePlayerSuggestionProvider;
1919
import org.bukkit.Bukkit;
@@ -148,16 +148,16 @@ private boolean setLocation(OfflinePlayer player, Location location) {
148148
}
149149

150150
private CompoundTag toTag(Location location) {
151-
var pos = new ListTag<>(DoubleTag.ID);
152-
pos.add(new DoubleTag(location.getX()));
153-
pos.add(new DoubleTag(location.getY()));
154-
pos.add(new DoubleTag(location.getZ()));
151+
var pos = ListTag.of(DoubleTag.ID);
152+
pos.add(DoubleTag.of(location.getX()));
153+
pos.add(DoubleTag.of(location.getY()));
154+
pos.add(DoubleTag.of(location.getZ()));
155155

156-
var rotation = new ListTag<>(FloatTag.ID);
157-
rotation.add(new FloatTag(location.getYaw()));
158-
rotation.add(new FloatTag(location.getPitch()));
156+
var rotation = ListTag.of(FloatTag.ID);
157+
rotation.add(FloatTag.of(location.getYaw()));
158+
rotation.add(FloatTag.of(location.getPitch()));
159159

160-
var tag = new CompoundTag();
160+
var tag = CompoundTag.empty();
161161
tag.add("WorldUUIDLeast", location.getWorld().getUID().getLeastSignificantBits());
162162
tag.add("WorldUUIDMost", location.getWorld().getUID().getMostSignificantBits());
163163
tag.add("Dimension", location.getWorld().key().asString());
@@ -179,8 +179,8 @@ private CompoundTag toTag(Location location) {
179179
var data = new File(overworld.getWorldFolder(), "playerdata");
180180
var io = IO.of(data, player.getUniqueId() + ".dat");
181181
var fallback = IO.of(data, player.getUniqueId() + ".dat_old");
182-
return io.exists() ? new NBTFile<>(io, new CompoundTag())
183-
: fallback.exists() ? new NBTFile<>(fallback, new CompoundTag())
182+
return io.exists() ? new NBTFile<>(io, CompoundTag.empty())
183+
: fallback.exists() ? new NBTFile<>(fallback, CompoundTag.empty())
184184
: null;
185185
}
186186
}

0 commit comments

Comments
 (0)