From d6c464de8f4f6a41fc8b489abd16aecf800bf7d3 Mon Sep 17 00:00:00 2001 From: WingedSeal Date: Wed, 19 Jan 2022 10:13:25 +0700 Subject: [PATCH] Fix command.py - say command - variable operation variable --- jmc/command.py | 11 +++++++++-- patch_notes/v1.0/v1.1.0-alpha.2.md | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 patch_notes/v1.0/v1.1.0-alpha.2.md diff --git a/jmc/command.py b/jmc/command.py index 06f32d95..41cc5835 100644 --- a/jmc/command.py +++ b/jmc/command.py @@ -15,7 +15,15 @@ class Command: def __init__(self, command: str, datapack: "DataPack") -> None: self.datapack = datapack logger.debug(f"Command - Input: {command}") - self.command = " ".join(split(command, ' ')) + if command.startswith('say'): + self.command = command + + else: + say_command = split(command, 'say') + self.command = " ".join(split(say_command[0], ' ')) + if len(say_command) > 1: + self.command += f' say {say_command[1]}' + logger.debug(f"Command - Delete whitespaces: {command}") self.function_call() self.built_in_functions() @@ -76,7 +84,6 @@ def operator_int(match: re.Match) -> str: def operator_var(match: re.Match) -> str: groups = match.groups() - self.datapack.ints.add(int(groups[2])) return f'scoreboard players operation {groups[0]} __variable__ {groups[1]} {groups[2]} __variable__' self.command = re.sub(f'{Re.start_var}\s*{Re.operator_equal}\s*{Re.var}', operator_var, self.command) diff --git a/patch_notes/v1.0/v1.1.0-alpha.2.md b/patch_notes/v1.0/v1.1.0-alpha.2.md new file mode 100644 index 00000000..01e7b276 --- /dev/null +++ b/patch_notes/v1.0/v1.1.0-alpha.2.md @@ -0,0 +1,5 @@ +# Changelog v1.1.0-alpha.2 + +### Fixed +- Fixed whitespaces after say command being insignificant. +- Fixed Variable Operation with variable being broken \ No newline at end of file