添加reset命令
This commit is contained in:
parent
a40a33b19c
commit
0905d460b6
@ -2,6 +2,18 @@
|
||||
// 忽略假人分数
|
||||
// **请勿修改文件名!!**
|
||||
global_app_version = '1.0-beta.8';
|
||||
global_current_scoreboard_list = [
|
||||
'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() -> {
|
||||
'scope' -> 'global',
|
||||
@ -13,17 +25,28 @@ __config() -> {
|
||||
'commands' -> {
|
||||
'' -> 'help',
|
||||
'help' -> 'help',
|
||||
'delete_old <delete_old>' -> 'delete_old',
|
||||
'update_from <update_from>' -> 'update_from',
|
||||
'restore_from_stats' -> 'restore_from_stats',
|
||||
'recalculate_total' -> 'recalculate_total_scores',
|
||||
'commandPlayer <boolean>' -> 'command_player'
|
||||
'deleteOld <deleteOld>' -> 'delete_old',
|
||||
'updateFrom <updateFrom>' -> 'update_from',
|
||||
'restoreFrom' -> 'restore_from',
|
||||
'recalculate <scoreboardID>' -> 'recalculate_total_score',
|
||||
'recalculate' -> 'recalculate_total_scores',
|
||||
'commandPlayer <boolean>' -> 'command_player',
|
||||
'reset <scoreboardPlayer> <scoreboardID>' -> 'reset',
|
||||
'reset <scoreboardPlayer>' -> ['reset', null]
|
||||
},
|
||||
'arguments' -> {
|
||||
'scoreboardID' -> {
|
||||
'type' -> 'term',
|
||||
'suggest' -> global_current_scoreboard_list
|
||||
},
|
||||
'scoreboardPlayer' -> {
|
||||
'type' -> 'term',
|
||||
'suggester' -> _(args) -> get_scoreboard_player_list()
|
||||
},
|
||||
'boolean' -> {
|
||||
'type' -> 'bool'
|
||||
},
|
||||
'update_from' -> {
|
||||
'updateFrom' -> {
|
||||
'type' -> 'term',
|
||||
'suggest' -> [
|
||||
'2.x',
|
||||
@ -32,7 +55,7 @@ __config() -> {
|
||||
'3.0-beta.10'
|
||||
]
|
||||
},
|
||||
'delete_old' -> {
|
||||
'deleteOld' -> {
|
||||
'type' -> 'term',
|
||||
'suggest' -> [
|
||||
'2.x',
|
||||
@ -79,6 +102,37 @@ __on_player_disconnects(player, reason) -> (
|
||||
try_restore_team_from_cache(player);
|
||||
);
|
||||
|
||||
get_scoreboard_player_list() -> (
|
||||
// 获取所有计分板下的所有玩家列表
|
||||
set = m();
|
||||
for(global_current_scoreboard_list,
|
||||
for(scoreboard(_),
|
||||
if(_ ~ '\\w',
|
||||
put(set:_, null);
|
||||
);
|
||||
);
|
||||
);
|
||||
return(keys(set));
|
||||
);
|
||||
|
||||
reset(player, scoreboard) -> (
|
||||
if(scoreboard == null,
|
||||
(
|
||||
for(global_current_scoreboard_list,
|
||||
scoreboard_remove(_, player);
|
||||
);
|
||||
recalculate_total_scores();
|
||||
print('已重置' + player + '的所有分数');
|
||||
),
|
||||
(
|
||||
scoreboard_remove(scoreboard, player);
|
||||
recalculate_total_score(scoreboard);
|
||||
print('已重置' + player + '的' + scoreboard + '分数');
|
||||
)
|
||||
);
|
||||
return();
|
||||
);
|
||||
|
||||
try_restore_team_from_cache(player) -> (
|
||||
player_team = player ~ 'team';
|
||||
player_name = player ~ 'name';
|
||||
@ -265,24 +319,13 @@ get_total_score_name_new(scoreboard) -> (
|
||||
);
|
||||
|
||||
recalculate_total_scores() -> (
|
||||
scoreboards = [
|
||||
'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.placement_count',
|
||||
'fzsd.module.scoreboard.display.aviating_distance'
|
||||
];
|
||||
for(scoreboards,recalculate_total_score(_, get_total_score_name_new(_)));
|
||||
for(global_current_scoreboard_list, recalculate_total_score(_));
|
||||
print('已重新计算总分!');
|
||||
return();
|
||||
);
|
||||
|
||||
recalculate_total_score(scoreboard, total_score_name_new) -> (
|
||||
recalculate_total_score(scoreboard) -> (
|
||||
total_score_name_new = get_total_score_name_new(scoreboard);
|
||||
// 计算总分
|
||||
total_score = 0;
|
||||
for(scoreboard(scoreboard),
|
||||
@ -309,7 +352,7 @@ display_total_score(scoreboard) -> (
|
||||
return();
|
||||
);
|
||||
|
||||
restore_from_stats() -> (
|
||||
restore_from() -> (
|
||||
print('暂未开发');
|
||||
return();
|
||||
);
|
||||
@ -321,6 +364,7 @@ merge_stat(scoreboard, ...stats) -> (
|
||||
|
||||
command_player(boolean) -> (
|
||||
print(run('carpet setDefault commandPlayer ' + str(boolean)):1:0);
|
||||
return();
|
||||
);
|
||||
|
||||
// 工具函数
|
||||
|
Loading…
Reference in New Issue
Block a user