fix scripts/fzsd_score.sc. (重写)

Signed-off-by: 延皓 <harvey_husky@foxmail.com>
This commit is contained in:
延皓 2024-06-23 13:12:20 +00:00 committed by Gitee
parent d81d0a530a
commit 96f2320257
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -43,6 +43,24 @@ global_current_scoreboard_list = [
'fzsd.module.scoreboard.display.aviating_distance', 'fzsd.module.scoreboard.display.aviating_distance',
'fzsd.module.scoreboard.display.placement_count' 'fzsd.module.scoreboard.display.placement_count'
]; ];
global_generals_old = {
'fzsd.module.scoreboard.display.damage_taken' -> '总受伤害量',
'fzsd.module.scoreboard.display.dig_count' -> '总挖掘量',
'fzsd.module.scoreboard.display.placement_count' -> '总放置方块数',
'fzsd.module.scoreboard.display.trade_count' -> '总交易量'
};
global_current_generals = {
'fzsd.module.scoreboard.display.activation' -> '总活跃时间',
'fzsd.module.scoreboard.display.damage_taken' -> '总受伤害数',
'fzsd.module.scoreboard.display.death_count' -> '总死亡数',
'fzsd.module.scoreboard.display.dig_count' -> '总挖掘数',
'fzsd.module.scoreboard.display.fishing_count' -> '总钓鱼数',
'fzsd.module.scoreboard.display.kill_count' -> '总击杀数',
'fzsd.module.scoreboard.display.trade_count' -> '总交易数',
'fzsd.module.scoreboard.display.bedrock_broken_count' -> '总破基岩数',
'fzsd.module.scoreboard.display.aviating_distance' -> '总飞行距离',
'fzsd.module.scoreboard.display.placement_count' -> '总建造数'
};
__config() -> { __config() -> {
'scope' -> 'global', 'scope' -> 'global',
@ -54,26 +72,18 @@ __config() -> {
'commands' -> { 'commands' -> {
// '' -> 'help', // '' -> 'help',
// 'help' -> 'help', // 'help' -> 'help',
'delete <version>' -> 'command_delete', 'restore whitelist' -> ['command_restore_whitelist', null],
'update <version>' -> 'command_update', 'restore whitelist <scoreboardID>' -> 'command_restore_whitelist',
'restore whitelist' -> ['command_restore', null, null], 'restore player <playerName>' -> ['command_restore_player', null],
'restore whitelist <scoreboardID>' -> _(scoreboardID) -> command_restore(null, scoreboardID), 'restore player <playerName> <scoreboardID>' -> 'command_restore_player',
'restore player <playerName>' -> ['command_restore', null], 'recalculate <scoreboardID>' -> 'command_recalculate',
'restore player <playerName> <scoreboardID>' -> 'command_restore', 'recalculate' -> ['command_recalculate', null],
'restore <custom> whitelist <trade_count>' -> _(custom, trade_count) -> command_restore_trade_count_confirm(custom, null, trade_count), 'commandPlayer <permissionType>' -> 'command_carpet_command_player',
'restore <custom> player <playerName> <trade_count>' -> 'command_restore_trade_count_confirm',
'recalculate <scoreboardID>' -> 'command_recalculate_total_score',
'recalculate' -> ['command_recalculate_total_score', null],
'commandPlayer <permissionType>' -> 'carpet_command_player',
'reset <scoreboardPlayer> <scoreboardID>' -> 'command_reset', 'reset <scoreboardPlayer> <scoreboardID>' -> 'command_reset',
'reset <scoreboardPlayer>' -> ['command_reset', null], 'reset <scoreboardPlayer>' -> ['command_reset', null],
'set <playerName> <scoreboardID> <score>' -> 'command_set' 'set <playerName> <scoreboardID> <score>' -> 'command_set'
}, },
'arguments' -> { 'arguments' -> {
'trade_count' -> {
'type' -> 'term',
'suggest' -> ['fzsd.module.scoreboard.display.trade_count']
},
'playerName' -> { 'playerName' -> {
'type' -> 'term', 'type' -> 'term',
'suggester' -> _(args) -> player('all') 'suggester' -> _(args) -> player('all')
@ -94,22 +104,9 @@ __config() -> {
'ops' 'ops'
] ]
}, },
'version' -> {
'type' -> 'term',
'suggest' -> [
'2.x',
'3.0-beta.4',
'3.0-beta.9',
'3.0-beta.10'
]
},
'score' -> { 'score' -> {
'type' -> 'int', 'type' -> 'int',
'suggest' -> [] 'suggest' -> []
},
'custom' -> {
'type' -> 'term',
'suggest' -> []
} }
} }
}; };
@ -128,7 +125,7 @@ __on_close() -> (
write_file('team_cache', 'json', global_team_cache); write_file('team_cache', 'json', global_team_cache);
); );
if(require_version('1.4.999'), // 待支持 if(require_version('1.4.999'), // 暂时无效
__on_player_command(player, command) -> ( __on_player_command(player, command) -> (
l = length(command); l = length(command);
if(l > 13 if(l > 13
@ -199,7 +196,7 @@ reload_configs() -> (
global_config:'config_version' = '1.0.0'; // 占位用无实际作用 global_config:'config_version' = '1.0.0'; // 占位用无实际作用
config_changed = true; config_changed = true;
); );
// 待支持 // 暂时无效
if(require_version('1.4.999') && !contains(global_config, 'allow_spawn_whitelist_player'), if(require_version('1.4.999') && !contains(global_config, 'allow_spawn_whitelist_player'),
global_config:'allow_spawn_whitelist_player' = false; global_config:'allow_spawn_whitelist_player' = false;
config_changed = true; config_changed = true;
@ -223,297 +220,146 @@ get_scoreboard_player_list() -> (
return(keys(set)); return(keys(set));
); );
// 重置玩家计分板分数
command_reset(player, scoreboard) -> (
if(scoreboard == null,
for(scoreboard(),
scoreboard_remove(_, player);
);
command_recalculate_total_score(null);
print('已重置' + player + '的所有分数');
return();
);
scoreboard_remove(scoreboard, player);
command_recalculate_total_score(scoreboard);
print('已重置' + player + '' + scoreboard + '分数');
return();
);
// 尝试从缓存恢复玩家队伍玩家/假人上下线时执行 // 尝试从缓存恢复玩家队伍玩家/假人上下线时执行
try_restore_team_from_cache(player) -> ( try_restore_team_from_cache(player) -> (
player_team = player ~ 'team'; player_team = player ~ 'team';
player_name = player ~ 'name'; player_name = player ~ 'name';
debug('restore_team_from_cache'); debug('restore_team_from_cache');
if(player_team == 'fzsd.module.scoreboard.fake' if(player_team != 'fzsd.module.scoreboard.fake'
|| player_team == 'fzsd.module.scoreboard.shadow', && player_team != 'fzsd.module.scoreboard.shadow',
if(global_team_cache:player_name == null, return();
( );
team_leave(player); if(global_team_cache:player_name == null,
), team_leave(player);
team_add(global_team_cache:player_name , player); ,
delete(global_team_cache:player_name); team_add(global_team_cache:player_name , player);
); delete(global_team_cache:player_name);
); );
); );
help() -> ( help() -> (
print('暂未开发');
return(); return();
); );
// 删除旧版的计分板 // 重置玩家计分板分数
command_delete(fzsd_version) -> ( command_reset(player, scoreboard_id) -> (
if(fzsd_version == '3.0-beta.10', if(scoreboard_id == null,
( run('scoreboard players reset ' + player);
scoreboard_remove('fzsd.module.scoreboard.display.bedrock_broke_count'); print('已重置' + player + '的所有分数');
),
fzsd_version == '3.0-beta.9',
(
scoreboard_remove('fzsd.extra.bbl.display');
),
fzsd_version == '2.x',
(
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'];
team_remove('carpetBot');
team_remove('shadowedPlayer');
for(old_scoreboards, scoreboard_remove(_));
),
fzsd_version == '3.0-beta.4',
(
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(_));
),
print('参数错误!');
return(); return();
); );
print('已清除旧版计分板!'); scoreboard_remove(scoreboard_id, player);
return(); print('已重置' + player + '' + scoreboard_id + '分数');
);
// 从某一旧版升级
command_update(fzsd_version) -> (
if(fzsd_version == '3.0-beta.10',
(
merge_score('fzsd.module.scoreboard.display.bedrock_broke_count', 'fzsd.module.scoreboard.display.bedrock_broken_count', fzsd_version);
command_delete(fzsd_version);
scoreboard_remove('fzsd.module.scoreboard.display.placement_count', '总放置方块数');
scoreboard_remove('fzsd.module.scoreboard.display.general', '总放置方块数');
),
fzsd_version == '3.0-beta.9',
(
merge_score('fzsd.extra.bbl.display', 'fzsd.module.scoreboard.display.bedrock_broken_count', fzsd_version);
command_delete(fzsd_version);
),
fzsd_version == '2.x',
(
params = [
['activation', 'fzsd.module.scoreboard.display.activation'],
['damageTaken', 'fzsd.module.scoreboard.display.damage_taken'],
['deathCounter', 'fzsd.module.scoreboard.display.death_count'],
['digCounter', 'fzsd.module.scoreboard.display.dig_count'],
['fishingCounter', 'fzsd.module.scoreboard.display.fishing_count'],
['killCounter', 'fzsd.module.scoreboard.display.kill_count'],
['tradingCounter', 'fzsd.module.scoreboard.display.trade_count'],
['bedrockBreaked', 'fzsd.module.scoreboard.display.bedrock_broken_count'],
['fz.aviate1m', 'fzsd.module.scoreboard.display.aviating_distance']
];
for(params, merge_score(..._, fzsd_version));
command_delete(fzsd_version);
),
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_broken_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));
command_delete(fzsd_version);
),
print('参数错误!');
return();
);
command_recalculate_total_score(null);
print('已从' + fzsd_version + '升级!');
return();
);
// 将两计分板分数合并到后者
merge_score(from, to, fzsd_version) -> (
// 如果目标计分板不存在则创建
if(scoreboard() ~ to == null, scoreboard_add(to));
// new_players = [];
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');
)
);
for(scoreboard(from),
if(!(_ ~ '\\W'),
scoreboard(to, _, scoreboard(to, _) + scoreboard(from, _));
);
);
print('已合并:' + to);
return();
);
// 获取承载总览数据的玩家名
// 因为新计分板允许玩家自定义显示的总览名称故做复杂判断才能使脚本确定用来承载总览数据的玩家名
get_total_score_name_new(scoreboard) -> (
// 系统总览id
sys_total_name = replace(scoreboard, 'display', 'total');
// 当前总分
current_score = scoreboard('fzsd.module.scoreboard.assign.general', sys_total_name);
// 将系统总览分数设为INT_MIN使其成为最低分
scoreboard('fzsd.module.scoreboard.assign.general', sys_total_name, -2147483648);
// 将总分赋值到显示计分板上
display_total_score(scoreboard);
// 查找显示计分板内的最低分玩家名
last_min_player = null;
for(scoreboard(scoreboard),
if(last_min_player == null,
(
last_min_player = _;
),
if(scoreboard(scoreboard, _) < scoreboard(scoreboard, last_min_player),
last_min_player = _;
)
);
);
// 恢复总览分数
scoreboard('fzsd.module.scoreboard.assign.general', sys_total_name, current_score);
display_total_score(scoreboard);
// 返回榜内最低分的玩家名承载总览数据的玩家名
return(last_min_player);
); );
// 重算总分scoreboard == null 时重算所有总分 // 重算总分scoreboard == null 时重算所有总分
command_recalculate_total_score(scoreboard) -> ( command_recalculate(scoreboard_id) -> (
if(scoreboard == null, recalculate_general(scoreboard_id);
for(global_current_scoreboard_list, command_recalculate_total_score(_)); );
return();
); // 设置玩家的计分板分数
total_score_name_new = get_total_score_name_new(scoreboard); command_set(player, scoreboard_id, score) -> (
// 计算总分 i = scoreboard(scoreboard_id, player, score);
print('玩家' + player + '修改前的分数为:' + i);
recalculate_general(scoreboard_id);
return(i);
);
command_carpet_command_player(level) -> (
print(run('carpet setDefault commandPlayer ' + level):1:0);
);
command_restore_whitelist(scoreboard_id) -> (
restore_scores_of_whitelist_players(scoreboard_id);
);
command_restore_player(player_name, scoreboard_id) -> (
restore_score(player_name, scoreboard_id);
);
// impls...
recalculate_general(scoreboard_id) -> (
if(scoreboard_id == null,
(
for(global_current_scoreboard_list, _recalculate_general(_));
),( // else
_recalculate_general(scoreboard_id);
));
display_generals();
);
_recalculate_general(scoreboard_id) -> (
require_not_null(scoreboard_id);
scoreboard_remove(scoreboard_id, global_generals_old:scoreboard_id); // shit compat...
scoreboard_remove(scoreboard_id, global_current_generals:scoreboard_id); // shit compat...
total_score = 0; total_score = 0;
for(scoreboard(scoreboard), for(scoreboard(scoreboard_id),
if(_ != total_score_name_new, ( // _ = player_name
current_player_score = scoreboard(scoreboard, _); score = scoreboard(scoreboard_id, _);
if(current_player_score < -1000000000, // 避免溢出 if(score <= 0,(
current_player_score = 2147483647; scoreboard_remove(scoreboard_id, _);
scoreboard(scoreboard, _, 2147483647); continue();
); ));
total_score += current_player_score; total_score += scoreboard(scoreboard_id, _);
); if(total_score < 0,(
if(total_score < 0, // 避免溢出 total_score = 2147483647; // INT_MAX
total_score = 2147483647; break();
); ));
); ));
// 赋值总分到系统总分计分板 scoreboard('fzsd.module.scoreboard.assign.general', replace(scoreboard_id, 'display', 'total'), total_score); // shit... must call display_generals() later.
scoreboard( return(total_score);
'fzsd.module.scoreboard.assign.general',
replace(scoreboard, 'display', 'total'),
total_score
);
display_total_score(scoreboard);
return();
); );
// 使用数据包函数标签将总分赋值到显示计分板上 // 使用数据包函数标签将总分赋值到显示计分板上
display_total_score(scoreboard) -> ( display_generals() -> (
// 获取计算总览的函数标签名
str_1 = split('\\.', scoreboard);
function_name = str_1:(length(str_1) - 1);
// 运行函数将分数赋值到显示计分板上 // 运行函数将分数赋值到显示计分板上
run('function #fzsd:module/scoreboard/assign/scoreboard/general/' + function_name); run('function #fzsd:module/scoreboard/assign/scoreboard/general');
return();
); );
// 恢复计分板分数player == null 时恢复所有玩家分数scoreboard == null 时恢复所有计分板分数 restore_scores_of_whitelist_players(scoreboard_id) -> ( // whitelist players only!
command_restore(player, scoreboard) -> ( whitelist = get_server_whitelist();
if(player == null,
i = 0; if(scoreboard_id != null,
for(keys(system_info('server_whitelist')), (
i += 1; for(whitelist,
if(i > 10, ( // _ = player_name
game_tick(50); _restore_score(_, scoreboard_id);
i = 0; ));
); recalculate_general(scoreboard_id);
restore_score(_, scoreboard);
);
if(scoreboard == null,
(
print('重置交易榜会丢失猪灵交易分数,请输入\n“/' + global_app_name + ' restore confirm whitelist fzsd.module.scoreboard.display.trade_count”继续执行');
print('无法还原破基岩榜,已忽略');
print('已恢复所有玩家的所有分数');
),
if(scoreboard == 'fzsd.module.scoreboard.display.trade_count',
print('重置交易榜会丢失猪灵交易分数,请输入\n“/' + global_app_name + ' restore confirm whitelist fzsd.module.scoreboard.display.trade_count”继续执行');
,
scoreboard == 'fzsd.module.scoreboard.display.bedrock_broken_count',
print('无法还原破基岩榜,已忽略');
,
print('已恢复所有玩家的' + scoreboard + '分数');
);
);
return(); return();
); ));
if(scoreboard == null,
for(global_current_scoreboard_list, restore_score(player, _)); for(global_current_scoreboard_list,
print('重置交易榜会丢失猪灵交易分数,请输入\n“/' + global_app_name + ' restore confirm player <playerName> fzsd.module.scoreboard.display.trade_count”继续执行'); (
print('无法还原破基岩榜,已忽略'); scoreboard_id = _;
print('已恢复' + player + '的所有分数'); for(whitelist,
return(); ( // _ = player_name
); _restore_score(_, scoreboard_id);
if(restore_score(player, scoreboard), ));
print('已恢复' + player + '' + scoreboard + '分数'); ));
, recalculate_general(null);
if(scoreboard == 'fzsd.module.scoreboard.display.trade_count',
print('重置交易榜会丢失猪灵交易分数,请输入\n“/' + global_app_name + ' restore confirm whitelist fzsd.module.scoreboard.display.trade_count”继续执行');
,
scoreboard == 'fzsd.module.scoreboard.display.bedrock_broken_count',
print('无法还原破基岩榜,已忽略');
);
);
return();
); );
// 恢复玩家的计分板分数 // 恢复玩家的计分板分数
restore_score(player_name, scoreboard) -> ( restore_score(player_name, scoreboard_id) -> (
require_not_null(player_name); require_not_null(player_name);
if(scoreboard == null, if(scoreboard_id == null || scoreboard_id == '',
for(global_current_scoreboard_list, restore_score(player_name, _)); (
for(global_current_scoreboard_list, _restore_score(player_name, _));
recalculate_general(null);
return(true); return(true);
); ));
if(_restore_score(player_name, scoreboard_id),
(
recalculate_general(scoreboard_id);
return(true);
));
return(false);
);
_restore_score(player_name, scoreboard_id) -> (
require_not_null(scoreboard_id);
player = player(player_name); player = player(player_name);
player_is_offline = false; player_is_offline = false;
if(player == null, if(player == null,
@ -523,55 +369,49 @@ restore_score(player_name, scoreboard) -> (
player = player(player_name); player = player(player_name);
) )
); );
if(scoreboard == 'fzsd.module.scoreboard.display.activation', if(scoreboard_id == 'fzsd.module.scoreboard.display.activation',
( (
play_ticks = statistic(player, 'custom', 'play_time'); play_ticks = statistic(player, 'custom', 'play_time');
scoreboard('fzsd.event.play_ticks', player, play_ticks%72000); scoreboard('fzsd.event.play_ticks', player, play_ticks%72000);
scoreboard(scoreboard, player, play_ticks/72000); scoreboard(scoreboard_id, player, play_ticks/72000);
), ),
scoreboard == 'fzsd.module.scoreboard.display.damage_taken', scoreboard_id == 'fzsd.module.scoreboard.display.damage_taken',
scoreboard(scoreboard, player, statistic(player, 'custom', 'damage_taken')/10); scoreboard(scoreboard_id, player, statistic(player, 'custom', 'damage_taken')/10);
, ,
scoreboard == 'fzsd.module.scoreboard.display.death_count', scoreboard_id == 'fzsd.module.scoreboard.display.death_count',
restore_from_stat(scoreboard, player, 'custom', 'deaths'); scoreboard(scoreboard_id, player, statistic(player, 'custom', 'deaths'));
, ,
scoreboard == 'fzsd.module.scoreboard.display.dig_count', scoreboard_id == 'fzsd.module.scoreboard.display.dig_count',
( (
scoreboard(scoreboard, player, 0); scoreboard(scoreboard_id, player, 0);
for(block_list(), for(block_list(), append_from_stat(scoreboard_id, player, 'mined', _));
append_from_stat(scoreboard, player, 'mined', _);
);
), ),
scoreboard == 'fzsd.module.scoreboard.display.fishing_count', scoreboard_id == 'fzsd.module.scoreboard.display.fishing_count',
scoreboard(scoreboard, player, statistic(player, 'custom', 'fish_caught')); scoreboard(scoreboard_id, player, statistic(player, 'custom', 'fish_caught'));
, ,
scoreboard == 'fzsd.module.scoreboard.display.kill_count', scoreboard_id == 'fzsd.module.scoreboard.display.kill_count',
( (
scoreboard(scoreboard, player, 0); scoreboard(scoreboard_id, player, 0);
for(entity_types('living'), for(entity_types('living'), append_from_stat(scoreboard_id, player, 'killed', _));
append_from_stat(scoreboard, player, 'killed', _);
);
), ),
scoreboard == 'fzsd.module.scoreboard.display.trade_count', scoreboard_id == 'fzsd.module.scoreboard.display.trade_count',
scoreboard(scoreboard_id, player, statistic(player, 'custom', 'traded_with_villager'));
return(false); return(false);
, ,
scoreboard == 'fzsd.module.scoreboard.display.bedrock_broken_count', scoreboard_id == 'fzsd.module.scoreboard.display.bedrock_broken_count',
return(false); return(false);
, ,
scoreboard == 'fzsd.module.scoreboard.display.aviating_distance', scoreboard_id == 'fzsd.module.scoreboard.display.aviating_distance',
scoreboard(scoreboard, player, statistic(player, 'custom', 'aviate_one_cm')/200); scoreboard(scoreboard_id, player, statistic(player, 'custom', 'aviate_one_cm')/200);
, ,
scoreboard == 'fzsd.module.scoreboard.display.placement_count', scoreboard_id == 'fzsd.module.scoreboard.display.placement_count',
( (
scoreboard(scoreboard, player, 0); scoreboard(scoreboard_id, player, 0);
for(block_list(), for(block_list(), append_from_stat(scoreboard_id, player, 'used', _));
append_from_stat(scoreboard, player, 'used', _);
);
), ),
print('未识别的计分板ID' + scoreboard); print('未识别的计分板ID' + scoreboard_id);
return(false); return(false);
); );
command_recalculate_total_score(scoreboard);
if(player_is_offline, if(player_is_offline,
world_spawn = system_info('world_spawn_point'); world_spawn = system_info('world_spawn_point');
run('spreadplayers ' + world_spawn:0 + ' ' + world_spawn:2 + ' 0 10 false ' + player); run('spreadplayers ' + world_spawn:0 + ' ' + world_spawn:2 + ' 0 10 false ' + player);
@ -580,42 +420,9 @@ restore_score(player_name, scoreboard) -> (
return(true); return(true);
); );
// 确定恢复交易榜
command_restore_trade_count_confirm(confirm, player, trade_count) -> (
if(confirm != 'confirm' || trade_count != 'fzsd.module.scoreboard.display.trade_count',
print('命令格式错误!');
return();
);
if(player == null,
for(keys(system_info('server_whitelist')),
restore_from_stat(scoreboard, _, 'custom', 'traded_with_villager');
);
return();
);
restore_from_stat(scoreboard, player, 'custom', 'traded_with_villager');
return();
);
restore_from_stat(scoreboard, player, category, entry) -> (
scoreboard(scoreboard, player, statistic(player, category, entry));
);
append_from_stat(scoreboard, player, category, entry) -> ( append_from_stat(scoreboard, player, category, entry) -> (
scoreboard(scoreboard, player, scoreboard(scoreboard, player,
statistic(player, category, entry) + scoreboard(scoreboard, player) statistic(player, category, entry) + scoreboard(scoreboard, player)
); );
); );
// 修改地毯假人规则
carpet_command_player(level) -> (
print(run('carpet setDefault commandPlayer ' + level):1:0);
return();
);
// 设置玩家的计分板分数
command_set(player, scoreboard, score) -> (
i = scoreboard(scoreboard, player, score);
print('玩家' + player + '修改前的分数为:' + i);
command_recalculate_total_score(scoreboard);
return(i);
);