Class ItemMessage

java.lang.Object
com.bencodez.advancedcore.api.misc.effects.ItemMessage

public class ItemMessage extends Object
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 Classes
    Modifier and Type
    Class
    Description
    class 
    Represents a message record for item messages.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemMessage(org.bukkit.plugin.Plugin plugin)
    Creates a new item message handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    sendMessage(org.bukkit.entity.Player player, String message)
     
    void
    sendMessage(org.bukkit.entity.Player player, String message, int duration)
     
    void
    sendMessage(org.bukkit.entity.Player player, String message, int duration, int priority)
     
    void
    setEmptyHandReplacement(org.bukkit.Material material)
    Set which item the player should held if he receives a message without having something in his hand.
    void
    setFormats(String... formats)
    Set the alternating format strings for message display.
    void
    setInterval(int interval)
    set the interval the player will receive packets with the formatted message Default is 20 for every second

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemMessage

      public ItemMessage(org.bukkit.plugin.Plugin plugin)
      Creates a new item message handler.
      Parameters:
      plugin - the plugin instance
  • Method Details

    • sendMessage

      public void sendMessage(org.bukkit.entity.Player player, String message)
    • sendMessage

      public void sendMessage(org.bukkit.entity.Player player, String message, int duration)
    • 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

      public void setFormats(String... formats)
      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