Files
bingo.sk
Code
1 175
bingo.sk
options:
prefix: &6[Bingo]&r
bingo-items: 25
function bingoSetCard(p: player):
clear {_lore::*}
add "&7Twoje cele:" to {_lore::*}
loop {@bingo-items} times:
set {_goal} to {bingo.targets::%loop-number%}
if {bingo.completed::%loop-number%} is set:
add "&a✓ %{_goal}%" to {_lore::*}
else:
add "&7• %{_goal}%" to {_lore::*}
set {_card} to map named "&6Karta Bingo"
set lore of {_card} to {_lore::*}
set offhand tool of {_p} to {_card}
function bingoGiveCard(p: player):
if {_p}'s offhand tool is not map named "&6Karta Bingo":
if {_p}'s offhand tool is not air:
set {_oldItem} to {_p}'s offhand tool
give {_oldItem} to {_p}
bingoSetCard({_p})
function bingoSnapshot(p: player):
loop {@bingo-items} times:
set {_goal} to {bingo.targets::%loop-number%}
set {_amount} to amount of {_goal} in {_p}'s inventory
set {bingo.lastcount::%{_p}%::%loop-number%} to {_amount}
function bingoScanPlayer(p: player):
loop {@bingo-items} times:
set {_goal} to {bingo.targets::%loop-number%}
set {_amount} to amount of {_goal} in {_p}'s inventory
if {bingo.lastcount::%{_p}%::%loop-number%} is not set:
set {bingo.lastcount::%{_p}%::%loop-number%} to {_amount}
else:
if {_amount} > {bingo.lastcount::%{_p}%::%loop-number%}:
set {bingo.lastcount::%{_p}%::%loop-number%} to {_amount}
if {bingo.completed::%loop-number%} is not set:
set {bingo.completed::%loop-number%} to true
broadcast "{@prefix} &a%name of {_p}% zdobył(a) &e%{_goal}%&a!"
loop all players:
if loop-player's offhand tool is map named "&6Karta Bingo":
bingoSetCard(loop-player)
else:
set {bingo.lastcount::%{_p}%::%loop-number%} to {_amount}
function bingoStart():
delete {bingo.targets::*}
delete {bingo.completed::*}
delete {bingo.lastcount::*}
delete {bingo.pool::*}
add diamond to {bingo.pool::*}
add emerald to {bingo.pool::*}
add iron ingot to {bingo.pool::*}
add gold ingot to {bingo.pool::*}
add copper ingot to {bingo.pool::*}
add coal to {bingo.pool::*}
add redstone to {bingo.pool::*}
add lapis lazuli to {bingo.pool::*}
add amethyst shard to {bingo.pool::*}
add quartz to {bingo.pool::*}
add obsidian to {bingo.pool::*}
add blaze rod to {bingo.pool::*}
add ender pearl to {bingo.pool::*}
add slimeball to {bingo.pool::*}
add bone to {bingo.pool::*}
add string to {bingo.pool::*}
add gunpowder to {bingo.pool::*}
add leather to {bingo.pool::*}
add spider eye to {bingo.pool::*}
add feather to {bingo.pool::*}
add sugar to {bingo.pool::*}
add bread to {bingo.pool::*}
add apple to {bingo.pool::*}
add oak log to {bingo.pool::*}
add cobblestone to {bingo.pool::*}
add sand to {bingo.pool::*}
add glass to {bingo.pool::*}
add cactus to {bingo.pool::*}
add wheat to {bingo.pool::*}
add carrot to {bingo.pool::*}
add potato to {bingo.pool::*}
add pumpkin to {bingo.pool::*}
add melon slice to {bingo.pool::*}
add flint to {bingo.pool::*}
add prismarine shard to {bingo.pool::*}
add glowstone dust to {bingo.pool::*}
add nautilus shell to {bingo.pool::*}
add phantom membrane to {bingo.pool::*}
add honey bottle to {bingo.pool::*}
add raw iron to {bingo.pool::*}
add raw gold to {bingo.pool::*}
set {_available::*} to {bingo.pool::*}
loop {@bingo-items} times:
set {_goal} to random element out of {_available::*}
set {bingo.targets::%loop-number%} to {_goal}
remove {_goal} from {_available::*}
set {bingo.active} to true
loop all players:
bingoGiveCard(loop-player)
bingoSnapshot(loop-player)
teleport loop-player to spawn point of world of loop-player
command /startbingo:
permission: bingo.admin
permission message: &cNie masz uprawnień do rozpoczęcia Bingo.
trigger:
if {bingo.active} is true:
send "{@prefix} &cBingo już trwa. Użyj /bingorestart, aby wylosować nowe cele."
stop
bingoStart()
broadcast "{@prefix} &aBingo rozpoczęte! Karta jest w twojej drugiej ręce."
command /bingorestart:
permission: bingo.admin
permission message: &cNie masz uprawnień do restartu Bingo.
trigger:
bingoStart()
broadcast "{@prefix} &eBingo zrestartowane — wylosowano nowe cele!"
command /bingostop:
permission: bingo.admin
permission message: &cNie masz uprawnień do zatrzymania Bingo.
trigger:
delete {bingo.active}
delete {bingo.targets::*}
delete {bingo.completed::*}
delete {bingo.lastcount::*}
loop all players:
if loop-player's offhand tool is map named "&6Karta Bingo":
set loop-player's offhand tool to air
set {_target} to location at 0, 0, 0 in world of loop-player
set {_highest} to highest block at {_target}
set {_target} to location of {_highest}
add 1 to y-coordinate of {_target}
teleport loop-player to {_target}
broadcast "{@prefix} &cBingo zatrzymane. Wszyscy zostali teleportowani na X=0, Z=0."
every 5 ticks:
if {bingo.active} is true:
loop all players:
bingoScanPlayer(loop-player)
on join:
if {bingo.active} is true:
wait 1 tick
bingoGiveCard(player)
bingoSnapshot(player)
on drop:
if {bingo.active} is true:
if event-item is map named "&6Karta Bingo":
cancel event
on swap hand items:
if {bingo.active} is true:
if player's offhand tool is map named "&6Karta Bingo":
cancel event
on death of player:
if {bingo.active} is true:
loop drops:
if loop-item is map named "&6Karta Bingo":
remove loop-item from drops
on respawn:
if {bingo.active} is true:
wait 1 tick
bingoGiveCard(player)
bingoSnapshot(player)