InputGuiAPI
I have found a way to use the command block gui to read strings and using them, I made a small plugin with api for this so multiple plugin should be able to use it and making it a lot easier to use. :) The other text on the gui can be removed by using a modified resource pack. It already uses ProtocolLib to read incomming packets but doesn't use any nms.
Features:
- Open a input gui and read the input string.
- Intercept command block renaming.
- Intercept anvil renaming events. (Including color support.)
- Force a player to open a sign gui or command block edit gui.
Usefull Links:
Requirements:
How to use?
First you will need to import the api into your plugin build path.
You can also import the dependency using maven:
<dependency> <groupId>cybermaxke</groupId> <artifactId>inputgui</artifactId> <version>dev-SNAPSHOT</version> </dependency>
<repository> <id>cybermaxkes-repo</id> <url>http://dl.dropbox.com/u/104060836/mvn-repo</url> </repository>
Example:
This is how you should be able to get the api:
InputGuiAPI api = (InputGuiAPI) Bukkit.getPluginManager().getPlugin("InputGui");
Now, once you can acces the api, you can make the player opening a gui:
Player player = ...; InputPlayer iplayer = api.getPlayer(player); iplayer.openGui(new InputGui() { @Override public String getDefaultText() { return "This is a example!"; } @Override public void onConfirm(InputPlayer player, String input) { player.getPlayer().sendMessage(this.getDefaultText() + " -> " + input); } @Override public void onCancel(InputPlayer player) { } });
That is everything you need to do!
Please post issues on github.
Not working. :/
@Cybermaxke Will you be updating this to the new protocallib, or is this all ready in progress?
Currently using protocol lib taken from the developers repository, http://assets.comphenix.net/job/ProtocolLib/181/
The api does not appear to be working though. I followed the example above, and while methods are certainly being called, no interface is being opened. Is this an issue with protocol lib, or is it an issue with the input api? I'm trying to get this to work on 1.7.4
Good idea! I want to use it! ^-^