T - the type of the AnnoyingFile instancepublic class AnnoyingFile<T extends AnnoyingFile<T>>
extends org.bukkit.configuration.file.YamlConfiguration
AnnoyingResource,
AnnoyingData| Modifier and Type | Class and Description |
|---|---|
static class |
AnnoyingFile.Options<G extends AnnoyingFile.Options<G>>
A class to hold the options for a file
Default options: AnnoyingFile.Options.canBeEmpty = true
AnnoyingFile.Options.replace = false
|
| Modifier and Type | Field and Description |
|---|---|
@NotNull java.io.File |
file
The
File for the file |
protected @NotNull AnnoyingFile.Options<?> |
fileOptions
The
AnnoyingFile.Options for the file |
@NotNull AnnoyingPlugin |
plugin
The
AnnoyingPlugin instance |
BLANK_CONFIG, COMMENT_PREFIX| Constructor and Description |
|---|
AnnoyingFile(@NotNull AnnoyingPlugin plugin,
@NotNull java.io.File file)
Constructs a new
AnnoyingFile |
AnnoyingFile(@NotNull AnnoyingPlugin plugin,
@NotNull java.io.File file,
@Nullable AnnoyingFile.Options<?> fileOptions)
Constructs a new
AnnoyingFile |
AnnoyingFile(@NotNull AnnoyingPlugin plugin,
@NotNull java.lang.String path)
Constructs a new
AnnoyingFile |
AnnoyingFile(@NotNull AnnoyingPlugin plugin,
@NotNull java.lang.String path,
@Nullable AnnoyingFile.Options<?> fileOptions)
Constructs a new
AnnoyingFile |
| Modifier and Type | Method and Description |
|---|---|
void |
create()
Creates the
file |
boolean |
delete()
Deletes the
file, won't fail silently |
boolean |
delete(boolean silentFail)
Deletes the
file |
<G> @NotNull java.util.Optional<G> |
getAttributeModifier(@NotNull java.lang.String path)
1.9+ Gets an AttributeModifier from the path. |
@NotNull java.util.Optional<org.bukkit.configuration.ConfigurationSection> |
getConfigurationSectionOptional(@NotNull java.lang.String path)
Get a
ConfigurationSection from the path in an Optional |
<G> @NotNull java.util.Optional<G> |
getDef(@NotNull java.lang.String path)
Gets the default value from the path
|
@Nullable org.bukkit.inventory.ItemStack |
getItemStack(@NotNull java.lang.String path)
Gets an
ItemStack from the path. |
@Nullable org.bukkit.inventory.ItemStack |
getItemStack(@NotNull java.lang.String path,
@Nullable org.bukkit.inventory.ItemStack def)
Gets an
ItemStack from the path. |
@NotNull java.util.Optional<org.bukkit.inventory.ItemStack> |
getItemStackOptional(@NotNull java.lang.String path)
Gets an
ItemStack from the path. |
@NotNull java.util.Optional<PlayableSound> |
getPlayableSound(@NotNull java.lang.String path)
Gets a
PlayableSound from the path. |
@NotNull java.util.Optional<org.bukkit.potion.PotionEffect> |
getPotionEffect(@NotNull java.lang.String path)
Gets a
PotionEffect from the path. |
@NotNull java.util.Optional<org.bukkit.inventory.Recipe> |
getRecipe(@NotNull java.lang.String path)
Gets a
Recipe from the YAML. |
@NotNull java.util.Optional<org.bukkit.inventory.Recipe> |
getRecipe(@NotNull java.lang.String path,
@Nullable java.util.function.UnaryOperator<org.bukkit.inventory.ItemStack> itemFunction)
Gets a
Recipe from the YAML. |
@NotNull java.util.Optional<org.bukkit.inventory.Recipe> |
getRecipe(@NotNull java.lang.String path,
@Nullable java.util.function.UnaryOperator<org.bukkit.inventory.ItemStack> itemFunction,
@Nullable java.lang.String name)
Gets a
Recipe from the YAML. |
@NotNull java.util.Optional<org.bukkit.Sound> |
getSound(@NotNull java.lang.String path)
Gets a
Sound from the path |
boolean |
load()
Loads the YAML from the path.
|
void |
log(@NotNull java.util.logging.Level level,
@Nullable java.lang.String key,
@NotNull java.lang.String message)
Sends a formatted log message to the console
Sends a formatted warning message to the console
|
boolean |
save()
Saves the YAML to the
file |
T |
setChain(@NotNull java.lang.String path,
@Nullable java.lang.Object value)
Sets a value in the YAML and returns the
AnnoyingFile instance |
boolean |
setSave(@NotNull java.lang.String path,
@Nullable java.lang.Object value)
Sets a value in the YAML and then
saves the file |
@NotNull java.lang.String |
toString() |
buildHeader, convertMapsToSections, loadConfiguration, loadConfiguration, loadConfiguration, loadFromString, options, parseHeader, saveToStringload, load, load, load, save, saveaddDefault, addDefaults, addDefaults, getDefaults, getParent, setDefaultscontains, createPath, createPath, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefault, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isPrimitiveWrapper, isSet, isString, isVector, mapChildrenKeys, mapChildrenValues, setclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, createSection, createSection, get, get, getBoolean, getBoolean, getBooleanList, getByteList, getCharacterList, getColor, getColor, getConfigurationSection, getCurrentPath, getDefaultSection, getDouble, getDouble, getDoubleList, getFloatList, getInt, getInt, getIntegerList, getKeys, getList, getList, getLong, getLong, getLongList, getMapList, getName, getOfflinePlayer, getOfflinePlayer, getRoot, getShortList, getString, getString, getStringList, getValues, getVector, getVector, isBoolean, isColor, isConfigurationSection, isDouble, isInt, isItemStack, isList, isLong, isOfflinePlayer, isSet, isString, isVector, set@NotNull public final @NotNull AnnoyingPlugin plugin
AnnoyingPlugin instance@NotNull public final @NotNull java.io.File file
File for the file@NotNull protected final @NotNull AnnoyingFile.Options<?> fileOptions
AnnoyingFile.Options for the filepublic AnnoyingFile(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull java.io.File file,
@Nullable
@Nullable AnnoyingFile.Options<?> fileOptions)
AnnoyingFileplugin - pluginfile - filefileOptions - fileOptionspublic AnnoyingFile(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull java.io.File file)
AnnoyingFilepublic AnnoyingFile(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull java.lang.String path,
@Nullable
@Nullable AnnoyingFile.Options<?> fileOptions)
AnnoyingFileplugin - pluginpath - the path to the file (relative to the plugin's folder)fileOptions - fileOptionspublic AnnoyingFile(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
@NotNull java.lang.String path)
AnnoyingFileplugin - pluginpath - the path to the file (relative to the plugin's folder)@NotNull public @NotNull java.lang.String toString()
toString in class org.bukkit.configuration.MemorySectionpublic void create()
filepublic boolean load()
can't be empty, an empty YamlConfiguration will be usedpublic boolean delete(boolean silentFail)
filesilentFail - whether to fail silentlydelete()public boolean delete()
file, won't fail silentlydelete(boolean)@NotNull public T setChain(@NotNull @NotNull java.lang.String path, @Nullable @Nullable java.lang.Object value)
AnnoyingFile instancepath - the path to the nodevalue - the value to set the node toAnnoyingFile instancepublic boolean setSave(@NotNull
@NotNull java.lang.String path,
@Nullable
@Nullable java.lang.Object value)
saves the filepath - the path to the nodevalue - the value to set the node topublic boolean save()
filepublic void log(@NotNull
@NotNull java.util.logging.Level level,
@Nullable
@Nullable java.lang.String key,
@NotNull
@NotNull java.lang.String message)
level - the Level of the messagekey - the key of the node that the message is about (null if it's not about a node)message - the message to send@NotNull
public <G> @NotNull java.util.Optional<G> getDef(@NotNull
@NotNull java.lang.String path)
G - the type of the default valuepath - the path to the node@NotNull
public @NotNull java.util.Optional<org.bukkit.configuration.ConfigurationSection> getConfigurationSectionOptional(@NotNull
@NotNull java.lang.String path)
ConfigurationSection from the path in an Optionalpath - the path to the nodeConfigurationSection or empty if it doesn't exist@NotNull
public @NotNull java.util.Optional<org.bukkit.Sound> getSound(@NotNull
@NotNull java.lang.String path)
Sound from the pathpath - the path to the nodeSound or empty if it's invalid@NotNull public @NotNull java.util.Optional<PlayableSound> getPlayableSound(@NotNull @NotNull java.lang.String path)
PlayableSound from the path. See the wiki for more informationpath - the path to the nodePlayableSound or empty if it's invalid@NotNull
public @NotNull java.util.Optional<org.bukkit.potion.PotionEffect> getPotionEffect(@NotNull
@NotNull java.lang.String path)
PotionEffect from the path. See the wiki for more informationpath - the path to the nodePotionEffect or empty if it's invalid@NotNull
public <G> @NotNull java.util.Optional<G> getAttributeModifier(@NotNull
@NotNull java.lang.String path)
G - the AttributeModifier classpath - the path to the nodeAttributeModifier or empty if it's invalid@Nullable
public @Nullable org.bukkit.inventory.ItemStack getItemStack(@NotNull
@NotNull java.lang.String path)
ItemStack from the path. See the wiki for more informationgetItemStack in interface org.bukkit.configuration.ConfigurationSectiongetItemStack in class org.bukkit.configuration.MemorySectionpath - the path to the nodeItemStack or null if it's invalid@Nullable
public @Nullable org.bukkit.inventory.ItemStack getItemStack(@NotNull
@NotNull java.lang.String path,
@Nullable
@Nullable org.bukkit.inventory.ItemStack def)
ItemStack from the path. See the wiki for more informationgetItemStack in interface org.bukkit.configuration.ConfigurationSectiongetItemStack in class org.bukkit.configuration.MemorySectionpath - the path to the nodedef - the default valueItemStack or def if it's invalid@NotNull
public @NotNull java.util.Optional<org.bukkit.inventory.ItemStack> getItemStackOptional(@NotNull
@NotNull java.lang.String path)
ItemStack from the path. See the wiki for more informationpath - the path to the nodeItemStack or empty if it's invalid@NotNull
public @NotNull java.util.Optional<org.bukkit.inventory.Recipe> getRecipe(@NotNull
@NotNull java.lang.String path)
Recipe from the YAML. See the wiki for more informationpath - the path to get the recipe fromRecipe or null if it doesn't exist / is invalid / something went wrong@NotNull
public @NotNull java.util.Optional<org.bukkit.inventory.Recipe> getRecipe(@NotNull
@NotNull java.lang.String path,
@Nullable
@Nullable java.util.function.UnaryOperator<org.bukkit.inventory.ItemStack> itemFunction)
Recipe from the YAML. See the wiki for more informationpath - the path to get the recipe fromitemFunction - the function to apply to the ItemStack before returning itRecipe or empty if it's invalid@NotNull
public @NotNull java.util.Optional<org.bukkit.inventory.Recipe> getRecipe(@NotNull
@NotNull java.lang.String path,
@Nullable
@Nullable java.util.function.UnaryOperator<org.bukkit.inventory.ItemStack> itemFunction,
@Nullable
@Nullable java.lang.String name)
Recipe from the YAML. See the wiki for more informationpath - the path to get the recipe fromitemFunction - the function to apply to the ItemStack before returning itname - the name of the recipe (only used in 1.12+ for the NamespacedKey), or null to use the node nameRecipe or the def if it's invalid