Filled RNumber

Discussion in 'Plugin Requests' started by Resoluciones, Jul 3, 2019.

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

    Resoluciones

    Plugin category: Mechanics

    Minecraft version: Paper version git-Paper-123 (MC: 1.14.3) (Implementing API version 1.14.3-R0.1-SNAPSHOT)

    Suggested name:
    RNumber

    What I want: I would like a plugin that generates a random number from a range that can be used by other plugins. In example an operator can type 'give Resoluciones apple RN 1 10' and a number from 1 to 10 will be picked to give the apples. This funtion should be capable to be used within game, as well as by console as well as within configurations of other plugins.

    Ideas for commands: Not needed

    Ideas for permissions: r.number

    Ideas for configuration:

    - Integers only: yes/no
    - Decimals digits: 0-10 # only works in case integers only is 'no' and max quantity depending on what is recomended by the Developer, maybe Minecraft has some specification for this.

    When I'd like it by: whenever it's possible.

    Let me know! Thanks!
     
  2. Offline

    KarimAKL

    @Resoluciones I've made something that should work for what you want.
    Download link: https://www.dropbox.com/s/l4bqq0si6qtfzjq/RNumber.jar?dl=0
    The config only has an 'Allow-Doubles' boolean, it's set to 'false' by default.
    To use a random number you do 'r[number]:[number]'
    Examples:
    Code:
    r1:2 = 1 - 2
    r-5:-2 = -5 - -2
    r2.0:3 = 2.0 - 3.0
    I've only tested it using '/give (player) (item) (random amount)' and '/say (random amount)'.
    Let me know if something doesn't work or you want me to change anything.
     
  3. Offline

    Resoluciones

    Thanks KarimAKL! I downloaded the plugin already and I will test it tonight at the server and I'll let you know if any issues!
    Best regards!

    EDIT: Plugin working as expected! More than perfect! Thanks!

    EDIT2: The plugin works perfect if you put the command manually in the console. But when it's executed by another plugin it gives error:

    give Resoluciones apple r1:2
    04.07 18:19:47 [Server] INFO Expected integer

    I tested in different plugins, another error in a different plugin is:
    Failed to set the parameter (Wrong value: r5:30)

    So, when the command is executed by another plugin it seems the random value is not detected. Do you think you could fix that?

    Thanks!!!!
     
    Last edited: Jul 4, 2019
  4. Offline

    KarimAKL

    @Resoluciones What plugin are you using to make it run the command? I'll use that to try and get it working.
     
  5. Offline

    Resoluciones

  6. Offline

    KarimAKL

    @Resoluciones It seems it's impossible for me to set that because of the way those plugins are created. (they just make the player execute the command without making an event other plugins can listen to)
    I'll try recreating those plugins (if i'm able to) as well as i can and then i'll let you know how it goes.
    I'll go to sleep now, i'm gonna look further at it tomorrow.
     
    Resoluciones likes this.
  7. Offline

    KarimAKL

    @Resoluciones I've tried creating those 2 plugins, let me know if something doesn't work.
    RNumber: https://www.dropbox.com/s/l4bqq0si6qtfzjq/RNumber.jar?dl=0
    StartCommands: https://www.dropbox.com/s/hj61yjlu1zx7e0a/StartCommands.jar?dl=0
    CommandRandomizer: https://www.dropbox.com/s/xpwxa0mxxr4w8tn/CommandRandomizer.jar?dl=0

    StartCommands' default config.yml:
    Code:
    On-Enable-Commands: true
    On-Enable:
      1:
        Delay: 0
        Commands:
        - say This is run when the plugin is enabled
    On-Join:
      Console-Commands: true
      Player-Commands: true
      Console:
        1:
          Delay: 0
          Commands:
          - say This is run from the console when a player ({player}) joins the server
      Player:
        1:
          Delay: 0
          Commands:
          - say This is run from the player themself ({player}) when they join the server
    'On-Enable-Commands' is a boolean (true/false) where you can choose to enable or disable the 'On-Enable' commands. 'Console-Commands' and 'Player-Commands' are the same, just for 'On-Join''s 'Console' and 'Player' commands.
    How this works:
    Code:
    1:
      Delay: 0
      Commands:
      - "say this is fun"
    '1' is the ID of the command, the lower the ID, the faster the command gets executed. (1 before 2, 2 before 3, etc.) Miminum ID number is 1.
    'Delay' is the amount of ticks the plugin is gonna wait, before the command is executed. (20 ticks = 1 second) Set this to 0 if you don't want any delay.
    'Commands' is the list of commands that are gonna be executed.

    CommandRandomizer's default config.yml:
    Code:
    Commands:
      Console-Commands: true
      Player-Commands: true
      Console:
        name1:
          Delay: 600
          Period: 1200
          Chance: 50
          Commands:
          - "give {player} diamond 1"
      Player:
        name1:
          Delay: 18000
          Period: 18000
          Chance: 10
          Commands:
          - "kill"
    This is basically the same as the StartCommands' config file, just with a few additions.
    'Period' is the amount of ticks between command executions.
    'Chance' is the % chance for the command to be executed. (0-100)

    EDIT: I just noticed now that this might be a double post (2+ posts within 24 hours), sorry. :7
     
  8. Offline

    Resoluciones

    @KarimAKL This is more than great Karim! I will test everything now! Thanks!

    EDIT: Tested and the three plugins are working PERFECT!

    [​IMG]
     
    Last edited: Jul 7, 2019
    KarimAKL likes this.
  9. Offline

    KarimAKL

    Glad to know that. :) Let me know if you want anything changed.
     
    Last edited by a moderator: Jul 7, 2019
    Resoluciones likes this.
Thread Status:
Not open for further replies.

Share This Page