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

Merge pull request #498 from Redemption198/master

Opening the SF guide with commands #491
This commit is contained in:
TheBusyBiscuit 2017-11-20 12:15:38 +01:00 committed by GitHub
commit 4cb573b4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -84,6 +84,10 @@ public class SlimefunCommand implements CommandExecutor, Listener {
tabs.add("teleporter");
descriptions.add(Messages.local.getTranslation("commands.teleporter").get(0));
arguments.add("/sf open_guide");
tabs.add("open_guide");
descriptions.add(Messages.local.getTranslation("commands.open_guide").get(0));
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@ -103,7 +107,15 @@ public class SlimefunCommand implements CommandExecutor, Listener {
}
else if (args[0].equalsIgnoreCase("guide")) {
if (sender instanceof Player) {
((Player) sender).getInventory().addItem(SlimefunGuide.getItem(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("open_guide")) {
if (sender instanceof Player) {
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);
}

View File

@ -20,6 +20,7 @@ public class Messages {
local.setDefault("commands.timings", "Lag-Info about your Server");
local.setDefault("commands.teleporter", "See other Player's Waypoints");
local.setDefault("commands.versions", "Lists all installed Addons");
local.setDefault("commands.open_guide", "Opens Slimefun's guide without using the book");
local.setDefault("messages.only-players", "&4This Command is only for Players");
local.setDefault("messages.no-permission", "&4You do not have the required Permission to do this");

View File

@ -34,6 +34,12 @@ permissions:
slimefun.command.versions:
description: Allows you to do /sf versions
default: op
slimefun.command.guide:
description: Allows you to obtain the Slimefun guide book
default: true
slimefun.command.open_guide:
description: Allows you to open the SF guide without the book
default: op
slimefun.android.bypass:
description: Allows you to edit other Players Androids
default: op