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

Adds %map% and %player% variables into the broadcast #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Adds %map% and %player% variables into the broadcast #3

wants to merge 4 commits into from

Conversation

QuiCM
Copy link

@QuiCM QuiCM commented Jan 19, 2014

Much like MotD, replaces "%map%" with the world name or TShock server nickname, and "%players%" with a list of currently online players.

@Scavenger3
Copy link
Owner

Just wondering, why add if (Line.Contains("%map%") || Line.Contains("%players%"))? You check that in parseLine anyway.

Also, why iterate through each word? instead of just Line.Replace("%map%", worldName);. Is it so the variable has to be it's own word? That kinda defeats the point of using obscure symbols to reference a variable. If someone misses a space, it will just show e.g. Map name:%map%.

Thanks for the pull request :)

@QuiCM
Copy link
Author

QuiCM commented Jan 19, 2014

I added
if (Line.Contains("%map%") || Line.Contains("%players%"))
Because that way it only checks lines that contains those, rather checking every line.
I iterated through every word because previous testing with Line.Replace("string", "newstring") failed. Although you made me realise there was a MUCH simpler way of doing it. Do you want me to bother with Line.Contains() in the broadcast method? Or would you prefer me to remove it from there and just leave it in parseLine?

@QuiCM
Copy link
Author

QuiCM commented Mar 9, 2014

This PR now supports Api Version 1,15

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