Deprecates Core's NBTItem implementations in favor of `item-nbt-api`

This commit is contained in:
Christian Koop 2022-03-18 14:29:06 +01:00
parent 22d0c395e4
commit 8c0c281d9b
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
21 changed files with 67 additions and 0 deletions

View File

@ -69,6 +69,7 @@
<includes>
<include>com.songoda:*</include>
<include>com.zaxxer:HikariCP</include>
<include>de.tr7zw:item-nbt-api</include>
</includes>
</artifactSet>
@ -77,6 +78,11 @@
<pattern>com.zaxxer</pattern>
<shadedPattern>com.songoda.core.third_party.com.zaxxer</shadedPattern>
</relocation>
<relocation>
<pattern>de.tr7zw.changeme.nbtapi</pattern>
<shadedPattern>com.songoda.core.third_party.de.tr7zw.nbtapi</shadedPattern>
</relocation>
</relocations>
<filters>
@ -85,6 +91,7 @@
<includes>
<include>com/</include>
<include>de/tr7zw/</include>
<include>META-INF/MANIFEST.MF</include>
<include>META-INF/maven/com.songoda/SongodaCore/</include>
</includes>
@ -112,6 +119,13 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api</artifactId>
<version>2.9.2</version>
<scope>compile</scope>
</dependency>
<!-- Need to include all NMS modules here -->
<!-- Note when adding a new module: include the class in NmsManager -->
<dependency>

View File

@ -4,6 +4,7 @@ import com.songoda.core.configuration.Config;
import com.songoda.core.database.DataManagerAbstract;
import com.songoda.core.locale.Locale;
import com.songoda.core.utils.Metrics;
import de.tr7zw.changeme.nbtapi.utils.MinecraftVersion;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
@ -26,6 +27,12 @@ public abstract class SongodaPlugin extends JavaPlugin {
protected ConsoleCommandSender console = Bukkit.getConsoleSender();
private boolean emergencyStop = false;
static {
/* NBT-API */
MinecraftVersion.getLogger().setLevel(Level.WARNING);
MinecraftVersion.disableUpdateCheck();
}
public abstract void onPluginLoad();
public abstract void onPluginEnable();

View File

@ -4,8 +4,16 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public interface NBTCore {
/**
* @deprecated Use {@link de.tr7zw.nbtapi.NBTItem} instead.
*/
@Deprecated
NBTItem of(ItemStack item);
/**
* @deprecated Use {@link de.tr7zw.nbtapi.NBTItem} instead.
*/
@Deprecated
NBTItem newItem();
NBTEntity of(Entity entity);

View File

@ -2,6 +2,10 @@ package com.songoda.core.nms.nbt;
import org.bukkit.inventory.ItemStack;
/**
* @deprecated Use {@link de.tr7zw.nbtapi.NBTItem} instead.
*/
@Deprecated
public interface NBTItem extends NBTCompound {
ItemStack finish();
}

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);

View File

@ -10,11 +10,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
public class NBTCoreImpl implements NBTCore {
@Deprecated
@Override
public NBTItem of(ItemStack item) {
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
}
@Deprecated
@Override
public NBTItem newItem() {
return new NBTItemImpl(null);