Whitelist an Offline Player

Discussion in 'Plugin Development' started by Nico8k, Aug 31, 2021.

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

    Nico8k

    1. Hello!
    I wanted to create a command where i can whitelist a custom player (because for the /whitelist command you need op). The command is /cl (player). But when I run my code it says in chat: An Internal error occurred while trying to perform this command. I have no Idea what the problem is.
    Here is the code:
    String name = args[0]
    Player target = Bukkit.getofflineplayer(name)
    Player.addwhitelist(true)

    Idk if it helps, but the .getofflineplayer is crossed out.
    Does any1 have a Idea whats the problem?
    Thanks in advance!
     
  2. Online

    timtower Administrator Administrator Moderator

    @Nico8k Hover your mouse over it, it is deprecated as UUID's are better, can't use them here though so just ignore it.
    Your error in the console is a different issue. Need to see the error for that
     
  3. Offline

    davidclue

    @Nico8k You can't cast a player to an offlineplayer. Use this instead.
    Code:
    OfflinePlayer target = Bukkit.getOfflinePlayer(name);
     
Thread Status:
Not open for further replies.

Share This Page