Creating gui

I am trying to create a gui for when a player left or right clicks a compass, I created a var for the gui and stuff but can't get a way to create the gui? Thank you!
Code:


@EventHandler
public void onLeftClickBlockCompass(PlayerInteractEvent e){
Player p = e.getPlayer();
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)){
if (p.getInventory().getItemInHand().equals(compass)){
// I want to open the GUI here. Thank you!!
}
}
 

CreeperFace

🇨🇿🇺🇦 Слава Україні!
Staff member
I am trying to create a gui for when a player left or right clicks a compass, I created a var for the gui and stuff but can't get a way to create the gui? Thank you!
Code:


@EventHandler
public void onLeftClickBlockCompass(PlayerInteractEvent e){
Player p = e.getPlayer();
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)){
if (p.getInventory().getItemInHand().equals(compass)){
// I want to open the GUI here. Thank you!!
}
}
What do you mean? Form windows or inventory UI?
 

OsmanGny

Member
@EventHandler
public void onLeftClickBlockCompass(PlayerInteractEvent e){
Player p = e.getPlayer();
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)){
if (p.getInventory().getItemInHand().equals(compass)){
// I want to open the GUI here. Thank you!!
}
//Add this
p.showFormWindow(//Your form var)
}
 
Top