• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤

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

修訂d1e59dde8764d39e620ace3a46df64495471949b (tree)
時間2020-04-26 06:50:39
作者melchior <melchior@user...>
Commitermelchior

Log Message

{VS: V1.12.X } = ATK 0.3.4, updated for API changes (backup sys.),
better Admin listing

Change Summary

差異

--- a/AdminToolkit/AdminToolkit.csproj
+++ b/AdminToolkit/AdminToolkit.csproj
@@ -74,7 +74,6 @@
7474 <Compile Include="Commands\AdminListingCommand.cs" />
7575 <Compile Include="Commands\BackupCycleCommand.cs" />
7676 <Compile Include="Commands\RulesCommand.cs" />
77- <Compile Include="MechTurk.cs" />
7877 <Compile Include="Commands\BannerControl.cs" />
7978 </ItemGroup>
8079 <ItemGroup>
--- a/AdminToolkit/AdminToolkitMod.cs
+++ b/AdminToolkit/AdminToolkitMod.cs
@@ -97,6 +97,7 @@ namespace AdminToolkit
9797 this.ServerAPI.RegisterCommand(new RulesCommand(this.ServerAPI) );
9898 this.ServerAPI.RegisterCommand(new AdminListingCommand(this.ServerAPI) );
9999 this.ServerAPI.RegisterCommand(new BackupCycleCommand(this.ServerAPI) );
100+ //this.ServerAPI.RegisterCommand(new BannerControl(this.ServerAPI));
100101
101102 if (CachedConfiguration.BoomingVoice) {
102103 this.ServerAPI.Event.PlayerChat += BoomingVoiceOfAuthority;
--- a/AdminToolkit/Commands/AdminListingCommand.cs
+++ b/AdminToolkit/Commands/AdminListingCommand.cs
@@ -28,7 +28,8 @@ namespace AdminToolkit
2828 foreach (var srvPlayer in ServerAPI.Server.Players) {
2929 if (AdminToolkit.AdminRoles.Contains(srvPlayer.Role.Code)) {
3030
31- msgLine.AppendFormat("<font color='{2}'>[{0}]</font> -- \"{1}\" ", srvPlayer.Role.Name, srvPlayer.PlayerName, srvPlayer.Role.Color.Name);
31+ string playerName = srvPlayer.PlayerName ?? srvPlayer?.ServerData.LastKnownPlayername ?? "?";
32+ msgLine.AppendFormat("<font color='{2}'>[{0}]</font> -- \"{1}\" ", srvPlayer.Role.Name, playerName, srvPlayer.Role.Color.Name);
3233
3334 if (srvPlayer.ConnectionState == EnumClientState.Playing) {
3435 msgLine.AppendFormat("IS: <font color='lime'>*{0}*</font>", srvPlayer.ConnectionState);
--- a/AdminToolkit/Commands/BackupCycleCommand.cs
+++ b/AdminToolkit/Commands/BackupCycleCommand.cs
@@ -16,7 +16,7 @@ namespace AdminToolkit
1616 {
1717 private long backupTickerID;
1818 private const string _timeFormat = @"d\D\ hh\H\ mm\M\ ss\S";
19- private MechTurk mechanicalTurk;
19+
2020
2121 private DateTimeOffset _lastBackupTime = DateTimeOffset.MinValue;
2222
@@ -30,7 +30,7 @@ namespace AdminToolkit
3030 this.RequiredPrivilege = Privilege.controlserver;//"Backup" ?
3131 this.Syntax = "enable / disable / delay [hours] / stats";
3232
33- mechanicalTurk = new MechTurk(ServerAPI.Server.Config.Roles.Find(ro => ro.Code == "admin"), this.Logger);
33+
3434
3535 ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, ServerStarts);
3636 }
@@ -172,16 +172,8 @@ namespace AdminToolkit
172172 }
173173
174174
175- if (ServerAPI.World is ServerMain) {
176-
177- ServerMain serverMain = ServerAPI.World as ServerMain;
178- serverMain.EventManager.TriggerChatCommand(mechanicalTurk, GlobalConstants.ServerInfoChatGroup, @"genbackup", new CmdArgs( ));
179- _lastBackupTime = DateTimeOffset.UtcNow;
180- } else {
181- Logger.Warning("Could not invoke backup command - API (implimentation) has changed, Contact Developer!");
182- this.backupTickerID = 0;
183- return;
184- }
175+ ServerAPI.InjectConsole(@"/genbackup");
176+ _lastBackupTime = DateTimeOffset.UtcNow;
185177
186178 this.backupTickerID = ServerAPI.Event.RegisterCallback(BackupCycleHandler, ( int )this.CachedConfiguration.BackupDelay.TotalMilliseconds);
187179 Logger.Notification("BackupCycle re-engaged, delay: {0} next time: {1}", this.CachedConfiguration.BackupDelay.ToString(_timeFormat), DateTimeOffset.UtcNow.Add(this.CachedConfiguration.BackupDelay).ToString("u"));
--- a/AdminToolkit/Commands/BannerControl.cs
+++ b/AdminToolkit/Commands/BannerControl.cs
@@ -1,15 +1,46 @@
11 using System;
22
3+using Vintagestory.API.Common;
34 using Vintagestory.API.Server;
45
56 namespace AdminToolkit
67 {
78 public class BannerControl : AdminModCommand
89 {
10+ /// <summary>
11+ /// Control and Configuration of automatic Broadcast 'banners' / M.O.T.H.
12+ /// </summary>
913 public BannerControl(ICoreServerAPI _serverAPI) : base(_serverAPI)
1014 {
11-
15+
16+ //Add <slot#> "text" <repeat/once> <DD:HH:MM:SS - DD/MM
17+ //Remove <slot#>
18+ //Replace <slot#> "text"
19+ //List
20+
21+ //Mode:
22+ //Repeating (Per unit of time), Once (Future-Date)
23+
24+ //Delay;
25+ //HH:MM:SS
26+ ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, ReactivateBanners);
27+
28+ this.Command = "banners";
29+ this.Description = "Control future broadcast 'banners' or repeating Messages";
30+ this.RequiredPrivilege = Privilege.announce;
31+ this.handler += HandleBannerCommand;
32+ }
33+
34+ private void ReactivateBanners( )
35+ {
36+
1237 }
13- }
38+
39+
40+ private void HandleBannerCommand(IServerPlayer player, int groupId, CmdArgs args)
41+ {
42+
43+ }
44+}
1445 }
1546
--- a/AdminToolkit/Commands/RulesCommand.cs
+++ b/AdminToolkit/Commands/RulesCommand.cs
@@ -153,7 +153,7 @@ namespace AdminToolkit
153153
154154 StringBuilder adminMessage = new StringBuilder( );
155155
156- adminMessage.AppendFormat("<font color='{1}' weight='bold'>«{0}» ̠{2}̠ </font> Present.", byPlayer.Role.Name, byPlayer.Role.Color.Name, byPlayer.PlayerName);
156+ adminMessage.AppendFormat("<font color='{1}' weight='bold'>«{0}» {2}</font> Present.", byPlayer.Role.Name, byPlayer.Role.Color.Name, byPlayer.PlayerName);
157157
158158 ServerAPI.SendMessageToGroup(GlobalConstants.AllChatGroups, adminMessage.ToString( ), EnumChatType.AllGroups);
159159
--- a/AdminToolkit/MechTurk.cs
+++ /dev/null
@@ -1,210 +0,0 @@
1-using System;
2-using System.Collections.Generic;
3-
4-using Vintagestory.API.Common;
5-using Vintagestory.API.Common.Entities;
6-using Vintagestory.API.Server;
7-
8-namespace AdminToolkit
9-{
10- public class MechTurk: IPlayer, IServerPlayer
11- {
12- private ILogger Logger;
13-
14- public MechTurk( IPlayerRole role, ILogger logger)
15- {
16- this.Role = role;
17- Logger = logger;
18- }
19-
20- public int ClientId {
21- get {
22- return -1;
23- }
24- }
25-
26- public EnumClientState ConnectionState {
27- get {
28- return EnumClientState.Connected;
29- }
30- }
31-
32- public BlockSelection CurrentBlockSelection {
33- get {
34- throw new NotImplementedException( );
35- }
36- }
37-
38- public int CurrentChunkSentRadius {
39- get {
40- throw new NotImplementedException( );
41- }
42-
43- set {
44- throw new NotImplementedException( );
45- }
46- }
47-
48- public EntitySelection CurrentEntitySelection {
49- get {
50- throw new NotImplementedException( );
51- }
52- }
53-
54- public List<Entitlement> Entitlements {
55- get {
56- throw new NotImplementedException( );
57- }
58- }
59-
60- public EntityPlayer Entity {
61- get {
62- throw new NotImplementedException( );
63- }
64- }
65-
66- public PlayerGroupMembership[] Groups {
67- get {
68- throw new NotImplementedException( );
69- }
70- }
71-
72- public IPlayerInventoryManager InventoryManager {
73- get {
74- throw new NotImplementedException( );
75- }
76- }
77-
78- public string IpAddress {
79- get {
80- return @"127.0.0.1";
81- }
82- }
83-
84- public string LanguageCode {
85- get {
86- return @"en";//ISO639-2 ?
87- }
88- }
89-
90- public float Ping {
91- get {
92- return 0.0f;
93- }
94- }
95-
96- public string PlayerName {
97- get {
98- return @"Mechanical Turk";
99- }
100- }
101-
102- public string PlayerUID {
103- get {
104- return @"console";//Keeps 'ServerEventManager' satisfied
105- }
106- }
107-
108- public string[] Privileges {
109- get {
110- return new[]{
111- Privilege.buildblockseverywhere,
112- Privilege.useblockseverywhere,
113- Privilege.gamemode,
114- Privilege.pickingrange,
115- Privilege.kick,
116- Privilege.ban,
117- Privilege.whitelist,
118- Privilege.setwelcome,
119- Privilege.announce,
120- Privilege.readlists,
121- Privilege.give,
122- Privilege.setspawn,
123- Privilege.controlserver,
124- Privilege.tp,
125- Privilege.time,
126- Privilege.grantrevoke,
127- Privilege.root,
128- Privilege.commandplayer,};
129- }
130- }
131-
132- public IPlayerRole Role {
133- get; private set;
134- }
135-
136- public IServerPlayerData ServerData {
137- get {
138- throw new NotImplementedException( );
139- }
140- }
141-
142- public EntityPos SpawnPosition {
143- get {
144- throw new NotImplementedException( );
145- }
146- }
147-
148- public IWorldPlayerData WorldData {
149- get {
150- throw new NotImplementedException( );
151- }
152- }
153-
154- public void BroadcastPlayerData( )
155- {
156-
157- }
158-
159- public void ClearSpawnPosition( )
160- {
161- throw new NotImplementedException( );
162- }
163-
164- public void Disconnect( )
165- {
166- throw new NotImplementedException( );
167- }
168-
169- public void Disconnect(string message)
170- {
171- throw new NotImplementedException( );
172- }
173-
174- public PlayerGroupMembership GetGroup(int groupId)
175- {
176- throw new NotImplementedException( );
177- }
178-
179- public PlayerGroupMembership[ ] GetGroups( )
180- {
181- throw new NotImplementedException( );
182- }
183-
184- public bool HasPrivilege(string privilegeCode)
185- {
186- return true;//Robot can do anything
187- }
188-
189- public void SendIngameError(string code, string message = null, params object[] langparams)
190- {
191-
192- }
193-
194- public void SendMessage(int groupId, string message, EnumChatType chatType, string data = null)
195- {
196- Logger.Chat("®TURK: «{0}»",message);
197- }
198-
199- public void SendPositionToClient( )
200- {
201- throw new NotImplementedException( );
202- }
203-
204- public void SetSpawnPosition(PlayerSpawnPos pos)
205- {
206- throw new NotImplementedException( );
207- }
208- }
209-}
210-
--- a/AdminToolkit/modinfo.json
+++ b/AdminToolkit/modinfo.json
@@ -3,7 +3,7 @@
33 "name": "Administrator's Toolkit mod",
44 "description" : "Provides misc. Admin functions;\n list admins, print & accept rules (multi-lingual) , auto-backup...",
55 "authors": ["Melchior", ],
6- "version": "0.3.3",
6+ "version": "0.3.4",
77 "dependencies": {
88 "game": "1.11.0"
99 },