fix
This commit is contained in:
parent
c48f34d5d9
commit
fc168ac8ff
@ -1,2 +1,2 @@
|
|||||||
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @a [{"text": ""}, [{"selector": "@s"}, {"text": "说:我上次穿出的下界传送门位于", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]]
|
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @a [{"text": ""}, [{"selector": "@s"}, {"text": "说:我上次穿出的下界传送门位于", "color": "white"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.y"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]]
|
||||||
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
|
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
|
@ -1,2 +1,2 @@
|
|||||||
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s [{"text": "你上次穿出的下界传送门位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]
|
execute if score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s [{"text": "你上次穿出的下界传送门位于"}, {"nbt": "fzsd.api.dimension.name", "interpret": true, "storage": "fzsd:global"}, [{"text": " [", "color": "green"}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.x"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.y"}}, {"text": ", "}, {"score": {"name": "@s", "objective": "fzsd.module.last_nether_portal.z"}}, {"text": "]"}]]
|
||||||
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
|
execute unless score @s fzsd.module.last_nether_portal.dimension matches -2147483648..2147483647 run tellraw @s {"text": "你从未穿出过下界传送门!"}
|
@ -1,7 +1,66 @@
|
|||||||
// 计分板模块扩展插件
|
// 计分板模块扩展插件
|
||||||
// 忽略假人分数
|
// 忽略假人分数
|
||||||
// **请勿修改文件名!!**
|
// **请勿修改文件名!!**
|
||||||
global_app_version = '1.0-beta.13';
|
|
||||||
|
//** 工具函数 **//
|
||||||
|
|
||||||
|
contains(list, value) -> (
|
||||||
|
return(list ~ value != null);
|
||||||
|
);
|
||||||
|
|
||||||
|
debug(msg) -> (
|
||||||
|
logger('debug', msg);
|
||||||
|
return();
|
||||||
|
);
|
||||||
|
|
||||||
|
require_not_null(value) -> (
|
||||||
|
if(value == null, throw('空指针异常!'));
|
||||||
|
return(value);
|
||||||
|
);
|
||||||
|
|
||||||
|
require_version(requirement) -> (
|
||||||
|
req_0 = slice(requirement, 0, 1);
|
||||||
|
req_1 = slice(requirement, 1, 2);
|
||||||
|
if(req_0 == '>',
|
||||||
|
if(req_1 == '=',
|
||||||
|
req_ver = split('>=|\\.', requirement);
|
||||||
|
print(player('all'), req_ver);
|
||||||
|
cur_ver = split('\\.', global_carpet_version);
|
||||||
|
return(number(req_ver:1) >= number(cur_ver:0)
|
||||||
|
&& number(req_ver:2) >= number(cur_ver:1)
|
||||||
|
&& number(req_ver:3) >= number(cur_ver:2));
|
||||||
|
);
|
||||||
|
req_ver = split('>|\\.', requirement);
|
||||||
|
print(player('all'), req_ver);
|
||||||
|
cur_ver = split('\\.', global_carpet_version);
|
||||||
|
return(number(req_ver:1) > number(cur_ver:0)
|
||||||
|
&& number(req_ver:2) > number(cur_ver:1)
|
||||||
|
&& number(req_ver:3) > number(cur_ver:2));
|
||||||
|
);
|
||||||
|
if(req_0 == '<',
|
||||||
|
if(req_1 == '=',
|
||||||
|
req_ver = split('<=|\\.', requirement);
|
||||||
|
print(player('all'), req_ver);
|
||||||
|
cur_ver = split('\\.', global_carpet_version);
|
||||||
|
return(number(req_ver:1) <= number(cur_ver:0)
|
||||||
|
&& number(req_ver:2) <= number(cur_ver:1)
|
||||||
|
&& number(req_ver:3) <= number(cur_ver:2));
|
||||||
|
);
|
||||||
|
req_ver = split('<|\\.', requirement);
|
||||||
|
print(player('all'), req_ver);
|
||||||
|
cur_ver = split('\\.', global_carpet_version);
|
||||||
|
return(number(req_ver:1) < number(cur_ver:0)
|
||||||
|
&& number(req_ver:2) < number(cur_ver:1)
|
||||||
|
&& number(req_ver:3) < number(cur_ver:2));
|
||||||
|
);
|
||||||
|
return(false);
|
||||||
|
);
|
||||||
|
|
||||||
|
//** 主要逻辑 **//
|
||||||
|
|
||||||
|
global_app_name = system_info('app_name');
|
||||||
|
global_app_version = '1.1-beta.1';
|
||||||
|
global_carpet_version = split('\\+', system_info('scarpet_version')):0;
|
||||||
global_current_scoreboard_list = [
|
global_current_scoreboard_list = [
|
||||||
'fzsd.module.scoreboard.display.activation',
|
'fzsd.module.scoreboard.display.activation',
|
||||||
'fzsd.module.scoreboard.display.damage_taken',
|
'fzsd.module.scoreboard.display.damage_taken',
|
||||||
@ -14,13 +73,12 @@ 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_app_name = system_info('app_name');
|
|
||||||
|
|
||||||
__config() -> {
|
__config() -> {
|
||||||
'scope' -> 'global',
|
'scope' -> 'global',
|
||||||
'requires' -> {
|
'requires' -> {
|
||||||
'carpet' -> '>=1.4.45',
|
'carpet' -> '>=1.4.45',
|
||||||
'minecraft' -> '>=1.17'
|
'minecraft' -> '>=1.18'
|
||||||
},
|
},
|
||||||
'command_permission' -> 2,
|
'command_permission' -> 2,
|
||||||
'commands' -> {
|
'commands' -> {
|
||||||
@ -34,8 +92,8 @@ __config() -> {
|
|||||||
'restore player <playerName> <scoreboardID>' -> 'command_restore',
|
'restore player <playerName> <scoreboardID>' -> 'command_restore',
|
||||||
'restore <custom> whitelist <trade_count>' -> _(custom, trade_count) -> command_restore_trade_count_confirm(custom, null, trade_count),
|
'restore <custom> whitelist <trade_count>' -> _(custom, trade_count) -> command_restore_trade_count_confirm(custom, null, trade_count),
|
||||||
'restore <custom> player <playerName> <trade_count>' -> 'command_restore_trade_count_confirm',
|
'restore <custom> player <playerName> <trade_count>' -> 'command_restore_trade_count_confirm',
|
||||||
'recalculate <scoreboardID>' -> 'recalculate_total_score',
|
'recalculate <scoreboardID>' -> 'command_recalculate_total_score',
|
||||||
'recalculate' -> ['recalculate_total_score', null],
|
'recalculate' -> ['command_recalculate_total_score', null],
|
||||||
'commandPlayer <permissionType>' -> 'carpet_command_player',
|
'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],
|
||||||
@ -87,6 +145,22 @@ __config() -> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
__on_start() -> (
|
__on_start() -> (
|
||||||
|
// 读取配置文件
|
||||||
|
global_config = read_file('config', 'json');
|
||||||
|
if(global_config == null, // carpet 1.4.69 兼容
|
||||||
|
global_config = {};
|
||||||
|
);
|
||||||
|
if(length(global_config) == 0, // 读取失败或不存在
|
||||||
|
delete_file('config', 'json'); // 避免一些意外的问题
|
||||||
|
global_config:'config_version' = '1.0.0'; // 占位用,无实际作用
|
||||||
|
if(require_version('>=1.99.99'), // 等待新功能支持
|
||||||
|
global_config:'allow_spawn_whitelist_player' = false;
|
||||||
|
write_file('config', 'json', global_config);
|
||||||
|
,
|
||||||
|
// else
|
||||||
|
write_file('config', 'json', global_config);
|
||||||
|
);
|
||||||
|
);
|
||||||
global_team_cache = read_file('team_cache', 'json');
|
global_team_cache = read_file('team_cache', 'json');
|
||||||
if(global_team_cache == null, // carpet 1.4.69 兼容
|
if(global_team_cache == null, // carpet 1.4.69 兼容
|
||||||
global_team_cache = {};
|
global_team_cache = {};
|
||||||
@ -99,6 +173,17 @@ __on_close() -> (
|
|||||||
write_file('team_cache', 'json', global_team_cache);
|
write_file('team_cache', 'json', global_team_cache);
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(require_version('>=1.99.99'), // 等待新功能支持
|
||||||
|
__on_player_command(player, message) -> (
|
||||||
|
print(player('all'), 'command!');
|
||||||
|
if(length(message) > 7
|
||||||
|
&& slice(message, 0, 7) == '/player'
|
||||||
|
&& !(global_config:'allow_spawn_whitelist_player'),
|
||||||
|
return('cancel');
|
||||||
|
);
|
||||||
|
);
|
||||||
|
);
|
||||||
|
|
||||||
__on_player_connects(player) -> (
|
__on_player_connects(player) -> (
|
||||||
player_type = player ~ 'player_type';
|
player_type = player ~ 'player_type';
|
||||||
player_team = player ~ 'team';
|
player_team = player ~ 'team';
|
||||||
@ -156,12 +241,12 @@ command_reset(player, scoreboard) -> (
|
|||||||
for(scoreboard(),
|
for(scoreboard(),
|
||||||
scoreboard_remove(_, player);
|
scoreboard_remove(_, player);
|
||||||
);
|
);
|
||||||
recalculate_total_score(null);
|
command_recalculate_total_score(null);
|
||||||
print('已重置' + player + '的所有分数');
|
print('已重置' + player + '的所有分数');
|
||||||
return();
|
return();
|
||||||
);
|
);
|
||||||
scoreboard_remove(scoreboard, player);
|
scoreboard_remove(scoreboard, player);
|
||||||
recalculate_total_score(scoreboard);
|
command_recalculate_total_score(scoreboard);
|
||||||
print('已重置' + player + '的' + scoreboard + '分数');
|
print('已重置' + player + '的' + scoreboard + '分数');
|
||||||
return();
|
return();
|
||||||
);
|
);
|
||||||
@ -269,7 +354,7 @@ command_update(fzsd_version) -> (
|
|||||||
print('参数错误!');
|
print('参数错误!');
|
||||||
return();
|
return();
|
||||||
);
|
);
|
||||||
recalculate_total_score(null);
|
command_recalculate_total_score(null);
|
||||||
print('已从' + fzsd_version + '升级!');
|
print('已从' + fzsd_version + '升级!');
|
||||||
return();
|
return();
|
||||||
);
|
);
|
||||||
@ -357,9 +442,9 @@ get_total_score_name_new(scoreboard) -> (
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 重算总分,scoreboard == null 时重算所有总分
|
// 重算总分,scoreboard == null 时重算所有总分
|
||||||
recalculate_total_score(scoreboard) -> (
|
command_recalculate_total_score(scoreboard) -> (
|
||||||
if(scoreboard == null,
|
if(scoreboard == null,
|
||||||
for(global_current_scoreboard_list, recalculate_total_score(_));
|
for(global_current_scoreboard_list, command_recalculate_total_score(_));
|
||||||
return();
|
return();
|
||||||
);
|
);
|
||||||
total_score_name_new = get_total_score_name_new(scoreboard);
|
total_score_name_new = get_total_score_name_new(scoreboard);
|
||||||
@ -503,7 +588,7 @@ restore_score(player_name, scoreboard) -> (
|
|||||||
print('未识别的计分板ID!' + scoreboard);
|
print('未识别的计分板ID!' + scoreboard);
|
||||||
return(false);
|
return(false);
|
||||||
);
|
);
|
||||||
recalculate_total_score(scoreboard);
|
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);
|
||||||
@ -548,22 +633,6 @@ carpet_command_player(level) -> (
|
|||||||
command_set(player, scoreboard, score) -> (
|
command_set(player, scoreboard, score) -> (
|
||||||
i = scoreboard(scoreboard, player, score);
|
i = scoreboard(scoreboard, player, score);
|
||||||
print('玩家' + player + '修改前的分数为:' + i);
|
print('玩家' + player + '修改前的分数为:' + i);
|
||||||
recalculate_total_score(scoreboard);
|
command_recalculate_total_score(scoreboard);
|
||||||
return(i);
|
return(i);
|
||||||
);
|
);
|
||||||
|
|
||||||
// 工具函数
|
|
||||||
|
|
||||||
contains(list, value) -> (
|
|
||||||
return(list ~ value != null);
|
|
||||||
);
|
|
||||||
|
|
||||||
debug(msg) -> (
|
|
||||||
logger('debug', msg);
|
|
||||||
return();
|
|
||||||
);
|
|
||||||
|
|
||||||
require_not_null(value) -> (
|
|
||||||
if(value == null, throw('空指针异常!'));
|
|
||||||
return(value);
|
|
||||||
);
|
|
Loading…
Reference in New Issue
Block a user