UniHologram
A unified hologram library for most hologram plugins
Info
This is a small library that wraps methods of different hologram plugins to a unified API.
The API is designed to help developers develop hooks without worrying about which plugins they should support.
Notice
This is a wrapper library, which means it isn't intended to replace any hologram plugins.
The library just creates a unified API on these hologram plugins. That also means you need a hologram plugin for this to work.
Code
Code (Java):
// Get the hologram provider
HologramProvider
<Location
> provider
= JavaPlugin.
getPlugin
(UniHologramPlugin.
class
).
getProvider
(
)
;
// Create & Initialize the hologram
Hologram
<Location
> hologram
= provider.
createHologram
(
"test", location
)
;
hologram.
init
(
)
;
// Important
// Hologram methods
hologram.
addLine
(
new TextHologramLine
(
"This is a fancy line"
)
)
;
hologram.
setLine
(
new TextHologramLine
(
"This is another line"
)
)
;
hologram.
insertLine
(
0,
new ItemHologramLine
(
new ItemStack
(Material.
STONE
)
)
)
;
hologram.
removeLine
(
1
)
;
hologram.
setLines
(
Arrays.
asList
(
new ItemHologramLine
(
new ItemStack
(Material.
STONE
)
),
new TextHologramLine
(
"&f&lThis is a mysterious stone"
),
new TextHologramLine
(
"&c&lYou cannot touch it"
)
)
)
;
// Visibility methods
if
(hologram
instanceof PlayerVisibility
)
{
PlayerVisibility visibility
=
(PlayerVisibility
) hologram
;
visibility.
hideAll
(
)
;
visibility.
showAll
(
)
;
visibility.
hideTo
(player
)
;
visibility.
showTo
(player
)
;
if
(visibility.
isVisible
(player
)
)
System.
out.
println
(
"He can see the hologram"
)
;
}
// Clear/Delete the hologram
hologram.
clear
(
)
;
Supported Plugin