x = cmd.getName().equalsIgnoreCase("menu");

Discussion in 'Plugin Development' started by paully104, Jul 20, 2013.

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

    paully104

    Hey guys java novice here, i'm having a hard time creating a menu system at the moment. In regular java im use to using
    menuoption = Integer.parseInt( JOptionPane.showInputDialog( menulist));
    switch (menuoption)
    case 1: menuoption = 1

    case 2: menuoption = 2

    However when i try to do say menuoption = cmd.getName().equalsIgnoreCase("menu");
    and i go to declare String menuoption; it says that menuoption is a boolean ._.??? So is there a way i can grab the user input part to make this easy? I'm just hoping there's a simplistic way to activate the switch statement. If this looks a bit crazy or unorthodox if you could share your wisdom how to make a simple user interface i would be grateful. I just want to figure out how to make the user do /menu then prompt him with choices, then execute whatever command he puts in.
     
  2. Offline

    Bart

    .equalsIgnoreCase will return a boolean as to whether the string is equal to another one whilst ignoring the case. Therefore when you do menuoption = ....equalsIgnoreCase, it will end up returning a boolean, not a string.
     
  3. Offline

    gomeow

  4. Offline

    RainoBoy97

    Bukkit does not support swing.
     
  5. Offline

    paully104

    got a 404 not found on that page ^^!

    So how would you guys go about making a menu system for a plugin, if someone could show me a example of just a user doing /menu and then it says please enter 1 or 2 and then does whats under the switch i would be grateful.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  6. Offline

    gomeow

  7. Offline

    xTrollxDudex

  8. Offline

    paully104

Thread Status:
Not open for further replies.

Share This Page