Java Reference
In-Depth Information
My example of code that does all this is in code/FireBow . Try it yourself first,
from scratch, and if you get stuck take a look at the example. I added two
commands that allow you to enable or disable the firebow behavior.
Check Permissions
Sometimes when writing a plugin, you might want to restrict the commands
you've created—maybe only ops should run them, or maybe you have different
kinds of players or teams, and each should only be able to run certain
For instance, suppose you want to restrict the firebow commands to a select
set of players. We'll invent a new name; let's call it commands.firebow.enable .
You can then use the permissions field in the @Command annotation to check if
the player issuing the command is one of the chosen few:
@Command(aliases = { "nofirebow" },
description = "Disable firebow behavior" ,
permissions = { "commands.firebow.enable" },
toolTip = "/nofirebow" )
Now only players who have the permission for commands.firebow.enable can shoot
the massively exploding firebows. Great. So how do you grant players these
Setting and Managing Permissions
Setting and managing permissions can be a big deal if you're running a large
server with lots of users. You might set up groups or classes of users in the
server, using the Canary permissions commands.
Canary provides a bunch of in-game commands, including commands to set
permissions for players and groups, and to check what permissions someone
has. You can run these commands in the server console, or from inside the
client. Here are some examples:
/playermodpermissionadd playerName permissionName —grant the permission-
Name to playerName .
/playermodpermissioncheck playerName permissionName —check if playerName
has the permission permissionName .
/playermodgroupset playerName groupName —add playerName to the group
groupName .
/groupmodpermissionlist groupName —list permissions for groupName .
Search WWH ::

Custom Search