Action Setups
onButtonClick()
Its important you make sure to put player menu clickType inside the ( ) of the onButtonClick(player, menu, clickType)
local ClickType = import("org.bukkit.event.inventory.ClickType")
local Bukkit =
import("org.bukkit.Bukkit")
function onButtonClick(player, menu, clickType)
if clickType == ClickType.LEFT then
Bukkit:dispatchCommand(player, "dm open example")
end
end
Animating the title
Animate the title you can show a temporary title when a button is clicked
However its important you dont animate the title if you are opening another menu with a command, just keep that in mind
local ClickType = import("org.bukkit.event.inventory.ClickType")
local Bukkit =
import("org.bukkit.Bukkit")
function onButtonClick(player, menu, clickType)
if clickType == ClickType.LEFT then
menu:animateTitle("&cRight Clicked!")
end
end
ClickType checking
local ClickType = import("org.bukkit.event.inventory.ClickType")
local Bukkit =
import("org.bukkit.Bukkit")
local console = Bukkit:getConsoleSender()
function onButtonClick(player, menu, clickType)
if clickType == ClickType.Left then
menu:animateTitle("&cLeft Clicked!")
elseif clickType == ClickType.LEFT then
Bukkit:dispatchCommand(console, "say &cYour name is:&6 " .. player:getName())
end
end