Solved Whitelist

Discussion in 'Plugin Development' started by marijn0909, Jul 7, 2014.

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

    marijn0909

    Hey people,

    How can i check when the whitelist is on?

    thank you for your help
     
  2. Offline

    simolus3

    marijn0909 "Bukkit.hasWhitelist();" returns true if it's on.
     
  3. Offline

    marijn0909

    Thanks check now if it is working simolus3
     
  4. Offline

    teej107

  5. Offline

    marijn0909

    simolus3 in which event do i put in the bukkit.hasplayer();
     
  6. Offline

    simolus3

    marijn0909 Sorry I don't see any of your code and therefor don't understand the question in which event bukkit.hasplayer has to be in. The method "Bukkit.hasPlayer()" doesn't exist. If you want to check whether a player is whitelisted, you might want to do something like "Bukkit.getPlayer(name).isWhitelisted()". If you need more help with your plugin, please tell us what it should do so that we can help you.
     
  7. Offline

    marijn0909

    simolus3 I am srry it has to be Bukkit.hasWhitelist(); I dont know in which event i put the Bukkit.hasWhitelist();
    By the way i am a newbie with Java
     
  8. Offline

    Necrodoom

    marijn0909 what you are trying to do exactly? You would put that line where you want to check it.
     
  9. Offline

    hankered

    you really, really, need to learn java.
     
  10. Offline

    marijn0909

    I want to check when the whitelist is on to set setmaxplayers to 1 and i dont know how do do that. i search everwere and i find nothing. Necrodoom
     
  11. Offline

    Necrodoom

    marijn0909 when do YOU want to do it? When the server starts? Checking every few seconds seeing if someone toggled the whitelist? On command?
     
  12. Offline

    fireblast709

  13. Offline

    CorrieKay

    marijn0909 I'm fairly sure its not possible to change the max number of online players while the server is running. If you want to prevent people from joining the server when the whitelist is on, the whitelist will do that just nicely in and of itself, just dont add other people to the server.

    Alternatively, you can listen for a PlayerJoinEvent, and then check if the whitelist is active, and prevent them from joining the server then.
     
  14. Offline

    marijn0909

    hankered
    That is the reason that i am here. I want to learn it form you.

    I want this

    I fixed.
    here is my code that i used
    Code:java
    1. @EventHandler
    2. public void osp(ServerListPingEvent e) {
    3. e.setMotd(ChatColor.DARK_AQUA.toString() + ChatColor.BOLD + "The Project " + ChatColor.DARK_GRAY.toString() + ChatColor.BOLD + "||" + ChatColor.GREEN.toString() +
    4. ChatColor.ITALIC + " The MMORPG/PVP server"
    5. + "\n" + ChatColor.WHITE.toString() + ChatColor.ITALIC + "Currently developing and building things");
    6. e.setMaxPlayers(50);
    7. if(Bukkit.hasWhitelist()) {
    8. e.setMaxPlayers(1);
    9. return;
    10. }
    11.  
    12. }
     
  15. Offline

    CorrieKay

    If you're trying to set the maximum number of players that can be allowed in the server, you'll want to do that via the server properties file. From what I'm gleaning from this, your server is in development, and you want to let people know, without letting them in. All of this should be set via the properties file, and not via plugin code. You'll want to do that, and then when your server is ready to launch, just change the properties back to a live/production state as you will.
     
  16. Offline

    marijn0909

Thread Status:
Not open for further replies.

Share This Page