|
1 | | -from endstone.plugin import Service |
| 1 | +from __future__ import annotations |
2 | 2 | from endstone import Player |
| 3 | +from endstone.plugin import Service, Plugin |
| 4 | +from typing import Callable |
3 | 5 |
|
4 | 6 | __all__ = ["PlaceholderAPI"] |
5 | 7 |
|
6 | 8 | class PlaceholderAPI(Service): |
7 | | - def set_placeholders(self, player: Player, text: str) -> str: |
| 9 | + def __init__(self) -> None: ... |
| 10 | + def _get_placeholder_pattern(self) -> str: |
| 11 | + """ |
| 12 | + Get the normal placeholder pattern. |
8 | 13 | """ |
9 | | - Translates all placeholders into their corresponding values. |
10 | | - The pattern of a valid placeholder is {<identifier>:<params>}. |
11 | 14 |
|
12 | | - Args: |
13 | | - player (Player): Player to parse the placeholders against. |
14 | | - text (str): Text to set the placeholder values in. |
| 15 | + def _get_registered_identifiers(self) -> list[str]: |
| 16 | + """ |
| 17 | + Get all registered placeholder identifiers. |
| 18 | + """ |
15 | 19 |
|
16 | | - Returns: |
17 | | - str: String containing all translated placeholders. |
| 20 | + def contains_placeholders(self, text: str) -> bool: |
| 21 | + """ |
| 22 | + Check if a String contains any placeholders. |
| 23 | + """ |
| 24 | + |
| 25 | + def is_registered(self, identifier: str) -> bool: |
| 26 | + """ |
| 27 | + Check if a specific placeholder identifier is currently registered. |
| 28 | + """ |
| 29 | + |
| 30 | + def register_placeholder( |
| 31 | + self, |
| 32 | + plugin: Plugin, |
| 33 | + identifier: str, |
| 34 | + processor: Callable[[Player, str], str], |
| 35 | + ) -> bool: |
| 36 | + """ |
| 37 | + Attempt to register a placeholder. |
| 38 | + """ |
| 39 | + |
| 40 | + def set_placeholders(self, player: Player, text: str) -> str: |
| 41 | + """ |
| 42 | + Translates all placeholders into their corresponding values. |
18 | 43 | """ |
0 commit comments