Solved Ways to get input from player

Discussion in 'Plugin Development' started by oscar.shrimpton.dev, Mar 31, 2014.

Thread Status:
Not open for further replies.
  1. Hi,
    So i'm making an arena plugin and what i have is basically the player will see an IconMenu with 3 items:- Set max players, set min players and set locations
    For the set min/max players i would like them to be able to input a number and for me to be able to do stuff with that number
    Does anyone know how to do this?

    - whatapigdoes
     
  2. Offline

    Wolfey

    Code:text
    1. Integer.parseInt(string);
     
  3. Offline

    Wizehh

    You could open an anvil GUI, and then parse the string there, as Wolfey suggested. I believe someone has written a tutorial on how to that in the 'resources' section. There are a medley of other ways to do this, but this is probably the most player friendly method.
     
  4. Offline

    Maurdekye

    oscar.shrimpton.dev You could make the item's name be the number it represents, and when you left click it the number increases, and when you right click it decreases:
    "Max Players: 5" *left click* "Max Players: 6" *right click, right click* "Max Players: 4"
     
  5. I'm asking how i would easily get that string


    The only trouble is if the default is 5 and you want it 50 for some reason then you have to keep clicking...

    I'll probably go with @Maurdekye's suggestion but thanks all!
     
  6. Offline

    Maurdekye

    oscar.shrimpton.dev You could actually do something else entirely, like be able to pick up the item, and when you put it down it adds however many far over you dragged it. for example, if you start with the max players in the center (slot 5), it might go like this;
    Code:
    "Max Players: 5"
    *drag to slot 6*
    "Max Players: 6" (item resets to slot 5 after this)
    *drag to slot 6*
    "Max Players: 7"
    *drag to slot 7*
    "Max Players: 9" (Adds two, because that's how far you dragged it)
    *drag to slot 4*
    "Max Players: 8" (Subtracts one, because you moved it to an earlier slot)
    *drag to slot 2*
    "Max Players: 4" (Subtracts 4, because it's more efficient for the distance scaling to be in powers of two, rather than linear)
    *drag to slot 9*
    "Max Players: 20" (Adds 16, because you dragged it 4 slots to the right, which 2^4 = 16)
    I think this would be a very efficient method. Just maybe slightly more difficult to program.
     

  7. Awesome! I'm working on other parts of my plugin now but i'll definetely include that method when i get time!

    Thanks again,

    whatapigdoes
     
Thread Status:
Not open for further replies.

Share This Page