Need help with code

Discussion in 'Plugin Development' started by smib98, Jul 6, 2014.

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

    smib98

    I am working on a lobby system that adds a player to a group on join then vanishes everyone else. I need to know how to randomise the groups and make everyone except the players in the group disappear.

    Here is my source code:
    http://pastebin.com/S1yxv4MC#
     
  2. Offline

    Dubehh

    smib98
    - Randomizer:
    Code:java
    1. Random r = new Random();

    - Vanishing:
    • Create a for-loop
    • loop for all players and check if they are in the same group as the executer (player)
    • use the hidePlayer(player) method
    Concerning your project,
    you might want to keep your 'main' class small and compact. And use CommandExecuter classes for the commands, Listener classes for the events, getters/setters in other classes etc. It keeps your project clean and orginized :)
     
    smib98 likes this.
  3. Offline

    smib98

    kk, thanks for the help :)
     
  4. Offline

    Chpwnd

    I always used:
    Code:java
    1. Random randomGenerator = new Random();
    2. int a = (int) randomGenerator.nextInt(8);


    but i guess they do the exact same thing
     
  5. Chpwnd nextInt() (unsurprisingly) returns an int, why are you casting it to one? And what do you mean you guess they do the same thing? I don't see an alternative posted.
     
  6. Offline

    Chpwnd


    hmm i guess its just a habbit i have. Guess i never really needed to cast it xD
     
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page