Plugin Idea: BrightVote

Discussion in 'Plugin Requests' started by C0nsole, Mar 12, 2012.

  1. Online

    C0nsole

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    ill do this one... ill try anyway... ill pm the link to you when im done... just give me a few days
  3. Online

    C0nsole

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  4. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @Garret2smart87 hmm, im having some promblems with the listener... im terrible with those... ill keep trying
  5. Offline

    Sorroko

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @J4K3ST3R Why do you need a listener for a purely command based plugin??
  6. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @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...
  7. Offline

    Sorroko

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  8. Online

    C0nsole

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @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!
  9. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    yeah, im almost finished... just some debugging to do now
  10. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    how would
    i store them in the variable though? like what would the variable be equal to?
  11. Online

    C0nsole

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @J4K3ST3R you are almost finished?!

    Wow, hooray!
  12. Offline

    thepig

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    int yes = 0
    int no = 0
    then, for every /bvt day, ++ to int yes
    for every /bvt no, ++ to int no
  13. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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?
  14. Offline

    thepig

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Don't know :/
  15. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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?
  16. Offline

    thepig

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  17. Online

    Zarius BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.

    This post has been edited 2 times. It was last edited by Zarius Mar 13, 2012.
  18. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    wait, what do you mean by flag? could you code a quick example really fast to show me?
  19. Online

    Zarius BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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());
    
  20. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  21. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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...
  22. Online

    Zarius BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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).
  23. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    also, how would i determine if the user already voted?
  24. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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...

    This post has been edited 1 time. It was last edited by J4K3ST3R Mar 13, 2012.
  25. Offline

    CoKoC

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    [IMG]

    Hello.

    I made your plugin. You can download it here : http://www.mediafire.com/?de4sic1s1d333sr
    The sources are available here : http://www.mediafire.com/?c3hzso20n8m6skn

    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.

    This post has been edited 2 times. It was last edited by CoKoC Mar 14, 2012.
    garrett2smart87 likes this.
  26. Offline

    Sorroko

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @CoKoC awesome... but @J4K3ST3R was kind of working on it already
  27. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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....
  28. Online

    C0nsole

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @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...
  29. Offline

    Sorroko

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @J4K3ST3R its not me you were making it for :p
  30. Offline

    J4K3ST3R

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    lol, i saw the name above my post so i tagged you:p woopsie lol

Share This Page