1.8.8 Quick Question

Discussion in 'Spigot Plugin Development' started by lwccb, Jan 25, 2020.

  1. When making my GUI plugin i was wondering if there was a proper to use my placeholder to check the permissions of another player like for example to check the perm of the player running the command or clicking the item in the GUI its p.haspermission is there a way to use like targetplayer.haspermission (I already have the targetplayer variable working so that part is good)

    Thankyou in advance
  2. Bukkit.getPlayer(username or uuid).hasPermission(perm)
    • Like Like x 1
  3. Yes. Use targetplayer.hasPermission(). It's defined for Player, not for just the sender or something like that
    • Like Like x 1
  4. Once you have a variable of type Player:
    Code (Java):
    Player targetplayer = ...;
    you can check if a permission is set:
    Code (Java):
    if (targetplayer.hasPermission("yourplugin.yourpermission")) {
        // Do stuff