CommandCodes
CommandCodes
CommandCodes
CommandCodes is a Bukkit plugin which allows the generation of number codes which are linked to a specific command can be redeemed a certain number of times. An example use case is to allow a player who isn't an admin to perform a command giving them an item one time only. Codes are stored in JSON format in a codes file and can be viewed even after they have been redeemed.
Commands
- ccode generate [amount] [times usable] [command] - generates new codes (the amount is the specified [amount] parameter) linked to the given command, which is usable the specified amount of times
- ccode remove [code] - removes the given code, adding it to the list of previous codes if it has redeemers
- ccode show <code> - shows detailed information for the given code
- ccode view <page> - views a list of currently available command codes
- ccode previous <page> - views a list of already spent command codes
- ccode redeem [code] - redeems the given code, activating the command it is linked to
Note: Instead of /ccode, the commands /cc or /ccc can be used.
Permissions
- commandcodes.* - grants all plugin permissions
- commandcodes.admin - grants commandcodes.generate and commandcodes.remove
- commandcodes.generate - allows generation of new codes
- commandcodes.remove - allows removal of command codes
- commandcodes.view - allows viewing of current command codes
- commandcodes.previous - allows viewing of previous command codes
- commandcodes.redeem - allows redemption of command codes
- commandcodes.show - allows viewing details of a specific command code
Note: In general, I would recommend giving administrators commandcodes.admin, commandcodes.view and commandcodes.previous, and giving normal users only commandcodes.redeem, as if they were able to see the codes they could redeem those which weren't meant for them.
Config
Default configuration:
code-cap: 99999 multiple-redemptions: false
The 'code-cap' option modifies the highest code number which can be generated. Big servers will require a higher number here, as codes cannot be duplicates of current or previous codes. The 'multiple-redemptions' option configures whether the same player can redeem the same code multiple times.
Developers
Source code for CommandCodes is available on GitHub
If you plan on hooking into the source code in some way, I recommend doing this to get the CodeManager, which contains pretty much every method that another plugin might find in any way useful:
final CommandCodes ccPlugin = getServer().getPluginManager().getPlugin("CommandCodes"); final CodeManager codeManager = ccPlugin.getCodeManager();
From here, you can retrieve lists of current and previous command codes, and you can remove, redeem or generate command codes.
Hello! Thank you for a wonderful Piligin! Through it very convenient to organize online store. There is a small problem. After rebooting the server plug-in is not loaded. If i load it using Plugman, all codes disappear. Thus, every time I have to generate a new code. I would be very grateful if you fix this bug!
mcbbs.net it's down, so i only get here to get plugin ::>_<::
You can add me as author if you want ;)
Don't you add a placeholder for command? <player>
@JaackMC
No problem! Always good to see people benefiting from the plugin :)
Brilliant plugin!
Thanks for this. :)