import: org.bukkit.Bukkit org.bukkit.Sound org.bukkit.Material org.bukkit.material.MaterialData fr.mrmicky.fastparticle.FastParticle fr.mrmicky.fastparticle.ParticleType org.bukkit.event.player.PlayerInteractEvent org.bukkit.event.player.PlayerArmorStandManipulateEvent options: #do not touch this -_- plugin-version: 2.3.5 function kffa_check_yaml(dir: text, value: text, set: text, type: text = "text"): yaml value {_value} from "leaf.kffa.%{_dir}%" is not set: if {_type} is "text": set yaml value {_value} from "leaf.kffa.%{_dir}%" to {_set} if {_type} is "number": set yaml value {_value} from "leaf.kffa.%{_dir}%" to {_set} parsed as number if {_type} is "boolean": set yaml value {_value} from "leaf.kffa.%{_dir}%" to {_set} parsed as boolean if {_type} is "list": yaml list {_value} from "leaf.kffa.%{_dir}%" is not set loop {_set} split at "||": add loop-value to yaml list {_value} from "leaf.kffa.%{_dir}%" #From https://forums.skunity.com/resources/mirrorutils.706/ by EWS local expression replacer %texts% with %texts% in %text%: return type: text get: set {_result} to expr-3 loop exprs-1: add 1 to {_n} replace all "%loop-value-1%" with ({_n}th element of exprs-2 ? "") in {_result} return {_result} command kffa [] []: executable by: players trigger: if arg-1 is "help": send centered "&7☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁" to player send "&a/kffa join" if player has permission "ffa.admin": send "&a/kffa changeMap" send "&a/kffa leave" send centered "&7☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁" to player if player has permission "ffa.setup": send "&e/kffa createMap &8(&7map_name&8)" send "&e/kffa setSpawn &8(&7map_name&8)" send "&e/kffa setLeave" send centered "&7☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁☁" to player stop if arg-1 is "join": if {-kffa::cache::player::%player%::state} is set: stop kffa_join(player) if arg-1 is "changeMap": if player has permission "ffa.admin": open chest inventory with 6 rows named "&eSelect the Map" to player wait a tick set {_slot} to 0 loop yaml nodes with keys "Maps" from "leaf.kffa.data": set {_map} to loop-value-1 if yaml value "Maps.%{_map}%.State" from "leaf.kffa.data" is "ready": make a gui slot {_slot} of player with paper named "&a%{_map}%" to run: kffa_map_task({_map}) add 1 to {_slot} if arg-1 is "createMap": if player has permission "ffa.setup": if yaml value "Maps.%arg-2%.State" from "leaf.kffa.data" is set: send "&cThis map is already created." stop set yaml value "Maps.%arg-2%.State" from "leaf.kffa.data" to "created" send "&aArena &b%arg-2%&a created, spawn setted to your currect location." send "&fUse &b/kffa setSpawn %arg-2%, &fIf you want to modify spawn location." set yaml value "Maps.%arg-2%.Spawn" from "leaf.kffa.data" to location of player set yaml value "Maps.%arg-2%.State" from "leaf.kffa.data" to "ready" save yaml "leaf.kffa.data" if arg-1 is "setSpawn": if player has permission "ffa.setup": if yaml value "Maps.%arg-2%.State" from "leaf.kffa.data" is set: set yaml value "Maps.%arg-2%.Spawn" from "leaf.kffa.data" to location of player send "&aSpawn location Set for arena &b%arg-2%." save yaml "leaf.kffa.data" else: send "&eThere is no arena called like this." if arg-1 is "setLeave": if player has permission "ffa.setup": set yaml value "Locations.Leave" from "leaf.kffa.data" to location of player send "&aLeave location set." save yaml "leaf.kffa.data" on PlayerArmorStandManipulateEvent: if {-kffa::cache::player::%event.getPlayer()%::state} is set: cancel event on PlayerInteractEvent: if {-kffa::cache::player::%event.getPlayer()%::state} is set: if "%event.getAction()%" is "PHYSICAL": cancel event if "%event.getClickedBlock().getType()%" contains "plate": set {_p} to event.getPlayer() set {_block} to event.getClickedBlock() set {_w} to world of {_p} set {_loc} to location of {_p} kffa_play_sound({_p}, "PISTON_RETRACT", "BLOCK_PISTON_RETRACT") push {_p} upwards at speed 1.0 push {_p} forwards at speed 0.8 FastParticle.spawnParticle({_w}, ParticleType.FLAME, {_loc} and 1) metadata value "BLOCK-OWNER" of {_block} is not "%{_p}%": set metadata value "LAST-HIT" of {_p} to metadata value "BLOCK-OWNER" of {_block} on join: if yaml value "Settings.Bungeecord" from "leaf.kffa.config" is true: set join message to "" kffa_join(player) on quit: if {-kffa::cache::player::%player%::state} is set: set quit message to "" kffa_leave(player) on break: if {-kffa::cache::player::%player%::state} is set: if {kffa::cache::Blocks::%location of event-block%} is set: stop cancel event on place: if {-kffa::cache::player::%player%::state} is set: if event-block is sandstone or gold pressure plate: set {kffa::cache::Blocks::%location of event-block%} to location of event-block set metadata value "BLOCK-OWNER" of event-block to player if name of player's tool is "&eSuper Jump": set {_item} to player's tool kffa_item_cooldown(player, {_item}, 4, 15) if event-block is sandstone: wait 8 seconds set block at event-block to white clay wait a second set block at event-block to orange clay wait a second set block at event-block to red clay wait a second set block at event-block to air delete {kffa::cache::Blocks::%location of event-block%} if event-block is gold pressure plate: wait 5 second set block at event-block to air delete {kffa::cache::Blocks::%location of event-block%} else: cancel event on chat: if {-kffa::cache::player::%player%::state} is set: set {_format} to replacer "{player}" and "{message}" with "%player%" and message in yaml value "Settings.ChatFormat" from "leaf.kffa.config" loop "Points", "Kills" and "Deaths": set {_int} to yaml value "%uuid of player%.%loop-value-1%" from "leaf.kffa.playerdata" replace all "{%loop-value-1%}" with "%{_int}%" in {_format} set chat format to {_format} set chat recipients to {-kffa::cache::arena::players::*} on drop: if {-kffa::cache::player::%player%::state} is set: cancel event on hunger bar change: if {-kffa::cache::player::%player%::state} is set: set player's hunger to 20 on shoot: if {-kffa::cache::player::%shooter%::state} is set: projectile is arrow set metadata value "KFFA" of projectile to true set {_item} to shooter's tool kffa_item_cooldown(shooter, {_item}, 1, 20) on projectile hit: metadata value "KFFA" of projectile is set delete projectile function kffa_stats(p: player, do: text, type: text = "check", amount: number = 1): {_do} is "check": loop "Points", "Kills" and "Deaths": if yaml value "%uuid of {_p}%.%loop-value-1%" from "leaf.kffa.playerdata" is not set: set yaml value "%uuid of {_p}%.%loop-value-1%" from "leaf.kffa.playerdata" to 0 {_do} is "add": set yaml value "%uuid of {_p}%.%{_type}%" from "leaf.kffa.playerdata" to yaml value "%uuid of {_p}%.%{_type}%" from "leaf.kffa.playerdata" + {_amount} {_do} is "remove": set yaml value "%uuid of {_p}%.%{_type}%" from "leaf.kffa.playerdata" to yaml value "%uuid of {_p}%.%{_type}%" from "leaf.kffa.playerdata" - {_amount} function kffa_play_sound(p: player, soundLegacy: string, soundNew: string): if {-kffa::cache::sounds::%{_soundLegacy}%} is not set: if minecraft version contains "1.8": set {-kffa::cache::sounds::%{_soundLegacy}%} to Sound..{_soundLegacy} else: set {-kffa::cache::sounds::%{_soundLegacy}%} to Sound..{_soundNew} else: {_p}.playSound(location of {_p}, {-kffa::cache::sounds::%{_soundLegacy}%}, 1 and 1) function kffa_join(p: player): if {-kffa::cache::CurrentArena} is not set: stop kffa_stats({_p}, "check") kffa_clear_player({_p}) set {-kffa::cache::player::%{_p}%::state} to true teleport {_p} to yaml value "Maps.%{-kffa::cache::CurrentArena}%.Spawn" from "leaf.kffa.data" kffa_createBoard({_p}) add {_p} to {-kffa::cache::arena::players::*} send replacer "{player}" with {_p}'s display name in yaml value "Messages.Join" from "leaf.kffa.config" to {-kffa::cache::arena::players::*} kffa_equip_kit({_p}) function kffa_leave(p: player): kffa_clear_player({_p}) remove {_p} from {-kffa::cache::arena::players::*} send replacer "{player}" with {_p}'s display name in yaml value "Messages.Leave" from "leaf.kffa.config" to {-kffa::cache::arena::players::*} delete {-kffa::cache::player::%{_p}%::*} teleport {_p} to yaml value "Locations.Leave" from "leaf.kffa.data" function kffa_show_blood(p: player): set {_w} to world of {_p} set {_loc} to location of {_p} FastParticle.spawnParticle({_w}, ParticleType.BLOCK_CRACK, {_loc}, 3 and {-kffa::cache::Blood}) function kffa_player_death(p: player): if metadata value "KFFA-DEATH" of {_p} is set: stop set metadata value "KFFA-DEATH" of {_p} to true set {_killer} to "%metadata value ""LAST-HIT"" of {_p}%" parsed as player kffa_stats({_p}, "add", "Deaths") # kffa_stats({_p}, "remove", "Deaths", yaml value "Settings.LosePointsOnDeath" from "leaf.kffa.config") if {_killer} is set: kffa_stats({_killer}, "add", "Kills") kffa_stats({_killer}, "add", "Points", yaml value "Settings.PointsPerKill" from "leaf.kffa.config") send replacer "{victim}" and "{killer}" with "%{_p}%" and "%{_killer}%" in yaml value "Messages.Killed" from "leaf.kffa.config" to {-kffa::cache::arena::players::*} else: send replacer "{victim}" with "%{_p}%" in yaml value "Messages.Death" from "leaf.kffa.config" to {-kffa::cache::arena::players::*} teleport {_p} to yaml value "Maps.%{-kffa::cache::CurrentArena}%.Spawn" from "leaf.kffa.data" give 1 of ender pearl to {_killer} # kffa_play_sound({_p}, "ANVIL_BREAK", "BLOCK_ANVIL_BREAK") kffa_play_sound({_killer}, "LEVEL_UP", "ENTITY_PLAYER_LEVELUP") kffa_equip_kit({_p}) on damage of player: if {-kffa::cache::player::%victim%::state} is set: kffa_show_blood(victim) if attacker is player: set metadata value "LAST-HIT" of victim to attacker if damage cause is fall: cancel event stop if damage cause is void: cancel event kffa_player_death(victim) stop if damage >= health of victim: cancel event kffa_player_death(victim) function kffa_clear_player(p: player): heal {_p} extinguish {_p} set {_p}'s food to 20 clear {_p}'s level clear {_p}'s inventory {_p}.setFlying(false) {_p}.setAllowFlight(false) set {_p}'s gamemode to survival loop ...{_p}.getActivePotionEffects(): {_p}.removePotionEffect(loop-value-1.getType()) set velocity of {_p} to new vector 0, 0, 0 delete metadata value "LAST-HIT" of {_p} function kffa_createBoard(p: player): create scoreboard for {_p} set scoreboard title of {_p} to yaml value "Scoreboard.Name" from "leaf.kffa.config" set {_uuid} to uuid of {_p} while {-kffa::cache::player::%{_p}%::state} is set: set {_slot} to 1 set {_playerCount} to 0 loop all players: if {-kffa::cache::player::%loop-value-1%::state} is set: add 1 to {_playerCount} loop yaml list "Scoreboard.Lines" from "leaf.kffa.config": set {_value} to "%loop-value-1%" replace all "{now}" with "%now%" in {_value} replace all "{playerCount}" with "%{_playerCount}%" in {_value} replace all "{map}" with "%{-kffa::cache::CurrentArena}%" in {_value} replace all "{gametime}" with "%{-kffa::cache::timer::display}%" in {_value} loop "Points", "Kills" and "Deaths": set {_int} to yaml value "%{_uuid}%.%loop-value-2%" from "leaf.kffa.playerdata" replace all "{%loop-value-2%}" with "%{_int}%" in {_value} set scoreboard line {_slot} of {_p} to colored "%{-kffa::cache::SB::%{_slot}%}%%{_value}%" add 1 to {_slot} wait a second function kffa_map_task(map: string = "Random"): set {_backup::*} to {-kffa::cache::Maps::*} if {-kffa::cache::CurrentArena} is set: remove {-kffa::cache::CurrentArena} from {_backup::*} set {-kffa::cache::CurrentArena} to a random element out of {_backup::*} # if yaml value "Maps.%{_map}%.Spawn" from "leaf.kffa.data" is set: set {-kffa::cache::CurrentArena} to {_map} # if {-kffa::cache::CurrentArena} is not set: set {-kffa::cache::CurrentArena} to a random element out of {-kffa::cache::Maps::*} loop all players: if {-kffa::cache::player::%loop-value-1%::state} is set: teleport loop-value-1 to yaml value "Maps.%{-kffa::cache::CurrentArena}%.Spawn" from "leaf.kffa.data" kffa_equip_kit(loop-value-1) send replacer "{map}" with {-kffa::cache::CurrentArena} in yaml value "Messages.MapChange" from "leaf.kffa.config" to {-kffa::cache::arena::players::*} set {_currentMap} to {-kffa::cache::CurrentArena} set {-kffa::cache::timer::minutes} to 12 set {-kffa::cache::timer::seconds} to 59 while {-kffa::cache::CurrentArena} is {_currentMap}: if {-kffa::cache::timer::seconds} < 1: set {-kffa::cache::timer::seconds} to 59 if {-kffa::cache::timer::minutes} < 1: kffa_map_task() stop remove 1 from {-kffa::cache::timer::minutes} remove 1 from {-kffa::cache::timer::seconds} if {-kffa::cache::timer::seconds} <= 9: set {-kffa::cache::timer::display} to "%{-kffa::cache::timer::minutes}%:0%{-kffa::cache::timer::seconds}%" else: set {-kffa::cache::timer::display} to "%{-kffa::cache::timer::minutes}%:%{-kffa::cache::timer::seconds}%" wait a second function kffa_equip_kit(p: player): kffa_clear_player({_p}) set slot 0 of {_p} to unbreakable stick of sharpness 1 and knockback 2 named "&3Puncher" set slot 1 of {_p} to unbreakable bow named "&7︻デ═一" set slot 2 of {_p} to 64 sandstone set slot 4 of {_p} to gold pressure plate named "&eSuper Jump" set slot 7 of {_p} to feather named "&3Speed" set slot 8 of {_p} to ender pearl set slot 9 of {_p} to arrow set slot 10 of {_p} to 64 of arrow loop all items in {_p}'s inventory: metadata value "%type of loop-value-1%-COOLDOWN" of {_p} is set delete metadata value "%type of loop-value-1%-COOLDOWN" of {_p} wait a second delete metadata value "KFFA-DEATH" of {_p} function kffa_item_cooldown(p: player, item: item, slot: number, countdown: number): set metadata value "%type of {_item}%-COOLDOWN" of {_p} to true set {_mame} to name of {_item} set {_newItem} to {_item} enchant {_newItem} with sharpness 1 loop {_countdown} times: set {_counter} to {_countdown} - loop-number set {_newName} to join "&c%{_counter}%" with {_mame} if metadata value "%type of {_item}%-COOLDOWN" of {_p} is not set: stop if {-kffa::cache::player::%{_p}%::state} is not set: stop set slot {_slot} of {_p} to {_newItem} named {_newName} wait a second set slot {_slot} of {_p} to {_item} delete metadata value "%type of {_item}%-COOLDOWN" of {_p} on right click: if {-kffa::cache::player::%player%::state} is set: if metadata value "%type of event-item%-COOLDOWN" of player is set: cancel event stop if name of event-item is "&3Speed": apply speed 3 to player for 5 seconds kffa_item_cooldown(player, event-item, 7, 15) on load: loop all players: if {-kffa::cache::player::%loop-value-1%::state} is set: add loop-value-1 to {_backup::*} wait a tick delete {-kffa::cache::*} save yaml "leaf.kffa.playerdata" loop currently loaded yaml files: loop-value contains "leaf.kffa.config" or "leaf.kffa.playerdata" unload yaml loop-value-1 loop "config" and "data": load yaml "plugins/KnockBackFFA/%loop-value-1%.yml" as "leaf.kffa.%loop-value-1%" load yaml "plugins/KnockBackFFA/playerdata.yml" as "leaf.kffa.playerdata" kffa_check_yaml("config", "Settings.Bungeecord", "false", "boolean") kffa_check_yaml("config", "Settings.ChatFormat", "&a{kills} &8✦ &7{player} &8» &7{message}") kffa_check_yaml("config", "Settings.PointsPerKill", "5", "number") # kffa_check_yaml("config", "Settings.LosePointsOnDeath", "3", "number") kffa_check_yaml("config", "Scoreboard.Name", "&8︼︼ &eFFA &8︼︼") kffa_check_yaml("config", "Scoreboard.Lines", "&7{now}||||&7➥ &fYour Status ⤵||||&8▪ &fKills: &a{Kills}||&8▪ &fPoints: &a{Points}||&8▪ &fDeaths: &a{Deaths}||||&7➥ &fServer Status ⤵||||&8╔ &e&nMap&r: {map}||&8╠ &e&nNext Map In&r: {gametime}||&8╚ &e&nOnline&r: {playerCount}||||&eplay.my-cool-server.net", "list") kffa_check_yaml("config", "Messages.MapChange", "&cMap changed to &e{map}.") kffa_check_yaml("config", "Messages.Join", "&7{player} &ejoined.") kffa_check_yaml("config", "Messages.Leave", "&7{player} &eleft.") kffa_check_yaml("config", "Messages.Death", "&c➜ {victim} &7died.") kffa_check_yaml("config", "Messages.Killed", "&c➜ &a{victim} &7was killed by &a{killer}") loop "config" and "data": save yaml "leaf.kffa.%loop-value-1%" loop {kffa::cache::Blocks::*}: set block at loop-value-1 to air add 1 to {_int} if {_int} = 20: set {_int} to 0 wait a tick set {-kffa::cache::SB::*} to "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" set {-kffa::cache::Blood} to new MaterialData(Material.."REDSTONE_BLOCK") loop yaml nodes with keys "Maps" from "leaf.kffa.data": if yaml value "Maps.%loop-value-1%.State" from "leaf.kffa.data" is "ready": add loop-value-1 to {-kffa::cache::Maps::*} set {-kffa::cache::CurrentArena} to a random element out of {-kffa::cache::Maps::*} send "&7&l--------------------------------------------" to console send " " to console send "&aLoading &ev.{@plugin-version}&a..." to console broadcast "&aKnockBackFFA loaded!" send " " to console send "&7&l--------------------------------------------" to console #converting old maps if {kffa.maps::*} is set: loop {kffa.maps::*}: set yaml value "Maps.%loop-value-1%.State" from "leaf.kffa.data" to "ready" set yaml value "Maps.%loop-value-1%.Spawn" from "leaf.kffa.data" to {kffa.%loop-value-1%.spawn} save "leaf.kffa.data" delete {kffa.maps::*} # wait 2 seconds loop {_backup::*}: kffa_join(loop-value-1) wait a tick kffa_map_task() on unload: save yaml "leaf.kffa.playerdata" send "&7&l--------------------------------------------" to console send " " to console send "&aDisabling &ev.{@plugin-version}&a..." to console send "&ev.{@plugin-version} &adisabled!" to console send " " to console send "&7&l--------------------------------------------" to console #El Psy Kongroo