Sueta

SignGUI

v1.0

Simple Sign GUI library for developers!

·Plugin

This resource is out of date and only works on Minecraft 1.8 servers

Sign GUI allows developers to easily open and retrieve text from a Sign GUI window. Event handling is done in exactly the same way every other spigot event is handled making it intuitive to use for any spigot developer!

This plugin does nothing on it's own. It is a library intended to be used by developers to incorporate sign gui editors into their plugins.

Only tested on Spigot v1.8
Requires:
ProtocolLib

  • Drop SignGUI.jar into your /plugins folder
  • In your Java project, add SignGUI.jar to your build path
  • In your plugin yml add "depend:[SignGUI]"

String[] text = new String[]{ChatColor.BOLD + "Sign GUI Lib", player.getName(), "Enter some text:", ""};
SignGUI.openSignEditor(player, text);


When the player clicks 'Done' in the sign editor gui, a SignGUIUpdateEvent is fired. You can listen for this event just like you would listen for any other spigot event.

In your onEnable() method, register an event listener for the sign gui.

public void onEnable()
{
    getServer().getPluginManager().registerEvents(new OnSignGUIUpdateEvent(), this);
}

In this example, when the event is fired the code simply prints back to the player the text that was inside the sign.

public class OnSignGUIUpdateEvent implements Listener
{
    @EventHandler
    public void signUpdate(SignGUIUpdateEvent event)
    {
        Player player = event.getPlayer();
  
        for(String str : event.getSignText())
        {
            player.sendMessage(str);
        }
    }
}

Result:

Similar projects

Plugin →