77 lines
2.1 KiB
Scala
77 lines
2.1 KiB
Scala
// 计分板模块扩展插件
|
|
// 忽略假人分数
|
|
// **请勿修改文件名!!**
|
|
global_app_version = '1.0-beta.1';
|
|
|
|
__config() -> {
|
|
'scope' -> 'global',
|
|
'requires' -> {
|
|
'carpet' -> '>=1.4.45',
|
|
'minecraft' -> '>=1.17'
|
|
}
|
|
};
|
|
|
|
__on_start() -> (
|
|
global_team_cache = read_file('team_cache', 'json');
|
|
debug(global_team_cache);
|
|
team_add('fake');
|
|
team_add('shadow');
|
|
print(player('all'), '已忽略计分板模块假人分数');
|
|
);
|
|
|
|
__on_close() -> (
|
|
debug(global_team_cache);
|
|
delete_file('team_cache', 'json');
|
|
write_file('team_cache', 'json', global_team_cache);
|
|
);
|
|
|
|
__on_player_connects(player) -> (
|
|
debug(player ~ 'name');
|
|
debug(player ~ 'player_type');
|
|
debug(player ~ 'team');
|
|
debug(global_team_cache);
|
|
if (player ~ 'player_type' == 'fake' && player ~ 'team' != 'fake',
|
|
(
|
|
global_team_cache:(player ~ 'name') = player ~ 'team';
|
|
team_add('fake', player);
|
|
),
|
|
player ~ 'player_type' == 'shadow' && player ~ 'team' != 'shadow',
|
|
(
|
|
global_team_cache:(player ~ 'name') = player ~ 'team';
|
|
team_add('shadow', player);
|
|
),
|
|
if (player ~ 'team' == 'fake'
|
|
|| player ~ 'team' == 'shadow',
|
|
if (global_team_cache:(player ~ 'name') != null,
|
|
(
|
|
team_add(global_team_cache:(player ~ 'name'), player);
|
|
delete(global_team_cache, player);
|
|
),
|
|
team_leave(player);
|
|
);
|
|
);
|
|
);
|
|
);
|
|
|
|
__on_player_disconnects(player, reason) -> (
|
|
debug(player ~ 'name');
|
|
debug(player ~ 'player_type');
|
|
debug(player ~ 'team');
|
|
debug(global_team_cache);
|
|
if (player ~ 'team' == 'fake'
|
|
|| player ~ 'team' == 'shadow',
|
|
debug(global_team_cache);
|
|
if (global_team_cache:(player ~ 'name') != null,
|
|
(
|
|
team_add(global_team_cache:(player ~ 'name') , player);
|
|
delete(global_team_cache:(player ~ 'name'));
|
|
),
|
|
team_leave(player);
|
|
);
|
|
);
|
|
);
|
|
|
|
debug(msg) -> (
|
|
logger('debug', msg);
|
|
return();
|
|
); |