|
| 1 | +from endstone.command import Command, CommandSender, CommandExecutor |
| 2 | + |
| 3 | +# Zen of python - https://peps.python.org/pep-0020/ |
| 4 | +zen_of_python = """The Zen of Python, by Tim Peters |
| 5 | +
|
| 6 | +Beautiful is better than ugly. |
| 7 | +Explicit is better than implicit. |
| 8 | +Simple is better than complex. |
| 9 | +Complex is better than complicated. |
| 10 | +Flat is better than nested. |
| 11 | +Sparse is better than dense. |
| 12 | +Readability counts. |
| 13 | +Special cases aren't special enough to break the rules. |
| 14 | +Although practicality beats purity. |
| 15 | +Errors should never pass silently. |
| 16 | +Unless explicitly silenced. |
| 17 | +In the face of ambiguity, refuse the temptation to guess. |
| 18 | +There should be one-- and preferably only one --obvious way to do it. |
| 19 | +Although that way may not be obvious at first unless you're Dutch. |
| 20 | +Now is better than never. |
| 21 | +Although never is often better than *right* now. |
| 22 | +If the implementation is hard to explain, it's a bad idea. |
| 23 | +If the implementation is easy to explain, it may be a good idea. |
| 24 | +Namespaces are one honking great idea -- let's do more of those!""" |
| 25 | + |
| 26 | + |
| 27 | +class PythonCommand(Command): |
| 28 | + def __init__(self): |
| 29 | + Command.__init__(self, "python") |
| 30 | + self.description = "Zen of python" |
| 31 | + self.usages = ["/python"] |
| 32 | + self.aliases = ["py"] |
| 33 | + |
| 34 | + |
| 35 | +class PythonCommandExecutor(CommandExecutor): |
| 36 | + def on_command(self, sender: CommandSender, command: Command, args: list[str]) -> bool: |
| 37 | + sender.send_message(zen_of_python) |
| 38 | + return True |
0 commit comments