Solved Whitelist

Discussion in 'Plugin Development' started by Deleted user, Aug 9, 2013.

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

    Deleted user

    How would I make a whitelist?
     
  2. Offline

    StevenMG

    For a detailed answer you need to give a detailed question. What part of making a whitelist do you need help with?
     
  3. Offline

    Deleted user

    StevenMG

    The part that kicks the players if they aren't on the list and the part that stores the data in the Config
     
  4. Offline

    xxMOxMOxx

    If your talking about the whitelist file in the server folder, this is part of Vanilla Minecraft servers, not Bukkit, meaning this is posted in the wrong location
     
  5. Offline

    StevenMG

  6. Offline

    Deleted user

    xxMOxMOxx
    I'm talking about a custom plugin

    StevenMG
    How do I tell if the player is on the list?
     
  7. Offline

    james137137

    so you want to obtain the whitelist within your plugin?
     
  8. Offline

    Deleted user

    james137137

    No...I want to write my own plugin...pretty much just so you can customize the whitelist message
     
  9. Offline

    james137137

    Does this help?

    Code:
    @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event) {
            Player player = event.getPlayer();
            String PlayerName = player.getName();
            Set<OfflinePlayer> whitelistedPlayers = plugin.getServer().getWhitelistedPlayers();
            for (OfflinePlayer offlinePlayer : whitelistedPlayers) {
                if (PlayerName.equalsIgnoreCase(offlinePlayer.getName()))
                {
                    return;
                }
            }
            player.kickPlayer("customMessage");
        }
     
  10. Offline

    StevenMG

    That is probably a better way of doing it. I didn't know Bukkit was able to hook into the default whitelist... blonde moment :p
     
  11. Offline

    Deleted user

    james137137

    Would I use that EXACT code without the "custom message" thing?
     
  12. Offline

    james137137

    yeah you would. e.g. player.kickPlayer("You are not on the server Whitelist. Sorry " + player.getName);
     
Thread Status:
Not open for further replies.

Share This Page