Solved Ban player via UUID

Discussion in 'Plugin Development' started by knoxcorner, Jul 16, 2014.

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

    knoxcorner

    With the switch to UUIDs, I still haven't been able to figure this out. Is it possible to ban a player who has not yet joined via UUID? It seems that BanList.add(....) only accepts IPs and Names depending on which type you ask for. Banning a player by name who hasn't yet joined seems to do nothing as /banlist comes back empty.

    I'm working on a ban management system, and it seems a little strange to me that it's not possible to ban someone before they join the server. I know some will say "Why would you do that in the first place?" I agree it is a rare situation, but still I don't think skipping out here and there on server security is a good idea.

    My current idea is to have the plugin be able to ban players who haven't joined via /banuuid <uuid> or an option to fetch the currently associated UUID of a username and ban that. But AFAIK the only way for me to add these players to the ban list (since they aren't in OfflinePlayers) is to manually write to the banned-players.json file, which seems like a poor solution.

    Is there another solution I can use?
     
  2. Offline

    izarooni

    You could create a command that saves a player's UUID into a config/yml or something and make a PlayerPreLogin event that checks if the player UUID is in that file then cancel if it is.
     
  3. Offline

    ZironCodes

    There are plenty of websites out there where you can enter a username and it will return that user's UUID, skin, etc. If you were planning on banning past banned users with that, there is an easy way. Ageenkeech or something like that.
     
  4. Offline

    knoxcorner

    ZironCodes Thanks for your reply. While getting a player's UUID is part of the problem for banning a player that has yet to join, it isn't the only problem either. Personally I think that Bukkit should handle such a basic feature so that we don't have to rely on external tools to accomplish this.

    The main issue is that Bukkit does not accept just a UUID to ban someone. At the moment you can ban via passing an IP (which you won't have if they player never logged on) or passing a name. Unfortunately, passing a name won't have an effect unless the player has previously logged into the server and the UUID is stored locally, defeating the whole purpose of banning someone before they get on.
     
  5. Offline

    xTigerRebornx

    knoxcorner They had made it to ban with UUIDs originally, but apparently the system wasn't ready to handle it.
    Could always store the UUIDs in a temporary collection and keep it there until the Player with that UUID joins, then ban them by name after they join. May not be a very good solution, but its a workaround until the new system is implemented.
     
  6. Offline

    knoxcorner

    Ah, good to hear. I'll marked this as solved and go with the temporary solution.
     
Thread Status:
Not open for further replies.

Share This Page