Solved Best way to see if the server's whitelist is on

Discussion in 'Spigot Plugin Development' started by retrodaredevil, May 30, 2016.

  1. The title pretty much says it all. What is the easiest way to tell if the server is whitelisted? I tried hasWhitelist() but that doesn't return if the whitelist is on. Do I have to create a method to read or is there an easier way?
  2. Choco


  3. Maybe something like this?
    Code (Text):
        public boolean whitelistOn() throws IOException {
            return new String(Files.readAllBytes(new File("").toPath())).contains("white-list=true");
  4. Code (Text):

          if (Bukkit.hasWhitelist()) {
             sender.sendMessage("Whitelist is currently active.");
             return true;
           sender.sendMessage("Whitelist isn't active");
    This seems to work perfectly fine.
    • Like Like x 1
  5. silly me. Forgot a ! in front of the Bukkit.hasWhitelist() method
    • Like Like x 1