Inactive [MECH] Lightvote v1.73 - vote for day/night using commands, beds or items [1.1R5, 1.2.4]

Discussion in 'Inactive/Unsupported Plugins' started by Zarius, May 10, 2011.

  1. Offline

    Zarius

    Lightvote - any player can vote for day/night (based on xupwup's original Lightvote)
    Version: v1.73 (2012/03/02)

    Features:
    • Voting for both day and night
    • Sleeping in a bed starts/agrees to vote for day (optional)
    • Itemvote - vote for day/night by hitting a bed with a torch (configurable)
    • Itemvote - vote no by hitting dirt with a torch (configurable)
    • Permanent day or night (optional)
    • Reminders of vote in progress
    • Voting is disabled for a while after a vote
    • Inbuilt permission system - restrict voting to a subset of players
    • Basic multiworld support (still only world 0 for permanent time)
    Download: Download | Source (GitHub) | Bug/Feature Tracker

    Usage:
    /lvt day -- start/agree with vote for day (or vote no for a night vote)
    /lvt night -- start/agree with a vote for night (or vote no for a day vote)
    /lvt yes -- vote yes
    /lvt no -- vote no

    Configuration (open)

    The default config file looks like this:
    Code:
    # At least 'required-yes-percentage'*peopleOnServer people must vote yes, and there must be more people that voted yes than no
    # day
    required-yes-percentage-day 5
    minimum-agree-percentage-day 50
    # night
    required-yes-percentage-night 5
    minimum-agree-percentage-night 50
    vote-fail-delay 30
    vote-pass-delay 50
    vote-time 30
    reminders 2
    # enable bedvote (sleeping in a bed starts or agrees with a vote)
    bedvote yes
    # no commands - if this is enabled then all lightvote voting commands are disabled (bedvote or itemvote must be used)
    lightvote-nocommands no
    ##### Configure items for commandless voting (hitting 'itemhits' with 'iteminhand' starts/agrees/disagrees with a vote)
    # These are for starting a vote or agreeing to a vote in progress (day and night can be different if you want)
    itemVote yes
    bedvote-iteminhand-day TORCH
    bedvote-itemhits-day BED_BLOCK
    bedvote-iteminhand-night TORCH
    bedvote-itemhits-night BED_BLOCK
    # These are for disagreeing (voting no) with a vote in progress)
    bedvote-novote-iteminhand-day TORCH
    bedvote-novote-itemhits-day DIRT
    bedvote-novote-iteminhand-night TORCH
    bedvote-novote-itemhits-night DIRT
    debug-messages no
    permanent no
    use-permissions no
    The permissions file (plugins/LightVote/voteStarters.conf) consists of the names of players you wish to allow, separated by ONE space or newline. This is case insensitive. If I, for example, only want to allow myself and testuser1-3 to start votes, I could use the following config file.

    Code:
    xUpWuP testuser1 testuser2 testuser3
    If you just want everyone to be able to vote, as is the default, just use:

    Code:
    *
    Alternatively you can set "use-permissions" to yes and add the "lvt.vote.time" permission to users you want to be able to vote.

    The configuration files are in plugins/LightVote/LightVote.conf


    Changelog:

    Version 1.73 (2012/03/02)
    * updated for BukkitR5 new event system

    Version 1.72 (2011/07/27)
    * added start/join permissions (lvt.vote.time.join & lvt.vote.time.start) - start permission automatically grants join permission

    Version 1.71
    * removed debug message
    * default config includes use-permissions option now

    Older changes (open)
    Version 1.70
    * Added permissions support (enable in config and use "lvt.vote.time")
    * Added /lvt day & /lvt night commands to start or agree with a vote (or disagree as appropriate)
    * Fixed a bug with bedVote where it wouldn't work until you used a /lvt vote

    Version 1.68
    * Added option to disable itemVote.
    * Fixed bug where players could change day vote to night vote.

    Version 1.67
    * Vote message should be sent only to applicable world
    * Fixed vote start message to advise /lvt help when using lightvote-nocommands
    * Fixed count error in yes/no vote count

    Version 1.66

    * Added itemVote (hit item X with item Y in hand to vote yes/no for day/night)
    * Added lightvote-nocommands (disables /lvt start and /lvt yes/no to use only itemVote or bedVote)

    Version 1.65
    • Multiworld votes now only consider the players within the current world.
    Version 1.64
    • New feature: basic multiworld support - still only 1 vote at a time and only world 0 for permanent time.
    Version 1.63
    • New feature: bedvote. Sleeping in a bed at night starts or agrees to a vote for day. This can be turned off in the config file.
    Previous changes - see previous thread


    Todo:
    • Support for Permissions plugin. (done in 1.7)
    • Support for Bukkit SuperPerms
    • (Optional) Skip night cooldown - eg. every 5 (configurable) nights that are skipped the vote day command wont work until a full night has passed.
    • Vote /lvt day and /lvt night commands (I sometimes try these commands myself :)) (done in 1.7)
    • Bedvote: only start a vote when the player is asleep, rather than immediately upon entering the bed (if possible).
    • Weather? Both commands and gameplay (perhaps totems built to vote for rain, thunder, sun).
    • Allow simultaneous votes in different worlds (currently only one global vote at a time).
    • Voting in one world disables all voting for one minute (same issue as above) - fix this.
    • Customizable messages (thanks Hawtin)
    • Ignore NPC's
     
    Stassi, Hawtin, Linki and 1 other person like this.
  2. Offline

    Darcion

  3. Offline

    xupwup

    This is caused by failing multithreading. Anyway, this sometimes occurs when synchronising time when using permanent mode. This has a very low chance of occurring, so that explains why you do not have it. Take a look at the source of "properTime" where I have fixed this problem. For convenience, I posted the code below.
    Code:
    getServer().getScheduler().callSyncMethod(self, new Step());
    Code:
    private class Step implements Callable<Void>{
    			@Override
    			public Void call() {
    				long ctime = wrld.getTime();
    				if (perma >= 0){
    					wrld.setTime(ctime - (ctime % 24000) + perma);
    				}else{
    					if (ctime < lasttime + 3*defaultStep && ctime > lasttime - defaultStep){
    						
    						long ntime = lasttime + getStep(lasttime);
    						wrld.setTime(ntime);
    						if (debug) log.info("Synchronized time on world \"" + wrld.getName() + "\", diff was "+ (ntime - ctime) + ".");
    						lasttime = ntime;
    					}else{ // someone used settime
    						if (debug) log.info("Apparently someone used setTime, not synchronizing.");
    						lasttime = ctime;
    					}
    				}
    				return null;
    			}
    			
    		}
    
     
  4. Offline

    Stassi

    Has anyone tested this plugin with [818]?
     
  5. Offline

    Zarius

    Yes - me :) Working fine on my 818 server (tested all features).
     
  6. Offline

    Stassi

    Really enjoying the [818] release.
    Minor suggestion: I might have missed where you explained this earlier, but it would help new users if the "duration" fields in the config files had their units of measurement explained in a comment (eg: #all durations are in seconds).

    I believe the way Notch designed sleeping in beds was focused primarily on SSP, and this mod is the way it should have been designed for medium to large SMP servers. Thank you, Zarius. My community is going to love this.

    Works great in conjunction with EssentialsSpawn or similar mods.
     
  7. Offline

    Zarius

    Thanks for that, glad it's working well for you. Will add extra comments to the config file.
     
  8. Offline

    GlassZ

    This is a great plugin. Any way to make it so that it costs money to use it, so people won't be doing it excessively?
     
  9. Offline

    Zarius

    I don't use economy plugins but might be possible - will look into it.
     
  10. Offline

    xarrek

    Code:
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:292)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:377)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.NetworkListenThread.a(SourceFile:100)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.NetworkManager.a(NetworkManager.java:196)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.Packet15Place.a(SourceFile:57)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:535)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:215)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.BlockBed.interact(SourceFile:56)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:241)
    11.06 10:39:49 [Server] INFO     at net.minecraft.server.EntityHuman.a(EntityHuman.java:576)
    11.06 10:39:49 [Server] INFO     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:310)
    11.06 10:39:49 [Server] INFO     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    11.06 10:39:49 [Server] INFO     at org.bukkit.plugin.java.JavaPluginLoader$22.execute(JavaPluginLoader.java:390)
    11.06 10:39:49 [Server] INFO     at nl.xupwup.LightVote.LVTPlayerListener.onPlayerBedEnter(LVTPlayerListener.java:383)
    11.06 10:39:49 [Server] INFO     at nl.xupwup.LightVote.LVTPlayerListener.startVote(LVTPlayerListener.java:328)
    11.06 10:39:49 [Server] INFO java.lang.NullPointerException
    11.06 10:39:49 [Server] SEVERE Could not pass event PLAYER_BED_ENTER to LightVote
    818 error
     
  11. Offline

    xupwup

  12. Offline

    Zarius

    @xupwup

    Yeah, I've read that thread but wasn't sure of the etiquette in taking over another authors mod, will update.
     
  13. Offline

    Niemand

    is it possible to allow it for whole groupmanager-groups instead of players?
     
  14. Offline

    TruculentMC

    There seems to be a bug in the current version -- if someone in the normal world starts a lightvote for day, and someone in the nether votes yes, the time will briefly flick to day then immediately revert back to night. I'm able to replicate it 100% of the time by having 1 person in nether and 2 people in the normal world, having 1 of them in the normal world start a vote, the other in normal world not vote at all, and having the person in nether vote yes.

    LightVote.conf:
    Show Spoiler


    # At least 'required-yes-percentage'*peopleOnServer people must vote yes, and there must be more people that voted yes than no
    # day
    required-yes-percentage-day 5
    minimum-agree-percentage-day 50
    # night
    required-yes-percentage-night 5
    minimum-agree-percentage-night 50
    vote-fail-delay 15
    vote-pass-delay 15
    vote-time 15
    reminders 2
    # enable bedvote (sleeping in a bed starts or agrees with a vote)
    bedvote yes
    # no commands - if this is enabled then all lightvote voting commands are disabled (bedvote or itemvote must be used)
    lightvote-nocommands no
    ##### Configure items for commandless voting (hitting 'itemhits' with 'iteminhand' starts/agrees/disagrees with a vote)
    # These are for starting a vote or agreeing to a vote in progress (day and night can be different if you want)
    itemVote no
    bedvote-iteminhand-day GOLD_BLOCK
    bedvote-itemhits-day BED_BLOCK
    bedvote-iteminhand-night GOLD_BLOCK
    bedvote-itemhits-night BED_BLOCK
    # These are for disagreeing (voting no) with a vote in progress)
    bedvote-novote-iteminhand-day GOLD_BLOCK
    bedvote-novote-itemhits-day DIRT
    bedvote-novote-iteminhand-night GOLD_BLOCK
    bedvote-novote-itemhits-night DIRT
    debug-messages yes
    permanent no
     
  15. Offline

    Zixt

    How can I disable it on a specific world? I have a PVP world and a normal world and I only want users to vote for a time on the normal world.
     
  16. Offline

    Zarius

    Will have to check this out later.

    Hmm... I don't think this is possible yet - need to spend some time on this but been busy with other coding.
     
    Zathras likes this.
  17. Offline

    Zixt

    Couldn't you add a permission requirement or something? That could work
     
  18. Offline

    po5

    hello great plugin. been using without trouble for a while. I updated to cb946 and i started getting exceptions like these once in a while. Then the plugin will freeze, and you will be unable to start new votes.

    Code:
    2011-06-30 20:58:53 [SEVERE] Exception in thread "Timer-113"
    2011-06-30 20:58:53 [SEVERE] java.util.ConcurrentModificationException
    2011-06-30 20:58:53 [SEVERE]     at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
    2011-06-30 20:58:53 [SEVERE]     at java.util.AbstractList$Itr.next(AbstractList.java:343)
    2011-06-30 20:58:53 [SEVERE]     at org.bukkit.craftbukkit.CraftWorld.getPlayers(CraftWorld.java:559)
    2011-06-30 20:58:53 [SEVERE]     at nl.xupwup.LightVote.LVTPlayerListener.endVote(LVTPlayerListener.java:121)
    2011-06-30 20:58:53 [SEVERE]     at nl.xupwup.LightVote.LVTPlayerListener.access$2(LVTPlayerListener.java:119)
    2011-06-30 20:58:53 [SEVERE]     at nl.xupwup.LightVote.LVTPlayerListener$voteEnd.run(LVTPlayerListener.java:93)
    2011-06-30 20:58:53 [SEVERE]     at java.util.TimerThread.mainLoop(Timer.java:512)
    2011-06-30 20:58:53 [SEVERE]     at java.util.TimerThread.run(Timer.java:462)
     
  19. Offline

    shawn34668

    Thanks alot
    Very nice working :)
     
  20. Offline

    po5

    I really love this plugin for its simplicity. Unfortunately it has a habbit of breaking on 953 with the Timer error
     
  21. Offline

    Zarius

    Hmm... can you post the error (same as above?) I've been running this on 953 for 3 days or so now with no problems.
     
  22. Offline

    Kevin Robbens

    Doesnt seem to work for me.
    Bedvote has a NPE:
    Code:
    2011-07-05 15:52:13 [SEVERE] Could not pass event PLAYER_BED_ENTER to LightVote
    java.lang.NullPointerException
        at nl.xupwup.LightVote.LVTPlayerListener.startVote(LVTPlayerListener.java:328)
        at nl.xupwup.LightVote.LVTPlayerListener.onPlayerBedEnter(LVTPlayerListener.java:383)
        at org.bukkit.plugin.java.JavaPluginLoader$23.execute(JavaPluginLoader.java:398)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:321)
        at net.minecraft.server.EntityHuman.a(EntityHuman.java:626)
        at net.minecraft.server.EntityPlayer.a(EntityPlayer.java:313)
        at net.minecraft.server.BlockBed.interact(SourceFile:93)
        at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:219)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:552)
        at net.minecraft.server.Packet15Place.a(SourceFile:57)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:84)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Please fix this ^^
     
  23. Offline

    EmanuxJade

    Permissions needed pls, i wont that a new player can vote =/
     
  24. Offline

    Zarius

    Looks like LightVote might need a bit of TLC from me (been focused on OtherBlocks) - will take a look into it soon, thanks for the bug reports everyone.

    Just to be clear, you want it so that new players can't vote? Because new players should be able to vote at the moment. I'll look into added permissions support (more familiar with it all now :)).
     
    EmanuxJade likes this.
  25. Offline

    EmanuxJade

    ty :*
     
  26. Offline

    aykutmania

    Pleeeeeease fix asap xD
     
  27. Offline

    Zarius

    New version:

    Version 1.70
    * Added permissions support (enable in config and use "lvt.vote.time")
    * Added /lvt day & /lvt night commands to start or agree with a vote (or disagree as appropriate)
    * Fixed a bug with bedVote where it wouldn't work until you used a /lvt vote
     
    c0mp13371331337 likes this.
  28. Offline

    c0mp

    +1 internets for Permissions support! The only problem I've encountered, and you'll have to excuse me if I'm missing something blatantly obvious, is that I don't see the option in the config to enable Permissions support. I've let the plugin regenerate a fresh file, and I've combed through the OP, but the closest thing I've been able to find is your update changelog where it says it must be enabled in the config. On startup, I keep getting the Permissions off message:

    Code:
    [INFO] [LightVote] Permissions not enabled in config.


    Any insight you could provide would be much appreciated!

    Nevermind, after writing this I started trial-and-error-ing it and figured it out to be:

    Code:
    use-permissions yes
    In case anyone else runs into this as well. Again, if that was plastered in front of my face somewhere and I missed it, my apologies. :cool:
     
  29. Offline

    Zarius

    Nope, sorry about that - put the option in but didn't describe it anywhere :( Fixed in version 1.71.
     
  30. Offline

    Niemand

    sorry to bug you, but can you add permission-nodes like this:

    lvt.vote.start - for being able to use "/lvt start"
    lvt.vote.vote - for being able to use "/lvt yes" or "/lvt no"
    lvt.vote.time - for being able to use both. (would be same as lvt.vote.*, i guess. But this way the guys using it since now dont get any problems. ;) )
     
  31. Offline

    aykutmania

    Hey Friend,
    can you add iConomy-support for starting vote? :)
     
    Niemand likes this.

Share This Page