public class EntityData extends StringData
| Modifier and Type | Field and Description |
|---|---|
static @NotNull java.lang.String |
TABLE_NAME
The name of the table in the database to store entity data
|
TARGET_COLUMN, useCache| Constructor and Description |
|---|
EntityData(@NotNull AnnoyingPlugin plugin,
@NotNull org.bukkit.entity.Entity entity)
Construct a new
EntityData for the given entity |
| Modifier and Type | Method and Description |
|---|---|
@Nullable java.util.Map<java.lang.String,java.lang.String> |
convertOldData()
|
@Nullable java.util.Map<java.lang.String,java.lang.String> |
convertOldData(boolean onlyTryOnce)
|
@Nullable java.util.Map<java.lang.String,java.lang.String> |
convertOldData(boolean onlyTryOnce,
@Nullable java.util.Collection<java.lang.String> keys)
Convert all data from the old data storage system (PDC/file) to the new one (SQL)
This does not run automatically, you must call this method manually (for example, on PlayerJoinEvent)!
For 1.14+ (PDC), the entity will receive the api_converted key which indicates that the data has been converted, this will avoid duplicate conversion checks
All old data (PDC/file) will be removed after conversion (to avoid duplicate/overwriting data) |
@Nullable java.util.Map<java.lang.String,java.lang.String> |
convertOldData(boolean onlyTryOnce,
java.lang.String... keys)
Calls
convertOldData(boolean, Collection) with the given keys |
@Nullable java.util.Map<java.lang.String,java.lang.String> |
convertOldData(@NotNull java.util.Collection<java.lang.String> keys)
|
@Nullable java.util.Map<java.lang.String,java.lang.String> |
convertOldData(java.lang.String... keys)
|
get, remove, setget, getAnnoyingPlugin, getOptional, has, removeChain, sendError, set, setChain@NotNull public static final @NotNull java.lang.String TABLE_NAME
public EntityData(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull org.bukkit.entity.Entity entity)
EntityData for the given entityplugin - Data.pluginentity - entity and Data.target (uses entity UUID)@Nullable
public @Nullable java.util.Map<java.lang.String,java.lang.String> convertOldData(boolean onlyTryOnce,
@Nullable
@Nullable java.util.Collection<java.lang.String> keys)
PlayerJoinEvent)!
api_converted key which indicates that the data has been converted, this will avoid duplicate conversion checks
onlyTryOnce - 1.14+ only | true to only try once to convert the data, even if it fails (so if run again, nothing will happen). If false, the conversion failed previously, and this is run again, it will try to convert again. If the data is successfully converted, this option doesn't matterkeys - only applicable for 1.14-1.16, otherwise it will convert all keys (no matter what is provided)null if an error occurred (only returns null if 1.14+ fails)@Nullable
public @Nullable java.util.Map<java.lang.String,java.lang.String> convertOldData(boolean onlyTryOnce,
@NotNull
java.lang.String... keys)
convertOldData(boolean, Collection) with the given keysonlyTryOnce - 1.14+ only | true to only try once to convert the data, even if it fails (so if run again, nothing will happen). If false, the conversion failed previously, and this is run again, it will try to convert again. If the data is successfully converted, this option doesn't matterkeys - only applicable for 1.14-1.16, otherwise it will convert all keys (no matter what is provided)null if an error occurred (only returns null if 1.14+ fails)convertOldData(boolean, Collection)@Nullable
public @Nullable java.util.Map<java.lang.String,java.lang.String> convertOldData(@NotNull
@NotNull java.util.Collection<java.lang.String> keys)
keys - only applicable for 1.14-1.16, otherwise it will convert all keys (no matter what is provided)null if an error occurred (only returns null if 1.14+ fails)convertOldData(boolean, Collection)@Nullable
public @Nullable java.util.Map<java.lang.String,java.lang.String> convertOldData(@NotNull
java.lang.String... keys)
keys - only applicable for 1.14-1.16, otherwise it will convert all keys (no matter what is provided)null if an error occurred (only returns null if 1.14+ fails)convertOldData(boolean, Collection)@Nullable public @Nullable java.util.Map<java.lang.String,java.lang.String> convertOldData(boolean onlyTryOnce)
onlyTryOnce - 1.14+ only | true to only try once to convert the data, even if it fails (so if run again, nothing will happen). If false, the conversion failed previously, and this is run again, it will try to convert again. If the data is successfully converted, this option doesn't matternull if an error occurred (only returns null if 1.14+ fails)convertOldData(boolean, Collection)@Nullable public @Nullable java.util.Map<java.lang.String,java.lang.String> convertOldData()
null if an error occurred (only returns null if 1.14+ fails)convertOldData(boolean, Collection)