TheOnlySD12 / IPLogin

Basic plugin for IP login
MIT License
4 stars 0 forks source link

Permissions? #3

Open randriusr opened 10 months ago

randriusr commented 10 months ago

I couldn't find any documentation on permissions for this plugin. I searched through the Modrinth post and here on GitHub, as well as on LuckPerms editor, but there were no permissions associated with this plugin. This is an issue because I can't grant permission to a specific group of moderators on my server without giving them the op permission.

TheOnlySD12 commented 10 months ago

Hi randriusr,

I'm currently in the process of rewriting the plugin, and I've realized the importance of incorporating permissions. I'm contemplating whether it would be more practical to assign permissions individually for each command or to implement a single permission for all IPLogin commands. Your insights on this would be highly valuable. Additionally, I wanted to inform you that I'll be releasing snapshots for each feature I add or fix I make. I would greatly appreciate your input on these updates. Looking forward to hearing your opinions and suggestions.

Best regards, TheOnlySD12

randriusr commented 10 months ago

Hey TheOnlySD12,

To be frank, I don't see a compelling reason for the plugin to have distinct permissions for each command. While there might be some use cases out there, it ultimately depends on your preference - whether you want to keep it straightforward by assigning all commands to the same permission or separate them for potential future requests. My suggestion would be to cover both bases - have a primary permission for all commands and individual permissions for each command. While I don't have an extensive understanding of how MC permissions function, and I'm "relatively" new to Java, GitHub, etc., it's possible that the primary permission may not be necessary if other permission plugins operate similarly to LuckPerms. For instance, with LuckPerms, using something like IPLogin.* could grant access to all commands under the specified plugin.

Regarding suggestions, I have a few that might prove helpful if incorporated:

        else if (command.getName().equalsIgnoreCase("removeip")) {
            if (args.length == 1) {
                if (sender instanceof ConsoleCommandSender || sender instanceof BlockCommandSender) {
                    nameToIPConfig.set(args[0], null);
                    getLogger().info("Removed IP for " + args[0]);
                    return true;
                } else if (sender instanceof Player player) {
                    if (sender.isOp()) {
                        nameToIPConfig.set(args[0], null);
                        player.sendMessage(Component.text("Removed IP for " + args[0], NamedTextColor.YELLOW));
                    } else {
                        player.sendMessage(Component.text("You do not have permission to do that.", NamedTextColor.RED));
                    }
                    return true;
                }
            }
        }

Those are my suggestions. Best of luck with rewriting the plugin!

Happy New Year, randriusr