InputGui - Use the cmd block gui to read strings!

Discussion in 'Resources' started by Cybermaxke, Jul 18, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Cybermaxke

    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.
    I hope this will be usefull. ;)

    Download: Build Server, or if it's unavailable get it from my Repo.
    Source: Github

    You can also import the dependency using maven:
    Code:
    <dependency>
        <groupId>cybermaxke</groupId>
        <artifactId>inputgui</artifactId>
        <version>dev-SNAPSHOT</version>
    </dependency>
    Code:
    <repository>
        <id>cybermaxkes-repo</id>
        <url>http://dl.dropbox.com/u/104060836/mvn-repo</url>
    </repository>
    Here is a example how to use it:
    This is how you should be able to get the api:
    Code:
    InputGuiAPI api = (InputGuiAPI) Bukkit.getPluginManager().getPlugin("InputGui");
    Now, once you can acces the api, you can make the player opening a gui:
    Code:
    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 below or on github.

    A small video:
     
    Goblom, ampayne2, CMG and 17 others like this.
  2. Offline

    hawkfalcon

    No way.
    Edit: Pics?
     
  3. Offline

    lol768 Retired Staff

    It'll be awesome when servers can suggest these.
     
    jtjj222 likes this.
  4. Offline

    Cybermaxke

    I will post a small vid ;) and I will also need to improve the close checks.

    hawkfalcon I posted a video as proof. ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 9, 2016
  5. Offline

    Ultimate_n00b

    :eek: I was going to make this a while ago.. then forgot about it.

    Good work!
     
  6. Offline

    mncat77 Retired Staff

    Cybermaxke
    Suggestion: Add support for the anvil gui too (Yes thats possible done that already).
     
  7. Offline

    Cybermaxke

    I will look into it how I can do it. ;)

    mncat77
    Should I make a custom event to do this? Because its still a part of a inventory.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 9, 2016
    Ultimate_n00b likes this.
  8. Offline

    mncat77 Retired Staff

    If you use the inventory solely for the String input and disable all of the other slots you could just do it like you did with the commandblock, couldn't you?
     
  9. Offline

    Cybermaxke

    I will try it, but I will also make a optional event.
    EDIT: I don't think that you can use the rename box without a item in the first slot.
     
  10. Offline

    Cybermaxke

    Update:
    • Added a command block edit event.
    • Added a item rename event.
    Some examples:
    Code:
    @EventHandler
    public void onCommandBlockEdit(CommandBlockEditEvent e) {
        if (e.getNewCommand().equalsIgnoreCase("Apple")) {
            e.setNewCommand("Awesome Apple!");
        } else {
            e.setCancelled(true);
        }
    }
    Code:
    @EventHandler
    public void onItemRename(ItemRenameEvent e) {
        if (e.getInventory().contains(Material.APPLE)) {
            e.setNewName("Awesome Apple!");
        } else {
            e.setCancelled(true);
        }
    }
     
    DoggyCodeâ„¢ and mncat77 like this.
  11. Offline

    DSH105 Retired Staff

    Cybermaxke You are amazing. 'Nuf said. Fantastic work!
     
  12. Offline

    Cybermaxke

    Update:
    • Fixed that color chars are filtered.
     
  13. Offline

    andrewabosh

    Cybermaxke I got so many great ideas with this, but is it possible to change the text via packets or something?
     
  14. Offline

    Cybermaxke

    Yes, the same way when you will open the gui.
    What do you want to try?
     
  15. Offline

    andrewabosh

    By text I mean like Command Block, etc. Also my ideas a secreet :3
     
  16. Offline

    Goblom

    Will this API be submitted to the DBO any time soon ?
     
  17. Offline

    bobacadodl

    Theres no need for it to be submitted? Just include the classes in your project
     
  18. Offline

    Goblom

    bobacadodl I would rather use the Jar provided from the maven repo which is actually a bukkit plugin. It makes less conflicts with other plugins.

    But, if project will never be submitted i guess i will have to to add the classes to my project
     
  19. Offline

    clienthax

    Mhm, can't get this to work on 1.5.2, any ideas, doesn't throw up a error, just no gui opens
     
  20. Offline

    Cybermaxke

    This isn't working with 1.5.2 because the packets were added in version 1.6.2 ;)
     
  21. Offline

    Goblom

    Cybermaxke
     
  22. Offline

    Cybermaxke

    Oh, sorry, sure :)
     
  23. Offline

    Lionhard

    Cybermaxke So I do have to import protocolLib as an external jar, not?
     
  24. Offline

    Quaro

    Please make it undependable to other plugins, and to one or couple classes, that we could put inside our plugins.
     
  25. Offline

    Unfou

    Would it be possible to put custom text in the other box (for the command block) ?
     
  26. Offline

    Flybelette

    Hey Guys ! When I try to run the InputGUI Plugin I got multiple ProtocolLib errors, Does anyone know why ? http://pastebin.com/datT3nyv
     
  27. Offline

    Aperx

    This is great but would be better if it was just a couple of classes rather than a whole plugin that each project has to depend on :)
     
    T3h Cr33p3r likes this.
  28. Offline

    xXSniperzzXx_SD

    So is there a way to use this without making them need to get this plugin, mainly because this is made for 1.6.x and because it would be nice to have everything in one plugin.
     
  29. Offline

    Toni

    Wondering if this is going to be / is updated for 1.7.2 and 1.7.2 ProtocolLib? I'd love to use this :)
     
  30. Offline

    Monowii

    Excellent plugin ! Toni This actually work with 1.7.5
     
Thread Status:
Not open for further replies.

Share This Page