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