Scheduled Force Command

Discussion in 'Plugin Requests' started by Sprindex, May 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Sprindex

    I need a plugin that forces all players, or all players with a certain permission, to run a command. I scoured the internet for once, but didn't see how it would be possible without 2 or more plugins.

    The commands run and how often they run (x minutes) are all configurable in the config.

    Many thanks if someone could do this!
     
  2. Offline

    FisheyLP

    That can be easily done:
    just a little redstone clock and a commandblock that runs the commands (for this you would need an other plugin) for all players
     
  3. Offline

    htmlman1

    If the above solution doesn't satisfy your needs, I'm willing to step in and make this plugin.

    Tahg me though, the forum's alert system is a bit wonky.
     
  4. Offline

    Sprindex

    Last edited by a moderator: May 6, 2015
  5. Offline

    htmlman1

    @Sprindex Alright, I've finished the plugin! Hopefully this build works.

    https://www.dropbox.com/s/njeqkvna90bv9jt/CommandClock.jar?dl=0

    I've included instructions on command configuration in the auto-generated configuration file that should appear when you first load the plugin, but just in case you want to get an idea of it before you download (and perhaps suggest changes if necessary) here's a quick run-down.

    Every command "block" that will be configured falls under an overarching command configuration node. This should be generated automatically. An example configuration would look something like this:

    Code:
    commands:
        cmd1:
            content: "pay htmlman1 1000"
            interval: 20
            permission: "moneyfarmer.scrub"
        cmd2:
            . . . so on and so forth.
    Each command block has its own separate subsection:

    Code:
    [section name]:
        content: [command content]
        interval: [timer interval]
        permission: [discriminating permission]
    The name of each section is completely arbitrary - you can name it whatever the heck you like as long as it's not identical to another key. Here's an explanation of each individual key:

    • content: This is the command that would be run by a target player. An example value would be "warp survival" or "suicide" - note that no slashes precede the commands' bodies. Surround this value in double quotes!
    • interval: This is the timer interval for running the command in seconds. Whole numbers only, please.
    • permission: This is the permission node that would mark a player as a target. If no permissions are needed and the command's all-inclusive, simply set the node's value to "ALL". Surround this value in double quotes!
    Well, that's that! Tahg me if you have any questions, or if I've managed to screw up the code. (Apologies in advance if that occurs, by the way. It's been a while.)
     
  6. Offline

    Sprindex

  7. Online

    timtower Moderator Moderator

    @Sprindex Try this instead:
    Code:
    # The general configuration structure for a command should be placed under the 'commands' node.
    # Its basic layout is as follows:
    # commands:
    # - [command id]  This should be something like 'cmd1' or 'suicide'.
    #  - content:  "suicide"  Command content. Make sure to omit the slash!
    #  - interval: 3600  This interval is in seconds for convenience.
    #  - permission: "plugin.perm"  Either place the permission node or "ALL" to indicate.
    # Sorry, the organization is somewhat arbitrary.
    
    commands:   
        cmd1:
        - content:  "spawn"
        - interval: 10
        - permission: "ALL"
     
    htmlman1 likes this.
  8. Offline

    htmlman1

    @Sprindex Yes, what timtower said should work. I'm sorry if I caused any confusion in my explanation, try and model the layout of your configuration to match his example.

    There is a slight different in the final configuration structure, though. Don't put dashes before the keys in the YAML file. This means that your config should look like this:

    Code:
    # The general configuration structure for a command should be placed under the 'commands' node.
    # Its basic layout is as follows:
    # commands:
    # - [command id]  This should be something like 'cmd1' or 'suicide'.
    #  - content:  "suicide"  Command content. Make sure to omit the slash!
    #  - interval: 3600  This interval is in seconds for convenience.
    #  - permission: "plugin.perm"  Either place the permission node or "ALL" to indicate.
    # Sorry, the organization is somewhat arbitrary.
    
    commands:  
        cmd1:
          content:  "spawn"
          interval: 10
          permission: "ALL"
     
    Last edited: May 8, 2015
  9. Offline

    Sprindex

    I'm told I'm watching this thread. Apparently not... I made the changes just then and it works perfectly! Thank you so much!
     
Thread Status:
Not open for further replies.

Share This Page