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.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    82906
  • Created
    Jul 20, 2014
  • Last Released File
    Jun 9, 2016
  • Total Downloads
    800
  • License

Categories

Members

Recent Files