本文整理汇总了C#中IServer.GetLogger方法的典型用法代码示例。如果您正苦于以下问题:C# IServer.GetLogger方法的具体用法?C# IServer.GetLogger怎么用?C# IServer.GetLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServer
的用法示例。
在下文中一共展示了IServer.GetLogger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(IServer server, string commandName, string[] tokens)
{
if (tokens.Length < 1)
{
Help(server);
return;
}
var toKick = server.GetClients();
if (toKick.Any() && tokens[0].ToLower() != "all")
{
foreach (var client1 in toKick.Where(client1 => !client1.GetOwner().CanUseCommand("chraft.kick.exempt")))
{
client1.Kick(tokens.Length > 1 ? tokens[1] : "Kicked");
server.GetLogger().Log(LogLevel.Info, "Kicked " + client1.GetOwner().Name);
}
}
else
{
foreach (IClient t in toKick.Where(t => t.GetOwner().Name.ToLower() == tokens[0].ToLower()).Where(t => !t.GetOwner().CanUseCommand("chraft.kick.exempt")))
{
t.Kick(tokens.Length > 1 ? tokens[1] : "Kicked");
server.GetLogger().Log(LogLevel.Info, "Kicked " + t.GetOwner().Name);
}
}
}
示例2: Use
public void Use(IServer server, string commandName, string[] tokens)
{
if (tokens.Length < 1)
{
Help(server);
return;
}
server.GetBanSystem().RemoveFromBanList(tokens[0]);
server.GetLogger().Log(LogLevel.Info, string.Format("{0} has been unbanned", tokens[0]));
}
示例3: Use
public void Use(IServer server, string commandName, string[] tokens)
{
if (tokens.Length < 2)
{
Help(server);
return;
}
try
{
server.GetBanSystem().AddToBanList(tokens[0], tokens[1], tokens.Length > 2 ? tokens : null);
}
catch (FormatException ex)
{
server.GetLogger().Log(LogLevel.Info, ex.Message);
return;
}
foreach (var nClient in server.GetClients(tokens[0]).ToList())
{
nClient.Kick(tokens[1]);
}
server.GetLogger().Log(LogLevel.Info, string.Format("{0} has been banned", tokens[0]));
}
示例4: Use
public void Use(IServer server, string commandName, string[] tokens)
{
if (tokens.Length < 1)
{
Help(server);
return;
}
switch (tokens[0].ToLower())
{
case "on":
ChraftConfig.SetWhitelist(true);
foreach (var cl in server.GetClients())
{
if (!cl.GetOwner().CanUseCommand("chraft.whitelist.exempt") &&
server.GetBanSystem().IsOnWhiteList(cl.GetOwner().Name))
{
cl.Kick(ChraftConfig.WhiteListMesasge);
}
}
server.GetLogger().Log(LogLevel.Info, "Whitelist enabled");
break;
case "off":
ChraftConfig.SetWhitelist(false);
server.GetLogger().Log(LogLevel.Info, "Whitelist disabled");
break;
case "add":
if (tokens.Length < 2)
{
Help(server);
return;
}
server.GetBanSystem().AddToWhiteList(tokens[1]);
server.GetLogger().Log(LogLevel.Info, tokens[1] + " added to Whitelist");
break;
case "remove":
if (tokens.Length < 2)
{
Help(server);
return;
}
server.GetBanSystem().RemoveFromWhiteList(tokens[1]);
server.GetLogger().Log(LogLevel.Info, tokens[1] + " removed from Whitelist");
break;
case "list":
foreach (var play in server.GetBanSystem().ListWhiteList())
{
server.GetLogger().Log(LogLevel.Info, play);
}
break;
case "message":
if (tokens.Length < 2)
{
Help(server);
return;
}
ChraftConfig.SetWhitelistMessage(tokens[1]);
server.GetLogger().Log(LogLevel.Info, "Whitelist message set");
break;
}
}
示例5: Help
public void Help(IServer server)
{
server.GetLogger().Log(LogLevel.Info, "whitelist [on|off|add|remove|message] <player>");
}
示例6: Help
public void Help(IServer server)
{
server.GetLogger().Log(LogLevel.Info, "banip [ip] [reason] <duration>");
server.GetLogger().Log(LogLevel.Info, "e.g. /banip 127.0.0.1 hax d:30 h:5 m:5 s:5");
server.GetLogger().Log(LogLevel.Info, "banip 127.0.0.1 for 30 days, 5 hours, 5 minutes and 5 seconds");
}