mirror of
https://gitee.com/cssfw/EasyTools.git
synced 2026-03-28 12:01:36 +08:00
style: 重命名文件名
This commit is contained in:
44
Commands/KillMeCommand.cs
Normal file
44
Commands/KillMeCommand.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using CommandSystem;
|
||||
using EasyTools.Configs;
|
||||
using EasyTools.Events;
|
||||
using LabApi.Features.Wrappers;
|
||||
using RelativePositioning;
|
||||
using System;
|
||||
|
||||
namespace EasyTools.Commands
|
||||
{
|
||||
[CommandHandler(typeof(ClientCommandHandler))]
|
||||
public class RescueCommand : ICommand
|
||||
{
|
||||
public string Command => "killme";
|
||||
|
||||
public string[] Aliases => ["suicide"];
|
||||
|
||||
public string Description => "自救命令";
|
||||
|
||||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
|
||||
{
|
||||
Player player;
|
||||
TranslateConfig TranslateConfig = CustomEventHandler.TranslateConfig;
|
||||
|
||||
if (sender is null || (player = Player.Get(sender)) is null)
|
||||
{
|
||||
response = TranslateConfig.RescueCommandError;
|
||||
return false;
|
||||
}
|
||||
|
||||
WaypointBase.GetRelativePosition(player.Position, out byte id, out _);
|
||||
|
||||
if (!player.IsAlive || !CustomEventHandler.Config.KillMeCommand)
|
||||
{
|
||||
response = TranslateConfig.RescueCommandFailed;
|
||||
return false;
|
||||
}
|
||||
|
||||
player.Kill();
|
||||
|
||||
response = TranslateConfig.RescueCommandOk;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user