VotifierScripts
VotifierScripts is a plugin that listens for Votifier votes and allows you to run javascript code when a vote is received (allowing for endless possibilities!) This javascript is enhanced with the power of buscript which gives access to many global functions in order to make an easy to use scripting experience. No programming experience is required, but in that case you may find this plugin harder to use than most.
This plugin requires Votifier but already comes prepackaged with buscript.
The latest development builds can always be found at http://ci.onarandombox.com/job/VotifierScripts/
Commands
Currently there's just one command
/vstest <player> [service [address [timestamp]]]
- This command tests the script that is run when a vote is received.
- Permission: votifierscripts.test
- <player> is used to indicate a target for your script. In general, this should probably be someone that is online if you are going to use it.
- The test command will always reload the vote-script.txt file so there is no need to do anything special should you modify the script.
- The other 3 arguments are optional but each one requires using the one before it, so to use timestamp you have to do all 4. These will help you more fully test a vote script.
Scripts
Scripts are text files that contain Javascript code. This may sound scary to people unfamiliar with coding but luckily VotifierScripts provides several easy to use methods for creating basic scripts.
The primary script that is called when Votifier receives a vote is located at plugins/VotifierScripts/vote-script.txt. You will notice this script initially comes with a simple built in sample. Feel free to modify this!
Any script that the primary script runs must be located in plugin/VotifierScripts/scripts and may have any name/file extension you like.
Script Features
- Easy to use global functions including command running, message broadcasting, permission management and more.
- Any string used in these global functions has access to "%target%" which represents the current target of the script. Example: broadcast("Hello, %target%")
- The ability to run another script at a later time with 100% reliability, even if the server crashes!
- Defines the global variable target so more advanced things can be done with the script's target.
- The global variable server is also available which gives direct access to the Bukkit server variable just as if you were working from within a plugin!
Detailed Script Features
Global Functions and Variables
Additional Global Functions and Variables specific to VotifierScripts
Example Scripts
- Simple broadcast/command sample
- vote-script.txt
broadcast("Hey everyone, %target% is a cool guy!") command("op %target%")
- This is a simple script that tells everyone on the server what a cool guy the target (dumptruckman in this case) is and then ops them.
- Timed permission sample
- vote-script.txt
message("%target%", "You have just been given flight in the creative world for 30 minutes!") addPerm("creative", "%target%", "flight.permission") runLater("remove-perm.txt", "30m", "%target%")
- scripts/remove-perm.txt:
message("%target%", "Your flight power has been removed, hope you weren't up there!") removePerm("creative", "%target%", "flight.permission")
- Please note these two scripts require Vault and a Vault compatible permission manager which allows them to work even when the player is not online.
- It is possible to instead use the command() function to run your own permission commands without using Vault.
- Also note "flight.permission" is not a real permission. Your actual flight enabling permission may vary (or not even exist!)
Click Here for more sample scripts
Click Here for script requests
For Developers
Source code: https://github.com/dumptruckman/VotifierScripts
Maven repository: http://repo.onarandombox.com/content/groups/public/
Maven pom information:
<groupId>com.dumptruckman.minecraft</groupId> <artifactId>votifierscripts</artifactId> <version>1.0-SNAPSHOT</version>
You can add your own functionality to the scripts if you so choose. Here's how to hook into VotifierScripts:
Plugin plugin = Bukkit.getPluginManager().getPlugin("VotifierScripts"); if (plugin != null) { Buscript buscript = ((VotifierScripts) plugin).getScriptAPI(); // Do stuff with buscript object, see documentation below }
For more information about the buscript library, visit: http://dev.bukkit.org/server-mods/buscript/
-
View User Profile
-
Send Message
Posted May 11, 2013@jwpwns
do ยง istead of & to add color
@Rorro11
-
View User Profile
-
Send Message
Posted May 2, 2013How do you add color?
-
View User Profile
-
Send Message
Posted Apr 30, 2013@Siickest
if (getVoteCount() % requiredVotes == 5) <= needs to be if (getVoteCount() % requiredVotes === 5)
-
View User Profile
-
Send Message
Posted Apr 19, 2013Needs Update.
-
View User Profile
-
Send Message
Posted Apr 16, 2013I have used this on my server now for ages and it is working like a charm still. But however, does it support color codes?
-
View User Profile
-
Send Message
Posted Apr 5, 2013I'm having a problem.. My count on players doesen't seems to work.. I got this script
When I have voted 5 times even 7.. I do not give any reward either do my friend :O Why?
-
View User Profile
-
Send Message
Posted Apr 4, 2013@thedestinycrew1
try changing the port votifier uses
-
View User Profile
-
Send Message
Posted Apr 1, 2013Hay I've 2 Problems: 1. I don't see the vote-script.txt in the folder... and if i try to upload this, it doesn't show too 2. I Can't delete the folder "VotifierScripts"
-
View User Profile
-
Send Message
Posted Mar 30, 2013Hey I encountered a problem. Votifier won't work. I type in the ip, port and key and it says it was able to make a connection. Also when I did /vstest it worked. When I went on a voting site to vote for my server nothing happened so it must be the connection between votifier and this. It happend to all my voting plugins and listeners. Help? Thanks -thedestinycrew1
-
View User Profile
-
Send Message
Posted Mar 30, 2013I need help. So I got Votifier and this plugin and put them both in my server's plugins folder, but when I go to the website to vote it says I voted and nothing happens.
-
View User Profile
-
Send Message
Posted Mar 24, 2013@Lostferret13
You do not need any listeners for this plugin.
-
View User Profile
-
Send Message
Posted Mar 10, 2013Was working until today, and now it states:
[INFO] [KCVOTE] Mrchasez Voted and Recieved 4 Diamonds!
[INFO] Error: Player not found.
Whenever someone votes it states "Player not found" has been doing it for about three hours and i can't find out why.
Edit: A restart fixed it. I checked everything and couldn't find the source of the issue.
-
View User Profile
-
Send Message
Posted Feb 23, 2013Hi, I want to add to my script a test to see if the %target% belongs in a specific group called 'Default' and then perform certain commands? I'm currently using:
if (permissions.playerInGroup("world", "%target%", "default")) { broadcast("Hello, %target%! You belong in the default group!") } else { broadcast("Hello, %target%! You don't belong in the default group!") }
It's been a while since I've done programming, but I suspect 'permissions.playerInGroup' is not the right one to use if I'm using GroupManager?
-
View User Profile
-
Send Message
Posted Feb 22, 2013do I need a listener in addition to this or does it function as a listener by itself?
-
View User Profile
-
Send Message
Posted Feb 15, 2013Trying to create a script that promotes players to "Mayor" when they get 4 votes, then once they get up to 20 votes another day, it gives them "Governor" and so on. Also, give them 100 dollars for every vote. Can someone take a look at this and tell me if it's correct: http://pastebin.com/vAa3XWTj
-
View User Profile
-
Send Message
Posted Feb 8, 2013@ItsKohle
I don't think that is necessary, but if it works for you, I guess.. gratulations! :D
-
View User Profile
-
Send Message
Posted Feb 8, 2013@xpopy
Got it to work, I wasn't putting a semicolon after each command.
-
View User Profile
-
Send Message
Posted Feb 5, 2013@Siickest
Oh, I see what you mean. I don't know if it is possible, but I wouldn't be able to make such script, sorry :/
-
View User Profile
-
Send Message
Posted Feb 4, 2013@xpopy
No. But I want something else.. I don' think its possible but.. If someone make their first vote for they day it will be a broadcast.. But the next time it will be a message.. Is it possible.
Like I got 5-6 links. The first link they vote on it does broadcast to the server .. but the next 4-5 votes are sent as a message. I want people to see that they can vote but if people spam vote 5-6 links at the time it will be spammed in the chat =)
-
View User Profile
-
Send Message
Posted Feb 4, 2013@Siickest
message("%target%", "&cThanks for voting on %service%") command("give %target% 264 1")
I think this is what you want..?