Made serversigns force its commands into the command map (to replace the java plugin ServerSigns its commands)
This commit is contained in:
2
main.py
2
main.py
@@ -24,7 +24,7 @@ def on_enable():
|
||||
if "imbusy" in shared["modules"]:
|
||||
shared["modules"]["imbusy"].replace_ess_commands()
|
||||
if "serversigns" in shared["modules"]:
|
||||
shared["modules"]["serversigns"].check_all_signs()
|
||||
shared["modules"]["serversigns"].check_all_signs_and_force_commands()
|
||||
info("RedstonerUtils enabled!")
|
||||
|
||||
|
||||
|
||||
@@ -335,7 +335,26 @@ def can_build2(player, block):
|
||||
return not event.isCancelled()
|
||||
|
||||
|
||||
def check_all_signs():
|
||||
def check_all_signs_and_force_commands():
|
||||
for loc in signs:
|
||||
if server.getWorld(loc[0]).getBlockAt(loc[1], loc[2], loc[3]).getType() not in (Material.WALL_SIGN, Material.SIGN_POST):
|
||||
del signs[loc]
|
||||
|
||||
try:
|
||||
map_field = server.getPluginManager().getClass().getDeclaredField("commandMap")
|
||||
map_field.setAccessible(True)
|
||||
command_map = map_field.get(server.getPluginManager())
|
||||
|
||||
commands_field = command_map.getClass().getDeclaredField("knownCommands")
|
||||
commands_field.setAccessible(True)
|
||||
map = commands_field.get(command_map)
|
||||
|
||||
rsutils_cmd = map.get("redstonerutils:serversigns")
|
||||
info(str(rsutils_cmd))
|
||||
map.put("svs", rsutils_cmd)
|
||||
map.put("serversigns", rsutils_cmd)
|
||||
map.put("signsmsg", rsutils_cmd)
|
||||
|
||||
except:
|
||||
error("[Serversigns] failed to force commands")
|
||||
error(trace())
|
||||
|
||||
Reference in New Issue
Block a user