CommandMineRewards 7.1.1

Runs commands when players break certain blocks.

  1. Datatags
    Native Minecraft Version:
    1.13
    Tested Minecraft Versions:
    • 1.8
    • 1.12
    • 1.17
    Source Code:
    https://github.com/datatags/CommandMineRewards
    Contributors:
    natkemon, for the idea and details.
    [​IMG]
    When a player breaks a block, if the block broken is found in a list defined in the configuration file, it will run through each reward. The rewards work in the way that if a random number falls in a certain percentage, then a list of commands will be run.

    [​IMG]
    - Unlimited rewards: You may define as many rewards in the config as you want, and you may name them whatever you like, as of version 1.2. You can also define multiple reward sections so you can have multiple block lists.
    - The Multiplier: The Multiplier, either a whole number or a decimal number, multiplies the chance of getting each reward by its value. For example, if the config said that a player has a 25% chance of getting $300, and the multiplier is 3, then the player will have a 75% chance of getting $300, or if the config gives the player a 50% chance of getting $50, but the multiplier is set to 0.1, then the player has a 5% chance of getting $50. The multiplier is set by default to 1, so the chances of getting rewards are not affected. Please don't set this to 0 to disable it!! Instead of disabling the multiplier, it will disable all rewards because all chances will be multiplied by 0, meaning everything has a 0% chance of a reward! Simply set it to 1 to disable it.
    - Player name placeholder: Anytime "%player%" is found in a command to run, it will replace "%player%" with the name of the player that broke the block.
    - In-game setup: Most options in the configuration can be modified in-game, no configuration editing required! You can choose command-style or GUI-style!

    [​IMG]
    In my opinion, the command list and information looks much nicer in-game, but it is also slightly less detailed in-game.
    Important commands:
    /cmr: Gives plugin information.
    /cmr help: Gives a list of sub-commands for the command /cmr.
    /cmr reload: Reloads the multiplier, the list of blocks that trigger the rewards, and the rewards themselves and their properties (the chance of getting the reward and the commands to run upon triggering).
    /cmr gui [player]: Opens the CMR configuration GUI. If a player is specified, you can attach to their editing session where you effectively have the same permissions they do while in the GUI, and you can click on things for them.
    /cmr debug: If you're experiencing an issue, run this command to enable debug mode and debug logging. The console will receive a huge amount of information whenever CMR is working, which should help you troubleshoot. If you need additional help, you can find a log containing all the debug info at <server root>/plugins/CommandMineRewards/debug.log. Debug mode is automatically disabled when the server restarts.
    /cmr multiplier [multiplier]: Reads or updates the multiplier value. The multiplier may be either an integer or a decimal number.
    /cmr block add <rewardSection> [block]: Adds a block to the list of reward-triggering blocks. You can use it either by specifying the name of the block you want to add, or just by holding it in your hand. Similarly...
    /cmr block remove <rewardSection> [block]: This removes a block from the list in the same manner as /cmr block add.
    /cmr block list <rewardSection>: Lists all the blocks that trigger rewards in a nice, readable format. Make sure you have no duplicate blocks in your block lists, or this will yell at you, and for good reason. The plugin may act unexpectedly in the presence of duplicate blocks.
    /cmr reward add <rewardSection> [reward_name]: Create a new reward or a new reward section if no reward is specified.
    /cmr reward remove <rewardSection> [reward_name]: Delete a reward or reward section. If reward name is not specified, it will delete the whole reward section so be careful with this one!
    /cmr reward list [rewardSection]: Lists all reward sections defined. If used with a reward section parameter, it lists all rewards in that reward section.
    /cmr command add <rewardSection> <reward_name> <command>: Add a command to a reward by just specifying the reward name, the reward section, and the command. The command can have spaces for args, and %player% to represent the name of the player who triggered it.
    /cmr command insert <rewardSection> <reward_name> <insert_position> <command>: Insert a command at a specified position, meaning that the new command will have insert_position as its new ID, shifting all the ones below it down in ID. This is just in case the commands need to run in a specific order.
    /cmr command replace <rewardSection> <reward_name> <index> <command>: Similar to /cmr command insert, but instead of shifting the commands it replaces the one at the specified index. Useful if there was a typo in the command you just /cmr command add-ed.
    /cmr command remove <rewardSection> <reward_name> <command_ID>: Remove a command from the specified reward in the specified reward section. You can use the command ID to remove a command or the command itself if you are very precise and case sensitive. You can get the ID of a command with this next command...
    /cmr command list <rewardSection> <reward_name>: Shows all commands attached to a reward and their IDs to use in /cmr command remove and /cmr command insert
    /cmr world add [world] [rewardSection]: Adds a world to the list of allowed worlds in a reward section, or if no reward section specified, adds the world to the default, or global, allowed worlds list. The config option validateWorldsAndRegions will determine whether it will check to see if the world you typed in was actually valid. If no world is specified, adds the world you are in.
    /cmr world remove [world] [rewardSection]: Pretty much the same as /cmr world add, except this command removes a world from a list. If no world is specified, uses the world you are in.
    /cmr world list [rewardSection]: Lists the allowed worlds in a reward section, or the default/global allowed worlds list if no reward section specified.
    /cmr region add <region> [rewardSection]: Same as /cmr world add except using regions instead of worlds.
    /cmr region remove <region> [rewardSection]: Same as /cmr world remove except using regions instead of worlds.
    /cmr region list [rewardSection]: Same as /cmr world list except using regions instead of worlds.
    /cmr reward chance <rewardSection> <reward> [chance]: Changes or views the chance of a reward occurring.

    [​IMG]
    Important permissions:
    - cmr.use.<rewardSection>.<reward>: Allows players to receive rewards from the reward called <reward> in the section called <rewardSection> in the config file.
    - cmr.use.*: Allows players to get rewards from all rewards defined in the CMR config. You'll probably want to add this to all users, but it isn't a default permission.
    - cmr.reload: Allows the user to reload the CMR config.
    - cmr.debug: Allows the user to enable CMR debug mode. See /cmr debug in command info.
    - cmr.gui: Allows the user to open a new CMR GUI session for themselves. Anything they do in the GUI is restricted by what configuration permissions they have (see below).
    - cmr.gui.assist: Allows the user to attach to another player's GUI session. See /cmr gui in command info.
    - cmr.block: Allows you to see the list of blocks. Potentially handy for the average user to see how to be rewarded.
    - cmr.block.modify: Allows the user to add and remove blocks with /cmr addblock and /cmr removeblock.
    - cmr.reward: Allows you to see the list of reward names. Not useful for the regular user.
    - cmr.reward.modify: Allows the user to add and delete rewards using /cmr reward add and /cmr reward remove, as well as editing the chance of reward occurring with /cmr reward chance.
    - cmr.command: Lets you see what commands are used when you receive a reward. Could be handy to let the user admire the prize.
    - cmr.command.modify: Allows the user to add, insert, and delete commands used in any reward. I'm sure you can figure out which commands you need to do that.
    - cmr.multiplier: Allows you to see the current multiplier value.
    All of the above permissions default to OP only.
    - cmr.multiplier.modify: Allows the user to change the multiplier setting.
    - cmr.world: Allows you to see the list of worlds, both in reward sections and globally.
    - cmr.world.modify: Allows you to modify the list of worlds, both in reward sections and globally.
    - cmr.region: Allows you to view the list of regions, both in reward sections and globally.
    - cmr.region.modify: Allows you to modify the list of regions, both in reward sections and globally.
    - cmr.silktouchpolicy: Allows you to see whether silk touch is required or disallowed from triggering a reward, section, or globally.
    - cmr.silktouchpolicy.modify: Allows you to change the policy on silk touch triggering rewards, sections, or globally.

    [​IMG]
    Code (YAML):

    # globalAllowedWorlds: string list: a list of worlds all rewards will operate in.  Is overridden by allowedWorlds in a reward section.  Defaults to "*", meaning all worlds allowed.
    globalAllowedWorlds
    :
    - "*"
    # globalAllowedRegions: string list: same as globalAllowedWorlds except with WorldGuard regions instead of worlds.
    globalAllowedRegions
    :
    - "*"
    # globalSilkTouch: string, can be REQUIRED, IGNORED, or DISALLOWED: The global setting on whether silk touch is required, disallowed, or ignored to receive rewards.  Is overrided by silkTouch in a reward section or reward.  Defaults to IGNORED.
    globalSilkTouch
    : IGNORED
    # removeInvalidValues: boolean: If true, will delete invalid blocks in the lists of blocks.
    removeInvalidValues
    : false
    # survivalOnly: boolean:  If the reward should only be enabled when the player is in survival mode.
    survivalOnly
    : true
    # boolean: will prevent you from using invalid worlds and WorldGuard regions in their associated commands
    validateWorldsAndRegions
    : true
    # verbosity: number (0, 1, or 2) (default 1):  How verbose console messages should be.  0 for only errors, 1 for errors and executed commands, 2 for a metric ton of logging detail. (probably don't use 2 in production.)
    # Please note that even with verbosity: 0 you will still receive command output in console.  ex. if you have in a reward /give %player% diamond, you will still receive the message "Gave 1 [Diamond] to %player%" every time it runs,
    # and there is no way to prevent this that I'm aware of. If you figure it out, please let me know.
    verbosity
    : 1
    # autopickupCompat: boolean (true or false): If true, will grab the broken block type at a lower priority than normal to allow compatibility with plugins such as auto pickup plugins. This setting should be disabled unless required as it may add a bit of overhead
    autopickupCompat
    : false
    # randomizeRewardOrder: boolean (true or false): If true, will randomize the order rewards are evaluated in, so it isn't weighted toward the first reward in the list. This usually only matters if you are using any sort of reward limit.
    randomizeRewardOrder
    : false
    # mcMMOHookEnabled: boolean (true or false): If true, will only allow rewards to be issued from blocks not placed by players, as determined by mcMMO. (Requires mcMMO to be installed obviously)
    mcMMOHookEnabled
    : false
    removeInvalidValues: Type: true/false. Default: false. When CommandMineRewards starts up, it will check the block list in each reward section for invalid blocks. If this is true, it will remove them from the list for you. If this is false, it will just ignore them.
    multiplier: Type: number. Default: 1. Changes the reward chance multiplier, just like the in-game multiplier command. 0 is no rewards, 1 is normal, 2 is double chance, etc.
    survivalOnly: Type: true/false. Default: true. If this is true, it will not allow creative players to get rewards. If, for some reason, you want creative players to participate too, change this to false.
    validateWorldsAndRegions: Type: true/false. Default: true. If this is true, it will make sure worlds and regions actually exist before you add them with /cmr addregion and /cmr addworld.
    verbosity: Type: number. Default: 1. If this is 0, CommandMineRewards will only log errors, nothing more. If this is 1, CMR will log errors and the commands it executes when it executes them. If this is 2, CMR will log EVERYTHING. This includes EVERYTHING that happens, EVERYTHING that doesn't happen and why, and just basically spams the console a lot. This is useful for if you're having a problem related to not issuing rewards and you need help from me.
    autoPickupCompat: Type: true/false. Default: false. If this is true, enables some special trickery to play nicer with auto-pickup plugins.
    mcMMOHookEnabled: Type: true/false. Default: false. If this is true, CMR will hook mcMMO and issue no rewards for broken blocks that are marked as being placed by players.

    Reward section structure (for rewards.yml):
    Code (YAML):
    rewardSection:
        blocks
    :
           - block1
            - block2
            - block3
        allowedWorlds
    :
           - world
            - world_nether
            - world_the_end
        allowedRegions
    :
           - mine
            - yours
        silkTouch
    : DISALLOWED
        rewardLimit
    : 1
        rewards
    :
            rewardA
    :
                chance
    : 5
                commands
    :
                  - eco give %player% 200
                   - broadcast %player% received rewards
            rewardB
    :
                chance
    : 20
                commands
    :
                  - give %player% diamond 1
                   - !msg %player% &aGood job!
     
    What it means
    blocks
    : Type: List of "strings". The list of blocks that will trigger rewards. If you want to detect fully-grown crops and not just any crops, you can do, for example, "wheat:true" Similarly, if you want to detect crops that aren't fully grown, do "wheat:false" But again, to detect any growth stage of crops, just do, for example, "wheat" and it'll work fine.
    allowedWorlds: Type: List of "strings". List of worlds that the rewards in this section work in. To allow in all worlds, make a list of a single item with just "*". If this option is not present or is empty, it will default to a root option called globalAllowedWorlds. If this is empty or missing too, it will allow it in any world.
    allowedRegions: Type: List of "strings". Pretty much exactly like allowedWorlds, except with WorldGuard regions instead of worlds.
    silkTouch: Type: String. You can set it to REQUIRED, IGNORED, or DISALLOWED. REQUIRED makes it so that you need silk touch for it to work. IGNORED, it doesn't matter. DISALLOWED, only tools without silk touch will be rewarded. If this option is not present, it defaults to a root-level option called globalSilkTouch.
    rewardLimit: Type: Number. Whatever number this is set to, a player won't be able to receive more than that number of rewards from a single block break. This can cause the chance of a reward triggering to be different than what you'd expect. In this case, if a player receives rewardA, they will not be eligible to receive rewardB on the same block break. This also means that the effective chance of rewardB is slightly reduced, because it can only happen if rewardA doesn't trigger, giving it a 95% of even evaulating the random number, meaning that the effective chance of rewardB triggering is 0.95 * 0.2 = 0.19, or 19% chance of triggering. You can combat this effect by enabling randomizeRewardOrder in config.yml
    rewards: The rewards under this section. These rewards contain three properties: chance, a number representing the percentage chance that the reward will be triggered (1-100). The second is the list of commands, "strings". Wherever "%player%" appears in a command, it will be replaced by the name of the player who triggered it. The third is an optional silkTouch option. It's the same as silkTouch in reward sections, except overrides that. If this one does not exist, it falls back to the parent reward section's, then globally, then falls to IGNORED.

    You can also use the special commands "!msg <message>", "!title <title> <subtitle> [<fadeIn> <stay> <fadeOut>]", and "!sound <sound> [volume] [pitch]". See "/cmr help special" for more info on these.

    [​IMG]
    GitHub repository where you can report issues:
    https://github.com/datatags/CommandMineRewards
    If you'd like to see a feature and are a fellow developer, it'd really help me if you'd draft the changes and shoot me a pull request!

    [​IMG]
    Add optional check to not reward if player is not in survival mode.
    Progress: Added in v1.2
    Add ability to add blocks to the reward trigger list in-game
    Progress: Added in v2.0
    Add in-game reward creation system
    Progress: Added in v2.0
    Add per-reward permission nodes
    Progress: Added in v1.2
    Add per-reward blocks, including the ability to change the chance of getting rewards per-block.
    Progress: Added in v3.0
    Add better permissions system (ex. modifycommands -> commands.modify)
    Progress: Done in v5.2.
    Add more aliases
    Progress: Unnecessary with the new GUI
    Simplify command descriptions in /cmr help, and add detailed descriptions in /cmr help <command>
    Progress: Added in v5.5
    Add configuration options to the description page
    Progress: Done.
    Add tab-completion for commands and reward/sections
    Progess: Added in v5.1
    Add permission filtering for tab-completion
    Progress: Added in v5.3
    Simplify command usage, i.e. /cmr addworld replaced by /cmr world add
    Progress: Added in v6.0
    Add in-game configuration through GUI
    Progress: Added in v7.0
    Hook mcMMO for player-placed block database
    Progress: Added in v7.0
    Add "Rewarding" enchantment that multiplies chances of getting a reward by level + 1
    Progress: 0%
    Translatable messages
    Progress: 0%
    Set up Gradle
    Progress: 0%

    So much to do, so little time! :)

    [​IMG]
    Frequently (and otherwise) asked questions and issues:
    • <auto pickup plugin> breaks CMR!
      • Make sure you have enabled autoPickupCompat in CMR's config.yml.
      • If that does not fix the problem, set verbosity: 2 in config, reload, and break a block, then read the console.
        • If it says the event was cancelled, you likely have an incompatible auto pickup plugin. This plugin is known-CMR-compatible.
        • Otherwise, it may not be caused by auto pickup. Please contact me if you can't figure it out.
    • CMR isn't working!
      • Run /cmr debug and break a block. There should be a useful message about what went wrong in the console.
      • Contact me if you can't figure it out. Please include your console output, config.yml, and rewards.yml

    You can PM me or go to the discussion tab or GitHub issues to ask for features, or get help with errors. Please don't post errors or questions in the reviews, I won't be able to help you there. Thank you!

    CMR does include metrics, because I like to see that people are using it. If you don't want to send metrics, you can always disable it in <server root>/plugins/bStats/config.yml

    When you ask for help
    When you ask for help, please include your CMR config.yml and rewards.yml, and the debug log while the plugin is in debug mode. To put the plugin in debug mode, use /cmr debug. Reproduce the issue several times in-game, and send me the aforementioned files, and debug.log. You might even be able to figure out what the problem was by just reading the debug log.

    Usage on 1.12.2 and under (legacy versions): All recent versions of CMR were compiled against MC 1.13 or later. Most things should still work on legacy versions, CMR is generally pretty backwards compatible. As of CMR 7.1, you no longer need CMRLegacyWG since it's all handled through reflection now. Also, the GUI will not work on legacy versions due to changes between 1.12.2 and 1.13 (technically solvable using XMaterial) and due to PersistentDataContainer not being available before 1.14 (technically solvable with, ew, NMS or ew, a library that has to be shaded or installed alongside CMR.) If you'd like to see GUI support on legacy versions, please let me know in the discussion tab, and make sure you are running at least CMR 7.0 with metrics on so I can see how many people are using CMR on those versions. Thanks!

Recent Reviews

  1. PieHater25
    PieHater25
    5/5,
    Version: 7.0.1.1
    this definitely not working with 1.12
    you use the newer version of MCMMO (which is not going to work for 1.12.2).

    I have to change the code so it work with lower MCMMO version
    1. Datatags
      Author's Response
      Firstly, reviews are still not for reporting bugs or asking questions. It's immensely disappointing to get a review notification for it just to be a bug report and nothing more.

      Secondly, CMR DOES support 1.12 for the most part, but like any software, there are bugs, and I can't fix bugs I don't know about.

      Thirdly, while the project is open source, it's also still active, meaning that it would be most beneficial to everyone to simply report any bugs to me so I can fix them for everyone. Or even better, fix them in your fork and then submit a PR.

      I will be fixing the mcMMO hook issue soon.

      If you have any further questions or bug reports, PLEASE use the discussion tab, GitHub issues, or PM me.
  2. PieHater25
    PieHater25
    5/5,
    Version: 7.0.1
    Why the source code doesn't contain a maven file

    cai dit con me may sao may deo compile java 8 ha con cho?
    1. Datatags
      Author's Response
      I've never used maven before, but I'll consider it. CMR only has a couple dependencies anyway: mcMMO, WorldGuard, WorldEdit, and Spigot. I'll update the plugin with a Java 8 build.

      In the future, please use the discussion tab for this kind of thing, thanks!
  3. Top
    Top
    5/5,
    Version: 6.8.2
    It is amazing and so wonderful thank you
    ---------------------------------------
    1. Datatags
      Author's Response
      Glad you liked it! :)
  4. Amandusjf
    Amandusjf
    5/5,
    Version: 6.7
    Really nice plugin and active dev! i had some problems with this and a autopickup plugin and the dev of this plugin helped me figure out what was causing the issue and it will be fixed. Would recommend cmr for any prison server!
    1. Datatags
      Author's Response
      Thanks, pleasure working with you :)
  5. Golicraft
    Golicraft
    5/5,
    Version: 6.6
    Great plugin for every server in need of something that gives rewards upon mining special blocks. In my example, I use this as a lucky-block system and I must say it's much easier and smooth to work with than most lucky blocks plugins. This has EXACTLY what I was looking for. I asked for some improvements at GitHub and the developer did it right away without any doubts. Resource 10/10, Developer 10/10. Thank you!
    1. Datatags
      Author's Response
      Thanks :)
  6. jonnycp9
    jonnycp9
    5/5,
    Version: 5.4
    thank for fix problem with worldguard
    --------------------------------------------------------
  7. jonnycp9
    jonnycp9
    5/5,
    Version: 5.0
    Dev active, this plugin is awesome
    -------------------------------------------------------
    1. Datatags
      Author's Response
      Thanks for the review :)
  8. Yuwee
    Yuwee
    4/5,
    Version: 4.0
    Great plugin I'm having a lot of fun using this one! I would have posted this in the discussion section but it's too old to reply to apparently... Is it possible to hide executed commands in the console window? It can get rather spammy.
  9. Bart0vs
    Bart0vs
    4/5,
    Version: 2.0
    version at working in 1.8? Or some alternative plugin?. I really need this on my server,
    1. Datatags
      Author's Response
      Yes, it should work on 1.8 just fine. :)
  10. Resoluciones
    Resoluciones
    5/5,
    Version: 1.2.1
    This plugin is great! Thank you very much Developer and keep the good work!!!!!
    1. Datatags
      Author's Response
      Thanks for the feedback! :)