• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

Administrator's Toolkit VS plugin


Commit MetaInfo

Revisiond6acc761ffd61cb20716738e109c8fa186e285c5 (tree)
Zeit2019-06-26 06:26:01
Autormelchior <melchior@user...>
Commitermelchior

Log Message

changed message formats, admin login annocunce
Incriment game version for API fix

Ändern Zusammenfassung

Diff

--- a/AdminToolkit/AdminToolkitMod.cs
+++ b/AdminToolkit/AdminToolkitMod.cs
@@ -87,7 +87,7 @@ namespace AdminToolkit
8787 this.ServerAPI.RegisterCommand("admins", "List of Server Administrators", string.Empty, AdminsitratorListing);
8888
8989
90- this.ServerAPI.Event.PlayerJoin += SendRulesMessage;
90+ this.ServerAPI.Event.PlayerJoin += UponJoin;
9191 this.ServerAPI.Event.PlayerChat += BoomingVoiceOfAuthority;
9292
9393
@@ -138,20 +138,21 @@ namespace AdminToolkit
138138 }
139139
140140 /// <summary>
141- /// Brief Rules info.
141+ /// Send Rule info text or Admin welcome
142142 /// </summary>
143- /// <returns>The rules message.</returns>
144143 /// <param name="byPlayer">By player.</param>
145- private void SendRulesMessage(IServerPlayer byPlayer)
144+ private void UponJoin(IServerPlayer byPlayer)
146145 {
147146 if (AdminRoles.Contains(byPlayer.Role.Code)) {
148- //Already admin...
147+ //Annonce to all Admin\Moderator is here.
149148
150149 StringBuilder adminMessage = new StringBuilder( );
151150
152- adminMessage.AppendFormat("Greetings <font color='{2}'>[{0}]</font> -- {1}, its: {3}H Moon:{4}, Players:{5}", byPlayer.Role.Name,byPlayer.PlayerName, byPlayer.Role.Color.Name, ServerAPI.World.Calendar.HourOfDay ,ServerAPI.World.Calendar.MoonPhase, ServerAPI.World.AllOnlinePlayers.Count() );
151+ adminMessage.AppendFormat("<font color='{1}' weight='bold'>«{0}» ̠{2}̠ </font> Present.", byPlayer.Role.Name, byPlayer.Role.Color.Name, byPlayer.PlayerName);
153152
154- byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, adminMessage.ToString(), EnumChatType.Notification);
153+ ServerAPI.SendMessageToGroup(GlobalConstants.AllChatGroups, adminMessage.ToString(), EnumChatType.AllGroups);
154+
155+ byPlayer.ServerData.CustomPlayerData[_lastLoginKey] = DateTimeOffset.UtcNow.ToString("u");
155156
156157 } else {
157158
@@ -179,6 +180,10 @@ namespace AdminToolkit
179180 } else {
180181 msgLine.AppendFormat("IS: <font color='yellow'>{0}</font>", srvPlayer.ConnectionState);
181182 }
183+
184+ if (srvPlayer.ServerData.CustomPlayerData.ContainsKey(_lastLoginKey)) {
185+ msgLine.AppendFormat(" Last Login: {0}", srvPlayer.ServerData.CustomPlayerData[_lastLoginKey]);
186+ }
182187 msgLine.AppendLine( );
183188 }
184189 }
@@ -251,16 +256,21 @@ namespace AdminToolkit
251256 private string BoomingVoiceOfAuthority(IServerPlayer byPlayer, int channelId, string message, BoolRef consumed)
252257 {
253258 if (AdminRoles.Contains(byPlayer.Role.Code)) {
254- //Is admin; message BEFORE their chat line.
259+ //Make text lined
255260 consumed.value = false;
256261 StringBuilder adminMessage = new StringBuilder( );
257- adminMessage.AppendFormat("<font color='{1}' weight='bold'>«{0}» ̠{2}̠ </font>…", byPlayer.Role.Name, byPlayer.Role.Color.Name, byPlayer.PlayerName);
258-
259- ServerAPI.SendMessage(byPlayer,channelId, adminMessage.ToString( ), EnumChatType.OthersMessage);
262+ foreach (char letter in message) {
263+
264+ adminMessage.Append(letter);
265+ if (!Char.IsWhiteSpace(letter)) {
266+ adminMessage.Append(@"̅̅̅");
267+ adminMessage.Append(@"̲");
268+ }
269+ }
260270
261- return null;
271+ return adminMessage.ToString( );
262272 }
263- return null;
273+ return message;
264274 }
265275
266276 private static bool CheckRuleAccepted(IServerPlayer byPlayer)
--- a/AdminToolkit/modinfo.json
+++ b/AdminToolkit/modinfo.json
@@ -5,7 +5,7 @@
55 "authors": ["Melchior", ],
66 "version": "0.1.0",
77 "dependencies": {
8- "game": "1.9.9"
8+ "game": "1.9.11"
99 },
1010 "website": "http://nowebsite.nope"
1111 }