-
Notifications
You must be signed in to change notification settings - Fork 140
Voting Module
Spacebuilder2020 edited this page Jan 14, 2025
·
14 revisions
Last updated for forgeessentials-1.12.2-1.4.x
When the Voting module is enabled, scripts in the 'ForgeEssentials/scripts/servervote' folder will be executed when a player votes. (Note: any folder will work as long as a script has the onServerVote event method in it.)
To add a reward, simply create a script in that folder that runs a specified command or set of commands when the vote is issued.
For more information on scripting visit Here
[update 2021-06-29 (needs formatting)] A demo TS script that is triggered by the onVote event:
(note: needs to be transpiled to Javascript. In this example, simply removing : mc.ICommandSender will do the trick)
function onServervote(sender: mc.ICommandSender) {
//Server.chatConfirm("Vote event callled");
Server.runCommand(sender.doAs(null, true), 'wallet', sender.getPlayer().getName(), 'add', 100);
sender.chatConfirm('You are rewarded for voting ' + sender.getPlayer().getName() + '!' );
}
// Server.registerEvent("onServervote", onServervote);