forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminSpawnItem.cs
More file actions
38 lines (33 loc) · 992 Bytes
/
Copy pathAdminSpawnItem.cs
File metadata and controls
38 lines (33 loc) · 992 Bytes
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
using System;
using System.Threading.Tasks;
using L2dotNET.Attributes;
using L2dotNET.Models.Player;
using NLog;
namespace L2dotNET.Commands.Admin
{
[Command(CommandName = "createitem")]
class AdminSpawnItem : AAdminCommand
{
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
protected internal override async Task UseAsync(L2Player admin, string alias)
{
await Task.Run(() =>
{
int id = int.Parse(alias.Split(' ')[1]);
int count = 1;
try
{
count = int.Parse(alias.Split(' ')[2]);
}
catch (Exception e)
{
Log.Error($"AdminSpawnItem: {e.Message}");
}
admin.AddItem(id, count);
});
}
public AdminSpawnItem(IServiceProvider serviceProvider) : base(serviceProvider)
{
}
}
}