Compare commits

...

7 Commits

Author SHA1 Message Date
延皓 525e1a0865 修复自动升级相关bug 2022-08-02 01:43:37 +08:00
延皓 24bb299869 fix fzsd_score.sc 2022-08-02 01:21:45 +08:00
延皓 26dac885cb fix README 2022-08-02 01:09:40 +08:00
延皓 7fc0c2612a beta.7 2022-08-02 00:38:47 +08:00
延皓 ed3c0e5077 fix 2022-08-02 00:36:38 +08:00
延皓 3d2348dd61 更新 README.md 2022-08-02 00:36:13 +08:00
延皓 d05ac38056 更新readme 2022-08-02 00:32:05 +08:00
15 changed files with 148 additions and 115 deletions
+8 -4
View File
@@ -11,8 +11,8 @@
## 安装教程 ## 安装教程
1. 兼容性 1. 兼容性
- `数据包 v3.0.x` 暂时只支持 `Minecraft 1.19+` - `数据包 v3.0.x` 支持 `Minecraft 1.18~1.19.1`
- `数据包 v2.2.x` 支持 `Minecraft 1.19+` - `数据包 v2.2.x` 支持 `Minecraft 1.19.x`
- `数据包 v2.1.x` 支持 `Minecraft 1.17.x-1.18.x` - `数据包 v2.1.x` 支持 `Minecraft 1.17.x-1.18.x`
- `数据包 v2.0.x` 支持 `Minecraft 1.16.3-1.16.5` - `数据包 v2.0.x` 支持 `Minecraft 1.16.3-1.16.5`
2. 前往[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)下载对应MC版本的数据包 2. 前往[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)下载对应MC版本的数据包
@@ -25,7 +25,9 @@
# FZ生存数据包 3.0 # FZ生存数据包 3.0
[![release版本](https://img.shields.io/badge/发行版-3.0.0-blue.svg)](https://gitee.com/harvey-husky/FZ-sDatapack/releases/v3.0.0) [![mc版本](https://img.shields.io/badge/Minecraft-1.19+-blue.svg)](https://minecraft.net/) ## *目前仍在测试阶段,请先备份服务器再使用!*
[![数据包版本](https://img.shields.io/badge/测试版-3.0+beta.8-blue.svg)](https://gitee.com/harvey-husky/FZ-sDatapack/releases/v3.0-beta.8) [![MC版本](https://img.shields.io/badge/Minecraft-1.19+-blue.svg)](https://minecraft.net/)
> 其他版本见[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases) > 其他版本见[发行页面](https://gitee.com/harvey-husky/FZ-sDatapack/releases)
@@ -62,9 +64,11 @@
- 可避免Carpet假人污染计分板 - 可避免Carpet假人污染计分板
- 执行 `reload` 指令后自动生效 - 执行 `reload` 指令后自动生效
- 子命令( `/fzsd_score <子命令>` ): - 子命令( `/fzsd_score <子命令>` ):
- `merge_old`:用于从 `数据包2.x` 升级后恢复计分板数据 - `update_from <version>`:用于从给定的数据包版本恢复计分板数据(需要测试!)
- `recalculate_total`:重新计算总分 - `recalculate_total`:重新计算总分
### 其他 ### 其他
- 见游戏内交互器按钮 - 见游戏内交互器按钮
## 开发者相关
- 参见[开发文档](/DEVDOC.md)
+1 -1
View File
@@ -1,4 +1,4 @@
execute store success storage fzsd:version fzsd.need_update int 1 run data merge storage fzsd:version {fzsd: {version: '3.0.0-beta.6'}} execute store success storage fzsd:version fzsd.need_update int 1 run data merge storage fzsd:version {fzsd: {version: '3.0.0-beta.8'}}
execute if data storage fzsd:version fzsd{need_update: 1} run function fzsd:system/update execute if data storage fzsd:version fzsd{need_update: 1} run function fzsd:system/update
function fzsd:system/carpet/try_load_fzsd_score function fzsd:system/carpet/try_load_fzsd_score
function #fzsd:load function #fzsd:load
@@ -2,8 +2,6 @@
execute store result storage fzsd:here fzsd.x int 1 run data get entity @s Pos[0] execute store result storage fzsd:here fzsd.x int 1 run data get entity @s Pos[0]
execute store result storage fzsd:here fzsd.y int 1 run data get entity @s Pos[1] execute store result storage fzsd:here fzsd.y int 1 run data get entity @s Pos[1]
execute store result storage fzsd:here fzsd.z int 1 run data get entity @s Pos[2] execute store result storage fzsd:here fzsd.z int 1 run data get entity @s Pos[2]
data modify storage fzsd:here fzsd.message.dimension set from storage fzsd:global fzsd.api.dimension.name
data modify storage fzsd:here fzsd.message.position set value '[{"text": "[", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}]'
data modify storage fzsd:here fzsd.message.append set value '' data modify storage fzsd:here fzsd.message.append set value ''
## ##
@@ -1 +1 @@
tellraw @a [{"text": "", "color": "white"}, {"selector": "@s"}, {"text": "说:"}, {"text": "我在"}, {"nbt": "fzsd.message.dimension", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.position", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}] tellraw @a [{"selector": "@s"}, [{"text": "说:我在", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]]
@@ -1 +1 @@
tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.message.dimension", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.position", "interpret": true, "storage": "fzsd:here"}, {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}] tellraw @s [{"text": "你在", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:here"}, {"text": "]"}], {"nbt": "fzsd.message.append", "interpret": true, "storage": "fzsd:here"}]
@@ -1,2 +1,2 @@
execute if data entity @s LastDeathLocation run tellraw @s [{"text": "你上次死亡于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:last_death"}, {"text": "]"}]] execute if data entity @s LastDeathLocation run tellraw @s [{"text": "你上次死亡于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:last_death"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:last_death"}, {"text": "]"}]]
execute unless data entity @s LastDeathLocation run tellraw @s {"text": "你从未死亡!"} execute unless data entity @s LastDeathLocation run tellraw @s {"text": "你从未死亡!"}
@@ -1,2 +1,2 @@
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @a [{"selector": "@s"}, [{"text": "说:我上次穿出的下界传送门位于", "color": "white"}, {"nbt": "fzsd.message", "interpret": true, "storage": "fzsd:last_nether_portal"}]] execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @a [{"selector": "@s"}, [{"text": "说:我上次穿出的下界传送门位于", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]]
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"} execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
@@ -2,7 +2,6 @@ scoreboard objectives add fzsd.module.last_nether_portal.dimension dummy
scoreboard objectives add fzsd.module.last_nether_portal.x dummy scoreboard objectives add fzsd.module.last_nether_portal.x dummy
scoreboard objectives add fzsd.module.last_nether_portal.y dummy scoreboard objectives add fzsd.module.last_nether_portal.y dummy
scoreboard objectives add fzsd.module.last_nether_portal.z dummy scoreboard objectives add fzsd.module.last_nether_portal.z dummy
data modify storage fzsd:last_nether_portal fzsd.message set value '[{"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]'
## ##
data modify storage fzsd:install fzsd.module.last_nether_portal set value 1b data modify storage fzsd:install fzsd.module.last_nether_portal set value 1b
@@ -1,2 +1,2 @@
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s [{"text": "你上次穿出的下界传送门位于"}, {"nbt": "fzsd.message", "interpret": true, "storage": "fzsd:last_nether_portal"}] execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s [{"text": "你上次穿出的下界传送门位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"} execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
@@ -1,2 +1,2 @@
execute if data entity @s SpawnDimension run tellraw @s [{"text": "你的上个出生点位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[x: ", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_spawn_point"}, {"text": ", y: "}, {"nbt": "fzsd.y", "storage": "fzsd:last_spawn_point"}, {"text": ", z: "}, {"nbt": "fzsd.z", "storage": "fzsd:last_spawn_point"}, {"text": "]"}]] execute if data entity @s SpawnDimension run tellraw @s [{"text": "你的上个出生点位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"nbt": "fzsd.x", "storage": "fzsd:last_spawn_point"}, {"text": ", "}, {"nbt": "fzsd.y", "storage": "fzsd:last_spawn_point"}, {"text": ", "}, {"nbt": "fzsd.z", "storage": "fzsd:last_spawn_point"}, {"text": "]"}]]
execute unless data entity @s SpawnDimension run tellraw @s {"text": "你从未设置过出生点!"} execute unless data entity @s SpawnDimension run tellraw @s {"text": "你从未设置过出生点!"}
@@ -1,2 +1,2 @@
## ##
data modify storage fzsd:installed fzsd.cache set from storage fzsd:installed fzsd.module data modify storage fzsd:install fzsd.cache set from storage fzsd:install fzsd.module
@@ -1,3 +1,3 @@
## ##
data modify storage fzsd:installed fzsd.module set from storage fzsd:installed fzsd.cache data modify storage fzsd:install fzsd.module set from storage fzsd:install fzsd.cache
data remove storage fzsd:installed fzsd.cache data remove storage fzsd:install fzsd.cache
+1 -1
View File
@@ -1,2 +1,2 @@
execute if data storage fzsd:installed fzsd{global: 1b} run function #fzsd:uninstall execute if data storage fzsd:install fzsd{global: 1b} run function #fzsd:uninstall
function #fzsd:install function #fzsd:install
+1 -1
View File
@@ -5,8 +5,8 @@
"#fzsd:system/uninstall/before", "#fzsd:system/uninstall/before",
"fzsd:system/uninstall/cache_module_install_data", "fzsd:system/uninstall/cache_module_install_data",
"#fzsd:system/uninstall/module", "#fzsd:system/uninstall/module",
"fzsd:system/uninstall/restore_module_install_data",
"#fzsd:system/uninstall/system", "#fzsd:system/uninstall/system",
"fzsd:system/uninstall/restore_module_install_data",
"#fzsd:system/uninstall/after" "#fzsd:system/uninstall/after"
] ]
} }
+128 -96
View File
@@ -1,7 +1,7 @@
// 计分板模块扩展插件 // 计分板模块扩展插件
// 忽略假人分数 // 忽略假人分数
// **请勿修改文件名** // **请勿修改文件名**
global_app_version = '1.0-beta.4'; global_app_version = '1.0-beta.6';
__config() -> { __config() -> {
'scope' -> 'global', 'scope' -> 'global',
@@ -13,148 +13,176 @@ __config() -> {
'commands' -> { 'commands' -> {
'' -> 'help', '' -> 'help',
'help' -> 'help', 'help' -> 'help',
'delete_old' -> 'delete_old', 'delete_old <fzsd_version>' -> 'delete_old',
'merge_old' -> 'restore_merge_old', 'update_from <fzsd_version>' -> 'update_from',
'restore_from_stats' -> 'restore_from_stats', 'restore_from_stats' -> 'restore_from_stats',
'recalculate_total' -> 'recalculate_total_scores' 'recalculate_total' -> 'recalculate_total_scores',
'commandPlayer <boolean>' -> 'command_player'
},
'arguments' -> {
'boolean' -> {
'type' -> 'bool'
},
'fzsd_version' -> {
'type' -> 'term',
'suggest' -> [
'2.x',
'3.0-beta.4'
]
}
} }
}; };
__on_start() -> ( __on_start() -> (
global_team_cache = read_file('team_cache', 'json'); global_team_cache = read_file('team_cache', 'json');
debug(global_team_cache); if(global_team_cache == null, // carpet 1.4.69 兼容
global_team_cache = {};
);
print(player('all'), 'fzsd_score.sc已加载!'); print(player('all'), 'fzsd_score.sc已加载!');
); );
__on_close() -> ( __on_close() -> (
debug(global_team_cache);
delete_file('team_cache', 'json'); delete_file('team_cache', 'json');
write_file('team_cache', 'json', global_team_cache); write_file('team_cache', 'json', global_team_cache);
); );
__on_player_connects(player) -> ( __on_player_connects(player) -> (
debug(player ~ 'name'); player_type = player ~ 'player_type';
debug(player ~ 'player_type'); player_team = player ~ 'team';
debug(player ~ 'team'); player_name = player ~ 'name';
debug(global_team_cache); if(player_type == 'fake' && player_team != 'fzsd.module.scoreboard.fake',
if(player ~ 'player_type' == 'fake' && player ~ 'team' != 'fz.module.scoreboard.fake',
( (
debug('1~'); global_team_cache:player_name = player_team;
global_team_cache:(player ~ 'name') = player ~ 'team'; team_add('fzsd.module.scoreboard.fake', player);
debug(global_team_cache);
team_add('fz.module.scoreboard.fake', player);
), ),
player ~ 'player_type' == 'shadow' && player ~ 'team' != 'fz.module.scoreboard.shadow', player_type == 'shadow' && player_team != 'fzsd.module.scoreboard.shadow',
( (
debug('2~'); global_team_cache:player_name = player_team;
global_team_cache:(player ~ 'name') = player ~ 'team'; team_add('fzsd.module.scoreboard.shadow', player);
team_add('fz.module.scoreboard.shadow', player);
), ),
try_restore_team_from_cache(player); try_restore_team_from_cache(player);
); );
debug(global_team_cache);
); );
__on_player_disconnects(player, reason) -> ( __on_player_disconnects(player, reason) -> (
debug(player ~ 'name');
debug(player ~ 'player_type');
debug(player ~ 'team');
debug(global_team_cache);
try_restore_team_from_cache(player); try_restore_team_from_cache(player);
); );
try_restore_team_from_cache(player) -> ( try_restore_team_from_cache(player) -> (
player_team = player ~ 'team';
player_name = player ~ 'name';
debug('restore_team_from_cache'); debug('restore_team_from_cache');
if(player ~ 'team' == 'fz.module.scoreboard.fake' if(player_team == 'fzsd.module.scoreboard.fake'
|| player ~ 'team' == 'fz.module.scoreboard.shadow', || player_team == 'fzsd.module.scoreboard.shadow',
debug(global_team_cache); if(global_team_cache:player_name == null,
if(global_team_cache:(player ~ 'name') == null,
( (
debug('global_team_cache:(player ~ \'name\') == null');
team_leave(player); team_leave(player);
), ),
debug('global_team_cache:(player ~ \'name\') != null'); team_add(global_team_cache:player_name , player);
team_add(global_team_cache:(player ~ 'name') , player); delete(global_team_cache:player_name);
delete(global_team_cache:(player ~ 'name'));
); );
); );
); );
help() -> ( help() -> (
print('这是一条帮助'); print('暂未开发');
return(0); return(0);
); );
delete_old() -> ( delete_old(fzsd_version) -> (
old_scoreboards = [ old_scoreboards = [];
'usedDiaAxe', 'usedDiaPickaxe', 'usedDiaShovel', 'usedDiaHoe', 'usedIroAxe', 'usedIroPickaxe', if(fzsd_version == '2.x',
'usedIroShovel', 'usedIroHoe', 'usedStoAxe', 'usedStoPickaxe', 'usedStoShovel', 'usedStoHoe', (
'usedWooAxe', 'usedWooPickaxe', 'usedWooShovel', 'usedWooHoe', 'usedGolAxe', 'usedGolPickaxe', old_scoreboards = ['usedDiaAxe', 'usedDiaPickaxe', 'usedDiaShovel', 'usedDiaHoe', 'usedIroAxe','usedIroPickaxe', 'usedIroShovel', 'usedIroHoe', 'usedStoAxe', 'usedStoPickaxe', 'usedStoShovel', 'usedStoHoe', 'usedWooAxe', 'usedWooPickaxe', 'usedWooShovel', 'usedWooHoe', 'usedGolAxe', 'usedGolPickaxe', 'usedGolShovel', 'usedGolHoe', 'usedNetAxe', 'usedNetPickaxe', 'usedNetShovel', 'usedNetHoe', 'usedShears', 'damageTaken', '10xDamageTaken', 'deathCounter', 'deathTester', 'digCounter', 'fishingCounter', 'fishingTester', 'killCounter', 'tradingCounter', 'totalList', 'bedrockBreaked', 'fz.bbl', 'fz.aviate1m', 'fz.aviateCounter', 'fz.aviateOneTime', 'Health', 'carpetBot', 'parameter'];
'usedGolShovel', 'usedGolHoe', 'usedNetAxe', 'usedNetPickaxe', 'usedNetShovel', 'usedNetHoe', team_remove('carpetBot');
'usedShears', 'damageTaken', '10xDamageTaken', 'deathCounter', 'deathTester', 'digCounter', team_remove('shadowedPlayer');
'fishingCounter', 'fishingTester', 'killCounter', 'tradingCounter', 'totalList', ),
'bedrockBreaked', 'fz.bbl', 'fz.aviate1m', 'fz.aviateCounter', 'fz.aviateOneTime', 'Health', fzsd_version == '3.0-beta.4',
'carpetBot', 'parameter' (
]; old_scoreboards = ['fz.module.scoreboard.display.activation', 'fz.module.scoreboard.display.damage_taken', 'fz.module.scoreboard.display.death_count', 'fz.module.scoreboard.display.dig_count', 'fz.module.scoreboard.display.fishing_count', 'fz.module.scoreboard.display.kill_count', 'fz.module.scoreboard.display.trade_count', 'fz.module.scoreboard.display.bedrock_broke_count', 'fz.module.scoreboard.display.aviating_distance', 'fz.module.scoreboard.display.placement_count', 'fz.module.scoreboard.assign.general', 'fz.module.scoreboard.display.general', 'fz.module.scoreboard.interactor'];
team_remove('fz.module.scoreboard.fake');
team_remove('fz.module.scoreboard.shadow');
)
);
for(old_scoreboards, scoreboard_remove(_)); for(old_scoreboards, scoreboard_remove(_));
team_remove('carpetBot');
team_remove('shadowedPlayer');
print('已清除旧版计分板!'); print('已清除旧版计分板!');
return(0); return(0);
); );
restore_merge_old() -> ( update_from(fzsd_version) -> (
params = [];
merge_score('activation', 'fz.module.scoreboard.display.activation'); if(fzsd_version == '2.x',
merge_score('damageTaken', 'fz.module.scoreboard.display.damage_taken'); (
merge_score('deathCounter', 'fz.module.scoreboard.display.death_count'); params = [
merge_score('digCounter', 'fz.module.scoreboard.display.dig_count'); ['activation', 'fzsd.module.scoreboard.display.activation'],
merge_score('fishingCounter', 'fz.module.scoreboard.display.fishing_count'); ['damageTaken', 'fzsd.module.scoreboard.display.damage_taken'],
merge_score('killCounter', 'fz.module.scoreboard.display.kill_count'); ['deathCounter', 'fzsd.module.scoreboard.display.death_count'],
merge_score('tradingCounter', 'fz.module.scoreboard.display.trade_count'); ['digCounter', 'fzsd.module.scoreboard.display.dig_count'],
merge_score('bedrockBreaked', 'fz.module.scoreboard.display.bedrock_broke_count'); ['fishingCounter', 'fzsd.module.scoreboard.display.fishing_count'],
merge_score('fz.aviate1m', 'fz.module.scoreboard.display.aviating_distance'); ['killCounter', 'fzsd.module.scoreboard.display.kill_count'],
// restore_score('fz.module.scoreboard.display.placement_count', ); ['tradingCounter', 'fzsd.module.scoreboard.display.trade_count'],
['bedrockBreaked', 'fzsd.module.scoreboard.display.bedrock_broke_count'],
['fz.aviate1m', 'fzsd.module.scoreboard.display.aviating_distance']
]
),
fzsd_version == '3.0-beta.4',
(
params = [
['fz.module.scoreboard.display.activation', 'fzsd.module.scoreboard.display.activation'],
['fz.module.scoreboard.display.damage_taken', 'fzsd.module.scoreboard.display.damage_taken'],
['fz.module.scoreboard.display.death_count', 'fzsd.module.scoreboard.display.death_count'],
['fz.module.scoreboard.display.dig_count', 'fzsd.module.scoreboard.display.dig_count'],
['fz.module.scoreboard.display.fishing_count', 'fzsd.module.scoreboard.display.fishing_count'],
['fz.module.scoreboard.display.kill_count', 'fzsd.module.scoreboard.display.kill_count'],
['fz.module.scoreboard.display.trade_count', 'fzsd.module.scoreboard.display.trade_count'],
['fz.module.scoreboard.display.bedrock_broke_count', 'fzsd.module.scoreboard.display.bedrock_broke_count'],
['fz.module.scoreboard.display.aviating_distance', 'fzsd.module.scoreboard.display.aviating_distance'],
['fz.module.scoreboard.display.placement_count', 'fzsd.module.scoreboard.display.placement_count']
]
)
);
for(params, merge_score(..._, fzsd_version));
// 清除旧计分板 // 清除旧计分板
delete_old(); delete_old(fzsd_version);
print('完成!'); print('完成!');
return(0); return(0);
); );
merge_score(from, to) -> ( merge_score(from, to, fzsd_version) -> (
// 如果目标计分板不存在则创建 // 如果目标计分板不存在则创建
if(scoreboard() ~ to == null, scoreboard_add(to)); if(scoreboard() ~ to == null, scoreboard_add(to));
// 旧版数据包的假人列表 // new_players = [];
fake_players = team_list('carpetBot');
if(fzsd_version == '2.x',
(
// 2.x数据包的假人列表
fake_players = team_list('carpetBot');
// 新数据包的计分板中存储的玩家列表
new_players = scoreboard('fzsd.module.interactor.trigger');
for(fake_players, delete(new_players, _));
),
fzsd_version == '3.0-beta.4',
(
new_players = scoreboard('fz.module.interactor.trigger');
)
);
// 新数据包的计分板中存储的玩家列表
new_players = scoreboard('fz.module.interactor.trigger');
debug('2' + new_players);
for(scoreboard(from), for(scoreboard(from),
debug('3' + _); if(!(_ ~ '\\W'),
debug('3.1' + contains(fake_players, _));
debug('3.2' + contains(new_players, _));
debug('3.3' + str(_ != total_name_old));
debug('3.4' + str((!contains(fake_players, _)
|| contains(new_players, _)
) && !(_ ~ '\\W')));
if((!contains(fake_players, _)
|| contains(new_players, _)
) && !(_ ~ '\\W'),
debug('4' + _);
debug('from' + scoreboard(from, _));
debug('to' + scoreboard(to, _));
scoreboard(to, _, scoreboard(to, _) + scoreboard(from, _)); scoreboard(to, _, scoreboard(to, _) + scoreboard(from, _));
); );
); );
print('已合并:' + to);
// 重新计算总分 // 重新计算总分
recalculate_total_score(to, get_total_score_name_new(to)); recalculate_total_score(to, get_total_score_name_new(to));
print('已合并:' + to);
return(0); return(0);
); );
@@ -167,10 +195,10 @@ get_total_score_name_new(scoreboard) -> (
// 将系统总榜分数加上最小int值使其成为最低分 // 将系统总榜分数加上最小int值使其成为最低分
scoreboard( scoreboard(
'fz.module.scoreboard.assign.general', 'fzsd.module.scoreboard.assign.general',
system_total_name, system_total_name,
scoreboard( scoreboard(
'fz.module.scoreboard.assign.general', 'fzsd.module.scoreboard.assign.general',
system_total_name system_total_name
) + INT_MIN ) + INT_MIN
); );
@@ -189,15 +217,14 @@ get_total_score_name_new(scoreboard) -> (
last_min_player = _; last_min_player = _;
) )
); );
debug(_);
); );
// 恢复总榜分数 // 恢复总榜分数
scoreboard( scoreboard(
'fz.module.scoreboard.assign.general', 'fzsd.module.scoreboard.assign.general',
system_total_name, system_total_name,
scoreboard( scoreboard(
'fz.module.scoreboard.assign.general', 'fzsd.module.scoreboard.assign.general',
system_total_name system_total_name
) - INT_MIN ) - INT_MIN
); );
@@ -209,15 +236,15 @@ get_total_score_name_new(scoreboard) -> (
recalculate_total_scores() -> ( recalculate_total_scores() -> (
scoreboards = [ scoreboards = [
'fz.module.scoreboard.display.activation', 'fzsd.module.scoreboard.display.activation',
'fz.module.scoreboard.display.damage_taken', 'fzsd.module.scoreboard.display.damage_taken',
'fz.module.scoreboard.display.death_count', 'fzsd.module.scoreboard.display.death_count',
'fz.module.scoreboard.display.dig_count', 'fzsd.module.scoreboard.display.dig_count',
'fz.module.scoreboard.display.fishing_count', 'fzsd.module.scoreboard.display.fishing_count',
'fz.module.scoreboard.display.kill_count', 'fzsd.module.scoreboard.display.kill_count',
'fz.module.scoreboard.display.trade_count', 'fzsd.module.scoreboard.display.trade_count',
'fz.module.scoreboard.display.bedrock_broke_count', 'fzsd.module.scoreboard.display.bedrock_broke_count',
'fz.module.scoreboard.display.aviating_distance' 'fzsd.module.scoreboard.display.aviating_distance'
]; ];
for(scoreboards,recalculate_total_score(_, get_total_score_name_new(_))); for(scoreboards,recalculate_total_score(_, get_total_score_name_new(_)));
print('完成!'); print('完成!');
@@ -234,7 +261,7 @@ recalculate_total_score(scoreboard, total_score_name_new) -> (
); );
// 赋值总分到系统总分计分板 // 赋值总分到系统总分计分板
scoreboard( scoreboard(
'fz.module.scoreboard.assign.general', 'fzsd.module.scoreboard.assign.general',
replace(scoreboard, 'display', 'total'), replace(scoreboard, 'display', 'total'),
total_score total_score
); );
@@ -248,12 +275,11 @@ display_total_score(scoreboard) -> (
str_1 = split('\\.', scoreboard); str_1 = split('\\.', scoreboard);
function_name = str_1:(length(str_1) - 1); function_name = str_1:(length(str_1) - 1);
// 运行函数将分数赋值到显示计分板上 // 运行函数将分数赋值到显示计分板上
run('function #fz:module/scoreboard/assign/scoreboard/general/' + function_name); run('function #fzsd:module/scoreboard/assign/scoreboard/general/' + function_name);
return(0); return(0);
); );
restore_from_stats() -> ( restore_from_stats() -> (
print('暂未开发'); print('暂未开发');
return(0); return(0);
); );
@@ -263,6 +289,12 @@ merge_stat(scoreboard, ...stats) -> (
return(0); return(0);
); );
command_player(boolean) -> (
print(run('carpet setDefault commandPlayer ' + str(boolean)):1:0);
);
// 工具函数
contains(list, value) -> ( contains(list, value) -> (
return(list ~ value != null); return(list ~ value != null);
); );