Skip to content

Instantly share code, notes, and snippets.

@Olyno

Olyno/test.py Secret

Last active August 16, 2020 16:10
Show Gist options
  • Save Olyno/b94dce1015b22a99f5848767ceeac372 to your computer and use it in GitHub Desktop.
Save Olyno/b94dce1015b22a99f5848767ceeac372 to your computer and use it in GitHub Desktop.
import:
org.bukkit.Bukkit
on load:
set {chars::*} to split "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" at ""
function getRandomCode(amount: number) :: string:
set {_code} to ""
loop {_amount} times:
set {_char} to random element of {chars::*}
set {_code} to "%{_code}%%{_char}%"
return {_code}
command test <string>:
trigger:
# SkBee
if arg-1 is "skbee":
set {_start} to now
set {_startTime} to now
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
set title of player's scoreboard to "%{_code}%"
set {_time} to difference between {_startTime} and now
send "Change title time: %{_time}%"
set {_startTime} to now
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
set line 1 of player's scoreboard to "%{_code}%"
set {_time} to difference between {_startTime} and now
send "Change line time: %{_time}%"
set {_time} to difference between {_start} and now
send "Done in %{_time}%"
# Skript-mirror
else if arg-1 is "skm":
set {_start} to now
set {_startTime} to now
Bukkit.getServer().getPluginManager().getPlugin("TitleManager").giveScoreboard(player)
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
Bukkit.getServer().getPluginManager().getPlugin("TitleManager").setScoreboardTitle(player and {_code})
set {_time} to difference between {_startTime} and now
send "Change title time: %{_time}%"
set {_startTime} to now
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
Bukkit.getServer().getPluginManager().getPlugin("TitleManager").setScoreboardValue(player, 0 and {_code})
set {_time} to difference between {_startTime} and now
send "Change line time: %{_time}%"
set {_time} to difference between {_start} and now
send "Done in %{_time}%"
# Skore
else if arg-1 is "skore":
set {_start} to now
set {_startTime} to now
setup skoreboard for player
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
set title of skoreboard player to {_code}
set {_time} to difference between {_startTime} and now
send "Change title time: %{_time}%"
set {_startTime} to now
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
set slot 1 of skoreboard player to {_code}
set {_time} to difference between {_startTime} and now
send "Change line time: %{_time}%"
set {_time} to difference between {_start} and now
send "Done in %{_time}%"
# SkRayFall
else if arg-1 is "skray":
set {_start} to now
set {_startTime} to now
loop 5 times:
wipe player's sidebar
set {_code} to getRandomCode(5 * loop-value)
set name of sidebar of player to {_code}
set {_time} to difference between {_startTime} and now
send "Change title time: %{_time}%"
set {_startTime} to now
loop 5 times:
set {_code} to getRandomCode(5 * loop-value)
set score {_code} in sidebar of player to 1
set {_time} to difference between {_startTime} and now
send "Change line time: %{_time}%"
set {_time} to difference between {_start} and now
send "Done in %{_time}%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment