mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-20 18:32:49 +00:00
manulistp now accepts an additional + to list ALL Superperms
effective permissions (/manulistp <name> +). manucheckp also outputs superperms results.
This commit is contained in:
parent
b0fe189156
commit
497a08940e
|
@ -15,4 +15,6 @@ v 1.1:
|
||||||
- Reverted WorldHolder static change to maintain backward plugin compatibility.
|
- Reverted WorldHolder static change to maintain backward plugin compatibility.
|
||||||
- Update to handle 'getDescription().getPermissions(') returning a list (CB 1172).
|
- Update to handle 'getDescription().getPermissions(') returning a list (CB 1172).
|
||||||
- Fix for null in PLAYER_TELEPORT for bukkit perms.
|
- Fix for null in PLAYER_TELEPORT for bukkit perms.
|
||||||
- Fixed wasteful updating of perms on a manload.
|
- Fixed wasteful updating of perms on a manload.
|
||||||
|
- manulistp now accepts an additional + to list ALL Superperms effective permissions (/manulistp <name> +).
|
||||||
|
- manucheckp also outputs superperms results.
|
|
@ -637,16 +637,18 @@ public class GroupManager extends JavaPlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//VALIDANDO ARGUMENTOS
|
//VALIDANDO ARGUMENTOS
|
||||||
if (args.length != 1) {
|
if ((args.length == 0) || (args.length > 2)) {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> (+))");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
match = this.getServer().matchPlayer(args[0]);
|
match = this.getServer().matchPlayer(args[0]);
|
||||||
if (match.size() != 1) {
|
if (match.size() != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
sender.sendMessage(ChatColor.RED + "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
} else
|
||||||
|
targetPlayer = this.getServer().getPlayer(match.get(0).getName());
|
||||||
}
|
}
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
auxUser = dataHolder.getUser(match.get(0).getName());
|
auxUser = dataHolder.getUser(match.get(0).getName());
|
||||||
|
@ -683,6 +685,18 @@ public class GroupManager extends JavaPlugin {
|
||||||
sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString);
|
sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bukkit perms
|
||||||
|
if ((args.length == 2) && (args[1].equalsIgnoreCase("+"))) {
|
||||||
|
if (targetPlayer != null) {
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "Superperms reports: ");
|
||||||
|
for(String line: BukkitPermissions.listPerms(targetPlayer))
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + line);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case manucheckp:
|
case manucheckp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
|
@ -695,12 +709,14 @@ public class GroupManager extends JavaPlugin {
|
||||||
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
|
sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validateOnlinePlayer) {
|
if (validateOnlinePlayer) {
|
||||||
match = this.getServer().matchPlayer(args[0]);
|
match = this.getServer().matchPlayer(args[0]);
|
||||||
if (match.size() != 1) {
|
if (match.size() != 1) {
|
||||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
sender.sendMessage(ChatColor.RED + "Player not found!");
|
||||||
return false;
|
return false;
|
||||||
}
|
} else
|
||||||
|
targetPlayer = this.getServer().getPlayer(match.get(0).getName());
|
||||||
}
|
}
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
auxUser = dataHolder.getUser(match.get(0).getName());
|
auxUser = dataHolder.getUser(match.get(0).getName());
|
||||||
|
@ -730,6 +746,13 @@ public class GroupManager extends JavaPlugin {
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
|
sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// superperms
|
||||||
|
if (targetPlayer != null) {
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
case mangaddp:
|
case mangaddp:
|
||||||
//VALIDANDO ESTADO DO SENDER
|
//VALIDANDO ESTADO DO SENDER
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.bukkit.event.server.PluginEnableEvent;
|
||||||
import org.bukkit.event.server.ServerListener;
|
import org.bukkit.event.server.ServerListener;
|
||||||
import org.bukkit.permissions.Permission;
|
import org.bukkit.permissions.Permission;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
//import org.bukkit.permissions.PermissionAttachmentInfo;
|
//import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
@ -106,7 +107,7 @@ public class BukkitPermissions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePermissions(Player player, String world) {
|
public void updatePermissions(Player player, String world) {
|
||||||
if (player == null || !this.plugin.isEnabled()) {
|
if (player == null || !GroupManager.isLoaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,6 +173,27 @@ public class BukkitPermissions {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> listPerms(Player player) {
|
||||||
|
List<String> perms = new ArrayList<String>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
// All permissions registered with Bukkit for this player
|
||||||
|
PermissionAttachment attachment = this.attachments.get(player);
|
||||||
|
|
||||||
|
// List perms for this player
|
||||||
|
perms.add("Attachment Permissions:");
|
||||||
|
for(Map.Entry<String, Boolean> entry : attachment.getPermissions().entrySet()){
|
||||||
|
perms.add(" " + entry.getKey() + " = " + entry.getValue());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
perms.add("Effective Permissions:");
|
||||||
|
for(PermissionAttachmentInfo info : player.getEffectivePermissions()){
|
||||||
|
perms.add(" " + info.getPermission() + " = " + info.getValue());
|
||||||
|
}
|
||||||
|
return perms;
|
||||||
|
}
|
||||||
|
|
||||||
public void updateAllPlayers() {
|
public void updateAllPlayers() {
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
|
|
Loading…
Reference in a new issue