Command parser that probably works
This commit is contained in:
1 parent
6a090b2917
commit
ca558f76bd
4 files changed
+101
-3
No files matched your search
+21
-2
@@ -3,7 +3,7 @@ using System.Net.NetworkInformation;
|
||||
using PemukulPaku.GameServer;
|
||||
using Common.Database;
|
||||
using PemukulPaku.GameServer.Game;
|
||||
using Common.Utils.ExcelReader;
|
||||
using PemukulPaku.GameServer.Commands;
|
||||
|
||||
namespace PemukulPaku
|
||||
{
|
||||
@@ -18,13 +18,32 @@ namespace PemukulPaku
|
||||
|
||||
Global.config.Gameserver.Host = NetworkInterface.GetAllNetworkInterfaces().Where(i => i.NetworkInterfaceType != NetworkInterfaceType.Loopback && i.OperationalStatus == OperationalStatus.Up).First().GetIPProperties().UnicastAddresses.Where(a => a.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).First().Address.ToString();
|
||||
|
||||
CommandFactory.LoadCommandHandlers();
|
||||
PacketFactory.LoadPacketHandlers();
|
||||
new Thread(HttpServer.Program.Main).Start();
|
||||
_ = Server.GetInstance();
|
||||
|
||||
Player Player = new(User.FromName("test"));
|
||||
|
||||
Console.Read();
|
||||
while (true)
|
||||
{
|
||||
string? line = Console.ReadLine();
|
||||
|
||||
if (!string.IsNullOrEmpty(line))
|
||||
{
|
||||
foreach (Command cmd in CommandFactory.Commands)
|
||||
{
|
||||
if (line.StartsWith(cmd.Name.ToLower()))
|
||||
{
|
||||
List<string> args = line.Split(' ').ToList();
|
||||
args.RemoveAt(0);
|
||||
|
||||
cmd.Run(null, args.ToArray());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user