This commit is contained in:
5vl 2021-01-21 21:01:05 +01:00
parent 6a0d9df988
commit d0dc458251
2 changed files with 16 additions and 21 deletions

View File

@ -18,36 +18,28 @@ public final class permissions extends JavaPlugin {
}
HashMap<UUID, PermissionAttachment> attachments = new HashMap<>();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (label.equalsIgnoreCase("perm")) {
Player ps = Bukkit.getPlayer(args[0]);
PermissionAttachment attachment = ps.addAttachment(this);
PermissionAttachment attachment = Bukkit.getPlayer(args[0]).addAttachment(this);
Player p = (Player) sender;
if (sender instanceof Player) {
if (p.hasPermission("perm.setperm")) {
if (args.length > 2) {
attachment.setPermission(args[1], Boolean.parseBoolean(args[2]));
} else {
p.sendMessage("Please specify correct arguments: /perm <player> <permission> <true/false>");
}
} else {
p.sendMessage(ChatColor.RED + "You do not have permission to execute this command.");
if (p.hasPermission("perm.perm")) {
if (args.length < 3) {
p.sendMessage("Usage: /perm <player> <permission> <true/false>");
}
else if (args.length == 3) {
attachment.setPermission(args[1], Boolean.parseBoolean(args[2]));
p.sendMessage(ChatColor.WHITE + "Successfully set permission " + ChatColor.YELLOW + args[1] + ChatColor.WHITE + " to " + ChatColor.YELLOW + args[2] + ChatColor.WHITE + " for player " + ChatColor.YELLOW + args[0]);
}
else {
p.sendMessage("Usage: /perm <player> <permission> <true/false>");
}
}
else {
if (args.length > 2) {
attachment.setPermission(args[1], Boolean.parseBoolean(args[2]));
} else {
System.out.println("Please specify correct arguments: /perm <player> <permission> <true/false>");
}
p.sendMessage(ChatColor.RED + "You do not have permission to execute this command.");
}
}
return false;
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}

View File

@ -5,3 +5,6 @@ api-version: 1.16
authors: [ 5vl ]
description: A permission plguin made by 5vl.
website: https://github.com/5vl/PermissionPlugin
commands:
perm:
description: With this command you can set permissions.