Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add console@<player name>, which allows routing a console command via a specific player #34

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

quiquelhappy
Copy link

Problem:

In certain scenarios, NPCs are treated as players on the server. When using the current /forward console command, the system selects a random player connection to forward the command. However, this can sometimes select an NPC or bot, which might not have a valid BungeeCord connection, leading to failed message routing.

Solution:

By adding the ability to specify a player directly using console@<player_name>, users can ensure that the console command is forwarded via a valid, real player’s connection, avoiding the risk of selecting an invalid NPC or bot connection.

Updated SpigotMC section:

(on the Using It list):

  • Example Execute as Console (using a specific player connection):
    /forward console@playerName ping
    bridgePlayer is the player which connection should be used, but it will be executed as bungee console there.

@quiquelhappy
Copy link
Author

now testing it. compiled jar:
CommandForward.zip

@quiquelhappy
Copy link
Author

quiquelhappy commented Sep 25, 2024

I tested it, and it is working correctly

Code_hCn5J3mGM3.mp4

@games647
Copy link
Owner

I feel like this complicates the command usage a lot. Maybe we should rather detect the NPC status. Doesn't some NPC plugins set a metadata flag, we could use?

@quiquelhappy
Copy link
Author

quiquelhappy commented Oct 30, 2024

I feel like this complicates the command usage a lot. Maybe we should rather detect the NPC status. Doesn't some NPC plugins set a metadata flag, we could use?

not really (not for all plugins), either way, it adds flexibility to the command, routing console via an specific player could be very handy on other scenarios we might not be thinking about right now. its optional anyways, could be documented as something minor or as a note on the current console cmd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants