Compare commits
3
Commits
1a59643c02
...
ce851148f0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce851148f0 | ||
|
|
d3c7bc87cb | ||
|
|
d0746404cd |
+10
-11
@@ -2,19 +2,18 @@ using Vintagestory.API.Server;
|
||||
|
||||
namespace CommandHook;
|
||||
|
||||
public class CommandData
|
||||
public struct CommandData
|
||||
{
|
||||
public IServerPlayer? Sender { get; }
|
||||
public string FullCommand { get; }
|
||||
public bool IsPlayerCommand { get; }
|
||||
public bool Cancel { get; set; }
|
||||
public readonly IServerPlayer? Sender;
|
||||
public readonly string FullCommand;
|
||||
public readonly bool IsPlayerCommand;
|
||||
public bool Cancel;
|
||||
|
||||
|
||||
public CommandData(IServerPlayer sender, string fullCommand)
|
||||
public CommandData(IServerPlayer? sender, string fullCommand)
|
||||
{
|
||||
Sender = sender;
|
||||
IsPlayerCommand = Sender != null;
|
||||
FullCommand = fullCommand?.Trim() ?? string.Empty;
|
||||
Cancel = false;
|
||||
Sender = sender;
|
||||
FullCommand = fullCommand.Length > 0 ? fullCommand.Trim() : string.Empty;
|
||||
IsPlayerCommand = sender != null;
|
||||
Cancel = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>bin\$(Configuration)\Mods\mod</OutputPath>
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -50,16 +52,16 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="modinfo.json">
|
||||
<ItemGroup>
|
||||
<Content Include="modinfo.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="modicon.png" Condition="Exists('modicon.png')">
|
||||
<ItemGroup>
|
||||
<Content Include="modicon.png" Condition="Exists('modicon.png')">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
using Vintagestory.API.Server;
|
||||
using Vintagestory.API.Server;
|
||||
using Vintagestory.API.Common;
|
||||
|
||||
namespace CommandHook;
|
||||
|
||||
public class CommandHookModSystem : ModSystem
|
||||
{
|
||||
|
||||
public override bool ShouldLoad(EnumAppSide forSide)
|
||||
{
|
||||
return forSide == EnumAppSide.Server;
|
||||
}
|
||||
|
||||
public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server;
|
||||
|
||||
public override void StartServerSide(ICoreServerAPI api)
|
||||
{
|
||||
Mod.Logger.Notification("Loaded");
|
||||
Mod.Logger.Notification("[CommandHook] Loaded");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
{
|
||||
"$schema": "https://moddbcdn.vintagestory.at/schema/modinfo.latest.json",
|
||||
"type": "Code",
|
||||
"type": "code",
|
||||
"modid": "commandhook",
|
||||
"name": "CommandHook",
|
||||
"authors": [
|
||||
"anth64"
|
||||
],
|
||||
"description": "A server-side API for routing and overriding vanilla commands.",
|
||||
"version": "0.0.0",
|
||||
"description": "Exposes server command events for other mods to hook into.",
|
||||
"authors": ["anth64"],
|
||||
"version": "0.1.0",
|
||||
"side": "Server",
|
||||
"dependencies": {
|
||||
"game": "1.21.0"
|
||||
},
|
||||
"side": "Server"
|
||||
"game": "1.22.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user