This commit is contained in:
延皓 2022-10-28 23:38:07 +08:00
parent a91675e75e
commit df968611a7
3 changed files with 85 additions and 22 deletions

View File

@ -3,4 +3,4 @@ execute store result storage fzsd:here fzsd.nether.x int 0.125 run data get enti
execute store result storage fzsd:here fzsd.nether.z int 0.125 run data get entity @s Pos[2]
data modify storage fzsd:global fzsd.api.dimension.id set value "minecraft:the_nether"
function #fzsd:api/get_dimension_name
data modify storage fzsd:here fzsd.message[2] set value '[{"text": ",对应", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.nether.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.nether.z", "storage": "fzsd:here"}, {"text": "]"}]]'
data modify storage fzsd:here fzsd.message.append set value '[{"text": ",对应", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.nether.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.nether.z", "storage": "fzsd:here"}, {"text": "]"}]]'

View File

@ -3,4 +3,4 @@ execute store result storage fzsd:here fzsd.overworld.x int 8 run data get entit
execute store result storage fzsd:here fzsd.overworld.z int 8 run data get entity @s Pos[2]
data modify storage fzsd:global fzsd.api.dimension.id set value "minecraft:overworld"
function #fzsd:api/get_dimension_name
data modify storage fzsd:here fzsd.message[2] set value '[{"text": ",对应", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.overworld.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.overworld.z", "storage": "fzsd:here"}, {"text": "]"}]]'
data modify storage fzsd:here fzsd.message.append set value '[{"text": ",对应", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": "[", "color": "green"}, {"nbt": "fzsd.overworld.x", "storage": "fzsd:here"}, {"text": ", "}, {"nbt": "fzsd.overworld.z", "storage": "fzsd:here"}, {"text": "]"}]]'

View File

@ -1,7 +1,7 @@
// 计分板模块扩展插件
// 忽略假人分数
// **请勿修改文件名**
global_app_version = '1.0-beta.12';
global_app_version = '1.0-beta.13';
global_current_scoreboard_list = [
'fzsd.module.scoreboard.display.activation',
'fzsd.module.scoreboard.display.damage_taken',
@ -103,21 +103,37 @@ __on_player_connects(player) -> (
player_type = player ~ 'player_type';
player_team = player ~ 'team';
player_name = player ~ 'name';
if(player_type == 'fake' && player_team != 'fzsd.module.scoreboard.fake',
if(player_type == 'fake',
(
if(player_team != 'fzsd.module.scoreboard.fake',
global_team_cache:player_name = player_team;
);
team_add('fzsd.module.scoreboard.fake', player);
print(player('all'), '↑假的');
),
player_type == 'shadow' && player_team != 'fzsd.module.scoreboard.shadow',
player_type == 'shadow',
(
if(player_team != 'fzsd.module.scoreboard.shadow',
global_team_cache:player_name = player_team;
);
team_add('fzsd.module.scoreboard.shadow', player);
print(player('all'), '↑挂机');
),
try_restore_team_from_cache(player);
);
);
__on_player_disconnects(player, reason) -> (
player_type = player ~ 'player_type';
if(player_type == 'fake' && player_team != 'fzsd.module.scoreboard.fake',
(
print(player('all'), '↓假的');
),
player_type == 'shadow' && player_team != 'fzsd.module.scoreboard.shadow',
(
print(player('all'), '↓挂机');
)
);
try_restore_team_from_cache(player);
);
@ -377,27 +393,68 @@ display_total_score(scoreboard) -> (
// 恢复计分板分数player == null 时恢复所有玩家分数scoreboard == null 时恢复所有计分板分数
command_restore(player, scoreboard) -> (
if(player == null,
for(keys(system_info('server_whitelist')), restore_score(_, scoreboard));
i = 0;
for(keys(system_info('server_whitelist')),
i += 1;
if(i > 10,
game_tick(50);
i = 0;
);
restore_score(_, scoreboard);
);
if(scoreboard == null,
print('已恢复所有玩家的所有分数')
(
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();
);
if(scoreboard == null,
for(global_current_scoreboard_list, restore_score(player, _));
print('重置交易榜会丢失猪灵交易分数,请输入\n“/' + global_app_name + ' restore confirm player <playerName> fzsd.module.scoreboard.display.trade_count”继续执行');
print('无法还原破基岩榜,已忽略');
print('已恢复' + player + '的所有分数');
return();
);
if(restore_score(player, scoreboard),
print('已恢复' + player + '' + scoreboard + '分数');
,
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, scoreboard) -> (
restore_score(player_name, scoreboard) -> (
require_not_null(player_name);
if(scoreboard == null,
for(global_current_scoreboard_list, restore_score(player_name, _));
return();
);
player = player(player_name);
player_is_offline = false;
if(player == null,
(
run('player ' + player_name + ' spawn at ~ ~ ~ facing 0 0 in minecraft:overworld in survival');
player_is_offline = true;
player = player(player_name);
)
);
if(scoreboard == 'fzsd.module.scoreboard.display.activation',
(
play_ticks = statistic(player, 'custom', 'play_time');
@ -405,7 +462,7 @@ restore_score(player, scoreboard) -> (
scoreboard(scoreboard, player, play_ticks/72000);
),
scoreboard == 'fzsd.module.scoreboard.display.damage_taken',
restore_from_stat(scoreboard, player, 'custom', 'damage_taken');
scoreboard(scoreboard, player, statistic(player, 'custom', 'damage_taken')/10);
,
scoreboard == 'fzsd.module.scoreboard.display.death_count',
restore_from_stat(scoreboard, player, 'custom', 'deaths');
@ -428,15 +485,11 @@ restore_score(player, scoreboard) -> (
);
),
scoreboard == 'fzsd.module.scoreboard.display.trade_count',
(
print('此操作会丢失猪灵交易分数,请输入\n“/' + global_app_name + ' restore confirm whitelist fzsd.module.scoreboard.display.trade_count”或\n“/' + global_app_name + ' restore confirm player <playerName> fzsd.module.scoreboard.display.trade_count”继续执行');
return(false);
),
,
scoreboard == 'fzsd.module.scoreboard.display.bedrock_broken_count',
(
print('无法还原破基岩榜,已忽略');
return(false);
),
,
scoreboard == 'fzsd.module.scoreboard.display.aviating_distance',
scoreboard(scoreboard, player, statistic(player, 'custom', 'aviate_one_cm')/200);
,
@ -447,10 +500,15 @@ restore_score(player, scoreboard) -> (
append_from_stat(scoreboard, player, 'used', _);
);
),
print('未识别的计分板ID');
print('未识别的计分板ID' + scoreboard);
return(false);
);
recalculate_total_score(scoreboard);
if(player_is_offline,
world_spawn = system_info('world_spawn_point');
run('spreadplayers ' + world_spawn:0 + ' ' + world_spawn:2 + ' 0 10 false ' + player);
run('player ' + player + ' kill');
);
return(true);
);
@ -504,3 +562,8 @@ debug(msg) -> (
logger('debug', msg);
return();
);
require_not_null(value) -> (
if(value == null, throw('空指针异常!'));
return(value);
);