SETUP
TESTED VERSIONS
- Transfer the “.sk” extension file in the package you downloaded to the “Skript/scripts” section in the plugin folder on your server.
- Transfer the folder where the “.sk” extension file in the package you downloaded stores the data into the plugin folder.
- Install the required plugins/skript addons on your server.
- Use the command “/reload” to activate the script. Or restart the server.
- /timedvote preview - timedvote.nq.admin
- /timedvote start <vote name> - timedvote.nq.admin
- /timedvote cancel - timedvote.nq.admin
- /timedvote reload [module] - timedvote.nq.admin
TESTED VERSIONS
- 1.21, 1.21.4, 1.21.5
Code:
options:
folderPath: plugins/Skript/scripts/nqaaN's Skripts/Timed Vote # Do not change this unless you are an advanced user!
permission_timedvote_admin: timedvote.nq.admin
# --- Config
actionbar_track: true # Whether to display the vote status in the actionbar.
actionbar_update_continuous: true # If true, the actionbar updates every second. If false, it only shows when someone votes.
win_percentage: 50 # Minimum percentage to win (must be strictly greater than this value; e.g., 50.01% passes, 50% fails)
enable_tabComplete_module: true
# --- Sounds
sound_vote_start_name: "entity.player.levelup"
sound_vote_start_volume: 1
sound_vote_start_pitch: 1
sound_vote_finish_yes_name: "ui.toast.challenge_complete"
sound_vote_finish_yes_volume: 0.25
sound_vote_finish_yes_pitch: 1
sound_vote_finish_no_name: "entity.villager.no"
sound_vote_finish_no_volume: 0.8
sound_vote_finish_no_pitch: 0.675
sound_vote_cancelled_name: "block.anvil.land"
sound_vote_cancelled_volume: 0.375
sound_vote_cancelled_pitch: 1
sound_vote_yes_name: "block.note_block.bit"
sound_vote_yes_volume: 1
sound_vote_yes_pitch: 1
sound_vote_no_name: "block.note_block.bass"
sound_vote_no_volume: 1
sound_vote_no_pitch: 1
sound_already_voted_name: "block.note_block.didgeridoo"
sound_already_voted_volume: 1
sound_already_voted_pitch: 1
sound_vote_already_ended_name: "block.iron_trapdoor.close"
sound_vote_already_ended_volume: 0.875
sound_vote_already_ended_pitch: 1
sound_vote_no_permission_name: "block.candle.extinguish"
sound_vote_no_permission_volume: 1
sound_vote_no_permission_pitch: 1
# --- Lang
lang_prefix: "" # If the message contains more than one text, it works with the [prefix] placeholder.
lang_no_permission: "&cYou don't have permission to use this command!" # Placeholders > [permission]
lang_this_cmd_doesnt_exists: "&e/timedvote &6[command]" and " &6• &cThis command doesn't exist!" # Placeholders > [command]
lang_this_cmd_for_players_msg: "&cOnly players can use this command!"
lang_help: "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r", "&e/timedvote preview <vote/sound/actionbar>...", " &6• &7Preview a timed vote.", "&e/timedvote start <vote name>", " &6• &7Start a timed vote.", "&e/timedvote cancel", " &6• &7Cancel an ongoing vote.", "&e/timedvote reload [module]", " &6• &7Reload the skript." and "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r"
lang_preview_arg2_error: "&e/timedvote preview &6[argument]" and " &6• &cThis argument doesn't exist." # Placeholders > [argument]
lang_preview_arg2_else: "&e/timedvote preview <vote/sound/actionbar>" and " &6• &7Type one of these arguments."
lang_preview_arg2_vote_error: "&e/timedvote preview vote &6[vote name]" and " &6• &cThis timed vote doesn't exist." # Placeholders > [vote name]
lang_preview_arg2_vote_else: "&e/timedvote preview vote <vote name>" and " &6• &7Type a timed vote."
lang_preview_arg2_vote_arg1_error: "&e/timedvote preview vote [vote name] &6[message type]" and " &6• &cThis message type doesn't exist." # Placeholders > [vote name] | [message type]
lang_preview_arg2_vote_arg1_else: "&e/timedvote preview vote [vote name] <start/finish_yes/finish_no>" and " &6• &7Type a message type to preview." # Placeholders > [vote name]
lang_preview_arg2_sound_error: "&e/timedvote preview sound &6[sound name]" and " &6• &cThis sound doesn't exist." # Placeholders > [sound name]
lang_preview_arg2_sound_else: "&e/timedvote preview sound <sound name>" and " &6• &7Type a sound name."
lang_start_arg2_error: "&e/timedvote start &6[vote name]" and " &6• &cThis timed vote doesn't exist." # Placeholders > [vote name]
lang_start_arg2_else: "&e/timedvote start <vote name>" and " &6• &7Type a timed vote."
lang_reload_arg2_error: "&e/timedvote reload &6[module]" and " &6• &cThis module doesn't exist." # Placeholders > [module]
lang_preview_vote_start: "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r", "[preview]" and "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r" # Placeholders > [preview]
lang_preview_vote_finish_yes: "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r", "[preview]" and "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r" # Placeholders > [preview]
lang_preview_vote_finish_no: "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r", "[preview]" and "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r" # Placeholders > [preview]
lang_preview_permission: "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r", "[preview]" and "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript (Preview) &8&m● • ● • ●&r" # Placeholders > [preview]
lang_no_messages: "&cNo messages have been configured for this vote yet: &e[vote name]" # Placeholders > [vote name]
lang_cancel_vote_by_reload_broadcast: "&7The current vote has been &ccancelled &7due to a &esystem reload&7!"
lang_cancel_vote_broadcast: "&7The current vote has been &ccancelled &7by a staff!" # Placeholders > [staff]
lang_cancel_vote_success: "&aSuccessfully cancelled the active vote."
lang_error_cancel_no_active: "&cThere are no active votes to cancel at the moment."
lang_vote_success_yes: "&eYou have successfully voted for &aYES&e!"
lang_vote_already_yes: "&dYou have already voted for &aYES&e."
lang_vote_success_no: "&eYou have successfully voted for &cNO&e!"
lang_vote_already_no: "&dYou have already voted for &cNO&e."
lang_vote_expired: "&cThis vote has already ended."
lang_message_yes: "&a[Yes]"
lang_hover_message_yes: "&aClick to vote YES"
lang_message_no: "&c[No]"
lang_hover_message_no: "&cClick to vote NO"
# Type "%%" for "%"
lang_actionbar_track: "&a([+percentage]%%) [+] ← &e[duration]s &c→ [-] ([-percentage]%%)" # Placeholders > [eligiblePlayers] | [duration] | [+] | [-] | [/] | [+percentage] | [-percentage]
on load:
loop {timedVote_timedVotes::*}:
delete {timedVote_timedVotes::%loop-value%::start_messages::*}
delete {timedVote_timedVotes::%loop-value%::commands::*}
delete {timedVote_timedVotes::%loop-value%::permission}
delete {timedVote_timedVotes::*}
# --- Config (You will edit this section) + (Type "%%" for "%")
# create_timedVote("vote_name", duration)
# add_timedVote_message_start("vote_name", "message") # Placeholders > [eligiblePlayers] | [yes] | [no]
# add_timedVote_message_finish_yes("vote_name", "message") # Placeholders > [eligiblePlayers] | [+] | [-] | [/] | [+percentage] | [-percentage]
# add_timedVote_message_finish_no("vote_name", "message") # Placeholders > [eligiblePlayers] | [+] | [-] | [/] | [+percentage] | [-percentage]
# add_timedVote_command("vote_name", "command")
# set_timedVote_permission("vote_name", "permission")
# add_timedVote_message_permission("vote_name", "permission")
create_timedVote("morning", 20)
add_timedVote_command("morning", "time add 10000")
add_timedVote_message_start("morning", "&r")
add_timedVote_message_start("morning", "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r")
add_timedVote_message_start("morning", " &eDo you want to skip to morning?")
add_timedVote_message_start("morning", " &6• &7Duration: &e20s &7| &a[yes] &7/ &c[no]")
add_timedVote_message_start("morning", "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r")
add_timedVote_message_start("morning", "&r")
add_timedVote_message_finish_yes("morning", "&r")
add_timedVote_message_finish_yes("morning", "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r")
add_timedVote_message_finish_yes("morning", " &eSkipping straight to the morning...")
add_timedVote_message_finish_yes("morning", " &6• &7Result: &a[+percentage]%%")
add_timedVote_message_finish_yes("morning", "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r")
add_timedVote_message_finish_yes("morning", "&r")
add_timedVote_message_finish_no("morning", "&r")
add_timedVote_message_finish_no("morning", "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r")
add_timedVote_message_finish_no("morning", " &eThe night continues where it left off...")
add_timedVote_message_finish_no("morning", " &6• &7Result: &c[-percentage]%%")
add_timedVote_message_finish_no("morning", "&8&m● • ● • ●&r &6nqaaN's Timed Vote Skript &8&m● • ● • ●&r")
add_timedVote_message_finish_no("morning", "&r")
at 21:00 in "world": # 15000 Ticks
start_timedVote("morning")
