forked from SoDOff-Project/sodoff-mmo
implement `JU
`
This commit is contained in:
parent
fd9c7b817c
commit
b57bd2679f
32
src/CommandHandlers/JoinUserHandler.cs
Normal file
32
src/CommandHandlers/JoinUserHandler.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using sodoffmmo.Attributes;
|
||||
using sodoffmmo.Core;
|
||||
using sodoffmmo.Data;
|
||||
|
||||
namespace sodoffmmo.CommandHandlers
|
||||
{
|
||||
[ExtensionCommandHandler("JU")]
|
||||
public class JoinUserHandler : CommandHandler
|
||||
{
|
||||
public override Task Handle(Client client, NetworkObject receivedObject)
|
||||
{
|
||||
string mpId = receivedObject.Get<NetworkObject>("p").Get<string>("0");
|
||||
|
||||
if (mpId != null)
|
||||
{
|
||||
Room? room = Room.AllRooms().FirstOrDefault(e => e.Id == Int32.Parse(mpId));
|
||||
|
||||
if (room != null)
|
||||
{
|
||||
client.SetRoom(room);
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user