1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Added permission check to /sf guide command

The /sf guide command will now only be executed if the player has the permission "slimefun.command.guide"
This commit is contained in:
Redemption 2017-11-19 22:59:58 +01:00 committed by GitHub
parent 3f60207be7
commit 3bba53b20d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,16 +105,17 @@ public class SlimefunCommand implements CommandExecutor, Listener {
}
else Messages.local.sendTranslation(sender, "messages.only-players", true);
}
else if(args[0].equalsIgnoreCase("open_guide")) {
else if (args[0].equalsIgnoreCase("guide")) {
if (sender instanceof Player) {
if(sender.hasPermission("slimefun.command.open_guide")) SlimefunGuide.openGuide((Player) sender, SlimefunStartup.getCfg().getBoolean("guide.default-view-book"));
if(sender.hasPermission("slimefun.command.guide"))((Player) sender).getInventory().addItem(SlimefunGuide.getItem(SlimefunStartup.getCfg().getBoolean("guide.default-view-book")));
else Messages.local.sendTranslation(sender, "messages.no-permission", true);
}
else Messages.local.sendTranslation(sender, "messages.only-players", true);
}
else if (args[0].equalsIgnoreCase("guide")) {
else if(args[0].equalsIgnoreCase("open_guide")) {
if (sender instanceof Player) {
((Player) sender).getInventory().addItem(SlimefunGuide.getItem(SlimefunStartup.getCfg().getBoolean("guide.default-view-book")));
if(sender.hasPermission("slimefun.command.open_guide")) SlimefunGuide.openGuide((Player) sender, SlimefunStartup.getCfg().getBoolean("guide.default-view-book"));
else Messages.local.sendTranslation(sender, "messages.no-permission", true);
}
else Messages.local.sendTranslation(sender, "messages.only-players", true);
}