Skip to content

Commit

Permalink
Fix command.py
Browse files Browse the repository at this point in the history
- say command
- variable operation variable
  • Loading branch information
WingedSeal committed Jan 19, 2022
1 parent 3ea8416 commit d6c464d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jmc/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions patch_notes/v1.0/v1.1.0-alpha.2.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d6c464d

Please sign in to comment.