Skip to content

Commit

Permalink
Permissions
Browse files Browse the repository at this point in the history
Signed-off-by: Walker Crouse <[email protected]>
  • Loading branch information
windy1 committed Feb 1, 2016
1 parent f13826b commit 915836d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandPermissionException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
Expand Down Expand Up @@ -63,6 +64,7 @@ public class ComposerCommands {
.executor(this::previousTrack)
.build();
private final CommandSpec base = CommandSpec.builder()
.permission("composer.musicplayer")
.description(Text.of("Main parent command for plugin."))
.executor(this::listTracks)
.child(list, "list", "list-tracks", "tracks", "track-list")
Expand Down Expand Up @@ -143,7 +145,9 @@ private Player getPlayer(CommandSource src, CommandContext context) throws Comma
if (!(src instanceof Player))
throw new CommandException(Text.of("Cannot run command as non-player without player argument."));
player = (Player) src;
}
} else if (!src.hasPermission("composer.musicplayer.others"))
throw new CommandPermissionException(
Text.of("You do not have permission to control other player's music"));
return player;
}
}

0 comments on commit 915836d

Please sign in to comment.