Assigning Numbers

Discussion in 'Plugin Development' started by Irantwomiles, Nov 16, 2015.

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

    Irantwomiles

    I'm trying to "assign" a certain amount of numbers to a specific player. Let me explain. Lets say I have the numbers 1-100 inclusive and I need to assign numbers 1-25 to a specific player/person so when I run a command or something I can use a random number generator to pic a number between 1-100 and check if that number is between 1-25 and give them a prize for it. Please tell me if I'm thinking about this the wrong way or anything that will help me. I'm really stuck.
     
  2. Offline

    Scimiguy

    Will it always be 25 numbers per player?
     
  3. Offline

    Irantwomiles

    No. It'll change based on the situation
     
  4. Offline

    Scimiguy

    Will it always be the same amount of numbers per player then?
     
  5. Offline

    dlange

    @Irantwomiles You could have a hashmap containing players and numbers?
     
  6. Offline

    Irantwomiles

    Just for now let's say there will the same amount of people all the time
     
  7. Offline

    Scimiguy

    @Irantwomiles
    But the amount of numbers per player can change?

    The way you do this is significantly different based on exactly what you're trying to do..which is why I'm trying to get EXACT information

    So you'll have the same amount of players every time? The total amount of numbers will change?
    The amount of numbers to be given to each player will vary?
    ?
     
  8. Offline

    Zombie_Striker

    I think this is what you want.
    Code:
    HashMap<UUID,Integer> Player&Chance = new HashMap<UUID,Integer>();
    
    //someplace else
    int randomnumber = 50;
    if(Player&Chance.get(Player's uuid) <= that random number){
    //Player won
    }else{
    //player losses.
    }
     
Thread Status:
Not open for further replies.

Share This Page