Action Setups
onButtonClick()
Its important you make sure to put player menu clickType inside the ( ) of the onButtonClick(player, menu, clickType)
import("org.bukkit.event.inventory.ClickType")
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
import("org.bukkit.event.inventory.ClickType")
function onButtonClick(player, menu, clickType)
if clickType == ClickType.LEFT then
menu:animateTitle("&cRight Clicked!")
end
end
ClickType checking
import("org.bukkit.event.inventory.ClickType")
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.LEFTRIGHT then
Bukkit:dispatchCommand(console,menu:animateTitle("&cRight Clicked!"say &cYour name is:&6 " .. player:getName())
end
end