Skip to content

Commit

Permalink
Fix error that would occur when calling pyspigot module if ProtocolLi…
Browse files Browse the repository at this point in the history
…b and/or PlaceholderAPI were not running on the server
  • Loading branch information
magicmq committed Apr 11, 2024
1 parent fb8cc4f commit 9e36be9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/resources/python-libs/pyspigot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
from dev.magicmq.pyspigot.manager.command import CommandManager
from dev.magicmq.pyspigot.manager.task import TaskManager
from dev.magicmq.pyspigot.manager.config import ConfigManager
from dev.magicmq.pyspigot.manager.protocol import ProtocolManager
from dev.magicmq.pyspigot.manager.placeholder import PlaceholderManager

def script_manager():
"""Get the script manager for loading, unloading, and reloading scripts."""
Expand Down Expand Up @@ -57,12 +55,14 @@ def config_manager():
def protocol_manager():
"""Get the protocol manager for working with ProtocolLib (registering/unregistering packet listeners, sending packets, etc.). Note: this function will return None if ProtocolLib is not available on the server."""
if PySpigot.get().isProtocolLibAvailable():
from dev.magicmq.pyspigot.manager.protocol import ProtocolManager
return ProtocolManager.get()
else: return None

def placeholder_manager():
"""get the placeholder manager for registering/unregistering PlaceholderAPI placeholders. Note: this function will return None if PlaceholderAPI is not available on the server."""
if PySpigot.get().isPlaceholderApiAvailable():
from dev.magicmq.pyspigot.manager.placeholder import PlaceholderManager
return PlaceholderManager.get()
else: return None

Expand Down

0 comments on commit 9e36be9

Please sign in to comment.