Plugin Idea: BrightVote

Discussion in 'Archived: Plugin Requests' started by C0nsole, Mar 11, 2012.

  1. Inspired by LightVote, I have an idea for a plugin called BrightVote.

    LightVote makes it so that everyone on the server can vote for day time with /lvt day or /lvt no.

    BrightVote would be a plugin so that everyone on the server can vote for sun if it is raining with /bvt day or /bvt no.

    Thanks alot if you decide to take up this project, and if you do, you will earn AT LEAST moderator status on my server.

    Thanks!
     
  2. Offline

    J4K3ST3R

    ill do this one... ill try anyway... ill pm the link to you when im done... just give me a few days
     
  3. Offline

    J4K3ST3R

    @Garret2smart87 hmm, im having some promblems with the listener... im terrible with those... ill keep trying
     
  4. J4K3ST3R Why do you need a listener for a purely command based plugin??
     
  5. Offline

    J4K3ST3R

    ryan7745 are you forgetting that it needs to count how many votes it gets, as well as count a percentage of the yes/no votes it gets... please correct me if im wrong but i think i need a listener...
     
  6. No you could save the votes in a variable in the main plugin every time a player votes i.e /bvt day or /bvt no, after a certain amount of time using the scheduler check the votes and set to sun or keep as rain. I dont see a need for listener, I may be wrong though.
     
  7. J4K3ST3R ok, I was skiing but im back now.

    I dont know what a listener is because i dont code, that is why i made a plugin REQUEST

    Ok, you'll keep trying, thanks!
     
  8. Offline

    J4K3ST3R

    yeah, im almost finished... just some debugging to do now

    how would
    i store them in the variable though? like what would the variable be equal to?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  9. J4K3ST3R you are almost finished?!

    Wow, hooray!
     
  10. Offline

    thepig

    int yes = 0
    int no = 0
    then, for every /bvt day, ++ to int yes
    for every /bvt no, ++ to int no
     
  11. Offline

    J4K3ST3R

    yeah, i felt dumb after asking that because i knew it soon after... now im stuck at changing the weather? whats the code to change or set it?
     
  12. Offline

    thepig

    Don't know :/
     
  13. Offline

    J4K3ST3R

    Hmmm, this is whats stopping me, also. i need to make it so that users can only do /bvt when a vote has been started with /bvt start? how would this be done?
     
  14. Offline

    thepig

    Listen for a change in weather, then start the vote by broadcasting whether they want sun or rain/snow with /bvt day and /bvt no.
     
  15. Raining (or snow, depending on biome): player.getWorld().setStorm(true);

    Storm/thunder: player.getWorld().setThundering(true); (there's also a .setThunderingDuration(int ticks) function)

    Clear weather: set both of the previous two lines to false.

    See this page in the Bukkit Javadocs for more info.

    On the /bvt start command set a "vote-in-progress" flag to true (for multi-world support set the flag in a "Hash <World, Boolean>" so you can set true/false per world). Then you can check that in the /bvt command. Don't forget to set the "in-progress" flag back to false when the vote is finished.
     
  16. Offline

    J4K3ST3R

    wait, what do you mean by flag? could you code a quick example really fast to show me?
     
  17. By flag I just mean a variable of any kind that indicates the vote is in progress. It could be a string ("true", "false") or integer (1 or 0) but is usually a boolean as that's more efficient for storing just true/false.

    A "hash" is a means of storing "values" against "keys" - in this case our value is the in-progress flag (Boolean) and the key is the world the vote is in-progress in (World). Example:

    Code:
      Hash <World, Boolean> votesInProgress = new HashMap<World, Boolean>();
     
      // set vote in progress for a world
      votesInProgress.put(player.getWorld(), true);
     
      // stop vote in progress for a world
      votesInProgress.put(player.getWorld(), false);
     
      // get status of vote in progress for a world
      Boolean status = votesInProgress.get(player.getWorld());
    
     
  18. Offline

    J4K3ST3R

    so, i want it so when a user types /bvt start, it starts a vote for a set amount of time... and if a vote isnt in progress, a user that types /bvt day or no gets a message of a vote hasnt been started...
    and when a vote has been started, he gets a message such as thanks for voiting...
    im so lost... lol

    also, how would i reset the "votes" each time a vote is started? such as my yes/no votes are stored in variables and they are added by 1 each time a player votes... how do i make them reset when the vote is over? sorry for askin so many questions... i shouldnt even be making this plugin...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  19. You might be better off taking a look at the LightVote source-code and modifying that - might be easier to fork LightVote on Github, add a weather feature (eg. /lvt sunny, /lvt rain, etc) then do a "pull request" so it can be integrated into the LightVote plugin. The LightVote GitHub page is here.

    If you haven't used git there's problem a lot of learn that way too but it's well worth learning about git and GitHub.

    Or check out RabidCrab's Vote plugin here for a different example (it's out of date - I actually plan to pick this up - when I get more time - and merge LightVote's features into it to get the best of both).
     
  20. Offline

    J4K3ST3R

    also, how would i determine if the user already voted?

    alright, i know you dont want to explain this all to me, but i did take a look at the source code...
    i need this,
    * i need to know how to make it so that users cant vote more than once...
    * how to make it so that users cant vote unless a vote was started.
    * how to set a time for the vote...

    thats it. i dont want multiverse or anything...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  21. [​IMG]

    Hello.

    I made your plugin. You can download it here : <Edit by Moderator: Redacted mediafire url>
    The sources are available here : <Edit by Moderator: Redacted mediafire url>

    The plugin is exactly nearly as you requested. When rain is starting, there will be public votes available to all players to decide whether they want to keep the rain or not. They vote using the /bvote [yes/no] command. If there are more 'yes' votes than the majority of players, the rain will stop. You can change your vote.

    There is also a configuration file. You can set whether you want to use a message to tell players when it's raining and what's the said message.

    If you want any other features, found a bug or wreak havok on me (J4K3ST3R), poke me with a message on my profile with a link to this thread.
     
    Last edited by a moderator: Nov 11, 2016
    garrett2smart87 likes this.
  22. @CoKoC awesome... but J4K3ST3R was kind of working on it already
     
  23. Offline

    J4K3ST3R

    [quote uid=90651671 name="CoKoC" post=1018597]
    [​IMG]

    Hello.

    I made your plugin. You can download it here : <Edit by Moderator: Redacted mediafire url>
    The sources are available here : <Edit by Moderator: Redacted mediafire url>

    The plugin is exactly as you requested. When rain is starting, there will be public votes available to all players to decide whether they want to keep the rain or not. They vote using the /bvote [yes/no] command. If there are more 'yes' votes than the majority of players, the rain will stop. You can change your vote.

    There is also a configuration file. You can set whether you want to use a message to tell players when it's raining and what's the said message.

    If you want any other features, found a bug or wreak havok on me (J4K3ST3R), poke me with a message on my profile with a link to this thread.[/quote]well..... there went my bubble, i think you misunderstood. ryan7745 wanted the plugin and i was making it... but im not the greatest dev and i have alot to learn... oh well.... i guess ill delete mine....
     
    Last edited by a moderator: Nov 11, 2016
  24. CoKoC
    WOW THANK YOU, one thing though, am I aloud to make it public please?
    Also, you do get that (at least) moderator spot on my server when it comes up!

    J4K3ST3R
    Sorry he took it from you btw...
     
  25. J4K3ST3R its not me you were making it for :p
     
  26. Offline

    J4K3ST3R

    lol, i saw the name above my post so i tagged you:p woopsie lol
     
  27. CoKoC so can I make it so that the rain messages are colored, how would I go about that?
     
  28. Hi.

    You can add a tad of color to the rain message by prefixing it with the color ID you want to use.
    eg. If you want the entire text to be in red, you'd use this line in the config file :
    Code:
    rainmessage: §4It has come to raining! You may now vote for a sunny day with /bvote [yes/no]
    You can also make use of multiple colors. Say if you want to highlight the command in golden, you may use :
    Code:
    rainmessage: §4It has come to raining! You may now vote for a sunny day with §6/bvote [yes/no]
    The colors can be found here : http://www.minecraftwiki.net/wiki/Classic_server_protocol#Color_Codes
    But beware not to use the '&' character. The right character is that Simoleon-like character, '§'. It may be typed easily with ALT+21 on the keypad, see http://en.wikipedia.org/wiki/Section_sign.

    Also please take notice that I do not want you to release my plugins without my consent, which you do not have. As of the moderator title, I'd suggest you to find a dedicated moderator. I recommend you not to give it out as a reward for accomplishment, but rather to a competent individual with experience in this role. I understand you made this promise to encourage developers to help you, but I kindly decline.

    If you have any other questions or would like a new feature, do not hesitate.
     
  29. CoKoC

    garrett2smart87 probably doesn't care but if you're going to use the phrase it's "exactly what you asked for" you should note that he asked for a /bvt (rather than /bvote) command similar to the way Lightvote works - which is to say that /bvt clear would count as a "yes" vote whilst it's raining or start a vote if none in progress.
     

Share This Page