MyEssentials / MyTown2

Version 2 of MyTown - A Minecraft Server Protection Mod
The Unlicense
35 stars 22 forks source link

Having Issues with Admin Permissions with FE. #525

Open KaneHart opened 4 years ago

KaneHart commented 4 years ago

Hello again using the latest version of Permissions things been going well besides a few odd errors like when your not in a town and use /mytown select and get the following error: https://pastebin.com/4wa7gqyg

That is annoying but really it's fine as we can just tell people they get errors it normally means the command was done wrong or their not in a town, etc.

The biggest issue today we hit was starting to secure Admin land used for adventure style area's. Pretty much Teleport hubs, etc. The problem here is I get permissions error even if I gutt my permissions out 100% and just add like . or mytown.* etc. or add every node possible using p debug I still end up getting permission errors even with full out OP.

I'm guessing there might be something separate from the changes that you made that might of not applied to admin towns?

Either way Just throwing a report in if you don't have time for it I 100% understand. We can use an alt account or something and use normal player town protection.

Thanks!

KaneHart commented 4 years ago

Opps example of the command: /townadmin new Spawn You have no permissions to use this command in game and with perm debug with FE on: [00:46:53] [Server thread/INFO]: mytown.adm.cmd = true [00:46:53] [Server thread/INFO]: zone SERVER group OPS for user Kane_Hart [00:46:53] [Server thread/INFO]: mytown.adm.cmd.new = true [00:46:53] [Server thread/INFO]: zone SERVER group OPS for user Kane_Hart

Thanks.

bit2shift commented 3 years ago

I'm pretty sure you'd have this same problem with either Bukkit or ServerTools, since the issue is either in MyTown or in MyPermissions. The command fails because customManager is null in this permission check for /townadmin commands. https://github.com/MyEssentials/MyPermissions/blob/7de3a6d23fbc6122c93dc83759e7e1ffb7679509/src/main/java/mypermissions/command/core/entities/CommandTree.java#L89

    public boolean hasPermission(ICommandSender sender, CommandTreeNode node) throws CommandException {
        if(!node.getAnnotation().console() && (sender instanceof MinecraftServer || sender instanceof RConConsoleSource || sender instanceof CommandBlockLogic)) {
            throw new CommandException("commands.generic.permission");
        }

        if(sender instanceof EntityPlayer) {
            UUID uuid = ((EntityPlayer) sender).getUniqueID();
            String permission = node.getAnnotation().permission();

            if (PermissionProxy.getPermissionManager().hasPermission(uuid, permission) &&
/* ---->>>> */ (customManager != null && customManager.hasPermission(uuid, permission))) {
                return true;
            }
            throw new CommandException("commands.generic.permission");
        }
        return true;
    }
bit2shift commented 3 years ago

Meanwhile, I've forked the MyPermissions repo and fixed this bug. https://github.com/MyEssentials/MyPermissions/compare/master...bit2shift:bugfix/custom-manager