Version: 1.12.2
Version of Skript: v37c
Addons: SkQuery, Skelett, SkRayFall, MundoSK, TuSKe
Error:
Skript:
on script load:
set {_&} to "&"
if yaml value "CHAT-FORMAT" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "CHAT-FORMAT" from file "plugins/Battlegrounds/config.yml" to "%{_&}%3{player} %{_&}%8%{_&}%l{arrow-right} %{_&}%7{message}"
if yaml value "COMMANDS.KILL" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "COMMANDS.KILL" from file "plugins/Battlegrounds/config.yml" to "eco give {player} 5"
if yaml value "COMMANDS.WIN" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "COMMANDS.WIN" from file "plugins/Battlegrounds/config.yml" to "eco give {player} 20"
if yaml value "COMMANDS.GOAL" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "COMMANDS.GOAL" from file "plugins/Battlegrounds/config.yml" to "eco give {player} 10"
if yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml" to 30
if yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml" to 3
if yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml" to 30
if yaml value "MIX.ENABLE-CHESTS" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MIX.ENABLE-CHESTS" from file "plugins/Battlegrounds/config.yml" to true
if yaml value "ITEMS.LEAVE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "ITEMS.LEAVE" from file "plugins/Battlegrounds/config.yml" to "bed_item"
if yaml value "ITEMS.LEAVE-NAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "ITEMS.LEAVE-NAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%c%{_&}%lLEAVE"
if yaml value "MESSAGES.PREFIX" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.PREFIX" from file "plugins/Battlegrounds/config.yml" to "%{_&}%6%{_&}%lBATTLEGROUNDS %{_&}%8%{_&}%l{arrow-right} %{_&}%7"
if yaml value "MESSAGES.JOIN-MESSAGE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.JOIN-MESSAGE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%a{player} %{_&}%ehas joined to the game."
if yaml value "MESSAGES.LEFT-MESSAGE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.LEFT-MESSAGE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%a{player} %{_&}%ehas left the game."
if yaml value "MESSAGES.STARTING-IN" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.STARTING-IN" from file "plugins/Battlegrounds/config.yml" to "%{_&}%eStarting in %{_&}%6{seconds} %{_&}%eseconds"
if yaml value "SCOREBOARD.WEBSITE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "SCOREBOARD.WEBSITE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%eMC.SERVER.NET"
if yaml value "STATUS.INGAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "STATUS.INGAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%cINGAME"
if yaml value "STATUS.STARTING" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "STATUS.STARTING" from file "plugins/Battlegrounds/config.yml" to "%{_&}%3STARTING..."
if yaml value "STATUS.WAITING" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "STATUS.WAITING" from file "plugins/Battlegrounds/config.yml" to "%{_&}%aWAITING"
if yaml value "MESSAGES.IN-GAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.IN-GAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%cYou are already in game."
if yaml value "MESSAGES.NOT-IN-GAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.NOT-IN-GAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%c%{_&}%lYou are not in game."
if yaml value "MESSAGES.KILL-MESSAGE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.KILL-MESSAGE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%7{victim} %{_&}%7was killed by %{_&}%7{killer}"
if yaml list "MESSAGES.SUMMARY" from file "plugins/Battlegrounds/config.yml" is not set:
add "%{_&}%a----------------------------------------------", " ", " %{_&}%e%{_&}%lBATTLE ROYALE ", " ", " %{_&}%fWINNER - %{_&}%7{winner} ", " ", " %{_&}%3KILLS - %{_&}%7{kills} ", " " and "%{_&}%a----------------------------------------------" to {_SUMMARY::*}
loop {_SUMMARY::*}:
add "%loop-value%" to yaml list "MESSAGES.SUMMARY" from file "plugins/Battlegrounds/config.yml"
if yaml value "Min-Items" from file "plugins/Battlegrounds/chest.yml" is not set:
set yaml value "Min-Items" from file "plugins/Battlegrounds/chest.yml" to 3
if yaml value "Max-Items" from file "plugins/Battlegrounds/chest.yml" is not set:
set yaml value "Max-Items" from file "plugins/Battlegrounds/chest.yml" to 7
if yaml list "CHEST" from file "plugins/Battlegrounds/chest.yml" is not set:
add 1 stone_sword,1 diamond,1 golden_carrot,1 golden_apple, 1 bread,1 baked potato,1 cooked_beef,1 cooked_porkchop,1 cooked_chicken,1 iron_helmet,1 iron_chestplate,1 iron_leggings,1 iron_boots,1 chainmail_helmet,1 chainmail_chestplate,1 chainmail_leggings,1 chainmail_boots,1 golden_helmet,1 golden_chestplate,1 golden_leggings,1 golden_boots,1 bow, 1 pumpkin pie, 1 raw porkchop, 1 raw_chicken, 1 cookie, 1 cooked_fish, 1 stone_sword, 1 wooden_sword, 1 stone_axe, 1 wooden_axe, 1 fishing_rod, 1 bow, 5 arrows, 1 iron_ingot, 1 gold_ingot, 1 stick, 1 feather, 1 leather_helmet, 1 leather_chestplate, 1 leather_leggings, leather_boots and 5 arrows to {_list::*}
loop {_list::*}:
add "%loop-value%" to yaml list "CHEST" from file "plugins/Battlegrounds/chest.yml"
delete {BG::*}
loop "CHAT-FORMAT", "ITEMS.LEAVE", "ITEMS.LEAVE-NAME", "SCOREBOARD.WEBSITE", "COMMANDS.KILL", "COMMANDS.WIN", "MESSAGES.PREFIX", "MESSAGES.JOIN-MESSAGE", "MESSAGES.LEFT-MESSAGE", "MESSAGES.IN-GAME", "STATUS.WAITING", "STATUS.INGAME", "STATUS-STARTING", "MESSAGES.NOT-IN-GAME", "MESSAGES.NOT-IN-GAME", "MESSAGES.KILL-MESSAGE" and "MESSAGES.STARTING-IN":
set {BG::CONFIG::%loop-value%} to yaml value "%loop-value%" from file "plugins/Battlegrounds/config.yml"
loop {BG::CONFIG::*}:
replace all "&" with "§" in {BG::CONFIG::%loop-index%}
replace all "{arrow-right}" with "»" in {BG::CONFIG::%loop-index%}
replace all "{arrow-left}" with "«" in {BG::CONFIG::%loop-index%}
function format_slot(inv: inventory, slot: number, amount: number, item: item, name: text = "", lore: text = ""):
{_lore} is not "":
set {_line} to 1
loop {_lore} split at "||":
set line {_line} of the lore of {_item} to colored loop-value
add 1 to {_line}
set slot {_slot} of {_inv} to {_amount} of {_item} named {_name}
command /battlegrouns [<text>] [<text>] [<text>] [<number>]:
aliases: bg
executable by: players
trigger:
if arg-1 is "help" or "createarena" or "setspawn" or "join" or "leave" or "setlobby" or "deleteArena" or "list" or "autojoin" or "savearena" or "autojoin" or "stats" or "setarenalobby" or "setcenter" or "set-route-start" or "set-route-end" or "save-route" or "remove-route" or "start" or "border" or "reload" or "setbordersize":
if arg 1 is "help":
if player have permission "bg.player":
send "&7&l------------&8[ &6&lBATTLEGROUNDS &8]&7&l------------"
send "&7/bg list"
send "&7/bg join &8(&7arena_name&8)"
send "&7/bg autojoin"
send "&7/bg leave"
if player have permission "bg.admin":
send "&7/bg Start"
send "&7/bg ResetStats &8(&7player_name&8)"
send "&7/bg SetLobby"
send "&7/bg CreateArena &8(&7arena_name&8)"
send "&7/bg SetArenaLobby &8(&7arena_name&8)"
send "&7/bg SetCenter &8(&7arena_name&8)"
send "&7/bg Set-Route-Start &8(&7arena_name&8)"
send "&7/bg Set-Route-End &8(&7arena_name&8)"
send "&7/bg Save-Route &8(&7arena_name&8)"
send "&7/bg Remove-Route &8(&7arena_name&8)"
send "&7/bg Border &8(&7arena_name&8) &8(&7add/list&8/&7remove)"
send "&7/bg SetBorderSize &8(&7arena_name&8) &8(&7first border size&8)"
send "&7/bg SaveArena &8(&7arena_name&8)"
send "&7/bg DeleteArena &8(&7arena_name&8)"
send "&7&l------------------------------------------"
stop
if arg 1 is "join":
bg_join(player, arg-2)
if arg 1 is "list":
if {bg.player::%uuid of player%.state} is not set:
open chest inventory with 6 rows named "&8&l» &7BATTLEGROUNDS - ARENAS" to player
set {_slot} to 10
set slot 0, 1, 2, 3, 4, 5, 6, 7, 17, 26, 35, 44, 18, 27, 36, 9, 45, 46, 47, 48, 49, 50, 51, 52, 53 and 8 of player's current inventory to green glass named "&8 "
loop {bg.arenas::*}:
format_slot(player's current inventory, {_slot}, 1, green clay, "&e", "&8&l» &7NAME: &c&l%loop-value%||||&8&l» &7PLAYING: &3%size of {bg.arena.%loop-value%.ninjas::*}%||||&8&l» &7STATE: &a%{bg.arena.%loop-value%.status}%")
add 1 to {_slot}
if {_slot} is 17 or 26 or 35:
add 2 to {_slot}
if arg 1 is "leave":
bg_leave(player)
if arg 1 is "autojoin":
if {bg.player::%uuid of player%.state} is not set:
loop {bg.arenas::*}:
if {bg.arena.%loop-value%.status} is "WAITING" or "STARTING":
bg_join(player, loop-value)
stop
if arg-1 is "stats":
send "&e&l✦&7&l&m--------------------------------------&e&l✦"
send ""
send "&8&l» &6&lBATTLEGROUNDS STATS &8&l«"
send ""
send "&6&l» &7&lWINS &c%{bg.stats.wins::%uuid of player%}%"
send "&6&l» &7&lKILLS &c%{bg.stats.kills::%uuid of player%}%"
send "&6&l» &7&lDEATHS &c%{bg.stats.deaths::%uuid of player%}%"
send ""
send "&e&l✦&7&l&m--------------------------------------&e&l✦"
if arg 1 is "createarena":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.state} is not set:
set {bg.arena.%arg-2%.state} to "created"
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been created!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena already exists!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aSpecify Arena!"
if arg 1 is "setarenalobby":
if player has permission "bg.admin":
if {bg.arena.%arg-2%.state} is "created" or "ready":
set {bg.arena.%arg-2%.lobby} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLobby for Arena &3%arg-2% &ahas been set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
if arg 1 is "setlobby":
if player has permission "bg.admin":
set {bg.lobby} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLobby set."
if arg 1 is "set-route-start":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is not set:
set {bg.arena.%arg-2%.route.id} to 1
set {bg.arena.%arg-2%.start.%{bg.arena.%arg-2%.route.id}%} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aStart with id &e&n%{bg.arena.%arg-2%.route.id}%&r &aset."
if arg 1 is "set-route-end":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is not set:
set {bg.arena.%arg-2%.route.id} to 1
set {bg.arena.%arg-2%.end.%{bg.arena.%arg-2%.route.id}%} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aEnd with id &e&n%{bg.arena.%arg-2%.route.id}%&r &aset."
if arg 1 is "save-route":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is set:
if {bg.arena.%arg-2%.start.%{bg.arena.%arg-2%.route.id}%} and {bg.arena.%arg-2%.end.%{bg.arena.%arg-2%.route.id}%} is set:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aRoute with id &e&n%{bg.arena.%arg-2%.route.id}%&r&a saved."
add 1 to {bg.arena.%arg-2%.route.id}
if arg 1 is "remove-route":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is set:
delete {bg.arena.%arg-2%.start.%{bg.arena.%arg-2%.route.id}%} and {bg.arena.%arg-2%.end.%{bg.arena.%arg-2%.route.id}%}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aDelete route with id &e&n%{bg.arena.%arg-2%.route.id}%&r&a."
remove 1 from {bg.arena.%arg-2%.route.id}
if arg 1 is "setcenter":
if player has permission "bg.admin":
set {bg.arena.%arg-2%.center} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aCenter set."
if arg 1 is "setbordersize":
if player has permission "bg.admin":
set {bg.arena.%arg-2%.first-border} to arg-3 parsed as number
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aBorder size set."
if arg 1 is "resetstats":
if player has permission "bg.admin":
set {_p} to arg-2 parsed as player
bg_stats("reset", {_p})
send "%{BG::CONFIG::MESSAGES.PREFIX}% &cReseted Stats for &a%{_p}%"
if arg 1 is "border":
if player has permission "bg.admin":
if arg-3 is "add":
if {bg.arena.%arg-2%.border.id} is not set:
set {bg.arena.%arg-2%.border.id} to 1
set {bg.arena.%arg-2%.BORDERS::%{bg.arena.%arg-2%.border.id}%} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aAdded border with id ##%{bg.arena.%arg-2%.border.id}% to your location."
add 1 to {bg.arena.%arg-2%.border.id}
else if arg-3 is "list":
send "&a○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○"
loop {bg.arena.%arg-2%.BORDERS::*}:
send "&a##%loop-index% &e&n%loop-value%"
send "&a○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○"
else if arg-3 is "remove":
if arg-4 is set:
delete {bg.arena.%arg-2%.BORDERS::%arg-4%}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &cDeleted border with id ##%arg-4%."
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &a/bg border (arena) [add/list/remove = (id)]"
if arg 1 is "start":
if player has permission "bg.admin":
#size of {bg.arena.%{bg.player::%uuid of player%.arena}%.ninjas::*} > 1
bg_start({bg.player::%uuid of player%.arena})
if arg 1 is "reload":
if player has permission "bg.admin":
broadcast "%{BG::CONFIG::MESSAGES.PREFIX}% &aReloading..."
make console execute command "sk reload %script%"
if arg 1 is "savearena":
if player has permission "bg.admin":
if {bg.arena.%arg-2%.state} is "created":
if {bg.arena.%arg-2%.lobby} is set:
if {bg.arena.%arg-2%.start.1} is set:
if {bg.arena.%arg-2%.end.1} is set:
if {bg.arena.%arg-2%.center} is set:
if {bg.arena.%arg-2%.first-border} is set:
if size of {bg.arena.%arg-2%.BORDERS::*} > 1:
set {bg.arena.%arg-2%.state} to "ready"
add arg-2 to {bg.arenas::*}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been saved."
bg_resetarena(arg-2)
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aNo border locations added!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aBorder size is not set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aCenter is not set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aEnd point is not set"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aStart point is not set"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLobby is not set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
if arg 1 is "deletearena":
if player has permission "bg.admin":
if {bg.arena.%arg-2%.state} is set:
bg_resetarena(arg-2)
delete {bg.arena.%arg-2%.lobby}
delete {bg.arena.%arg-2%.center}
delete {bg.arena.%arg-2%.seconds}
delete {bg.arena.%arg-2%.minutes}
delete {bg.arena.%arg-2%.status}
delete {bg.arena.%arg-2%.BORDERS::*}
delete {bg.arena.%arg-2%.border.status}
delete {bg.arena.%arg-2%.ninjas::*}
delete {bg.arena.%arg-2%.border-size}
delete {bg.arena.%arg-2%.game-center}
delete {bg.arena.%arg-2%.state}
delete {bg.arena.%arg-2%.center}
loop {bg.arena.%arg-2%.route.id} times:
delete {bg.arena.%arg-2%.start.%loop-number%}
delete {bg.arena.%arg-2%.end.%loop-number%}
delete {bg.arena.%arg-2%.route.id}
remove arg-2 from {bg.arenas::*}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been deleted."
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
else:
make player execute command "bg help"
on chat:
if {bg.player::%uuid of player%.state} is "IN-GAME":
cancel event
set {_msg} to {BG::CONFIG::CHAT-FORMAT}
replace all "{player}" in {_msg} with player's displayname
replace all "&" with " " in message
replace all "{message}" with message in {_msg}
send {_msg} to {bg.arena.%{bg.player::%uuid of player%.arena}%.ninjas::*}
on drop:
if {bg.arena.%{bg.player::%uuid of player%.arena}%.status} is "STARTING" or "WAITING":
cancel event
on right click on chest:
if {bg.player::%uuid of player%.state} is "IN-GAME":
yaml value "MIX.ENABLE-CHESTS" from file "plugins/Battlegrounds/config.yml" is true
if {bg.arena.%{bg.player::%uuid of player%.arena}%.CHESTS::%location of event-block%} is not set:
clear inventory of block at event-block
set {_min} to yaml value "Min-Items" from file "plugins/Battlegrounds/chest.yml"
set {_max} to yaml value "Max-Items" from file "plugins/Battlegrounds/chest.yml"
set {_items} to random number between {_min} and {_max}
set {_loot::*} to yaml list "CHEST" from file "plugins/Battlegrounds/chest.yml"
loop rounded {_items} times:
set {_slot} to a random number between 0 and 26
set {_random} to a random element out of {_loot::*}
add {_random} parsed as material to slot {_slot} of block at event-block
set {bg.arena.%{bg.player::%uuid of player%.arena}%.CHESTS::%location of event-block%} to location of event-block
on hunger bar change:
if {bg.player::%uuid of player%.state} is "IN-GAME":
if {bg.arena.%{bg.player::%uuid of player%.arena}%.status} is "STARTING" or "WAITING":
set player's hunger to 20
on damage of player:
if {bg.player::%uuid of victim%.state} is "IN-GAME":
if {bg.arena.%{bg.player::%uuid of victim%.arena}%.status} is "STARTING" or "WAITING":
cancel event
damage was caused by void
teleport victim to {bg.arena.%{bg.player::%uuid of victim%.arena}%.lobby}
if {bg.arena.%{bg.player::%uuid of victim%.arena}%.status} is "INGAME":
metadata value "BG-LANDED" of victim is not set:
cancel event
if damage >= health of victim:
cancel event
add 1 to {bg.player::%uuid of attacker%.kills}
show an action bar from "&7You killed %victim% with %attacker's tool% &7- %size of {bg.arena.%{bg.player::%uuid of attacker%.arena}%.ninjas::*}% &7left &c&l%{bg.player::%uuid of attacker%.kills}% &c&lKILLS" to attacker
bg_death(victim)
if attacker is player:
attacker is not victim
set metadata value "LAST-HIT" of victim to attacker
damage was caused by void:
cancel event
bg_death(victim)
function bg_remove(p: player, arena: text):
remove {_p} from {bg.arena.%{_arena}%.ninjas::*}
if {bg.arena.%{_arena}%.status} is "INGAME":
size of {bg.arena.%{_arena}%.ninjas::*} is 1:
set {_winner} to random element out of {bg.arena.%{_arena}%.ninjas::*}
set {_uuid} to uuid of {_winner}
loop yaml list "MESSAGES.SUMMARY" from file "plugins/Battlegrounds/config.yml":
set {_msg} to loop-value
replace all "{winner}" with "%{_winner}%" in {_msg}
replace all "{kills}" with "%{bg.player::%{_uuid}%.kills}%" in {_msg}
send coloured {_msg} to {bg.arena.%{_arena}%.ninjas::*}
add 1 to {bg.stats.wins::%{_uuid}%}
loop 10 times:
launch "BALL" firework at location of {_winner} timed 1 coloured "RED" and "BLUE" AND "YELLOW" AND "GREEN"
wait a second
bg_resetarena({_arena})
function bg_death(p: player):
metadata value "BG-DEATH" of {_p} is not set:
set metadata value "BG-DEATH" of {_p} to "SET"
set {_uuid} to uuid of {_p}
add 1 to {bg.stats.deaths::%{_uuid}%}
metadata value "LAST-HIT" of {_p} is not set:
set {_y} to "unknown"
else:
set {_y} to metadata value "LAST-HIT" of {_p}
set {_uuid} to uuid of {_y}
add 1 to {bg.stats.kills::%{_uuid}%}
set {_o-o} to {BG::CONFIG::COMMANDS.KILL}
replace all "{player}" in {_o-o} with "%{_y}%"
make console execute command "%{_o-o}%"
set {_msg} to {BG::CONFIG::MESSAGES.KILL-MESSAGE}
replace all "{victim}" in {_msg} with "%{_p}%"
replace all "{killer}" in {_msg} with "%{_y}%"
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}
add {_p} to {bg.arena.%{bg.player::%{_uuid}%.arena}%.bad-ninjas::*}
send {_p} title "&e&l##%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}% &c&lGAME OVER" with subtitle "&eBATTLE ROYALE" for 5 seconds with 0 second fade in and 0 second fade out
bg_remove({_p}, {bg.player::%{_uuid}%.arena})
set {_p}'s gamemode to spectator
set {_helmet} to {_p}'s helmet
set {_chestplate} to {_p}'s chestplate
set {_leggings} to {_p}'s leggings
set {_boots} to {_p}'s boots
loop blocks in radius 1 of {_p}:
loop-block is air
set loop-block to chest
set {bg.arena.%{bg.player::%{_uuid}%.arena}%.CHESTS::%location of loop-block%} to location of loop-block
add {_helmet}, {_chestplate}, {_leggings} and {_boots} to loop-block
loop items in {_p}'s inventory:
add loop-item to loop-block
add 1 golden apple to loop-block
add location of loop-block to {bg.arena.%{bg.player::%{_uuid}%.arena}%.KILL-ME-PLS::*}
set {_block} to true
stop
loop items in {_p}'s inventory:
drop loop-item at {_p}
on load:
delete {bg.player::*}
send "&7&l--------------------------------------------" to console
send " " to console
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLoading &ev.0.0.4-B&a..." to console
wait a tick
broadcast "%{BG::CONFIG::MESSAGES.PREFIX}% &a&lPlugin loaded!"
send " " to console
send "&7&l--------------------------------------------" to console
loop {bg.arenas::*}:
delete {bg.arena.%loop-value-1%.ninjas::*} and {bg.arena.%loop-value-1%.bad-ninjas::*}
bg_resetarena(loop-value)
on unload:
send "&7&l--------------------------------------------" to console
send " " to console
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aDisabling &ev.0.0.4-B&a..." to console
send "%{BG::CONFIG::MESSAGES.PREFIX}% &ev.0.0.4-B &adisabled!" to console
send " " to console
send "&7&l--------------------------------------------" to console
function bg_stats(do: text, p: player):
set {_uuid} to uuid of {_p}
{_do} is "check":
loop "kills", "deaths" and "wins":
{bg.stats.%loop-value%::%{_uuid}%} is not set
set {bg.stats.%loop-value%::%{_uuid}%} to 0
{_do} is "reset":
loop "kills", "deaths" and "wins":
set {bg.stats.%loop-value%::%{_uuid}%} to 0
function bg_leave(p: player):
set {_uuid} to uuid of {_p}
if {bg.player::%{_uuid}%.state} is "IN-GAME":
set {_msg} to {BG::CONFIG::MESSAGES.LEFT-MESSAGE}
replace all "{player}" in {_msg} with {_p}'s displayname
bg_remove({_p}, {bg.player::%{_uuid}%.arena})
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}
loop "fly", "arena", "start", "end" and "state":
delete {bg.player::%{_uuid}%.%loop-value%}
bg_clear_player({_p})
bg_deleteBoard({_p})
teleport {_p} to {bg.lobby}
#need to be removed
lobby({_p})
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{BG::CONFIG::MESSAGES.NOT-IN-GAME}%" to {_p}
function bg_join(p: player, arena: text):
set {_uuid} to uuid of {_p}
if {bg.player::%{_uuid}%.state} is not set:
if {bg.arena.%{_arena}%.state} is "ready":
if {bg.arena.%{_arena}%.status} is "WAITING" or "STARTING":
if size of {bg.arena.%{_arena}%.ninjas::*} < 100:
bg_clear_player({_p})
set {bg.player::%{_uuid}%.state} to "IN-GAME"
set {bg.player::%{_uuid}%.arena} to {_arena}
set {bg.player::%{_uuid}%.kills} to 0
set slot 8 of {_p} to {BG::CONFIG::ITEMS.LEAVE} parsed as material named "%{BG::CONFIG::ITEMS.LEAVE-NAME}%"
add {_p} to {bg.arena.%{_arena}%.ninjas::*}
if size of {bg.arena.%{_arena}%.ninjas::*} = 2:
bg_start_countdown({_arena})
set {_msg} to {BG::CONFIG::MESSAGES.JOIN-MESSAGE}
replace all "{player}" in {_msg} with {_p}'s displayname
replace all "{players-count}" in {_msg} with "%size of {bg.arena.%{_arena}%.ninjas::*}%"
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{_arena}%.ninjas::*}
teleport {_p} to {bg.arena.%{_arena}%.lobby}
bg_createBoard({_p}, "BG-WAITING", 7)
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &7This arena is full" to {_p}
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &7This game is running" to {_p}
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &7This arena not exists" to {_p}
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{BG::CONFIG::MESSAGES.IN-GAME}%" to {_p}
on join:
bg_stats("check", player)
on right click with anything:
if {bg.player::%uuid of player%.state} is "IN-GAME":
name of event-item is {BG::CONFIG::ITEMS.LEAVE-NAME}:
cancel event
bg_leave(player)
on quit:
bg_leave(player)
on flight togge:
if {bg.player::%uuid of player%.state} is "IN-GAME":
if metadata value "BG-FLY" of player is set:
cancel event
on damage of chicken:
metadata value "type" of victim is "PLANE" or "PARACHUTE":
cancel event
function bg_fly_2(p: player, start: location, end: location):
load chunk chunk at {_start}
set {_uuid} to uuid of {_p}
teleport {_p} to {_start}
wait 10 ticks
set {_p}'s flight mode to true
set {_p}'s gamemode to survival
spawn an chicken at {_p}
set {_p-plane-%{_p}%} to spawned chicken
set metadata value "type" of {_p-plane-%{_p}%} to "PLANE"
set metadata value "BG-PLANE" of {_p-plane-%{_p}%} to {_p}
#apply invisibility without any particles to {_p-plane-%{_p}%} for 7 days
make {_p} ride {_p-plane-%{_p}%}
set metadata value "BG-FLY" of {_p} to "SET"
while metadata value "BG-FLY" of {_p} is set:
add 1 to {_title}
set {_v} to vector between {_p} and {_end}
push {_p-plane-%{_p}%} {_v} at speed 0.1
if y-coords of {_p} < y-coords of {_end}:
push {_p-plane-%{_p}%} upwards at speed 0.2
if y-coords of {_p} > y-coords of {_end} +10:
push {_p-plane-%{_p}%} downwards at speed 0.1
if distance between {_p} and {_end} < 30:
bg_parachute({_p})
wait 2 ticks
loop all chickens in radius 2 of {_p}:
metadata value "BG-PLANE" of loop-value is {_p}:
delete loop-value
stop
if distance between {_p} and {_start} > yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml":
{_title} >= 20:
send {_p} title "&e" with subtitle "&ePRESS &bSNEAK &eTO OPEN PARACHUTE" for 1 seconds with 0 second fade in and 0 second fade out
set {_title} to 0
if distance between {_p} and {_end} < 10:
make {_p} dismount
wait a tick
function bg_fly(arena: text):
set {_route} to rounded random number between 1 and {bg.arena.%{_arena}%.route.id} -1
set {_center} to {bg.arena.%{_arena}%.start.%{_route}%}
set {_end} to {bg.arena.%{_arena}%.end.%{_route}%}
set x-coords of {_center} to x-coords of {bg.arena.%{_arena}%.start.%{_route}%} -5
set x-coords of {_end} to x-coords of {bg.arena.%{_arena}%.start.%{_route}%} -5
set {_count} to 0
loop {bg.arena.%{_arena}%.ninjas::*}:
set {bg.player::%uuid of loop-value%.start} to {_center}
set {bg.player::%uuid of loop-value%.end} to {_end}
teleport loop-value to {_center}
apply blindness to loop-value for 3 seconds
bg_fly_2(loop-value, {_center}, {_end})
add 1 to x-coords of {_center}
add 1 to x-coords of {_end}
add 1 to {_count}
{_count} = 10:
add 2 to x-coords of {_center}
add 2 to x-coords of {_end}
set {_count} to 0
function bg_parachute(p: player):
delete metadata value "BG-FLY" of {_p}
set {_p}'s flight mode to false
loop all chickens in radius 2 of {_p}:
metadata value "BG-PARACHUTE" of loop-value is {_p}:
delete loop-value
wait 10 ticks
if {_p} is on ground:
set metadata value "BG-LANDED" of {_p} to "SET"
stop
spawn an chicken at {_p}
set {_p-parachute} to spawned chicken
set metadata value "type" of {_p-parachute} to "PARACHUTE"
#apply invisibility without any particles to {_p-parachute} for 7 days
set metadata value "BG-PARACHUTE" of {_p-parachute} to {_p}
make {_p} ride {_p-parachute}
push {_p} forwards at speed 0.2
while {_p} is not on ground:
{_p} is riding a chicken:
{_p-parachute} is not on ground:
set {_v} to vector between {_p} and block in front of {_p}
push {_p-parachute} {_v} at speed 0.05
push {_p} downwards at speed 0.1
{_p-parachute} is on ground:
make {_p} dismount
set {_loc} to location of {_p}
set y-coords of {_loc} to -100
teleport {_p-parachute} to {_loc}
set metadata value "BG-LANDED" of {_p} to "SET"
push {_p} upwards at speed 0.2
stop
else:
stop
wait a tick
on dismount:
if {bg.player::%uuid of player%.state} is "IN-GAME":
player is riding a chicken
metadata value "BG-FLY" of player is set:
loop all chickens in radius 2 of player:
metadata value "BG-PLANE" of loop-value is player:
delete loop-value
wait a tick
if distance between {bg.player::%uuid of player%.start} and player < yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml":
bg_fly_2(player, {bg.player::%uuid of player%.start}, {bg.player::%uuid of player%.end})
else:
bg_parachute(player)
stop
metadata value "BG-FLY" of player is not set:
wait a tick
bg_parachute(player)
on break:
if {bg.player::%uuid of player%.state} is "IN-GAME":
cancel event
on place:
if {bg.player::%uuid of player%.state} is "IN-GAME":
cancel event
on inventory click:
if display name of top inventory of player is "&8&l» &7BATTLEGROUNDS - ARENAS":
cancel event
set {_arena} to line 1 of the lore of event-item
bg_join(player, last element of {_arena} split at "8&l» &7NAME: &c&l")
function bg_border_shrink(arena: text, size: number):
set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {_size} over 2 minutes
loop 120 times:
if {bg.arena.%{_arena}%.status} is "INGAME":
wait a second
else:
stop
set {_time} to yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml"
set {bg.arena.%{_arena}%.game-center} to {bg.arena.%{_arena}%.center}
bg_game_border({_arena}, {_time}, {bg.arena.%{_arena}%.center})
function bg_game_border(arena: text, minutes: number, center: location):
set {bg.arena.%{_arena}%.minutes} to {_minutes} -1
set {bg.arena.%{_arena}%.seconds} to 60
set {bg.arena.%{_arena}%.border.status} to ""
set {bg.arena.%{_arena}%.game-center} to {_center}
wait a tick
set center of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.game-center}
set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.border-size}
while {bg.arena.%{_arena}%.status} is "INGAME":
remove 1 from {bg.arena.%{_arena}%.seconds}
if {bg.arena.%{_arena}%.seconds} < 9:
set {_sec} to "0%{bg.arena.%{_arena}%.seconds}%"
else:
set {_sec} to {bg.arena.%{_arena}%.seconds}
set {bg.arena.%{_arena}%.border.status} to "&fNEXT BORDER &a0%{bg.arena.%{_arena}%.minutes}%:%{_sec}%"
if {bg.arena.%{_arena}%.seconds} is 1:
if {bg.arena.%{_arena}%.minutes} = 0:
set {bg.arena.%{_arena}%.border.status} to "&cBORDER CLOSING"
set {bg.arena.%{_arena}%.border-size} to {bg.arena.%{_arena}%.border-size}/2
bg_border_shrink({_arena}, {bg.arena.%{_arena}%.border-size})
set {bg.arena.%{_arena}%.minutes} and {bg.arena.%{_arena}%.seconds} to 0
stop
if {bg.arena.%{_arena}%.seconds} is 1:
if {bg.arena.%{_arena}%.minutes} > 0:
remove 1 from {bg.arena.%{_arena}%.minutes}
set {bg.arena.%{_arena}%.seconds} to 59
wait a second
function bg_start(arena: text):
set {bg.arena.%{_arena}%.status} to "INGAME"
set {_time} to yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml"
set {bg.arena.%{_arena}%.border-size} to {bg.arena.%{_arena}%.first-border}
set {_center} to a random element out of {bg.arena.%{_arena}%.BORDERS::*}
bg_game_border({_arena}, {_time}, {_center})
loop {bg.arena.%{_arena}%.ninjas::*}:
#apply blindness to loop-value for 3 seconds
teleport loop-value to {bg.arena.%{_arena}%.start}
bg_clear_player(loop-value)
bg_createBoard(loop-value, "BG-GAME", 11)
wait a second
bg_fly({_arena})
function bg_start_countdown(arena: text):
set {bg.arena.%{_arena}%.status} to "STARTING"
loop {bg.arena.%{_arena}%.seconds} times:
if {bg.arena.%{_arena}%.status} is "STARTING" or "WAITING":
size of {bg.arena.%{_arena}%.ninjas::*} >= 2:
wait a second
remove 1 from {bg.arena.%{_arena}%.seconds}
if {bg.arena.%{_arena}%.seconds} = 1 or 2 or 3 or 4 or 5 or 10:
set {_msg} to {BG::CONFIG::MESSAGES.STARTING-IN}
replace all "{seconds}" in {_msg} with "%{bg.arena.%{_arena}%.seconds}%"
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{_arena}%.ninjas::*}
send {bg.arena.%{_arena}%.ninjas::*} title "&e&lSTARTING IN &c%{bg.arena.%{_arena}%.seconds}%" with subtitle "&eBATTLE ROYALE" for 1 seconds with 0 second fade in and 0 second fade out
if {bg.arena.%{_arena}%.seconds} = 1:
size of {bg.arena.%{_arena}%.ninjas::*} >= 2:
bg_start({_arena})
else:
set {bg.arena.%{_arena}%.status} to "WAITING"
set {bg.arena.%{_arena}%.seconds} to yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml"
stop
function bg_resetarena(arena: text):
loop {bg.arena.%{_arena}%.ninjas::*} and {bg.arena.%{_arena}%.bad-ninjas::*}:
loop "fly", "arena" and "state":
delete {bg.player::%uuid of loop-value-1%.%loop-value-2%}
bg_clear_player(loop-value-1)
bg_deleteBoard(loop-value-1)
set loop-value-1's gamemode to spectator
push loop-value-1 upwards at speed 0.5
teleport loop-value-1 to {bg.lobby}
set loop-value-1's gamemode to survival
#need to be removed
lobby(loop-value-1)
loop {bg.arena.%{_arena}%.CHESTS::*}:
clear inventory of block at loop-value
loop {bg.arena.%{_arena}%.KILL-ME-PLS::*}:
set block at loop-value to air
remove loop-value from {bg.arena.%{_arena}%.KILL-ME-PLS::*}
delete {bg.arena.%{_arena}%.KILL-ME-PLS::*}
delete {bg.arena.%{_arena}%.ninjas::*} and {bg.arena.%{bg.player::%{_uuid}%.arena}%.bad-ninjas::*}
delete {bg.arena.%{_arena}%.CHESTS::*}
set {bg.arena.%{_arena}%.border.status} to ""
loop all entities in radius 50000 around {bg.arena.%{_arena}%.center}:
clear loop-entity
set {bg.arena.%{_arena}%.seconds} to yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml"
set {bg.arena.%{_arena}%.status} to "WAITING"
function bg_clear_player(p: player):
heal {_p}
extinguish {_p}
set {_p}'s food to 20
clear {_p}'s level
clear {_p}'s inventory
set {_p}'s gamemode to survival
set {_p}'s flight mode to false
milk {_p}
loop "LAST-HIT", "BG-DEATH" and "BG-LANDED", "BG-FLY":
delete metadata value "%loop-value%" of {_p}
function bg_deleteBoard(p: player):
loop "BG-GAME" and "BG-WAITING":
if stylish scoreboard "%loop-value-1%-%{_p}%" exists:
loop 15 times:
delete the id based score "%{_p}%Slot%loop-number-2%" in stylish scoreboard "%loop-value-1%-%{_p}%"
delete stylish scoreboard "%loop-value-1%-%{_p}%"
function bg_setSlot(p: player, board: text, slot: integer, t: text):
add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
if {_slot} is between 1 and 15:
set text of id "%{_p}%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"
function bg_createBoard(p: player, t: text, size: integer = 15):
set {_uuid} to uuid of {_p}
bg_deleteBoard({_p})
add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
if stylish scoreboard "%{_t}%-%{_p}%" does not exist:
create new stylish scoreboard named "%{_t}%-%{_p}%"
loop {_size} times:
create a new id based score "%{_p}%Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%-%{_p}%"
wait a tick
set stylish scoreboard of {_p} to "%{_t}%-%{_p}%"
if {_t} is "BG-GAME":
set title of stylish scoreboard "BG-GAME-%{_p}%" to "&eBATTLE ROYALE"
while {bg.arena.%{bg.player::%{_uuid}%.arena}%.status} is "INGAME":
if location of {_p} is in within border:
set {_state} to "&aSAFE"
else:
set {_state} to "&cNOT SAFE"
if stylish scoreboard "BG-GAME-%{_p}%" exists:
bg_setSlot({_p}, "BG-GAME", 11, "&7%now%")
bg_setSlot({_p}, "BG-GAME", 10, "")
bg_setSlot({_p}, "BG-GAME", 9, "&8&l» &a%{bg.arena.%{bg.player::%{_uuid}%.arena}%.border.status}%")
bg_setSlot({_p}, "BG-GAME", 8, "")
bg_setSlot({_p}, "BG-GAME", 7, "&8&l» &fLOCATION %{_state}%")
bg_setSlot({_p}, "BG-GAME", 6, "&8&l» &aSize %{bg.arena.%{bg.player::%{_uuid}%.arena}%.border-size}%&am")
bg_setSlot({_p}, "BG-GAME", 5, "")
bg_setSlot({_p}, "BG-GAME", 4, "&8&l» &fKILLS &a%{bg.player::%{_uuid}%.kills}%")
bg_setSlot({_p}, "BG-GAME", 3, "&8&l» &fPLAYERS LEFT &a%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}%")
bg_setSlot({_p}, "BG-GAME", 2, "")
bg_setSlot({_p}, "BG-GAME", 1, "%{BG::CONFIG::SCOREBOARD.WEBSITE}%")
else:
stop
wait a second
if {_t} is "BG-WAITING":
set title of stylish scoreboard "BG-WAITING-%{_p}%" to "&eBATTLE ROYALE"
while {bg.arena.%{bg.player::%{_uuid}%.arena}%.status} is "WAITING" or "STARTING":
if stylish scoreboard "BG-WAITING-%{_p}%" exists:
bg_setSlot({_p}, "BG-WAITING", 7, "&7%now%")
bg_setSlot({_p}, "BG-WAITING", 6, "")
bg_setSlot({_p}, "BG-WAITING", 5, "&8&l» &fSTARTING IN &a%{bg.arena.%{bg.player::%{_uuid}%.arena}%.seconds}%")
bg_setSlot({_p}, "BG-WAITING", 4, "")
bg_setSlot({_p}, "BG-WAITING", 3, "&8&l» &fPLAYERS &a%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}%")
bg_setSlot({_p}, "BG-WAITING", 2, "")
bg_setSlot({_p}, "BG-WAITING", 1, "%{BG::CONFIG::SCOREBOARD.WEBSITE}%")
else:
stop
wait a second
Error:
indentation error: expected 3 tabs, but found 12 spaces (BG.sk, line 317: teleport victim to {bg.arena.%{bg.player::%uuid of victim%.arena}%.lobby}')
[20:58:46] [Server thread/ERROR] [Minecraft]: indentation error: expected 5 tabs, but found 20 spaces (BG.sk, line 683: send {bg.arena.%{_arena}%.ninjas::*} title "&e&lSTARTING IN &c%{bg.arena.%{_arena}%.seconds}%" with subtitle "&eBATTLE ROYALE" for 1 seconds with 0 second fade in and 0 second fade out')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't understand this condition/effect: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {_size} over 2 minutes (BG.sk, line 618: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {_size} over 2 minutes')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't understand this condition/effect: set center of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.game-center} (BG.sk, line 634: set center of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.game-center}')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't understand this condition/effect: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.border-size} (BG.sk, line 635: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.border-size}')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't compare a location with 'in within border' (BG.sk, line 755: if location of {_p} is in within border:')
[20:58:47] [Server thread/ERROR] [Minecraft]: 'else' has to be placed just after an 'if' or 'else if' section (BG.sk, line 757: else:')
Hello
Could someone fix me my mistake?
Version of Skript: v37c
Addons: SkQuery, Skelett, SkRayFall, MundoSK, TuSKe
Error:
Skript:
on script load:
set {_&} to "&"
if yaml value "CHAT-FORMAT" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "CHAT-FORMAT" from file "plugins/Battlegrounds/config.yml" to "%{_&}%3{player} %{_&}%8%{_&}%l{arrow-right} %{_&}%7{message}"
if yaml value "COMMANDS.KILL" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "COMMANDS.KILL" from file "plugins/Battlegrounds/config.yml" to "eco give {player} 5"
if yaml value "COMMANDS.WIN" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "COMMANDS.WIN" from file "plugins/Battlegrounds/config.yml" to "eco give {player} 20"
if yaml value "COMMANDS.GOAL" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "COMMANDS.GOAL" from file "plugins/Battlegrounds/config.yml" to "eco give {player} 10"
if yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml" to 30
if yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml" to 3
if yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml" to 30
if yaml value "MIX.ENABLE-CHESTS" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MIX.ENABLE-CHESTS" from file "plugins/Battlegrounds/config.yml" to true
if yaml value "ITEMS.LEAVE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "ITEMS.LEAVE" from file "plugins/Battlegrounds/config.yml" to "bed_item"
if yaml value "ITEMS.LEAVE-NAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "ITEMS.LEAVE-NAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%c%{_&}%lLEAVE"
if yaml value "MESSAGES.PREFIX" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.PREFIX" from file "plugins/Battlegrounds/config.yml" to "%{_&}%6%{_&}%lBATTLEGROUNDS %{_&}%8%{_&}%l{arrow-right} %{_&}%7"
if yaml value "MESSAGES.JOIN-MESSAGE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.JOIN-MESSAGE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%a{player} %{_&}%ehas joined to the game."
if yaml value "MESSAGES.LEFT-MESSAGE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.LEFT-MESSAGE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%a{player} %{_&}%ehas left the game."
if yaml value "MESSAGES.STARTING-IN" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.STARTING-IN" from file "plugins/Battlegrounds/config.yml" to "%{_&}%eStarting in %{_&}%6{seconds} %{_&}%eseconds"
if yaml value "SCOREBOARD.WEBSITE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "SCOREBOARD.WEBSITE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%eMC.SERVER.NET"
if yaml value "STATUS.INGAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "STATUS.INGAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%cINGAME"
if yaml value "STATUS.STARTING" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "STATUS.STARTING" from file "plugins/Battlegrounds/config.yml" to "%{_&}%3STARTING..."
if yaml value "STATUS.WAITING" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "STATUS.WAITING" from file "plugins/Battlegrounds/config.yml" to "%{_&}%aWAITING"
if yaml value "MESSAGES.IN-GAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.IN-GAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%cYou are already in game."
if yaml value "MESSAGES.NOT-IN-GAME" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.NOT-IN-GAME" from file "plugins/Battlegrounds/config.yml" to "%{_&}%c%{_&}%lYou are not in game."
if yaml value "MESSAGES.KILL-MESSAGE" from file "plugins/Battlegrounds/config.yml" is not set:
set yaml value "MESSAGES.KILL-MESSAGE" from file "plugins/Battlegrounds/config.yml" to "%{_&}%7{victim} %{_&}%7was killed by %{_&}%7{killer}"
if yaml list "MESSAGES.SUMMARY" from file "plugins/Battlegrounds/config.yml" is not set:
add "%{_&}%a----------------------------------------------", " ", " %{_&}%e%{_&}%lBATTLE ROYALE ", " ", " %{_&}%fWINNER - %{_&}%7{winner} ", " ", " %{_&}%3KILLS - %{_&}%7{kills} ", " " and "%{_&}%a----------------------------------------------" to {_SUMMARY::*}
loop {_SUMMARY::*}:
add "%loop-value%" to yaml list "MESSAGES.SUMMARY" from file "plugins/Battlegrounds/config.yml"
if yaml value "Min-Items" from file "plugins/Battlegrounds/chest.yml" is not set:
set yaml value "Min-Items" from file "plugins/Battlegrounds/chest.yml" to 3
if yaml value "Max-Items" from file "plugins/Battlegrounds/chest.yml" is not set:
set yaml value "Max-Items" from file "plugins/Battlegrounds/chest.yml" to 7
if yaml list "CHEST" from file "plugins/Battlegrounds/chest.yml" is not set:
add 1 stone_sword,1 diamond,1 golden_carrot,1 golden_apple, 1 bread,1 baked potato,1 cooked_beef,1 cooked_porkchop,1 cooked_chicken,1 iron_helmet,1 iron_chestplate,1 iron_leggings,1 iron_boots,1 chainmail_helmet,1 chainmail_chestplate,1 chainmail_leggings,1 chainmail_boots,1 golden_helmet,1 golden_chestplate,1 golden_leggings,1 golden_boots,1 bow, 1 pumpkin pie, 1 raw porkchop, 1 raw_chicken, 1 cookie, 1 cooked_fish, 1 stone_sword, 1 wooden_sword, 1 stone_axe, 1 wooden_axe, 1 fishing_rod, 1 bow, 5 arrows, 1 iron_ingot, 1 gold_ingot, 1 stick, 1 feather, 1 leather_helmet, 1 leather_chestplate, 1 leather_leggings, leather_boots and 5 arrows to {_list::*}
loop {_list::*}:
add "%loop-value%" to yaml list "CHEST" from file "plugins/Battlegrounds/chest.yml"
delete {BG::*}
loop "CHAT-FORMAT", "ITEMS.LEAVE", "ITEMS.LEAVE-NAME", "SCOREBOARD.WEBSITE", "COMMANDS.KILL", "COMMANDS.WIN", "MESSAGES.PREFIX", "MESSAGES.JOIN-MESSAGE", "MESSAGES.LEFT-MESSAGE", "MESSAGES.IN-GAME", "STATUS.WAITING", "STATUS.INGAME", "STATUS-STARTING", "MESSAGES.NOT-IN-GAME", "MESSAGES.NOT-IN-GAME", "MESSAGES.KILL-MESSAGE" and "MESSAGES.STARTING-IN":
set {BG::CONFIG::%loop-value%} to yaml value "%loop-value%" from file "plugins/Battlegrounds/config.yml"
loop {BG::CONFIG::*}:
replace all "&" with "§" in {BG::CONFIG::%loop-index%}
replace all "{arrow-right}" with "»" in {BG::CONFIG::%loop-index%}
replace all "{arrow-left}" with "«" in {BG::CONFIG::%loop-index%}
function format_slot(inv: inventory, slot: number, amount: number, item: item, name: text = "", lore: text = ""):
{_lore} is not "":
set {_line} to 1
loop {_lore} split at "||":
set line {_line} of the lore of {_item} to colored loop-value
add 1 to {_line}
set slot {_slot} of {_inv} to {_amount} of {_item} named {_name}
command /battlegrouns [<text>] [<text>] [<text>] [<number>]:
aliases: bg
executable by: players
trigger:
if arg-1 is "help" or "createarena" or "setspawn" or "join" or "leave" or "setlobby" or "deleteArena" or "list" or "autojoin" or "savearena" or "autojoin" or "stats" or "setarenalobby" or "setcenter" or "set-route-start" or "set-route-end" or "save-route" or "remove-route" or "start" or "border" or "reload" or "setbordersize":
if arg 1 is "help":
if player have permission "bg.player":
send "&7&l------------&8[ &6&lBATTLEGROUNDS &8]&7&l------------"
send "&7/bg list"
send "&7/bg join &8(&7arena_name&8)"
send "&7/bg autojoin"
send "&7/bg leave"
if player have permission "bg.admin":
send "&7/bg Start"
send "&7/bg ResetStats &8(&7player_name&8)"
send "&7/bg SetLobby"
send "&7/bg CreateArena &8(&7arena_name&8)"
send "&7/bg SetArenaLobby &8(&7arena_name&8)"
send "&7/bg SetCenter &8(&7arena_name&8)"
send "&7/bg Set-Route-Start &8(&7arena_name&8)"
send "&7/bg Set-Route-End &8(&7arena_name&8)"
send "&7/bg Save-Route &8(&7arena_name&8)"
send "&7/bg Remove-Route &8(&7arena_name&8)"
send "&7/bg Border &8(&7arena_name&8) &8(&7add/list&8/&7remove)"
send "&7/bg SetBorderSize &8(&7arena_name&8) &8(&7first border size&8)"
send "&7/bg SaveArena &8(&7arena_name&8)"
send "&7/bg DeleteArena &8(&7arena_name&8)"
send "&7&l------------------------------------------"
stop
if arg 1 is "join":
bg_join(player, arg-2)
if arg 1 is "list":
if {bg.player::%uuid of player%.state} is not set:
open chest inventory with 6 rows named "&8&l» &7BATTLEGROUNDS - ARENAS" to player
set {_slot} to 10
set slot 0, 1, 2, 3, 4, 5, 6, 7, 17, 26, 35, 44, 18, 27, 36, 9, 45, 46, 47, 48, 49, 50, 51, 52, 53 and 8 of player's current inventory to green glass named "&8 "
loop {bg.arenas::*}:
format_slot(player's current inventory, {_slot}, 1, green clay, "&e", "&8&l» &7NAME: &c&l%loop-value%||||&8&l» &7PLAYING: &3%size of {bg.arena.%loop-value%.ninjas::*}%||||&8&l» &7STATE: &a%{bg.arena.%loop-value%.status}%")
add 1 to {_slot}
if {_slot} is 17 or 26 or 35:
add 2 to {_slot}
if arg 1 is "leave":
bg_leave(player)
if arg 1 is "autojoin":
if {bg.player::%uuid of player%.state} is not set:
loop {bg.arenas::*}:
if {bg.arena.%loop-value%.status} is "WAITING" or "STARTING":
bg_join(player, loop-value)
stop
if arg-1 is "stats":
send "&e&l✦&7&l&m--------------------------------------&e&l✦"
send ""
send "&8&l» &6&lBATTLEGROUNDS STATS &8&l«"
send ""
send "&6&l» &7&lWINS &c%{bg.stats.wins::%uuid of player%}%"
send "&6&l» &7&lKILLS &c%{bg.stats.kills::%uuid of player%}%"
send "&6&l» &7&lDEATHS &c%{bg.stats.deaths::%uuid of player%}%"
send ""
send "&e&l✦&7&l&m--------------------------------------&e&l✦"
if arg 1 is "createarena":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.state} is not set:
set {bg.arena.%arg-2%.state} to "created"
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been created!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena already exists!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aSpecify Arena!"
if arg 1 is "setarenalobby":
if player has permission "bg.admin":
if {bg.arena.%arg-2%.state} is "created" or "ready":
set {bg.arena.%arg-2%.lobby} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLobby for Arena &3%arg-2% &ahas been set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
if arg 1 is "setlobby":
if player has permission "bg.admin":
set {bg.lobby} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLobby set."
if arg 1 is "set-route-start":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is not set:
set {bg.arena.%arg-2%.route.id} to 1
set {bg.arena.%arg-2%.start.%{bg.arena.%arg-2%.route.id}%} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aStart with id &e&n%{bg.arena.%arg-2%.route.id}%&r &aset."
if arg 1 is "set-route-end":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is not set:
set {bg.arena.%arg-2%.route.id} to 1
set {bg.arena.%arg-2%.end.%{bg.arena.%arg-2%.route.id}%} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aEnd with id &e&n%{bg.arena.%arg-2%.route.id}%&r &aset."
if arg 1 is "save-route":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is set:
if {bg.arena.%arg-2%.start.%{bg.arena.%arg-2%.route.id}%} and {bg.arena.%arg-2%.end.%{bg.arena.%arg-2%.route.id}%} is set:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aRoute with id &e&n%{bg.arena.%arg-2%.route.id}%&r&a saved."
add 1 to {bg.arena.%arg-2%.route.id}
if arg 1 is "remove-route":
if player has permission "bg.admin":
if arg-2 is set:
if {bg.arena.%arg-2%.route.id} is set:
delete {bg.arena.%arg-2%.start.%{bg.arena.%arg-2%.route.id}%} and {bg.arena.%arg-2%.end.%{bg.arena.%arg-2%.route.id}%}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aDelete route with id &e&n%{bg.arena.%arg-2%.route.id}%&r&a."
remove 1 from {bg.arena.%arg-2%.route.id}
if arg 1 is "setcenter":
if player has permission "bg.admin":
set {bg.arena.%arg-2%.center} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aCenter set."
if arg 1 is "setbordersize":
if player has permission "bg.admin":
set {bg.arena.%arg-2%.first-border} to arg-3 parsed as number
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aBorder size set."
if arg 1 is "resetstats":
if player has permission "bg.admin":
set {_p} to arg-2 parsed as player
bg_stats("reset", {_p})
send "%{BG::CONFIG::MESSAGES.PREFIX}% &cReseted Stats for &a%{_p}%"
if arg 1 is "border":
if player has permission "bg.admin":
if arg-3 is "add":
if {bg.arena.%arg-2%.border.id} is not set:
set {bg.arena.%arg-2%.border.id} to 1
set {bg.arena.%arg-2%.BORDERS::%{bg.arena.%arg-2%.border.id}%} to location of player
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aAdded border with id ##%{bg.arena.%arg-2%.border.id}% to your location."
add 1 to {bg.arena.%arg-2%.border.id}
else if arg-3 is "list":
send "&a○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○"
loop {bg.arena.%arg-2%.BORDERS::*}:
send "&a##%loop-index% &e&n%loop-value%"
send "&a○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○○"
else if arg-3 is "remove":
if arg-4 is set:
delete {bg.arena.%arg-2%.BORDERS::%arg-4%}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &cDeleted border with id ##%arg-4%."
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &a/bg border (arena) [add/list/remove = (id)]"
if arg 1 is "start":
if player has permission "bg.admin":
#size of {bg.arena.%{bg.player::%uuid of player%.arena}%.ninjas::*} > 1
bg_start({bg.player::%uuid of player%.arena})
if arg 1 is "reload":
if player has permission "bg.admin":
broadcast "%{BG::CONFIG::MESSAGES.PREFIX}% &aReloading..."
make console execute command "sk reload %script%"
if arg 1 is "savearena":
if player has permission "bg.admin":
if {bg.arena.%arg-2%.state} is "created":
if {bg.arena.%arg-2%.lobby} is set:
if {bg.arena.%arg-2%.start.1} is set:
if {bg.arena.%arg-2%.end.1} is set:
if {bg.arena.%arg-2%.center} is set:
if {bg.arena.%arg-2%.first-border} is set:
if size of {bg.arena.%arg-2%.BORDERS::*} > 1:
set {bg.arena.%arg-2%.state} to "ready"
add arg-2 to {bg.arenas::*}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been saved."
bg_resetarena(arg-2)
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aNo border locations added!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aBorder size is not set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aCenter is not set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aEnd point is not set"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aStart point is not set"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLobby is not set!"
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
if arg 1 is "deletearena":
if player has permission "bg.admin":
if {bg.arena.%arg-2%.state} is set:
bg_resetarena(arg-2)
delete {bg.arena.%arg-2%.lobby}
delete {bg.arena.%arg-2%.center}
delete {bg.arena.%arg-2%.seconds}
delete {bg.arena.%arg-2%.minutes}
delete {bg.arena.%arg-2%.status}
delete {bg.arena.%arg-2%.BORDERS::*}
delete {bg.arena.%arg-2%.border.status}
delete {bg.arena.%arg-2%.ninjas::*}
delete {bg.arena.%arg-2%.border-size}
delete {bg.arena.%arg-2%.game-center}
delete {bg.arena.%arg-2%.state}
delete {bg.arena.%arg-2%.center}
loop {bg.arena.%arg-2%.route.id} times:
delete {bg.arena.%arg-2%.start.%loop-number%}
delete {bg.arena.%arg-2%.end.%loop-number%}
delete {bg.arena.%arg-2%.route.id}
remove arg-2 from {bg.arenas::*}
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been deleted."
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
else:
make player execute command "bg help"
on chat:
if {bg.player::%uuid of player%.state} is "IN-GAME":
cancel event
set {_msg} to {BG::CONFIG::CHAT-FORMAT}
replace all "{player}" in {_msg} with player's displayname
replace all "&" with " " in message
replace all "{message}" with message in {_msg}
send {_msg} to {bg.arena.%{bg.player::%uuid of player%.arena}%.ninjas::*}
on drop:
if {bg.arena.%{bg.player::%uuid of player%.arena}%.status} is "STARTING" or "WAITING":
cancel event
on right click on chest:
if {bg.player::%uuid of player%.state} is "IN-GAME":
yaml value "MIX.ENABLE-CHESTS" from file "plugins/Battlegrounds/config.yml" is true
if {bg.arena.%{bg.player::%uuid of player%.arena}%.CHESTS::%location of event-block%} is not set:
clear inventory of block at event-block
set {_min} to yaml value "Min-Items" from file "plugins/Battlegrounds/chest.yml"
set {_max} to yaml value "Max-Items" from file "plugins/Battlegrounds/chest.yml"
set {_items} to random number between {_min} and {_max}
set {_loot::*} to yaml list "CHEST" from file "plugins/Battlegrounds/chest.yml"
loop rounded {_items} times:
set {_slot} to a random number between 0 and 26
set {_random} to a random element out of {_loot::*}
add {_random} parsed as material to slot {_slot} of block at event-block
set {bg.arena.%{bg.player::%uuid of player%.arena}%.CHESTS::%location of event-block%} to location of event-block
on hunger bar change:
if {bg.player::%uuid of player%.state} is "IN-GAME":
if {bg.arena.%{bg.player::%uuid of player%.arena}%.status} is "STARTING" or "WAITING":
set player's hunger to 20
on damage of player:
if {bg.player::%uuid of victim%.state} is "IN-GAME":
if {bg.arena.%{bg.player::%uuid of victim%.arena}%.status} is "STARTING" or "WAITING":
cancel event
damage was caused by void
teleport victim to {bg.arena.%{bg.player::%uuid of victim%.arena}%.lobby}
if {bg.arena.%{bg.player::%uuid of victim%.arena}%.status} is "INGAME":
metadata value "BG-LANDED" of victim is not set:
cancel event
if damage >= health of victim:
cancel event
add 1 to {bg.player::%uuid of attacker%.kills}
show an action bar from "&7You killed %victim% with %attacker's tool% &7- %size of {bg.arena.%{bg.player::%uuid of attacker%.arena}%.ninjas::*}% &7left &c&l%{bg.player::%uuid of attacker%.kills}% &c&lKILLS" to attacker
bg_death(victim)
if attacker is player:
attacker is not victim
set metadata value "LAST-HIT" of victim to attacker
damage was caused by void:
cancel event
bg_death(victim)
function bg_remove(p: player, arena: text):
remove {_p} from {bg.arena.%{_arena}%.ninjas::*}
if {bg.arena.%{_arena}%.status} is "INGAME":
size of {bg.arena.%{_arena}%.ninjas::*} is 1:
set {_winner} to random element out of {bg.arena.%{_arena}%.ninjas::*}
set {_uuid} to uuid of {_winner}
loop yaml list "MESSAGES.SUMMARY" from file "plugins/Battlegrounds/config.yml":
set {_msg} to loop-value
replace all "{winner}" with "%{_winner}%" in {_msg}
replace all "{kills}" with "%{bg.player::%{_uuid}%.kills}%" in {_msg}
send coloured {_msg} to {bg.arena.%{_arena}%.ninjas::*}
add 1 to {bg.stats.wins::%{_uuid}%}
loop 10 times:
launch "BALL" firework at location of {_winner} timed 1 coloured "RED" and "BLUE" AND "YELLOW" AND "GREEN"
wait a second
bg_resetarena({_arena})
function bg_death(p: player):
metadata value "BG-DEATH" of {_p} is not set:
set metadata value "BG-DEATH" of {_p} to "SET"
set {_uuid} to uuid of {_p}
add 1 to {bg.stats.deaths::%{_uuid}%}
metadata value "LAST-HIT" of {_p} is not set:
set {_y} to "unknown"
else:
set {_y} to metadata value "LAST-HIT" of {_p}
set {_uuid} to uuid of {_y}
add 1 to {bg.stats.kills::%{_uuid}%}
set {_o-o} to {BG::CONFIG::COMMANDS.KILL}
replace all "{player}" in {_o-o} with "%{_y}%"
make console execute command "%{_o-o}%"
set {_msg} to {BG::CONFIG::MESSAGES.KILL-MESSAGE}
replace all "{victim}" in {_msg} with "%{_p}%"
replace all "{killer}" in {_msg} with "%{_y}%"
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}
add {_p} to {bg.arena.%{bg.player::%{_uuid}%.arena}%.bad-ninjas::*}
send {_p} title "&e&l##%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}% &c&lGAME OVER" with subtitle "&eBATTLE ROYALE" for 5 seconds with 0 second fade in and 0 second fade out
bg_remove({_p}, {bg.player::%{_uuid}%.arena})
set {_p}'s gamemode to spectator
set {_helmet} to {_p}'s helmet
set {_chestplate} to {_p}'s chestplate
set {_leggings} to {_p}'s leggings
set {_boots} to {_p}'s boots
loop blocks in radius 1 of {_p}:
loop-block is air
set loop-block to chest
set {bg.arena.%{bg.player::%{_uuid}%.arena}%.CHESTS::%location of loop-block%} to location of loop-block
add {_helmet}, {_chestplate}, {_leggings} and {_boots} to loop-block
loop items in {_p}'s inventory:
add loop-item to loop-block
add 1 golden apple to loop-block
add location of loop-block to {bg.arena.%{bg.player::%{_uuid}%.arena}%.KILL-ME-PLS::*}
set {_block} to true
stop
loop items in {_p}'s inventory:
drop loop-item at {_p}
on load:
delete {bg.player::*}
send "&7&l--------------------------------------------" to console
send " " to console
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aLoading &ev.0.0.4-B&a..." to console
wait a tick
broadcast "%{BG::CONFIG::MESSAGES.PREFIX}% &a&lPlugin loaded!"
send " " to console
send "&7&l--------------------------------------------" to console
loop {bg.arenas::*}:
delete {bg.arena.%loop-value-1%.ninjas::*} and {bg.arena.%loop-value-1%.bad-ninjas::*}
bg_resetarena(loop-value)
on unload:
send "&7&l--------------------------------------------" to console
send " " to console
send "%{BG::CONFIG::MESSAGES.PREFIX}% &aDisabling &ev.0.0.4-B&a..." to console
send "%{BG::CONFIG::MESSAGES.PREFIX}% &ev.0.0.4-B &adisabled!" to console
send " " to console
send "&7&l--------------------------------------------" to console
function bg_stats(do: text, p: player):
set {_uuid} to uuid of {_p}
{_do} is "check":
loop "kills", "deaths" and "wins":
{bg.stats.%loop-value%::%{_uuid}%} is not set
set {bg.stats.%loop-value%::%{_uuid}%} to 0
{_do} is "reset":
loop "kills", "deaths" and "wins":
set {bg.stats.%loop-value%::%{_uuid}%} to 0
function bg_leave(p: player):
set {_uuid} to uuid of {_p}
if {bg.player::%{_uuid}%.state} is "IN-GAME":
set {_msg} to {BG::CONFIG::MESSAGES.LEFT-MESSAGE}
replace all "{player}" in {_msg} with {_p}'s displayname
bg_remove({_p}, {bg.player::%{_uuid}%.arena})
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}
loop "fly", "arena", "start", "end" and "state":
delete {bg.player::%{_uuid}%.%loop-value%}
bg_clear_player({_p})
bg_deleteBoard({_p})
teleport {_p} to {bg.lobby}
#need to be removed
lobby({_p})
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{BG::CONFIG::MESSAGES.NOT-IN-GAME}%" to {_p}
function bg_join(p: player, arena: text):
set {_uuid} to uuid of {_p}
if {bg.player::%{_uuid}%.state} is not set:
if {bg.arena.%{_arena}%.state} is "ready":
if {bg.arena.%{_arena}%.status} is "WAITING" or "STARTING":
if size of {bg.arena.%{_arena}%.ninjas::*} < 100:
bg_clear_player({_p})
set {bg.player::%{_uuid}%.state} to "IN-GAME"
set {bg.player::%{_uuid}%.arena} to {_arena}
set {bg.player::%{_uuid}%.kills} to 0
set slot 8 of {_p} to {BG::CONFIG::ITEMS.LEAVE} parsed as material named "%{BG::CONFIG::ITEMS.LEAVE-NAME}%"
add {_p} to {bg.arena.%{_arena}%.ninjas::*}
if size of {bg.arena.%{_arena}%.ninjas::*} = 2:
bg_start_countdown({_arena})
set {_msg} to {BG::CONFIG::MESSAGES.JOIN-MESSAGE}
replace all "{player}" in {_msg} with {_p}'s displayname
replace all "{players-count}" in {_msg} with "%size of {bg.arena.%{_arena}%.ninjas::*}%"
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{_arena}%.ninjas::*}
teleport {_p} to {bg.arena.%{_arena}%.lobby}
bg_createBoard({_p}, "BG-WAITING", 7)
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &7This arena is full" to {_p}
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &7This game is running" to {_p}
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% &7This arena not exists" to {_p}
else:
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{BG::CONFIG::MESSAGES.IN-GAME}%" to {_p}
on join:
bg_stats("check", player)
on right click with anything:
if {bg.player::%uuid of player%.state} is "IN-GAME":
name of event-item is {BG::CONFIG::ITEMS.LEAVE-NAME}:
cancel event
bg_leave(player)
on quit:
bg_leave(player)
on flight togge:
if {bg.player::%uuid of player%.state} is "IN-GAME":
if metadata value "BG-FLY" of player is set:
cancel event
on damage of chicken:
metadata value "type" of victim is "PLANE" or "PARACHUTE":
cancel event
function bg_fly_2(p: player, start: location, end: location):
load chunk chunk at {_start}
set {_uuid} to uuid of {_p}
teleport {_p} to {_start}
wait 10 ticks
set {_p}'s flight mode to true
set {_p}'s gamemode to survival
spawn an chicken at {_p}
set {_p-plane-%{_p}%} to spawned chicken
set metadata value "type" of {_p-plane-%{_p}%} to "PLANE"
set metadata value "BG-PLANE" of {_p-plane-%{_p}%} to {_p}
#apply invisibility without any particles to {_p-plane-%{_p}%} for 7 days
make {_p} ride {_p-plane-%{_p}%}
set metadata value "BG-FLY" of {_p} to "SET"
while metadata value "BG-FLY" of {_p} is set:
add 1 to {_title}
set {_v} to vector between {_p} and {_end}
push {_p-plane-%{_p}%} {_v} at speed 0.1
if y-coords of {_p} < y-coords of {_end}:
push {_p-plane-%{_p}%} upwards at speed 0.2
if y-coords of {_p} > y-coords of {_end} +10:
push {_p-plane-%{_p}%} downwards at speed 0.1
if distance between {_p} and {_end} < 30:
bg_parachute({_p})
wait 2 ticks
loop all chickens in radius 2 of {_p}:
metadata value "BG-PLANE" of loop-value is {_p}:
delete loop-value
stop
if distance between {_p} and {_start} > yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml":
{_title} >= 20:
send {_p} title "&e" with subtitle "&ePRESS &bSNEAK &eTO OPEN PARACHUTE" for 1 seconds with 0 second fade in and 0 second fade out
set {_title} to 0
if distance between {_p} and {_end} < 10:
make {_p} dismount
wait a tick
function bg_fly(arena: text):
set {_route} to rounded random number between 1 and {bg.arena.%{_arena}%.route.id} -1
set {_center} to {bg.arena.%{_arena}%.start.%{_route}%}
set {_end} to {bg.arena.%{_arena}%.end.%{_route}%}
set x-coords of {_center} to x-coords of {bg.arena.%{_arena}%.start.%{_route}%} -5
set x-coords of {_end} to x-coords of {bg.arena.%{_arena}%.start.%{_route}%} -5
set {_count} to 0
loop {bg.arena.%{_arena}%.ninjas::*}:
set {bg.player::%uuid of loop-value%.start} to {_center}
set {bg.player::%uuid of loop-value%.end} to {_end}
teleport loop-value to {_center}
apply blindness to loop-value for 3 seconds
bg_fly_2(loop-value, {_center}, {_end})
add 1 to x-coords of {_center}
add 1 to x-coords of {_end}
add 1 to {_count}
{_count} = 10:
add 2 to x-coords of {_center}
add 2 to x-coords of {_end}
set {_count} to 0
function bg_parachute(p: player):
delete metadata value "BG-FLY" of {_p}
set {_p}'s flight mode to false
loop all chickens in radius 2 of {_p}:
metadata value "BG-PARACHUTE" of loop-value is {_p}:
delete loop-value
wait 10 ticks
if {_p} is on ground:
set metadata value "BG-LANDED" of {_p} to "SET"
stop
spawn an chicken at {_p}
set {_p-parachute} to spawned chicken
set metadata value "type" of {_p-parachute} to "PARACHUTE"
#apply invisibility without any particles to {_p-parachute} for 7 days
set metadata value "BG-PARACHUTE" of {_p-parachute} to {_p}
make {_p} ride {_p-parachute}
push {_p} forwards at speed 0.2
while {_p} is not on ground:
{_p} is riding a chicken:
{_p-parachute} is not on ground:
set {_v} to vector between {_p} and block in front of {_p}
push {_p-parachute} {_v} at speed 0.05
push {_p} downwards at speed 0.1
{_p-parachute} is on ground:
make {_p} dismount
set {_loc} to location of {_p}
set y-coords of {_loc} to -100
teleport {_p-parachute} to {_loc}
set metadata value "BG-LANDED" of {_p} to "SET"
push {_p} upwards at speed 0.2
stop
else:
stop
wait a tick
on dismount:
if {bg.player::%uuid of player%.state} is "IN-GAME":
player is riding a chicken
metadata value "BG-FLY" of player is set:
loop all chickens in radius 2 of player:
metadata value "BG-PLANE" of loop-value is player:
delete loop-value
wait a tick
if distance between {bg.player::%uuid of player%.start} and player < yaml value "MIX.ALLOW-PARACHUTE-AFTER" from file "plugins/Battlegrounds/config.yml":
bg_fly_2(player, {bg.player::%uuid of player%.start}, {bg.player::%uuid of player%.end})
else:
bg_parachute(player)
stop
metadata value "BG-FLY" of player is not set:
wait a tick
bg_parachute(player)
on break:
if {bg.player::%uuid of player%.state} is "IN-GAME":
cancel event
on place:
if {bg.player::%uuid of player%.state} is "IN-GAME":
cancel event
on inventory click:
if display name of top inventory of player is "&8&l» &7BATTLEGROUNDS - ARENAS":
cancel event
set {_arena} to line 1 of the lore of event-item
bg_join(player, last element of {_arena} split at "8&l» &7NAME: &c&l")
function bg_border_shrink(arena: text, size: number):
set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {_size} over 2 minutes
loop 120 times:
if {bg.arena.%{_arena}%.status} is "INGAME":
wait a second
else:
stop
set {_time} to yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml"
set {bg.arena.%{_arena}%.game-center} to {bg.arena.%{_arena}%.center}
bg_game_border({_arena}, {_time}, {bg.arena.%{_arena}%.center})
function bg_game_border(arena: text, minutes: number, center: location):
set {bg.arena.%{_arena}%.minutes} to {_minutes} -1
set {bg.arena.%{_arena}%.seconds} to 60
set {bg.arena.%{_arena}%.border.status} to ""
set {bg.arena.%{_arena}%.game-center} to {_center}
wait a tick
set center of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.game-center}
set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.border-size}
while {bg.arena.%{_arena}%.status} is "INGAME":
remove 1 from {bg.arena.%{_arena}%.seconds}
if {bg.arena.%{_arena}%.seconds} < 9:
set {_sec} to "0%{bg.arena.%{_arena}%.seconds}%"
else:
set {_sec} to {bg.arena.%{_arena}%.seconds}
set {bg.arena.%{_arena}%.border.status} to "&fNEXT BORDER &a0%{bg.arena.%{_arena}%.minutes}%:%{_sec}%"
if {bg.arena.%{_arena}%.seconds} is 1:
if {bg.arena.%{_arena}%.minutes} = 0:
set {bg.arena.%{_arena}%.border.status} to "&cBORDER CLOSING"
set {bg.arena.%{_arena}%.border-size} to {bg.arena.%{_arena}%.border-size}/2
bg_border_shrink({_arena}, {bg.arena.%{_arena}%.border-size})
set {bg.arena.%{_arena}%.minutes} and {bg.arena.%{_arena}%.seconds} to 0
stop
if {bg.arena.%{_arena}%.seconds} is 1:
if {bg.arena.%{_arena}%.minutes} > 0:
remove 1 from {bg.arena.%{_arena}%.minutes}
set {bg.arena.%{_arena}%.seconds} to 59
wait a second
function bg_start(arena: text):
set {bg.arena.%{_arena}%.status} to "INGAME"
set {_time} to yaml value "TIMERS.BORDER" from file "plugins/Battlegrounds/config.yml"
set {bg.arena.%{_arena}%.border-size} to {bg.arena.%{_arena}%.first-border}
set {_center} to a random element out of {bg.arena.%{_arena}%.BORDERS::*}
bg_game_border({_arena}, {_time}, {_center})
loop {bg.arena.%{_arena}%.ninjas::*}:
#apply blindness to loop-value for 3 seconds
teleport loop-value to {bg.arena.%{_arena}%.start}
bg_clear_player(loop-value)
bg_createBoard(loop-value, "BG-GAME", 11)
wait a second
bg_fly({_arena})
function bg_start_countdown(arena: text):
set {bg.arena.%{_arena}%.status} to "STARTING"
loop {bg.arena.%{_arena}%.seconds} times:
if {bg.arena.%{_arena}%.status} is "STARTING" or "WAITING":
size of {bg.arena.%{_arena}%.ninjas::*} >= 2:
wait a second
remove 1 from {bg.arena.%{_arena}%.seconds}
if {bg.arena.%{_arena}%.seconds} = 1 or 2 or 3 or 4 or 5 or 10:
set {_msg} to {BG::CONFIG::MESSAGES.STARTING-IN}
replace all "{seconds}" in {_msg} with "%{bg.arena.%{_arena}%.seconds}%"
send "%{BG::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {bg.arena.%{_arena}%.ninjas::*}
send {bg.arena.%{_arena}%.ninjas::*} title "&e&lSTARTING IN &c%{bg.arena.%{_arena}%.seconds}%" with subtitle "&eBATTLE ROYALE" for 1 seconds with 0 second fade in and 0 second fade out
if {bg.arena.%{_arena}%.seconds} = 1:
size of {bg.arena.%{_arena}%.ninjas::*} >= 2:
bg_start({_arena})
else:
set {bg.arena.%{_arena}%.status} to "WAITING"
set {bg.arena.%{_arena}%.seconds} to yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml"
stop
function bg_resetarena(arena: text):
loop {bg.arena.%{_arena}%.ninjas::*} and {bg.arena.%{_arena}%.bad-ninjas::*}:
loop "fly", "arena" and "state":
delete {bg.player::%uuid of loop-value-1%.%loop-value-2%}
bg_clear_player(loop-value-1)
bg_deleteBoard(loop-value-1)
set loop-value-1's gamemode to spectator
push loop-value-1 upwards at speed 0.5
teleport loop-value-1 to {bg.lobby}
set loop-value-1's gamemode to survival
#need to be removed
lobby(loop-value-1)
loop {bg.arena.%{_arena}%.CHESTS::*}:
clear inventory of block at loop-value
loop {bg.arena.%{_arena}%.KILL-ME-PLS::*}:
set block at loop-value to air
remove loop-value from {bg.arena.%{_arena}%.KILL-ME-PLS::*}
delete {bg.arena.%{_arena}%.KILL-ME-PLS::*}
delete {bg.arena.%{_arena}%.ninjas::*} and {bg.arena.%{bg.player::%{_uuid}%.arena}%.bad-ninjas::*}
delete {bg.arena.%{_arena}%.CHESTS::*}
set {bg.arena.%{_arena}%.border.status} to ""
loop all entities in radius 50000 around {bg.arena.%{_arena}%.center}:
clear loop-entity
set {bg.arena.%{_arena}%.seconds} to yaml value "TIMERS.WAITING" from file "plugins/Battlegrounds/config.yml"
set {bg.arena.%{_arena}%.status} to "WAITING"
function bg_clear_player(p: player):
heal {_p}
extinguish {_p}
set {_p}'s food to 20
clear {_p}'s level
clear {_p}'s inventory
set {_p}'s gamemode to survival
set {_p}'s flight mode to false
milk {_p}
loop "LAST-HIT", "BG-DEATH" and "BG-LANDED", "BG-FLY":
delete metadata value "%loop-value%" of {_p}
function bg_deleteBoard(p: player):
loop "BG-GAME" and "BG-WAITING":
if stylish scoreboard "%loop-value-1%-%{_p}%" exists:
loop 15 times:
delete the id based score "%{_p}%Slot%loop-number-2%" in stylish scoreboard "%loop-value-1%-%{_p}%"
delete stylish scoreboard "%loop-value-1%-%{_p}%"
function bg_setSlot(p: player, board: text, slot: integer, t: text):
add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
if {_slot} is between 1 and 15:
set text of id "%{_p}%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"
function bg_createBoard(p: player, t: text, size: integer = 15):
set {_uuid} to uuid of {_p}
bg_deleteBoard({_p})
add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
if stylish scoreboard "%{_t}%-%{_p}%" does not exist:
create new stylish scoreboard named "%{_t}%-%{_p}%"
loop {_size} times:
create a new id based score "%{_p}%Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%-%{_p}%"
wait a tick
set stylish scoreboard of {_p} to "%{_t}%-%{_p}%"
if {_t} is "BG-GAME":
set title of stylish scoreboard "BG-GAME-%{_p}%" to "&eBATTLE ROYALE"
while {bg.arena.%{bg.player::%{_uuid}%.arena}%.status} is "INGAME":
if location of {_p} is in within border:
set {_state} to "&aSAFE"
else:
set {_state} to "&cNOT SAFE"
if stylish scoreboard "BG-GAME-%{_p}%" exists:
bg_setSlot({_p}, "BG-GAME", 11, "&7%now%")
bg_setSlot({_p}, "BG-GAME", 10, "")
bg_setSlot({_p}, "BG-GAME", 9, "&8&l» &a%{bg.arena.%{bg.player::%{_uuid}%.arena}%.border.status}%")
bg_setSlot({_p}, "BG-GAME", 8, "")
bg_setSlot({_p}, "BG-GAME", 7, "&8&l» &fLOCATION %{_state}%")
bg_setSlot({_p}, "BG-GAME", 6, "&8&l» &aSize %{bg.arena.%{bg.player::%{_uuid}%.arena}%.border-size}%&am")
bg_setSlot({_p}, "BG-GAME", 5, "")
bg_setSlot({_p}, "BG-GAME", 4, "&8&l» &fKILLS &a%{bg.player::%{_uuid}%.kills}%")
bg_setSlot({_p}, "BG-GAME", 3, "&8&l» &fPLAYERS LEFT &a%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}%")
bg_setSlot({_p}, "BG-GAME", 2, "")
bg_setSlot({_p}, "BG-GAME", 1, "%{BG::CONFIG::SCOREBOARD.WEBSITE}%")
else:
stop
wait a second
if {_t} is "BG-WAITING":
set title of stylish scoreboard "BG-WAITING-%{_p}%" to "&eBATTLE ROYALE"
while {bg.arena.%{bg.player::%{_uuid}%.arena}%.status} is "WAITING" or "STARTING":
if stylish scoreboard "BG-WAITING-%{_p}%" exists:
bg_setSlot({_p}, "BG-WAITING", 7, "&7%now%")
bg_setSlot({_p}, "BG-WAITING", 6, "")
bg_setSlot({_p}, "BG-WAITING", 5, "&8&l» &fSTARTING IN &a%{bg.arena.%{bg.player::%{_uuid}%.arena}%.seconds}%")
bg_setSlot({_p}, "BG-WAITING", 4, "")
bg_setSlot({_p}, "BG-WAITING", 3, "&8&l» &fPLAYERS &a%size of {bg.arena.%{bg.player::%{_uuid}%.arena}%.ninjas::*}%")
bg_setSlot({_p}, "BG-WAITING", 2, "")
bg_setSlot({_p}, "BG-WAITING", 1, "%{BG::CONFIG::SCOREBOARD.WEBSITE}%")
else:
stop
wait a second
Error:
indentation error: expected 3 tabs, but found 12 spaces (BG.sk, line 317: teleport victim to {bg.arena.%{bg.player::%uuid of victim%.arena}%.lobby}')
[20:58:46] [Server thread/ERROR] [Minecraft]: indentation error: expected 5 tabs, but found 20 spaces (BG.sk, line 683: send {bg.arena.%{_arena}%.ninjas::*} title "&e&lSTARTING IN &c%{bg.arena.%{_arena}%.seconds}%" with subtitle "&eBATTLE ROYALE" for 1 seconds with 0 second fade in and 0 second fade out')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't understand this condition/effect: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {_size} over 2 minutes (BG.sk, line 618: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {_size} over 2 minutes')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't understand this condition/effect: set center of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.game-center} (BG.sk, line 634: set center of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.game-center}')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't understand this condition/effect: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.border-size} (BG.sk, line 635: set diameter of world "%{bg.arena.%{_arena}%.game-center}'s world%" to {bg.arena.%{_arena}%.border-size}')
[20:58:47] [Server thread/ERROR] [Minecraft]: Can't compare a location with 'in within border' (BG.sk, line 755: if location of {_p} is in within border:')
[20:58:47] [Server thread/ERROR] [Minecraft]: 'else' has to be placed just after an 'if' or 'else if' section (BG.sk, line 757: else:')
Hello
Could someone fix me my mistake?