• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Administrator's Toolkit VS plugin


Commit MetaInfo

Revision5d4bc37c03db327db9863ed14c4adec06d5cc76d (tree)
Zeit2022-06-26 03:27:02
Autormelchior <melchior@user...>
Commitermelchior

Log Message

0.3.9-rc Changes

Ändern Zusammenfassung

Diff

--- a/AdminToolkit/AdminToolkit.csproj
+++ b/AdminToolkit/AdminToolkit.csproj
@@ -102,7 +102,6 @@
102102 <None Include="assets\atk\lang\en.json">
103103 <CopyToOutputDirectory>Always</CopyToOutputDirectory>
104104 </None>
105- <None Include="MultiLang.cs" />
106105 </ItemGroup>
107106 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
108107 </Project>
\ No newline at end of file
--- a/AdminToolkit/Commands/IdlePlayerControl.cs
+++ b/AdminToolkit/Commands/IdlePlayerControl.cs
@@ -26,7 +26,7 @@ namespace AdminToolkit
2626 playerPositions = new Dictionary<string, EntityPos>(32);
2727 this.Command = "idlekick";
2828 this.Description = "Adjust Idle-ejector system settings.";
29- this.Syntax = @" set {time} | stats ";
29+ this.Syntax = @" set {minutes} | stats ";
3030 this.RequiredPrivilege = Privilege.kick;
3131 this.handler += HandleIdlerCommand;
3232 ServerAPI.Event.PlayerLeave += PlayerLeft;
@@ -46,36 +46,46 @@ namespace AdminToolkit
4646 case @"set":
4747 //Change default & next cycle check time
4848 var timeMinutes = args.PopInt(0);
49- if (timeMinutes >= 5) {
49+ if (timeMinutes > 0) {
5050 TimeSpan newTimeout = new TimeSpan(0, timeMinutes.Value, 0);
5151 this.CachedConfiguration.IdleTimeout = newTimeout;
5252 player.SendMessage(groupId, $"Changed Idle timeout to: {newTimeout}", EnumChatType.CommandSuccess);
5353 RestartTimers();
5454 } else
55- player.SendMessage(groupId, "no change; Value must be >= 5", EnumChatType.CommandError);
55+ {
56+ player.SendMessage(groupId, "Idle-check disabled.", EnumChatType.CommandError);
57+ HaltIdleCheck( );
58+ }
5659 break;
5760
5861 case @"stats":
59- if (this.CachedConfiguration.IdleTimeout.TotalMinutes >= 5f)
62+ if (this.CachedConfiguration.IdleTimeout.TotalMinutes > 0f)
6063 { player.SendMessage(groupId, $"Ejected: {kick_tally} player(s), Timeout = {this.CachedConfiguration.IdleTimeout}", EnumChatType.CommandSuccess); }
6164 else { player.SendMessage(groupId, "offline.", EnumChatType.CommandSuccess); }
6265 break;
6366
6467 default:
65- player.SendMessage(groupId, $"Unrecognised command: {command}", EnumChatType.CommandError);
68+ player.SendMessage(groupId, $"Unrecognised command: '{command}'", EnumChatType.CommandError);
6669 break;
6770 }
6871 }
6972
73+ private void HaltIdleCheck( )
74+ {
75+ if (timerIdent != 0L) {
76+ ServerAPI.Event.UnregisterCallback(timerIdent);
77+ playerPositions.Clear( );
78+ }
79+ }
80+
7081 private void RestartTimers( )
7182 {
7283 if (timerIdent != 0L)
7384 {
7485 ServerAPI.Event.UnregisterCallback(timerIdent);
75- playerPositions.Clear( );
76- FindIdlers(0f );
86+ playerPositions.Clear( );
7787 }
78- timerIdent = ServerAPI.Event.RegisterCallback(FindIdlers, ( int )this.CachedConfiguration.IdleTimeout.TotalMilliseconds);
88+ FindIdlers(0f);
7989 }
8090
8191 private void FindIdlers(float delta )
@@ -85,10 +95,10 @@ namespace AdminToolkit
8595 #endif
8696
8797 foreach (var srvPlayer in ServerAPI.Server.Players.Where(plr => plr.ConnectionState == EnumClientState.Playing)) {
88- if (srvPlayer?.WorldData?.CurrentGameMode != EnumGameMode.Spectator) {
98+ if (srvPlayer?.WorldData?.CurrentGameMode == EnumGameMode.Survival) {
8999 EntityPos oldPos;
90100 if (playerPositions.TryGetValue(srvPlayer.PlayerUID, out oldPos)) {
91- if (oldPos.BasicallySameAsIgnoreAngles(srvPlayer.Entity.ServerPos, 0.001f)) {
101+ if (oldPos.BasicallySameAsIgnoreAngles(srvPlayer.Entity.ServerPos, 0.01f)) {
92102 if ( srvPlayer.Entity.CurrentControls.HasFlag( EnumEntityActivity.Idle) ||
93103 srvPlayer.Entity.CurrentControls.HasFlag(EnumEntityActivity.FloorSitting) ||
94104 srvPlayer.Entity.CurrentControls.HasFlag(EnumEntityActivity.Dead) ||
@@ -105,14 +115,17 @@ namespace AdminToolkit
105115 }
106116 }
107117 }
118+
119+ timerIdent = ServerAPI.Event.RegisterCallback(FindIdlers, ( int )this.CachedConfiguration.IdleTimeout.TotalMilliseconds);
108120 }
109121
122+
110123 private void KickIdler(IServerPlayer them)
111124 {
112125 kick_tally++;
113126 var message = MultiLang.Get(them.LanguageCode, idleKick_Key, them.PlayerName);
114127 them.Disconnect(message);
115- ServerAPI.BroadcastMessageToAllGroups(message, EnumChatType.Notification);
128+ //ServerAPI.BroadcastMessageToAllGroups(message, EnumChatType.Notification);
116129 }
117130
118131 private void PlayerLeft(IServerPlayer byPlayer)
--- a/AdminToolkit/Commands/RulesCommand.cs
+++ b/AdminToolkit/Commands/RulesCommand.cs
@@ -153,7 +153,7 @@ namespace AdminToolkit
153153 if (!AdminToolkit.AdminRoles.Contains(byPlayer.Role.Code)) {
154154 //For regular players
155155 if (RulesCommand.CheckRuleAccepted(byPlayer) == false) {
156- //TODO: localize
156+
157157 byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, MultiLang.GetUnformatted(byPlayer,"atk:type-rules"), EnumChatType.Notification);
158158
159159 if (this.CachedConfiguration.RuleRoleChangerEnabled) {
--- a/AdminToolkit/MultiLang.cs
+++ /dev/null
@@ -1,11 +0,0 @@
1-using System;
2-namespace AdminToolkit
3-{
4- public class MultiLang
5- {
6- public MultiLang( )
7- {
8- }
9- }
10-}
11-
--- a/AdminToolkit/modinfo.json
+++ b/AdminToolkit/modinfo.json
@@ -4,7 +4,7 @@
44 "ModID":"atk",
55 "description" : "Provides Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & more.",
66 "authors": ["Melchior", ],
7- "version": "0.3.8",
7+ "version": "0.3.9-rc.0",
88 "dependencies": {
99 "game": "1.16.0"
1010 },