Class Image
ImageCommands
.
In most cases the class is used to be a reliable between a YAML configuration of registered image and their Minecraft features.
- Since:
- 2021-08-23
- Version:
- 1.0.0
- Author:
- Xxathyx
-
Constructor Summary
ConstructorDescriptionAnnother constructor for Image class, this one creates an Image variable according to aFile
, the file variable is assigned to the given parameter file.Constructor for Image class, creates an Image variable according to aString
name, it search for an YAML image configuration-file, with the parameter name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create
(BufferedImage bufferedImage, org.bukkit.entity.Player player) Creates a Minecraft rendered image and gives an image-poster to aPlayer
, seegive(Player)
.org.bukkit.configuration.file.FileConfiguration
Gets an FileConfiguration instance of the image configuration-file, wich grant access to the configuration data.getFile()
Gets the image configuration-file passed earlier by the constructors.int
Gets the Minecraft image height.getIds()
Gets an list ofInteger
corresponding to the ids wich were used to render the image in Minecraft.getName()
Gets the image name without extension from the image configuration.getPath()
Gets the original image file path, it can be an online redirection.int
getWidth()
Gets the Minecraft image width.org.bukkit.World
getWorld()
Gets theWorld
that an image is rendered in.void
give
(org.bukkit.entity.Player player) Gives an image-posterItemStack
to aPlayer
.
-
Constructor Details
-
Image
Constructor for Image class, creates an Image variable according to aString
name, it search for an YAML image configuration-file, with the parameter name.- Parameters:
name
- The name of the image without extension.
-
Image
Annother constructor for Image class, this one creates an Image variable according to aFile
, the file variable is assigned to the given parameter file.- Parameters:
file
- The image configuration-file.
-
Image
Annother constructor for Image class, this one creates an Image variable according to aString
name and aString
path to image YAML configuration-file.This constructor should be called when the YAML configuration-file ins't created, then a
create(BufferedImage, Player)
can be called.- Parameters:
file
- The image configuration-file.
-
-
Method Details
-
create
Creates a Minecraft rendered image and gives an image-poster to aPlayer
, seegive(Player)
.Note: This method should be called once and then wait it finish to be called again for annother image, to avoid a
invalid @link
ConcurrentModificationException
- Parameters:
bufferedImage
- The image that will be rendered in Minecraft.player
- The player that will receive the image-poster.
-
give
public void give(org.bukkit.entity.Player player) Gives an image-posterItemStack
to aPlayer
.If player inventory is full no items will be dropped.
- Parameters:
bufferedImage
- The image that will be rendered in Minecraft.player
- The player that will receive the image-poster.
-
getName
Gets the image name without extension from the image configuration.- Returns:
- The image name.
-
getPath
Gets the original image file path, it can be an online redirection.- Returns:
- The original image file path.
-
getWidth
public int getWidth()Gets the Minecraft image width.Corresponding to the number of horizontal ItemFrames necessary to display the image in a single horizontal line.
- Returns:
- The Minecraft image width count.
-
getHeight
public int getHeight()Gets the Minecraft image height.Corresponding to the number of vertical ItemFrames necessary to display the image in a single vertical line.
- Returns:
- The Minecraft image height count.
-
getWorld
public org.bukkit.World getWorld()Gets theWorld
that an image is rendered in.Note: The World parameter point the World in wich will be rendered the Map, map_ids.dat will always be stored in the main minecraft World data-folder, even if the maps are being rendered in other world, but more strangely this don't really work has it supposed to, if map are being rendered somewhere else than the main World they will not be showed, because what is always showed and can't be change correspond to main World and no other, even if you render a map on a external world, the map_id of main world will always be displayed has an main world-map, expect this method to always return the main Minecraft World.
- Returns:
- The World where the image was rendered in.
-
getIds
Gets an list ofInteger
corresponding to the ids wich were used to render the image in Minecraft.- Returns:
- A list of the ids that were used to render the image.
-
getFile
Gets the image configuration-file passed earlier by the constructors.- Returns:
- The image configuration-file.
-
getConfigFile
public org.bukkit.configuration.file.FileConfiguration getConfigFile()Gets an FileConfiguration instance of the image configuration-file, wich grant access to the configuration data.This method isn't usable directly, its used on class getters method such as
getName()
to access data.- Returns:
- FileConfiguration instance of the image configuration-file.
-