-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommands.cs
More file actions
39 lines (36 loc) · 1.26 KB
/
Commands.cs
File metadata and controls
39 lines (36 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using Cysharp.Threading.Tasks;
using OpenMod.Core.Commands;
using System.Threading.Tasks;
using OpenMod.Unturned.Users;
using Microsoft.Extensions.Localization;
namespace BuilderMode
{
[Command("buildermode")]
[CommandAlias("bm")]
[CommandAlias("bmode")]
[CommandDescription("Command to enable or disable the builder mode.")]
public class CommandAwesome : Command
{
private readonly IStringLocalizer ro_StringLocalizer;
public CommandAwesome(IServiceProvider serviceProvider, IStringLocalizer stringLocalizer) : base(serviceProvider)
{
ro_StringLocalizer = stringLocalizer;
}
protected override async Task OnExecuteAsync()
{
var user = (UnturnedUser)Context.Actor;
var z = PlayerManager.InBuilderMode;
if (z.Contains(user.Id))
{
z.Remove(user.Id);
await user.PrintMessageAsync(ro_StringLocalizer["plugin_translations:buildermode_off"], System.Drawing.Color.Red);
}
else
{
z.Add(user.Id);
await user.PrintMessageAsync(ro_StringLocalizer["plugin_translations:buildermode_on"], System.Drawing.Color.Blue);
}
}
}
}