1.16.5 Detect when a player is unbanned

Discussion in 'Spigot Plugin Development' started by Nemo_64, Jun 22, 2021.

  1. Right now I have a long that saves the date when a player will be unbanned but what it another plugin unbans it or the command /pardon is used? Then this long will be incorrect and I need it. Is it a better idea instead of saving a long getting the date from the BanList? Is there and event that I may use? And the BanList seems to work with the names and IP, is it a way to use the UUID instead? Since I store the UUID of the player I don't want to have to use Bukkit.getOfflinePlayer to be able to get the name of the player to then get its BanEntry. Thanks for the help!
     
  2. As far as I know most punishment plugins store the bans in the database, so they do not use the vanilla system. You can intercept the PlayerCommandPreprocessEvent and check if the command is your /pardon, but there is not an universal answer for all the plugins. You could also check if /unban or similar is used, but be aware that /<plugin name>:<unban command> can be used, so you need to check that too