Filled Random item given using command

Discussion in 'Archived: Plugin Requests' started by Dotoo, Sep 10, 2014.

  1. Offline

    Dotoo

    This may sounds like odd, but I need a plugin which gives players an random item through typing a command.

    Here is full detail of my request; Player A types /rgive command. He gets an random item choosed one written in config.yml. That's it. It could be slightly better if I can set listed item's quantity but no big deal.
    No cooldowns/economy support/any limitations needed here. I just want to get an random item using a command. It sounds like no use for ordinary server so I am asking here.

    This is totally an optional request but it is cool sending a message for players as system message which item they just got through the command. Again, this is optional request and can be ignored if this takes too much time to implemented.

    Can someone make this plugin?

    It would be great if the plugin is simple and not being broke each bukkit update if I am not asking too much since I have heard they are removing item IDs anytime soon which I afraid.

    Thanks.
     
  2. Online

    timtower Administrator Administrator Moderator

    Dotoo Keeping this working for 1.8 is pretty tricky based on that ID removal part. We can't counter that without knowing what we can use.
    No changes to the github yet.
     
  3. Offline

    undeaD_D

    I'm on it right now ...

    Here ya go ^^
    https://github.com/CustomCraftDev/randomgive
    (Uploaded it on my private cloud :p )
    Have fun...

    PS: If you have questions or you want to add/remove something pm me.
    undeaD_D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  4. Offline

    Onlineids

    undeaD_D for the command rdisable, you disable the plugin then run code....
     
    undeaD_D likes this.
  5. Offline

    Dotoo

    Thanks undeaD_D I will try when I am go back to home!
     
  6. Offline

    undeaD_D

    http://prntscr.com/4lrche
    nope it gets executed ... ;)

    UPDATE:
    - small improvements made ...
    - raplaced replace() with replaceAll()
    - added $World$
     
  7. undeaD_D Iirc, calling setEnabled() doesn't really 'disable' the plugin - it just tells everyone it's disabled.

    Revert that change. replaceAll() is for regex.
     
  8. Offline

    Onlineids

    undeaD_D Ahh right I was thinking of getPluginManager().disable(this);
     
  9. Offline

    undeaD_D

    thats what the command /rdisable is ment to do -.-
    if something gets out of control (spamming etc.)

    UPDATE:
    - replaced replaceAll() with replace()
    - learned something new today \o/
     
  10. undeaD_D But does it stop it, though? Since you never check isEnabled() for anything, I don't believe that marking it as disabled will make a lot of difference. Unless the internal command handling process checks if the plugin is disabled before calling the onCommand() method but that doesn't sound too likely to me.
     
  11. Offline

    undeaD_D

    if you dont trust me try it ;)
    http://prntscr.com/4lrw3h

    commands are disabled after calling /rdisable ...
    but you can still see it when calling /help or /pl
     
  12. undeaD_D Then I was probably wrong with my "marking as disabled doesn't actually disable" belief :)
     
    undeaD_D likes this.

Share This Page