Add dial permissions

This commit is contained in:
Steven Scott
2012-03-18 16:27:28 -07:00
parent 933b7f9893
commit 54992bc083
2 changed files with 14 additions and 2 deletions

View File

@@ -289,7 +289,7 @@ public class StargateCommand extends JavaPlugin {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
sender.sendMessage("[SGC] This command can only be used ingame"); sendMessage(sender, "This command can only be used ingame", true);
return true; return true;
} }
Player player = (Player)sender; Player player = (Player)sender;
@@ -349,10 +349,18 @@ public class StargateCommand extends JavaPlugin {
String source = null; String source = null;
String network = null; String network = null;
if (args.length == 1) { if (args.length == 1) {
if (!player.hasPermission("stargate.command.dial.interactive")) {
sendMessage(player, "Permission Denied", true);
return true;
}
dest = args[0]; dest = args[0];
players.put(player, new SGCPlayer(player, Action.DIAL, args)); players.put(player, new SGCPlayer(player, Action.DIAL, args));
sendMessage(player, "The next Stargate you activate will connect to " + dest + " if available", false); sendMessage(player, "The next Stargate you activate will connect to " + dest + " if available", false);
} else if (args.length > 1) { } else if (args.length > 1) {
if (!player.hasPermission("stargate.command.dial.direct")) {
sendMessage(player, "Permission Denied", true);
return true;
}
source = args[0]; source = args[0];
dest = args[1]; dest = args[1];
if (args.length < 2) { if (args.length < 2) {

View File

@@ -26,4 +26,8 @@ permissions:
description: Allow the use of /sgc export description: Allow the use of /sgc export
default: op default: op
stargate.command.dial: stargate.command.dial:
description: Allow the use of /dial description: Allow the use of /dial
default: true
children:
stargate.command.dial.interactive: true
stargate.command.dial.direct: false