Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added Announcements Feature
You can now specify which messagetype is used when sending the announcement by prefixing the line with λ001, λ002, λ100, et cetera.
  • Loading branch information
123DMWM committed Aug 30, 2020
1 parent 96c0e99 commit 53db6db
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions fCraft/System/Server.cs
Expand Up @@ -978,13 +978,18 @@ static void CheckIdles(SchedulerTask task)
if ( players.Length == 0 ) return;

foreach (Player pl in players) {
byte messageLine = 100;
if (line.StartsWith("λ")) {
try {
messageLine = byte.Parse(line.Remove(0,1).Take(3).JoinToString());
} catch {}
line = line.Remove(0, 4);
}
string anncmnt = (line.CaselessStarts("&") ? "" : "&R") + Chat.ReplaceTextKeywords(pl, line);
if (pl.Supports(CpeExt.MessageType)) {
if (line.CaselessStarts("&d"))
line = line.Remove(0, 2);
pl.Send(Packet.Message((byte)MessageType.Announcement,
"&d" + Chat.ReplaceTextKeywords(pl, line), pl));
pl.Send(Packet.Message(messageLine, anncmnt, pl));
} else {
pl.Message("&d" + Chat.ReplaceTextKeywords(pl, line));
pl.Message(anncmnt);
}
}
}
Expand Down

0 comments on commit 53db6db

Please sign in to comment.