Skip to content

Commit

Permalink
Fixed 'ALL' permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHeijden committed May 27, 2019
1 parent 90a0483 commit 2ee9b60
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,26 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
Material material = Material.getMaterial(args[i]);
EntityType entityType = plugin.utils.getEntityType(args[i]);
if (material != null) {
if (sender.hasPermission("insights.scan.custom. " + material.name())) {
if (sender.hasPermission("insights.scan.custom." + material.name())) {
materials.add(material);
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else if (entityType != null) {
if (sender.hasPermission("insights.scan.custom. " + entityType.name())) {
if (sender.hasPermission("insights.scan.custom." + entityType.name())) {
entityTypes.add(entityType);
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else if (args[i].equalsIgnoreCase("ALL")) {
isAll = true;
if (sender.hasPermission("insights.scan.custom.all")) {
isAll = true;
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else {
plugin.utils.sendMessage(sender, "messages.scan.custom.invalid_argument", "%argument%", args[i]);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,26 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
Material material = Material.getMaterial(args[i]);
EntityType entityType = plugin.utils.getEntityType(args[i]);
if (material != null) {
if (sender.hasPermission("insights.scanradius.custom. " + material.name())) {
if (sender.hasPermission("insights.scanradius.custom." + material.name())) {
materials.add(material);
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else if (entityType != null) {
if (sender.hasPermission("insights.scanradius.custom. " + entityType.name())) {
if (sender.hasPermission("insights.scanradius.custom." + entityType.name())) {
entityTypes.add(entityType);
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else if (args[i].equalsIgnoreCase("ALL")) {
isAll = true;
if (sender.hasPermission("insights.scan.custom.all")) {
isAll = true;
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else {
plugin.utils.sendMessage(sender, "messages.scanradius.custom.invalid_argument", "%argument%", args[i]);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,26 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
Material material = Material.getMaterial(args[i]);
EntityType entityType = plugin.utils.getEntityType(args[i]);
if (material != null) {
if (sender.hasPermission("insights.scanworld.custom. " + material.name())) {
if (sender.hasPermission("insights.scanworld.custom." + material.name())) {
materials.add(material);
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else if (entityType != null) {
if (sender.hasPermission("insights.scanworld.custom. " + entityType.name())) {
if (sender.hasPermission("insights.scanworld.custom." + entityType.name())) {
entityTypes.add(entityType);
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else if (args[i].equalsIgnoreCase("ALL")) {
isAll = true;
if (sender.hasPermission("insights.scan.custom.all")) {
isAll = true;
} else {
plugin.utils.sendMessage(sender, "messages.no_permission");
return true;
}
} else {
plugin.utils.sendMessage(sender, "messages.scanworld.custom.invalid_argument", "%argument%", args[i]);
return true;
Expand Down

0 comments on commit 2ee9b60

Please sign in to comment.