From 1c2134f1a41046c98066df88541c78689653b124 Mon Sep 17 00:00:00 2001 From: Harveykang <46108547+Harveykang@users.noreply.github.com> Date: Tue, 7 Jan 2020 00:12:59 +0800 Subject: [PATCH] Add files via upload --- data/fz/functions/carpet/scarpet.mcfunction | 2 +- data/fz/functions/install.mcfunction | 10 ++++++---- data/fz/functions/noai/configs.mcfunction | 5 ----- data/fz/functions/score/install.mcfunction | 3 +-- data/fz/functions/score/main.mcfunction | 3 +++ .../functions/score/removebottag.mcfunction | 2 ++ .../updatebeforeinstall133.mcfunction | 19 +++++++++++++++++++ .../updatebeforeinstall134.mcfunction | 2 ++ 8 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 data/fz/functions/score/removebottag.mcfunction create mode 100644 data/fz/functions/updatebeforeinstall133.mcfunction create mode 100644 data/fz/functions/updatebeforeinstall134.mcfunction diff --git a/data/fz/functions/carpet/scarpet.mcfunction b/data/fz/functions/carpet/scarpet.mcfunction index ab74b2c..4fb39b5 100644 --- a/data/fz/functions/carpet/scarpet.mcfunction +++ b/data/fz/functions/carpet/scarpet.mcfunction @@ -1,2 +1,2 @@ #带标签的假玩家# -script run __config() -> m('stay_loaded': true);__command() -> (p = player();summon(slice(p,0,12)+'_bot');'';);global_tag = 'carpetBot';summon(player_name) ->(player_name = slice(player_name, 0, 16);s_player = player();if (player(player_name), exit('Player '+player_name+' already exists'));player_name = replace(player_name, '\\s','');run(str('player %s spawn at %f %f %f', player_name, s_player~'x', s_player~'y', s_player~'z'));if (!(player(player_name)), exit('failed to spawn player '+player_name));modify(player(player_name), 'tag', global_tag);logger('fake player tag added to player '+player_name); '';);kill(player_name) ->( player_name = slice(player_name, 0, 16); if (!(player (player_name)), exit('Player '+player_name+' is not aviable')); modify(player(player_name), 'clear_tag', global_tag);run(str('player %s kill', player_name)); logger('fake player tag remove from player '+player_name);); \ No newline at end of file +script run __command() -> ( help() ); help() ->( print('使用帮助:'); print('/script invoke summon xxx生成玩家'); print('/script invoke kill xxx删除玩家'); print('/script invoke tp xxx x y z,传送假玩家,xyz可替换为\"s\"来代表你的位置'); print('/script invoke killall删除全部玩家'); print('tagplayer Version: 0.0.0-SNAPSHOT-20200106.2207'); '' ); __config() -> m( l('stay_loaded', true)); global_tag = 'carpetBot'; global_tag_no_bot = 'noCarpetBot'; __check_offline(player_name) ->( if (!(player (player_name)), exit('§4假人'+player_name+'未在线'); '' ); if (!query(player(player_name),'has_tag',global_tag), exit('§4'+player_name+'不是假人'); '' ); ); __check_online(player_name) ->( if (player(player_name), if (query(player(player_name),'has_tag',global_tag), exit('§4假人'+player_name+'已经在线了'); '' ); exit('§4玩家'+player_name+'已经在线了'); '' ); ); __check_pos(x) ->( x = number(x); if(x == null, exit('§4请输入正确的坐标'); '' ); return(x) ); __check_tick(tick) ->( tick = str('%d',number(tick+0.5)); if(tick == null, exit('§4请输入正确的游戏刻间隔'); '' ); if(tick < 2, exit(str('§4整数不能小于2,却发现了%d',tick)); '' ); return(tick) ); summon(player_name) ->( s_player = player(); player_name = replace(player_name, '\\s',''); __check_online(player_name); run(str('player %s spawn at %f %f %f', player_name, s_player~'x', s_player~'y', s_player~'z')); if (!(player(player_name)), exit('§4生成失败') ); if(query(player(player_name),'has_tag',global_tag_no_bot), modify(player(player_name),'clear_tag',global_tag_no_bot) ); modify(player(player_name), 'tag', global_tag); print('已为'+player_name+'添加标签 '); '' ); kill(player_name) ->( player_name = replace(player_name, '\\s',''); __check_offline(player_name); modify(player(player_name), 'tag', global_tag_no_bot); print('已将'+player(player_name)+'移交§6FZ\'sDataPack§f清除标签'); run(str('player %s kill', player_name)); game_tick(50); if(player(player_name), exit( modify(player(player_name), 'tag', global_tag); print('§4清除失败'); print('已重新添加'+player_name+'的标签'); '' ); ); print('已清除'+player_name); '' ); killall() ->( i = 0; player_list = player('all'); loop(2147483647,,, one_player = slice(player_list,i,i+1); one_player_str = join('',one_player); if(one_player_str=='', break() ); if(query(player(one_player_str),'has_tag',global_tag), do_fake_player = 1; modify(player(one_player_str), 'tag', global_tag_no_bot); run(str('player %s kill', one_player_str)); ); i = i+1; ); if(do_fake_player != 1, exit('§4不存在假人'); '' ); print('已将全部假人移交§6FZ\'sDataPack§f清除标签'); game_tick(50); print('已清除全部假人'); '' ); tp(player_name,x,y,z) ->( __check_offline(player_name); s_player = player(); if(x == 's', x = s_player~'x' ); if(y == 's', y = s_player~'y' ); if(z == 's', z = s_player~'z' ); x = __check_pos(x); y = __check_pos(y); z = __check_pos(z); run(str('tp %s %f %f %f', player_name, x, y, z)); '' ); \ No newline at end of file diff --git a/data/fz/functions/install.mcfunction b/data/fz/functions/install.mcfunction index f58c7fb..b5ab126 100644 --- a/data/fz/functions/install.mcfunction +++ b/data/fz/functions/install.mcfunction @@ -6,10 +6,11 @@ # This project is licensed under the terms of the GNU General Public License v3.0. # Copyright (C)2019-2020 Harvey.Kang -scoreboard objectives add version dummy #升级用# +scoreboard objectives add version dummy scoreboard players operation version version = version version -execute if score version version matches ..132 run function fz:updatebeforeinstall +execute if score version version matches ..132 run function fz:updatebeforeinstall133 +execute if score version version matches 133 run function fz:updatebeforeinstall134 #### scoreboard objectives add timeCounter dummy scoreboard objectives add 20 dummy @@ -22,7 +23,8 @@ function fz:cleaner/install function fz:logintips/install function fz:config/install #升级用# -execute if score installed installed matches ..132 run function fz:updateafterinstall -scoreboard players set version version 133 +execute if score installed installed matches ..132 run function fz:updateafterinstall133 +execute if score installed installed matches 133 run function fz:updateafterinstall134 +scoreboard players set version version 1331 #### tellraw @a [{"text":"[Datapack]"},{"text":" FZ'sDataPack v1.3.3 installed successfully","color":"gold"}] \ No newline at end of file diff --git a/data/fz/functions/noai/configs.mcfunction b/data/fz/functions/noai/configs.mcfunction index 901b584..173e54f 100644 --- a/data/fz/functions/noai/configs.mcfunction +++ b/data/fz/functions/noai/configs.mcfunction @@ -21,8 +21,3 @@ execute if data storage minecraft:pufferfish {ai:0b} run tellraw @s [{"text":"- execute unless data storage minecraft:bat {ai:0b} run tellraw @s [{"text":"- "},{"text":"蝙蝠[minecraft:bat]","hoverEvent":{"action":"show_text","value":"状态:开启"}},{"text":" "},{"text":"[✔]","color":"gray","hoverEvent":{"action":"show_text","value":"已开启"}},{"text":" "},{"text":"[✘]","color":"dark_red","clickEvent":{"action":"run_command","value":"/data modify storage minecraft:bat ai set value 0b"},"hoverEvent":{"action":"show_text","value":"点击以关闭"}}] #如果蝙蝠ai为开则显示开启按钮 execute if data storage minecraft:bat {ai:0b} run tellraw @s [{"text":"- "},{"text":"蝙蝠[minecraft:bat]","hoverEvent":{"action":"show_text","value":"状态:关闭"}},{"text":" "},{"text":"[✔]","color":"dark_green","clickEvent":{"action":"run_command","value":"/data modify storage minecraft:bat ai set value 1b"},"hoverEvent":{"action":"show_text","value":"点击以开启"}},{"text":" "},{"text":"[✘]","color":"gray","hoverEvent":{"action":"show_text","value":"已关闭"}}] - - - - - diff --git a/data/fz/functions/score/install.mcfunction b/data/fz/functions/score/install.mcfunction index 725507d..f12947c 100644 --- a/data/fz/functions/score/install.mcfunction +++ b/data/fz/functions/score/install.mcfunction @@ -68,8 +68,7 @@ team join tradingCounter 总交易数 team join damageTaken 总受伤害量 team join activation 总活跃时间 #安装显示 -team modify displayScoresOff color dark_purple -scoreboard objectives setdisplay sidebar.team.dark_purple +scoreboard objectives setdisplay sidebar team modify displayScoresOn color gold scoreboard objectives setdisplay sidebar.team.gold totalList team modify killCounter color red diff --git a/data/fz/functions/score/main.mcfunction b/data/fz/functions/score/main.mcfunction index 9515403..b7f8a62 100644 --- a/data/fz/functions/score/main.mcfunction +++ b/data/fz/functions/score/main.mcfunction @@ -74,4 +74,7 @@ execute if score 总活跃时间 totalActivation matches 1.. run scoreboard play #execute if score totalFished totalFished matches ..0 run function fz:score/totalnodisplay/fishingcounter #execute if score totalHurt totalHurt matches ..0 run function fz:score/totalnodisplay/damagetaken #execute if score totalActivation totalActivation matches ..0 run function fz:score/activation/totalnodisplay +#### +#假人清理模块# +execute as @a[tag=noCarpetBot] run function fz:score/removebottag #### \ No newline at end of file diff --git a/data/fz/functions/score/removebottag.mcfunction b/data/fz/functions/score/removebottag.mcfunction new file mode 100644 index 0000000..f9d4963 --- /dev/null +++ b/data/fz/functions/score/removebottag.mcfunction @@ -0,0 +1,2 @@ +tag @s remove carpetBot +tag @s remove noCarpetBot \ No newline at end of file diff --git a/data/fz/functions/updatebeforeinstall133.mcfunction b/data/fz/functions/updatebeforeinstall133.mcfunction new file mode 100644 index 0000000..544e530 --- /dev/null +++ b/data/fz/functions/updatebeforeinstall133.mcfunction @@ -0,0 +1,19 @@ +scoreboard objectives remove installed +scoreboard players operation 总挖掘数 totalList = totalDug totalList +scoreboard players operation 总击杀数 totalList = totalKilled totalList +scoreboard players operation 总死亡数 totalList = totalDeath totalList +scoreboard players operation 总交易数 totalList = totalTraded totalList +scoreboard players operation 总钓鱼数 totalList = totalFished totalList +scoreboard players operation 总受伤害量 totalList = totalHurt totalList +scoreboard players operation 总活跃时间 totalList = totalActivation totalList +scoreboard players reset totalDug +scoreboard players reset totalKilled +scoreboard players reset totalDeath +scoreboard players reset totalTraded +scoreboard players reset totalFished +scoreboard players reset totalHurt +scoreboard players reset totalActivation +scoreboard objectives remove scoreswitch +scoreboard objectives remove actCounter +scoreboard objectives setdisplay sidebar.team.dark_purple +team remove displayScoresOff \ No newline at end of file diff --git a/data/fz/functions/updatebeforeinstall134.mcfunction b/data/fz/functions/updatebeforeinstall134.mcfunction new file mode 100644 index 0000000..89aacbd --- /dev/null +++ b/data/fz/functions/updatebeforeinstall134.mcfunction @@ -0,0 +1,2 @@ +scoreboard objectives setdisplay sidebar.team.dark_purple +team remove displayScoresOff \ No newline at end of file