Class ItemMessage
java.lang.Object
com.bencodez.advancedcore.api.misc.effects.ItemMessage
Minecraft displays the item tooltip to the player briefly when it's changed.
Let's (ab)use that to send a "popup" message to the player via one of these
tooltips. This is nice for temporary messages where you don't want to clutter
up the chat window.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRepresents a message record for item messages. -
Constructor Summary
ConstructorsConstructorDescriptionItemMessage(org.bukkit.plugin.Plugin plugin) Creates a new item message handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidsendMessage(org.bukkit.entity.Player player, String message) voidsendMessage(org.bukkit.entity.Player player, String message, int duration) voidsendMessage(org.bukkit.entity.Player player, String message, int duration, int priority) voidsetEmptyHandReplacement(org.bukkit.Material material) Set which item the player should held if he receives a message without having something in his hand.voidsetFormats(String... formats) Set the alternating format strings for message display.voidsetInterval(int interval) set the interval the player will receive packets with the formatted message Default is 20 for every second
-
Constructor Details
-
ItemMessage
public ItemMessage(org.bukkit.plugin.Plugin plugin) Creates a new item message handler.- Parameters:
plugin- the plugin instance
-
-
Method Details
-
sendMessage
-
sendMessage
-
sendMessage
public void sendMessage(org.bukkit.entity.Player player, String message, int duration, int priority) -
setEmptyHandReplacement
public void setEmptyHandReplacement(org.bukkit.Material material) Set which item the player should held if he receives a message without having something in his hand. Default is a snow layer- Parameters:
material- Material- Throws:
IllegalArgumentException- if material is null
-
setFormats
Set the alternating format strings for message display. The strings must be different and must each contain one (and only one) occurrence of '%s'.- Parameters:
formats- the format strings- Throws:
IllegalArgumentException- if the strings are the same, or do not contain a %s
-
setInterval
public void setInterval(int interval) set the interval the player will receive packets with the formatted message Default is 20 for every second- Parameters:
interval- in ticks- Throws:
IllegalArgumentException- if interval is below 1
-