public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                GiveMaxSkills(src.ToPlayer(), false);
            }
            else
            {
                if (args.Length < 2 && src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                if (!args[0].IsBool)
                {
                    return(CommandResult.Lang("INVALID_BOOLEAN", args[0]));
                }

                var overpower = args[0].ToBool;

                // player or all
                if (args.Length > 1)
                {
                    if (args[1].Equals("*"))
                    {
                        if (!src.HasPermission($"{Permission}.all"))
                        {
                            return(CommandResult.NoPermission($"{Permission}.all"));
                        }
                        UServer.Players.ForEach(p => GiveMaxSkills(p, overpower));
                        EssLang.Send(src, "MAX_SKILLS_ALL");
                    }
                    else
                    {
                        if (!src.HasPermission($"{Permission}.other"))
                        {
                            return(CommandResult.NoPermission($"{Permission}.other"));
                        }
                        if (!args[1].IsValidPlayerIdentifier)
                        {
                            return(CommandResult.Lang("PLAYER_NOT_FOUND", args[1]));
                        }
                        var targetPlayer = args[1].ToPlayer;
                        GiveMaxSkills(targetPlayer, overpower);
                        EssLang.Send(src, "MAX_SKILLS_TARGET", targetPlayer.DisplayName);
                    }
                }
                else     // self (with overpower)
                {
                    GiveMaxSkills(src.ToPlayer(), overpower);
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 2
0
        private CommandResult PositionCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            if (args.Length == 0)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                var p = src.ToPlayer();
                EssLang.Send(src, "POSITION", p.Position.x, p.Position.y, p.Position.z);
            }
            else
            {
                if (!src.HasPermission($"{cmd.Permission}.other"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.other"));
                }

                if (!args[0].IsValidPlayerIdentifier)
                {
                    return(CommandResult.LangError("PLAYER_NOT_FOUND", args[0]));
                }

                var p = args[0].ToPlayer;
                EssLang.Send(src, "POSITION_OTHER", p.DisplayName, p.Position.x, p.Position.y, p.Position.z);
            }

            return(CommandResult.Success());
        }
Exemplo n.º 3
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            switch (args.Length)
            {
            case 1:
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                DropKit(src, args[0], src.ToPlayer().Position);
                EssLang.Send(src, "DROPKIT_SENDER", args[0]);
                break;

            case 2:
                if (!src.HasPermission($"{Permission}.other"))
                {
                    return(CommandResult.Lang("COMMAND_NO_PERMISSION"));
                }

                var found = UPlayer.TryGet(args[1], player => {
                    DropKit(src, args[0], player.Position);
                    EssLang.Send(src, "DROPKIT_PLAYER", args[0], player.DisplayName);
                });

                if (!found)
                {
                    return(CommandResult.Lang("PLAYER_NOT_FOUND", args[1]));
                }
                break;

            case 4:
                var pos = args.GetVector3(1);

                if (pos.HasValue)
                {
                    DropKit(src, args[0], pos.Value);
                    EssLang.Send(src, "DROPKIT_LOCATION", args[1], args[2], args[3]);
                }
                else
                {
                    return(CommandResult.Lang("INVALID_COORDS", args[1], args[2], args[3]));
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 4
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty && src.IsConsole)
            {
                return(CommandResult.ShowUsage());
            }

            if (args.IsEmpty)   // self
            {
                ClearInventory(src.ToPlayer());
            }
            else if (args[0].Equals("*"))     // all
            {
                if (!src.HasPermission($"{Permission}.all"))
                {
                    return(CommandResult.NoPermission($"{Permission}.all"));
                }
                UServer.Players.ForEach(ClearInventory);
                EssLang.Send(src, "INVENTORY_CLEARED_ALL");
            }
            else
            {
                if (!args[0].IsValidPlayerIdentifier)   // specific player
                {
                    return(CommandResult.LangError("PLAYER_NOT_FOUND", args[0]));
                }
                if (!src.HasPermission($"{Permission}.other"))
                {
                    return(CommandResult.NoPermission($"{Permission}.other"));
                }
                ClearInventory(args[0].ToPlayer);
                EssLang.Send(src, "INVENTORY_CLEARED_PLAYER", args[0].ToPlayer.DisplayName);
            }

            return(CommandResult.Success());
        }
Exemplo n.º 5
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                GiveMaxSkills(src.ToPlayer(), false);
            }
            else
            {
                if (args.Length < 2 && src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                if (!args[0].IsBool)
                {
                    return(CommandResult.Lang("INVALID_BOOLEAN", args[0]));
                }

                if (args.Length == 2 && !src.HasPermission(Permission + ".other"))
                {
                    return(CommandResult.Lang("COMMAND_NO_PERMISSION"));
                }

                var overpower    = args[0].ToBool;
                var targetPlayer = args.Length == 2 ? args[1].ToPlayer : src.ToPlayer();

                if (targetPlayer == null)
                {
                    return(CommandResult.Lang("PLAYER_NOT_FOUND", args[1]));
                }

                GiveMaxSkills(targetPlayer, overpower);

                if (src.IsConsole || src.ToPlayer() != targetPlayer)
                {
                    EssLang.Send(src, "MAX_SKILLS_TARGET", targetPlayer.DisplayName);
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 6
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                var currentVeh = src.ToPlayer().CurrentVehicle;

                if (currentVeh != null)
                {
                    VehicleManager.sendVehicleHealth(currentVeh, currentVeh.asset.health);

                    EssLang.VEHICLE_REPAIRED.SendTo(src);
                }
                else
                {
                    return(CommandResult.Lang(EssLang.NOT_IN_VEHICLE));
                }
            }
            else if (args[0].Is("all"))
            {
                if (!src.HasPermission(Permission + ".all"))
                {
                    return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                }

                lock (UWorld.Vehicles)
                {
                    UWorld.Vehicles
                    .Where(veh => !veh.isExploded && !veh.isUnderwater)
                    .ToList()
                    .ForEach(vehicle => {
                        VehicleManager.sendVehicleHealth(vehicle, vehicle.asset.health);
                    });

                    EssLang.VEHICLE_REPAIRED_ALL.SendTo(src);
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 7
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                var currentVeh = src.ToPlayer().CurrentVehicle;

                if (currentVeh != null)
                {
                    VehicleManager.sendVehicleHealth(currentVeh, currentVeh.asset.health);

                    EssLang.Send(src, "VEHICLE_REPAIRED");
                }
                else
                {
                    return(CommandResult.Lang("NOT_IN_VEHICLE"));
                }
            }
            else if (args[0].Equals("all"))
            {
                if (!src.HasPermission($"{Permission}.all"))
                {
                    return(CommandResult.NoPermission($"{Permission}.all"));
                }

                lock (UWorld.Vehicles) {
                    UWorld.Vehicles
                    .WhereNot(veh => veh.isExploded || veh.isUnderwater)
                    .ToList()
                    .ForEach(vehicle => {
                        VehicleManager.sendVehicleHealth(vehicle, vehicle.asset.health);
                    });

                    EssLang.Send(src, "VEHICLE_REPAIRED_ALL");
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 8
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                var currentVeh = src.ToPlayer().CurrentVehicle;

                if (currentVeh != null)
                {
                    RefuelVehicle(currentVeh);
                    EssLang.Send(src, "VEHICLE_REFUELED");
                }
                else
                {
                    return(CommandResult.Lang("NOT_IN_VEHICLE"));
                }
            }
            else if (args[0].Is("all"))
            {
                if (!src.HasPermission($"{Permission}.all"))
                {
                    return(CommandResult.NoPermission($"{Permission}.all"));
                }

                lock (UWorld.Vehicles) {
                    UWorld.Vehicles
                    .WhereNot(veh => veh.isExploded || veh.isUnderwater)
                    .ForEach(RefuelVehicle);

                    EssLang.Send(src, "VEHICLE_REFUELED_ALL");
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="source">Source that you want to check if is authorized</param>
 /// <returns>If source has permission to use this warp</returns>
 public bool CanUse( ICommandSource source )
 {
     return source.HasPermission( $"essentials.warps.{Name}" );
 }
Exemplo n.º 10
0
        private CommandResult VehicleFeaturesCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            var toggleVal = GetToggleValue(args[1]);

            if (!toggleVal.HasValue)
            {
                return(CommandResult.Lang("INVALID_BOOLEAN", args[1]));
            }

            var player    = src.ToPlayer();
            var component = player.GetComponent <VehicleFeatures>() ?? player.AddComponent <VehicleFeatures>();

            switch (args[0].ToLowerString)
            {
            case "autorefuel":
                if (!src.HasPermission($"{cmd.Permission}.autorefuel"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.autorefuel"));
                }
                if (toggleVal.Value)
                {
                    component.AutoRefuel = true;
                    EssLang.Send(src, "AUTO_REFUEL_ENABLED");
                }
                else
                {
                    component.AutoRefuel = false;
                    EssLang.Send(src, "AUTO_REFUEL_DISABLED");
                }
                break;

            case "autorepair":
                if (!src.HasPermission($"{cmd.Permission}.autorepair"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.autorepair"));
                }
                if (toggleVal.Value)
                {
                    component.AutoRepair = true;
                    EssLang.Send(src, "AUTO_REPAIR_ENABLED");
                }
                else
                {
                    component.AutoRepair = false;
                    EssLang.Send(src, "AUTO_REPAIR_DISABLED");
                }
                break;

            case "all":
                if (!src.HasPermission($"{cmd.Permission}.all"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.all"));
                }
                if (toggleVal.Value)
                {
                    component.AutoRepair = true;
                    component.AutoRefuel = true;
                    EssLang.Send(src, "AUTO_REPAIR_ENABLED");
                    EssLang.Send(src, "AUTO_REFUEL_ENABLED");
                }
                else
                {
                    component.AutoRepair = false;
                    component.AutoRefuel = false;
                    EssLang.Send(src, "AUTO_REPAIR_DISABLED");
                    EssLang.Send(src, "AUTO_REFUEL_DISABLED");
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 11
0
        private static void GiveItem(ICommandSource src, UPlayer target, ICommandArgument itemArg,
                                     ICommandArgument amountArg, bool allPlayers = false)
        {
            if (!src.HasPermission("essentials.command.item.other") && target != src)
            {
                EssLang.Send(src, "COMMAND_NO_PERMISSION");
                return;
            }

            var optAsset = ItemUtil.GetItem(itemArg.ToString());

            if (optAsset.IsAbsent)
            {
                EssLang.Send(src, "ITEM_NOT_FOUND", itemArg);
                return;
            }

            if (UEssentials.Config.GiveItemBlacklist.Contains(optAsset.Value.id) &&
                !src.HasPermission("essentials.bypass.blacklist.item"))
            {
                EssLang.Send(src, "BLACKLISTED_ITEM", $"{optAsset.Value.itemName} ({optAsset.Value.id})");
                return;
            }

            ushort amt = 1;

            if (amountArg != null)
            {
                if (!amountArg.IsShort)
                {
                    EssLang.Send(src, "INVALID_NUMBER", amountArg);
                }
                else if (amountArg.ToShort <= 0)
                {
                    EssLang.Send(src, "MUST_POSITIVE");
                }
                else
                {
                    amt = amountArg.ToUShort;
                    goto give;
                }
                return;
            }

give:
            var asset = optAsset.Value;
            var playersToReceive = new List <UPlayer>();
            var item             = new Item(asset.id, true);

            if (asset is ItemFuelAsset)
            {
                ItemUtil.Refuel(item);
            }

            if (!src.HasPermission("essentials.bypass.itemlimit") && amt > UEssentials.Config.ItemSpawnLimit)
            {
                amt = UEssentials.Config.ItemSpawnLimit;
                EssLang.Send(src, "ITEM_LIMIT", amt);
            }

            if (allPlayers)
            {
                UServer.Players.ForEach(playersToReceive.Add);
                EssLang.Send(src, "GIVEN_ITEM_ALL", amt, asset.itemName, asset.id);
            }
            else
            {
                playersToReceive.Add(target);

                if (!src.IsConsole && src.ToPlayer() == target)
                {
                    goto give2;
                }

                EssLang.Send(src, "GIVEN_ITEM", amt, asset.itemName, asset.id, target.CharacterName);
            }

give2:
            playersToReceive.ForEach(p => {
                var success = p.GiveItem(item, amt, true);

                EssLang.Send(p, "RECEIVED_ITEM", amt, asset.itemName, asset.id);

                if (!success)
                {
                    EssLang.Send(p, "INVENTORY_FULL");
                }
            });
        }
Exemplo n.º 12
0
        private CommandResult ClearCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            if (args.IsEmpty)
            {
                return(CommandResult.ShowUsage());
            }

            /*
             *  TODO: Options
             *      -i = items
             *      -v = vehicles
             *      -z = zombies
             *      -b = barricades
             *      -s = structures
             *      -a = ALL
             *
             *  /clear -i -z -v = items, zombies, vehicles
             */

            var distance = -1;

            if (args.Length > 1)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                if (!args[1].IsInt)
                {
                    return(CommandResult.LangError("INVALID_NUMBER", args[1]));
                }

                if (args[1].ToInt < 1)
                {
                    return(CommandResult.LangError("NUMBER_BETWEEN", 1, int.MaxValue));
                }

                distance = args[1].ToInt;
            }

            switch (args[0].ToLowerString)
            {
            case "ev":
            case "emptyvehicles":
                if (!src.HasPermission(cmd.Permission + ".emptyvehicles"))
                {
                    return(CommandResult.LangError("COMMAND_NO_PERMISSION"));
                }

                src.SendMessage("This command is unstable and can cause bugs.", Color.yellow);

                var numRemoved = 0;
                UWorld.Vehicles
                .Where(v => v.passengers.All(p => p?.player == null))         // Check if it's has no passengers
                .Where(v => {
                    if (v.id == 186 || v.id == 187)
                    {
                        return(false);                                    // Ignore trains; TODO: config blacklist for this?
                    }
                    if (distance == -1)
                    {
                        return(true);
                    }

                    return(Vector3.Distance(v.transform.position, src.ToPlayer().Position) <= distance);
                })
                .Select(v => v.instanceID)
                .ToList()
                .ForEach(id => {
                    VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, id);
                    numRemoved++;
                });

                EssLang.Send(src, "CLEAR_EMPTY_VEHICLES", numRemoved);
                break;

            case "i":
            case "items":
                if (!src.HasPermission(cmd.Permission + ".items"))
                {
                    return(CommandResult.LangError("COMMAND_NO_PERMISSION"));
                }

                ItemManager.askClearAllItems();
                EssLang.Send(src, "CLEAR_ITEMS");
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 13
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty || (args.Length < 5 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            var     rawId     = args[0].ToString();
            var     rawAmount = args.Length >= 2 ? args[1].ToString() : "1";
            Vector3 pos;

            if (args.Length == 5)
            {
                var argPos = args.GetVector3(2);

                if (!argPos.HasValue)
                {
                    return(CommandResult.LangError("INVALID_COORDS", args[2], args[3], args[4]));
                }

                pos = argPos.Value;
            }
            else
            {
                pos = src.ToPlayer().Position;
            }

            if (!ushort.TryParse(rawAmount, out var amount))
            {
                return(CommandResult.LangError("INVALID_NUMBER", rawAmount));
            }

            var itemAsset = ItemUtil.GetItem(rawId);

            if (itemAsset.IsAbsent)
            {
                return(CommandResult.LangError("INVALID_ITEM_ID", rawId));
            }

            if (UEssentials.Config.GiveItemBlacklist.Contains(itemAsset.Value.id) &&
                !src.HasPermission("essentials.bypass.blacklist.item"))
            {
                return(CommandResult.LangError("BLACKLISTED_ITEM", $"{itemAsset.Value.itemName} ({itemAsset.Value.id})"));
            }

            var item = new Item(itemAsset.Value.id, true);

            if (itemAsset.Value is ItemFuelAsset)
            {
                ItemUtil.Refuel(item);
            }

            for (var i = 0; i < amount; i++)
            {
                ItemManager.dropItem(item, pos, true, true, true);
            }

            if (args.Length == 5)
            {
                EssLang.Send(src, "SPAWNED_ITEM_AT", amount, itemAsset.Value.itemName, pos.x, pos.y, pos.z);
            }
            else
            {
                EssLang.Send(src, "SPAWNED_ITEM", amount, itemAsset.Value.itemName);
            }

            return(CommandResult.Success());
        }
Exemplo n.º 14
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                return(CommandResult.ShowUsage());
            }
            else
            {
                switch (args[0].ToString().ToLower())
                {
                case "start":
                    if (src.HasPermission("essentials.command.poll.start"))
                    {
                        if (args.Length < 4)
                        {
                            return(CommandResult.InvalidArgs("/poll start [name] [duration] [description]"));
                        }

                        var pollName = args[1].ToString();

                        lock ( Polls )
                        {
                            if (Polls.ContainsKey(pollName))
                            {
                                return(CommandResult.Lang(EssLang.POLL_NAME_IN_USE));
                            }
                        }

                        var pollDescription = args.Join(3);

                        if (args[2].IsInt)
                        {
                            var poll = new Poll(
                                pollName,
                                pollDescription,
                                args[2].ToInt
                                );

                            poll.Start();
                        }
                        else
                        {
                            return(CommandResult.Lang(EssLang.INVALID_NUMBER, args[2]));
                        }
                    }
                    else
                    {
                        return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                    }
                    break;

                case "stop":
                    if (src.HasPermission("essentials.command.poll.stop"))
                    {
                        if (args.Length < 2)
                        {
                            return(CommandResult.InvalidArgs("/poll stop [name]"));
                        }

                        var pollName = args[1].ToString();

                        if (!PollExists(pollName, src))
                        {
                            return(CommandResult.Empty());
                        }

                        lock ( Polls )
                        {
                            Polls[pollName].Stop();
                        }
                    }
                    else
                    {
                        return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                    }
                    break;

                case "list":
                    if (src.HasPermission("essentials.command.poll.info"))
                    {
                        lock ( Polls )
                        {
                            if (!Polls.Any())
                            {
                                return(CommandResult.Lang(EssLang.POLL_NONE));
                            }

                            lock ( Polls )
                            {
                                EssLang.POLL_LIST.SendTo(src);

                                foreach (var poll in Polls.Values)
                                {
                                    EssLang.POLL_LIST_ENTRY.SendTo(
                                        src,
                                        poll.Name,
                                        poll.Description,
                                        poll.YesVotes,
                                        poll.NoVotes
                                        );
                                }
                            }
                        }
                    }
                    else
                    {
                        return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                    }
                    break;

                case "info":
                    if (src.HasPermission("essentials.command.poll.info"))
                    {
                        lock ( Polls )
                        {
                            if (!Polls.Any())
                            {
                                return(CommandResult.Lang(EssLang.POLL_NONE));
                            }

                            if (args.Length < 2)
                            {
                                return(CommandResult.InvalidArgs("Use /poll info [poll_name]"));
                            }

                            var pollName = args[1].ToString();

                            if (!PollExists(pollName, src))
                            {
                                return(CommandResult.Empty());
                            }

                            var poll = Polls[pollName];

                            EssLang.POLL_INFO.SendTo(src, pollName);

                            EssLang.POLL_LIST_ENTRY.SendTo(
                                src,
                                pollName,
                                poll.Description,
                                poll.YesVotes,
                                poll.NoVotes
                                );
                        }
                    }
                    else
                    {
                        return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                    }
                    break;

                default:
                    return(CommandResult.ShowUsage());
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="source">Source that you want to check if is authorized</param>
 /// <returns>If source has permission to use this warp</returns>
 public bool CanUse(ICommandSource source)
 {
     return(source.HasPermission($"essentials.warp.{Name}"));
 }
Exemplo n.º 16
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                return(CommandResult.ShowUsage());
            }

            switch (args[0].ToLowerString)
            {
            case "reload":
                if (!src.HasPermission("essentials.reload"))
                {
                    return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                }

                if (args.Length == 1)
                {
                    src.SendMessage("Reloading all...");
                    ReloadConfig();
                    ReloadKits();
                    ReloadLang();
                    R.Permissions.Reload();
                    src.SendMessage("Reload finished...");
                }
                else
                {
                    switch (args[1].ToLowerString)
                    {
                    case "kits":
                    case "kit":
                        src.SendMessage("Reloading kits...");
                        ReloadKits();
                        src.SendMessage("Reload finished...");
                        break;

                    case "config":
                        src.SendMessage("Reloading config...");
                        ReloadConfig();
                        src.SendMessage("Reload finished...");
                        break;

                    case "lang":
                        src.SendMessage("Reloading translations...");
                        ReloadLang();
                        src.SendMessage("Reload finished...");
                        break;

                    default:
                        return(CommandResult.InvalidArgs("Use /ess reload <kits/config/lang>"));
                    }
                }
                break;

            case "commands":
                if (src.IsConsole)
                {
                    if (_cachedCommands == null)
                    {
                        var builder = new StringBuilder("Commands: \n");

                        (
                            from command in UEssentials.CommandManager.Commands
                            where _isEssentialsCommand(command)
                            select command
                        ).ForEach(command => {
                            builder.Append("  /")
                            .Append(command.Name.ToLower())
                            .Append(command.Usage == "" ? "" : " " + command.Usage)
                            .Append(" - ").Append(command.Description)
                            .AppendLine();
                        });

                        _cachedCommands = builder.ToString();
                    }

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(_cachedCommands);
                    Console.WriteLine("Use /ess help <command> to view help page.");
                }
                else if (args.Length != 2 || !args[1].IsInt)
                {
                    src.SendMessage("Use /ess commands [page]");
                }
                else
                {
                    if (_ingameCommandPages == null)
                    {
                        const int PAGE_SIZE = 16;

                        _ingameCommandPages = new List <List <string> >(50)
                        {
                            new List <string>(PAGE_SIZE)
                        };

                        var builder = new StringBuilder("Commands: \n");
                        var count   = 0;
                        var page    = 0;

                        (
                            from command in UEssentials.CommandManager.Commands
                            where _isEssentialsCommand(command)
                            select command
                        ).ForEach(command => {
                            if (count >= (PAGE_SIZE - 1))
                            {
                                _ingameCommandPages[page++].Add("Use /ess help <command> to view help page.");
                                _ingameCommandPages.Add(new List <string>(PAGE_SIZE));
                                count = 0;
                            }

                            builder.Append("  /")
                            .Append(command.Name.ToLower())
                            .Append(command.Usage == "" ? "" : " " + command.Usage)
                            .Append(" - ").Append(command.Description)
                            .AppendLine();

                            _ingameCommandPages[page].Add(builder.ToString());
                            builder.Length = 0;
                            count++;
                        });
                    }

                    var pageArg = args[1].ToInt;

                    if (pageArg < 1 || pageArg > _ingameCommandPages.Count - 1)
                    {
                        src.SendMessage($"Page must be between 1 and {_ingameCommandPages.Count - 1}", Color.red);
                    }
                    else
                    {
                        _ingameCommandPages[pageArg - 1].ForEach(s => {
                            src.SendMessage(s, Color.cyan);
                        });
                    }
                }
                break;

            case "info":
                if (src.IsConsole)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                src.SendMessage("Author:  leonardosc", Color.yellow);
                src.SendMessage("Skype:   devleeo", Color.yellow);
                src.SendMessage("Github:  github.com/leonardosnt", Color.yellow);
                src.SendMessage("Version: " + EssCore.PLUGIN_VERSION, Color.yellow);
                break;

            case "help":
                if (src.IsConsole)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                if (args.Length == 1)
                {
                    src.SendMessage("Use /ess help <command>");
                }
                else
                {
                    var command = UEssentials.CommandManager.GetByName(args[1].ToString());

                    if (command == null)
                    {
                        src.SendMessage($"Command {args[1]} does not exists", Color.red);
                    }
                    else
                    {
                        src.SendMessage("Command: " + command.Name, Color.cyan);
                        src.SendMessage("  Arguments: <optional> [required]", Color.cyan);
                        src.SendMessage("  Help: " + command.Description, Color.cyan);
                        src.SendMessage("  Usage: /" + command.Name + " " + command.Usage, Color.cyan);
                        if (command.Aliases.Any())
                        {
                            src.SendMessage("  Aliases: " + string.Join(", ", command.Aliases), Color.cyan);
                        }
                    }
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 17
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.Length == 0 || (args.Length == 1 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            if (args.Length == 1)
            {
                var player  = src.ToPlayer();
                var kitName = args[0].ToLowerString;

                if (!KitModule.Instance.KitManager.Contains(kitName))
                {
                    return(CommandResult.LangError("KIT_NOT_EXIST", kitName));
                }

                var requestedKit = KitModule.Instance.KitManager.GetByName(kitName);

                if (!requestedKit.CanUse(player))
                {
                    return(CommandResult.LangError("KIT_NO_PERMISSION"));
                }

                var steamPlayerId = player.CSteamId.m_SteamID;
                var kitCost       = requestedKit.Cost;

                if (
                    kitCost > 0 &&
                    UEssentials.EconomyProvider.IsPresent &&
                    !src.HasPermission("essentials.bypass.kitcost")
                    )
                {
                    var ecoProvider = UEssentials.EconomyProvider.Value;

                    if (!ecoProvider.Has(player, kitCost))
                    {
                        return(CommandResult.LangError("KIT_NO_MONEY", kitCost, ecoProvider.CurrencySymbol));
                    }
                }

                var globalCooldown = EssCore.Instance.Config.Kit.GlobalCooldown;
                var kitCooldown    = requestedKit.Cooldown;

                if (!src.HasPermission("essentials.bypass.kitcooldown"))
                {
                    // Check if is on global cooldown
                    if (globalCooldown > 0 && GlobalCooldown.ContainsKey(steamPlayerId))
                    {
                        var remainingTime = DateTime.Now - GlobalCooldown[steamPlayerId];

                        if ((remainingTime.TotalSeconds + 1) < globalCooldown)
                        {
                            return(CommandResult.LangError("KIT_GLOBAL_COOLDOWN",
                                                           TimeUtil.FormatSeconds((uint)(globalCooldown - remainingTime.TotalSeconds))));
                        }
                    }

                    // Check if is on cooldown for this specific kit
                    if (kitCooldown > 0)
                    {
                        if (!Cooldowns.TryGetValue(steamPlayerId, out var playerCooldowns) || playerCooldowns == null)
                        {
                            Cooldowns[steamPlayerId] = playerCooldowns = new Dictionary <string, DateTime>();
                        }

                        if (playerCooldowns.TryGetValue(kitName, out var lastTimeUsedThisKit))
                        {
                            var remainingTime = DateTime.Now - lastTimeUsedThisKit;

                            if ((remainingTime.TotalSeconds + 1) < kitCooldown)
                            {
                                return(CommandResult.LangError("KIT_COOLDOWN", TimeUtil.FormatSeconds(
                                                                   (uint)(kitCooldown - remainingTime.TotalSeconds))));
                            }
                        }
                    }
                }

                if (kitCost > 0 && !src.HasPermission("essentials.bypass.kitcost"))
                {
                    UEssentials.EconomyProvider.IfPresent(ec => {
                        ec.Withdraw(player, kitCost);
                        EssLang.Send(player, "KIT_PAID", kitCost, ec.CurrencySymbol);
                    });
                }

                requestedKit.GiveTo(player);

                // Only apply the cooldowns if the player received the kit
                // and does not have the bypass permission.
                if (!src.HasPermission("essentials.bypass.kitcooldown"))
                {
                    if (globalCooldown > 0)
                    {
                        GlobalCooldown[steamPlayerId] = DateTime.Now;
                    }
                    if (kitCooldown > 0)
                    {
                        Cooldowns[steamPlayerId][kitName] = DateTime.Now;
                    }
                }
            }
            else if (args.Length == 2)
            {
                var kitName = args[0].ToLowerString;

                if (!src.HasPermission($"essentials.kit.{kitName}.other"))
                {
                    return(CommandResult.NoPermission($"essentials.kit.{kitName}.other"));
                }

                if (!KitModule.Instance.KitManager.Contains(kitName))
                {
                    return(CommandResult.LangError("KIT_NOT_EXIST", kitName));
                }

                var kit = KitModule.Instance.KitManager.GetByName(kitName);

                if (args[1].Equals("*"))
                {
                    UServer.Players.ForEach(kit.GiveTo);
                    EssLang.Send(src, "KIT_GIVEN_SENDER_ALL", kitName);
                }
                else
                {
                    if (!UPlayer.TryGet(args[1].ToString(), out var target))
                    {
                        return(CommandResult.LangError("PLAYER_NOT_FOUND", args[1]));
                    }

                    kit.GiveTo(target);
                    EssLang.Send(src, "KIT_GIVEN_SENDER", kitName, target);
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 18
0
        public override void OnExecute( ICommandSource source, ICommandArgs parameters )
        {
            if ( parameters.IsEmpty )
            {
                ShowUsage( source );
            }
            else
            {
                switch (parameters[0].ToString().ToLower())
                {
                    case "start":
                        if ( source.HasPermission( "essentials.commands.poll.start" ) )
                        {
                            if ( parameters.Length < 4 )
                            {
                                source.SendMessage( "/poll start [name] [duration] [description]" );
                                return;
                            }

                            var pollName = parameters[1].ToString();

                            lock ( Polls )
                            {
                                if ( Polls.ContainsKey( pollName ) )
                                {
                                    EssLang.POLL_NAME_IN_USE.SendTo( source );
                                    return;
                                }
                            }

                            var pollDescription = parameters.Join( 3 );

                            if ( parameters[2].IsInt )
                            {
                                var poll = new Poll( 
                                    pollName, 
                                    pollDescription,
                                    parameters[2].ToInt 
                                );

                                poll.Start();
                            }
                            else
                            {
                                EssLang.INVALID_NUMBER.SendTo( source, parameters[2] );
                            }
                        }
                        else
                        {
                            EssLang.COMMAND_NO_PERMISSION.SendTo( source );
                        }
                        break;

                    case "stop":
                        if ( source.HasPermission( "essentials.commands.poll.stop" ) )
                        {
                            if ( parameters.Length < 2 )
                            {
                                source.SendMessage( "/poll stop [name]" );
                                return;
                            }

                            var pollName = parameters[1].ToString();

                            if ( !PollExists( pollName, source ) ) return;

                            lock ( Polls )
                            {
                                Polls[pollName].Stop();
                            }
                        }
                        else
                        {
                            EssLang.COMMAND_NO_PERMISSION.SendTo( source );
                        }
                        break;

                    case "list":
                        if ( source.HasPermission( "essentials.commands.poll.info" ) )
                        {
                            lock ( Polls )
                            {
                                if ( !Polls.Any() )
                                {
                                    EssLang.POLL_NONE.SendTo( source );
                                    return;
                                }

                                lock ( Polls )
                                {
                                    EssLang.POLL_LIST.SendTo( source );

                                    foreach ( var poll in Polls.Values )
                                    {
                                        EssLang.POLL_LIST_ENTRY.SendTo( 
                                            source,
                                            poll.Name,
                                            poll.Description, 
                                            poll.YesVotes,
                                            poll.NoVotes
                                        );
                                    }
                                }
                            }
                        }
                        else
                        {
                            EssLang.COMMAND_NO_PERMISSION.SendTo( source );
                        }                        
                        break;

                    case "info":
                        if ( source.HasPermission( "essentials.commands.poll.info" ) )
                        {
                            lock ( Polls )
                            {
                                if ( !Polls.Any() )
                                {
                                    EssLang.POLL_NONE.SendTo( source );
                                    return;
                                }

                                if ( parameters.Length < 2 )
                                {
                                    source.SendMessage( "Use /poll info [poll_name]");
                                }
                                else
                                {
                                    var pollName = parameters[1].ToString();

                                    if ( !PollExists( pollName, source ) ) return;

                                    var poll = Polls[pollName];

                                    EssLang.POLL_INFO.SendTo( source, pollName );

                                    EssLang.POLL_LIST_ENTRY.SendTo( 
                                        source, 
                                        pollName, 
                                        poll.Description, 
                                        poll.YesVotes, 
                                        poll.NoVotes 
                                    );
                                }
                            }
                        }
                        else
                        {
                            EssLang.COMMAND_NO_PERMISSION.SendTo( source );
                        }
                        break;

                    default:
                        ShowUsage( source );
                        break;
                }
            }
        }
Exemplo n.º 19
0
 /// <summary>
 /// <returns> If determinated player has permission for this kit </returns>
 /// </summary>
 public bool CanUse( ICommandSource player )
 {
     return player.HasPermission( $"essentials.kit.{Name}" );
 }
Exemplo n.º 20
0
        private CommandResult ItemFeaturesCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            var toggleVal = GetToggleValue(args[1]);

            if (!toggleVal.HasValue)
            {
                return(CommandResult.LangError("INVALID_BOOLEAN", args[1]));
            }

            var player    = src.ToPlayer();
            var component = player.GetComponent <ItemFeatures>() ?? player.AddComponent <ItemFeatures>();

            switch (args[0].ToLowerString)
            {
            case "autoreload":
                if (!src.HasPermission($"{cmd.Permission}.autoreload"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.autoreload"));
                }

                if (toggleVal.Value)
                {
                    component.AutoReload = true;
                    context.User.SendLocalizedMessage(Translations, "AUTO_RELOAD_ENABLED");
                }
                else
                {
                    component.AutoReload = false;
                    context.User.SendLocalizedMessage(Translations, "AUTO_RELOAD_DISABLED");
                }

                break;

            case "autorepair":
                if (!src.HasPermission($"{cmd.Permission}.autorepair"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.autorepair"));
                }

                if (toggleVal.Value)
                {
                    component.AutoRepair = true;
                    context.User.SendLocalizedMessage(Translations, "AUTO_REPAIR_ENABLED");
                }
                else
                {
                    component.AutoRepair = false;
                    context.User.SendLocalizedMessage(Translations, "AUTO_REPAIR_DISABLED");
                }

                break;

            case "all":
                if (!src.HasPermission($"{cmd.Permission}.all"))
                {
                    return(CommandResult.NoPermission($"{cmd.Permission}.all"));
                }

                if (toggleVal.Value)
                {
                    component.AutoReload = true;
                    component.AutoRepair = true;
                    context.User.SendLocalizedMessage(Translations, "AUTO_RELOAD_ENABLED");
                    context.User.SendLocalizedMessage(Translations, "AUTO_REPAIR_ENABLED");
                }
                else
                {
                    component.AutoReload = false;
                    component.AutoRepair = false;
                    context.User.SendLocalizedMessage(Translations, "AUTO_RELOAD_DISABLED");
                    context.User.SendLocalizedMessage(Translations, "AUTO_REPAIR_DISABLED");
                }

                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 21
0
 /// <summary>
 /// Check If source has permission to use this warp
 /// </summary>
 /// <param name="source">Source that you want to check if is authorized</param>
 /// <returns>If source has permission to use this warp</returns>
 public bool CanBeUsedBy(ICommandSource source)
 {
     return(source.HasPermission($"essentials.warp.{Name.ToLowerInvariant()}") || !UEssentials.Config.Warp.PerWarpPermission);
 }
Exemplo n.º 22
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty || _validInputs.None(i => i.EqualsIgnoreCase(args[0].ToString())))
            {
                return(CommandResult.ShowUsage());
            }
            if (!src.HasPermission($"{Permission}.{args[0]}"))
            {
                return(CommandResult.NoPermission($"{Permission}.{args[0]}"));
            }
            switch (args[0].ToString().ToLower())
            {
            case "start": {
                if (args.Length < 4)
                {
                    return(CommandResult.InvalidArgs("/poll start [name] [duration] [description]"));
                }

                var pollName = args[1].ToString();

                lock (Polls) {
                    if (Polls.ContainsKey(pollName))
                    {
                        return(CommandResult.Lang("POLL_NAME_IN_USE"));
                    }
                }

                var pollDescription = args.Join(3);

                if (args[2].IsInt)
                {
                    var poll = new Poll(
                        pollName,
                        pollDescription,
                        args[2].ToInt
                        );

                    poll.Start();
                }
                else
                {
                    return(CommandResult.Lang("INVALID_NUMBER", args[2]));
                }
                break;
            }

            case "stop": {
                if (args.Length < 2)
                {
                    return(CommandResult.InvalidArgs("/poll stop [name]"));
                }

                var pollName = args[1].ToString();

                if (!PollExists(pollName, src))
                {
                    return(CommandResult.Empty());
                }

                lock (Polls) {
                    Polls[pollName].Stop();
                }
                break;
            }

            case "list": {
                lock (Polls) {
                    if (!Polls.Any())
                    {
                        return(CommandResult.Lang("POLL_NONE"));
                    }

                    EssLang.Send(src, "POLL_LIST");

                    foreach (var poll in Polls.Values)
                    {
                        EssLang.Send(src,
                                     "POLL_LIST_ENTRY",
                                     poll.Name,
                                     poll.Description,
                                     poll.YesVotes,
                                     poll.NoVotes
                                     );
                    }
                }
                break;
            }

            case "info": {
                lock (Polls) {
                    if (!Polls.Any())
                    {
                        return(CommandResult.Lang("POLL_NONE"));
                    }

                    if (args.Length < 2)
                    {
                        return(CommandResult.InvalidArgs("Use /poll info [poll_name]"));
                    }

                    var pollName = args[1].ToString();

                    if (!PollExists(pollName, src))
                    {
                        return(CommandResult.Empty());
                    }

                    var poll = Polls[pollName];

                    EssLang.Send(src, "POLL_INFO", pollName);

                    EssLang.Send(
                        src,
                        "POLL_LIST_ENTRY",
                        pollName,
                        poll.Description,
                        poll.YesVotes,
                        poll.NoVotes
                        );
                }
                break;
            }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 23
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.Length == 0 || (args.Length == 1 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            if (!args[0].IsInt)
            {
                return(CommandResult.LangError("INVALID_NUMBER", args[0]));
            }

            var amount = args[0].ToInt;

            if (amount > MAX_INPUT_VALUE || amount < -MAX_INPUT_VALUE)
            {
                return(CommandResult.LangError("NUMBER_BETWEEN", -MAX_INPUT_VALUE, MAX_INPUT_VALUE));
            }

            if (args.Length == 2)
            {
                // Everyone
                if (args[1].Equals("*"))
                {
                    if (!src.HasPermission($"{Permission}.all"))
                    {
                        return(CommandResult.NoPermission($"{Permission}.all"));
                    }

                    UServer.Players.ForEach(p => GiveExp(p, amount));

                    if (amount >= 0)
                    {
                        EssLang.Send(src, "EXPERIENCE_GIVEN", amount, EssLang.Translate("EVERYONE"));
                    }
                    else
                    {
                        EssLang.Send(src, "EXPERIENCE_TAKE", -amount, EssLang.Translate("EVERYONE"));
                    }
                }
                else if (!args[1].IsValidPlayerIdentifier)
                {
                    return(CommandResult.LangError("PLAYER_NOT_FOUND", args[1]));
                }
                else     // Other player
                {
                    if (!src.HasPermission($"{Permission}.other"))
                    {
                        return(CommandResult.NoPermission($"{Permission}.other"));
                    }

                    var player = args[1].ToPlayer;

                    if (amount >= 0)
                    {
                        EssLang.Send(src, "EXPERIENCE_GIVEN", amount, player.DisplayName);
                    }
                    else
                    {
                        EssLang.Send(src, "EXPERIENCE_TAKE", -amount, player.DisplayName);
                    }

                    GiveExp(player, amount);
                }
            }
            else
            {
                GiveExp(src.ToPlayer(), amount);
            }

            return(CommandResult.Success());
        }
Exemplo n.º 24
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.Length == 0 || (args.Length == 1 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            if (args.Length == 1)
            {
                var player = src.ToPlayer();

                if (!KitModule.Instance.KitManager.Contains(args[0].ToString()))
                {
                    return(CommandResult.Lang("KIT_NOT_EXIST", args[0]));
                }

                var kitName      = args[0].ToLowerString;
                var requestedKit = KitModule.Instance.KitManager.GetByName(kitName);

                if (!requestedKit.CanUse(player))
                {
                    return(CommandResult.Lang("KIT_NO_PERMISSION"));
                }

                var steamPlayerId = player.CSteamId.m_SteamID;
                var kitCost       = requestedKit.Cost;

                if (kitCost > 0 && UEssentials.EconomyProvider.IsPresent)
                {
                    var ecoProvider = UEssentials.EconomyProvider.Value;

                    if (!ecoProvider.Has(player, kitCost))
                    {
                        return(CommandResult.Lang("KIT_NO_MONEY", kitCost, ecoProvider.Currency));
                    }
                }

                if (!src.HasPermission("essentials.bypass.kitcooldown"))
                {
                    var globalCooldown = EssCore.Instance.Config.Kit.GlobalCooldown;

                    if (globalCooldown > 0)
                    {
                        if (GlobalCooldown.ContainsKey(steamPlayerId))
                        {
                            var remainingTime = DateTime.Now - GlobalCooldown[steamPlayerId];

                            if ((remainingTime.TotalSeconds + 1) > globalCooldown)
                            {
                                GlobalCooldown[steamPlayerId] = DateTime.Now;
                            }
                            else
                            {
                                return(CommandResult.Lang("KIT_GLOBAL_COOLDOWN",
                                                          TimeUtil.FormatSeconds((uint)(globalCooldown - remainingTime.TotalSeconds))));
                            }
                        }
                        else
                        {
                            GlobalCooldown.Add(steamPlayerId, DateTime.Now);
                        }
                    }
                    else
                    {
                        var kitCooldown = requestedKit.Cooldown;

                        if (!Cooldowns.ContainsKey(steamPlayerId))
                        {
                            Cooldowns.Add(steamPlayerId, new Dictionary <string, DateTime>());
                        }
                        else if (Cooldowns[steamPlayerId] == null)
                        {
                            Cooldowns[steamPlayerId] = new Dictionary <string, DateTime>();
                        }

                        if (Cooldowns[steamPlayerId].ContainsKey(kitName))
                        {
                            var remainingTime = DateTime.Now - Cooldowns[steamPlayerId][kitName];

                            if ((remainingTime.TotalSeconds + 1) > kitCooldown)
                            {
                                Cooldowns[steamPlayerId][kitName] = DateTime.Now;
                            }
                            else
                            {
                                return(CommandResult.Lang("KIT_COOLDOWN", TimeUtil.FormatSeconds(
                                                              (uint)(kitCooldown - remainingTime.TotalSeconds))));
                            }
                        }
                        else
                        {
                            Cooldowns[steamPlayerId].Add(kitName, DateTime.Now);
                        }
                    }
                }

                if (kitCost > 0)
                {
                    UEssentials.EconomyProvider.IfPresent(ec => {
                        ec.Withdraw(player, kitCost);
                        EssLang.Send(player, "KIT_PAID", kitCost, ec.Currency);
                    });
                }

                KitModule.Instance.KitManager.GetByName(kitName).GiveTo(player);
            }
            else if (args.Length == 2)
            {
                var kitName = args[0].ToLowerString;

                if (!src.HasPermission($"essentials.kit.{kitName}.other"))
                {
                    return(CommandResult.Empty());
                }

                if (!KitModule.Instance.KitManager.Contains(kitName))
                {
                    return(CommandResult.Lang("KIT_NOT_EXIST", kitName));
                }

                var kit = KitModule.Instance.KitManager.GetByName(kitName);

                if (args[1].Is("*"))
                {
                    UServer.Players.ForEach(kit.GiveTo);
                    EssLang.Send(src, "KIT_GIVEN_SENDER_ALL", kitName);
                }
                else
                {
                    var target = args[1].ToPlayer;

                    if (target == null)
                    {
                        return(CommandResult.Lang("PLAYER_NOT_FOUND", args[1]));
                    }

                    kit.GiveTo(target);
                    EssLang.Send(src, "KIT_GIVEN_SENDER", kitName, target);
                }
            }

            return(CommandResult.Success());
        }
Exemplo n.º 25
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty)
            {
                return(CommandResult.ShowUsage());
            }

            switch (args[0].ToLowerString)
            {
            case "savedata":
                if (!src.HasPermission($"{Permission}.savedata"))
                {
                    return(CommandResult.NoPermission($"{Permission}.savedata"));
                }
                UEssentials.ModuleManager.GetModule <KitModule>().IfPresent(m => {
                    m.KitManager.CooldownData.Save();
                });
                UEssentials.ModuleManager.GetModule <WarpModule>().IfPresent(m => {
                    m.WarpManager.Save();
                });
                break;

            case "reload":
                if (!src.HasPermission($"{Permission}.reload"))
                {
                    return(CommandResult.NoPermission($"{Permission}.reload"));
                }
                if (args.Length == 1)
                {
                    src.SendMessage("Reloading all...");
                    ReloadConfig();
                    ReloadKits();
                    ReloadLang();
                    R.Permissions.Reload();
                    src.SendMessage("Reload finished...");
                }
                else
                {
                    switch (args[1].ToLowerString)
                    {
                    case "kits":
                    case "kit":
                        src.SendMessage("Reloading kits...");
                        ReloadKits();
                        src.SendMessage("Reload finished...");
                        break;

                    case "config":
                        src.SendMessage("Reloading config...");
                        ReloadConfig();
                        src.SendMessage("Reload finished...");
                        break;

                    case "lang":
                        src.SendMessage("Reloading translations...");
                        ReloadLang();
                        src.SendMessage("Reload finished...");
                        break;

                    default:
                        return(CommandResult.InvalidArgs("Use /ess reload <kits/config/lang>"));
                    }
                }
                break;

            case "commands":
                if (src.IsConsole)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(_cachedCommands.Value);
                    Console.WriteLine("Use /ess help <command> to view help page.");
                }
                else if (args.Length != 2 || !args[1].IsInt)
                {
                    src.SendMessage("Use /ess commands [page]");
                }
                else
                {
                    var pages   = _ingameCommandPages.Value;
                    var pageArg = args[1].ToInt;

                    if (pageArg < 1 || pageArg > pages.Count - 1)
                    {
                        src.SendMessage($"Page must be between 1 and {pages.Count - 1}", Color.red);
                    }
                    else
                    {
                        pages[pageArg - 1].ForEach(s => {
                            src.SendMessage(s, Color.cyan);
                        });
                    }
                }
                break;

            case "info":
                if (src.IsConsole)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                src.SendMessage("Author:  leonardosc", Color.yellow);
                src.SendMessage("Github:  github.com/leonardosnt", Color.yellow);
                src.SendMessage("uEssentials Github:  github.com/uEssentials", Color.yellow);
                src.SendMessage("Version: " + EssCore.PLUGIN_VERSION, Color.yellow);
                break;

            case "help":
                if (src.IsConsole)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                if (args.Length == 1)
                {
                    src.SendMessage("Use /ess help <command>");
                }
                else
                {
                    var command = UEssentials.CommandManager.GetByName(args[1].ToString());

                    if (command == null)
                    {
                        src.SendMessage($"Command {args[1]} does not exists", Color.red);
                    }
                    else
                    {
                        src.SendMessage("Command: " + command.Name, Color.cyan);
                        src.SendMessage("  Usage Syntax: ", Color.cyan);
                        src.SendMessage("    - [arg] = required argument.", Color.cyan);
                        src.SendMessage("    - <arg> = optional argument.", Color.cyan);
                        src.SendMessage("    - | or / = means 'Or'.", Color.cyan);
                        src.SendMessage("  Description: " + command.Description, Color.cyan);
                        src.SendMessage("  Usage: /" + command.Name + " " + command.Usage, Color.cyan);
                        if (command.Aliases.Any())
                        {
                            src.SendMessage("  Aliases: " + string.Join(", ", command.Aliases), Color.cyan);
                        }
                    }
                }
                break;

            case "debug":
            case "dbg":
                if (!src.HasPermission($"{Permission}.debug"))
                {
                    return(CommandResult.NoPermission($"{Permission}.debug"));
                }

                if (args.Length < 3)
                {
                    return(CommandResult.InvalidArgs("Use /essentials debug [commands/tasks] [true/false]"));
                }

                if (!args[2].IsBool)
                {
                    return(CommandResult.Lang("INVALID_BOOLEAN", args[2]));
                }

                var flag = args[2].ToBool;
                switch (args[1].RawValue.ToLowerInvariant())
                {
                case "commands":
                    EssCore.Instance.DebugCommands = flag;
                    src.SendMessage($"DebugCommands set to {flag}");
                    break;

                case "tasks":
                    src.SendMessage($"DebugTasks set to {flag}");
                    EssCore.Instance.DebugTasks = flag;
                    break;

                default:
                    return(CommandResult.InvalidArgs($"Invalid option '{args[1]}'"));
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 26
0
 /// <summary>
 /// <returns> Check if <paramref name="src"/>> has permission for this kit. </returns>
 /// </summary>
 public bool CanUse(ICommandSource src)
 {
     return(src.HasPermission($"essentials.kit.{Name.ToLowerInvariant()}"));
 }
Exemplo n.º 27
0
 /// <summary>
 /// Check If source has permission to use this warp
 /// </summary>
 /// <param name="source">Source that you want to check if is authorized</param>
 /// <returns>If source has permission to use this warp</returns>
 public bool CanUse(ICommandSource source)
 {
     return(source.HasPermission($"essentials.warp.{Name.ToLowerInvariant()}"));
 }
Exemplo n.º 28
0
        private CommandResult ClearCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            if (args.IsEmpty)
            {
                return(CommandResult.ShowUsage());
            }

            /*
             *  TODO: Options
             *      -i = items
             *      -v = vehicles
             *      -z = zombies
             *      -b = barricades
             *      -s = structures
             *      -a = ALL
             *
             *  /clear -i -z -v = items, zombies, vehicles
             */

            var distance = -1;

            if (args.Length > 1)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                if (!args[1].IsInt)
                {
                    return(CommandResult.LangError("INVALID_NUMBER", args[1]));
                }

                if (args[1].ToInt < 1)
                {
                    return(CommandResult.LangError("NUMBER_BETWEEN", 1, int.MaxValue));
                }

                distance = args[1].ToInt;
            }

            switch (args[0].ToLowerString)
            {
            case "ev":
            case "emptyvehicles":
                if (!src.HasPermission(cmd.Permission + ".emptyvehicles"))
                {
                    return(CommandResult.LangError("COMMAND_NO_PERMISSION"));
                }

                src.SendMessage("This command is unstable and can cause bugs.", Color.yellow);

                var numRemoved = 0;
                //VehicleManager.vehicles
                //    .Where(v => v.passengers.All(p => p?.player == null)) // Check if it's has no passengers
                //    .Where(v =>
                //    {
                //        if (v.id == 186 || v.id == 187) return false; // Ignore trains; TODO: config blacklist for this?
                //        if (distance == -1) return true;

                //        return Vector3.Distance(v.transform.position, src.ToPlayer().Position) <= distance;
                //    })
                //    .Select(v => v.instanceID)
                //    .ToList()
                //    .ForEach(id =>
                //    {
                //        VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, id);
                //        numRemoved++;
                //    });
                //VehicleManager.vehicles
                //   .Where(v => v.passengers.All(p => p?.player == null)) // Check if it's has no passengers
                //   .Where(v =>
                //   {
                //       if (v.id == 186 || v.id == 187) return false; // Ignore trains; TODO: config blacklist for this?
                //        if (distance == -1) return true;

                //       return Vector3.Distance(v.transform.position, src.ToPlayer().Position) <= distance;
                //   })
                //   .Select(v => v.instanceID)
                //   .ToList()
                //   .ForEach(id =>
                //   {
                //       VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, id);
                //       numRemoved++;
                //   });
                for (byte i = 0; i < VehicleManager.vehicles.Count; i++)
                {
                    VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, VehicleManager.vehicles[i].instanceID);
                    numRemoved++;
                }
                for (byte i = 0; i < VehicleManager.vehicles.Count; i++)
                {
                    VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, VehicleManager.vehicles[i].instanceID);
                    numRemoved++;
                }
                //while (VehicleManager.vehicles.Count != 0)
                //{
                //    for (byte i = 0; i < VehicleManager.vehicles.Count; i++)
                //    {
                //        VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, VehicleManager.vehicles[i].instanceID);
                //        numRemoved++;
                //    }
                //}
                //for (byte i = (byte)(VehicleManager.vehicles.Count - 1); i >= 0 ; i--)
                //{
                //    VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, VehicleManager.vehicles[i].instanceID);
                //    numRemoved++;
                //}

                //InteractableVehicle[] vehicles = new InteractableVehicle[VehicleManager.vehicles.Count];
                //for (byte i = 0; i < VehicleManager.vehicles.Count; i++)
                //{
                //    vehicles[i] = VehicleManager.vehicles[i];
                //}
                //Console.WriteLine($"VehicleManager.vehicles.Count: {VehicleManager.vehicles.Count}");
                //int len = (VehicleManager.vehicles.Count - 1);
                //for (int index1 = len; index1 >= 0; index1--)
                //{
                //    Console.WriteLine($"index1: {index1}");
                //    //VehicleManager.vehicles.Remove(VehicleManager.vehicles[index1]);
                //    UnityEngine.Object.Destroy((UnityEngine.Object)VehicleManager.vehicles[index1].gameObject);
                //}
                //Console.WriteLine($"VehicleManager.vehicles.Count: {VehicleManager.vehicles.Count}");
                //VehicleManager.respawnVehicleIndex = (ushort)0;
                //VehicleManager.vehicles.Clear();

                //for (byte i = 1; i < vehicles.Length - 1; i++)
                //{
                //    if (vehicles[i].passengers != null || vehicles[i].passengers.Length != 0 || vehicles[i].id == 186 || vehicles[i].id == 187)
                //        continue;
                //    VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, vehicles[i].instanceID);
                //}

                EssLang.Send(src, "CLEAR_EMPTY_VEHICLES", numRemoved);
                break;

            case "i":
            case "items":
                if (!src.HasPermission(cmd.Permission + ".items"))
                {
                    return(CommandResult.LangError("COMMAND_NO_PERMISSION"));
                }

                ItemManager.askClearAllItems();
                EssLang.Send(src, "CLEAR_ITEMS");
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 29
0
        private CommandResult ClearCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            if (args.IsEmpty)
            {
                return(CommandResult.ShowUsage());
            }

            /*
             *  TODO: Options
             *      -i = items
             *      -v = vehicles
             *      -z = zombies
             *      -b = barricades
             *      -s = structures
             *      -a = ALL
             *
             *  /clear -i -z -v = items, zombies, vehicles
             */

            var distance = -1;

            if (args.Length > 1)
            {
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                if (!args[1].IsInt)
                {
                    return(CommandResult.Lang("INVALID_NUMBER", args[1]));
                }

                if (args[1].ToInt < 1)
                {
                    return(CommandResult.Lang("NUMBER_BETWEEN", 1, int.MaxValue));
                }

                distance = args[1].ToInt;
            }

            switch (args[0].ToLowerString)
            {
            case "ev":
            case "emptyvehicles":
                if (!src.HasPermission(cmd.Permission + ".emptyvehicles"))
                {
                    return(CommandResult.Lang("COMMAND_NO_PERMISSION"));
                }

                src.SendMessage("This command is unstable and can cause bugs.", Color.red);

                var toRemove = new List <uint>();
                UWorld.Vehicles
                .Where(v => v.passengers.All(p => p?.player == null))
                .Where(v => {
                    if (distance == -1)
                    {
                        return(true);
                    }
                    return(Vector3.Distance(v.transform.position, src.ToPlayer().Position) <= distance);
                })
                .Select(v => v.instanceID)
                .ForEach(toRemove.Add);

                toRemove.ForEach(id => {
                    VehicleManager.instance.channel.send("tellVehicleDestroy", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, id);
                });

                EssLang.Send(src, "CLEAR_EMPTY_VEHICLES", toRemove.Count);
                break;

            /*case "v":
             * case "vehicle":
             *  return CommandResult.Generic("This option is currently disabled.");
             *
             *  if (!src.HasPermission(cmd.Permission + ".vehicles")) {
             *      return CommandResult.Lang("COMMAND_NO_PERMISSION");
             *  }
             *
             *  UWorld.Vehicles.ForEach(v => {
             *      for (byte i = 0; i < v.passengers.Length; i++) {
             *          if (v.passengers[i] == null ||
             *              v.passengers[i].player == null) continue;
             *
             *          Vector3 point;
             *          byte angle;
             *
             *          v.getExit(i, out point, out angle);
             *          VehicleManager.sendExitVehicle(v, i, point, angle, true);
             *      }
             *  });
             *
             *  VehicleManager.askVehicleDestroyAll();
             *  EssLang.Send(src, "CLEAR_VEHICLES");
             *  break;*/

            case "i":
            case "items":
                if (!src.HasPermission(cmd.Permission + ".items"))
                {
                    return(CommandResult.Lang("COMMAND_NO_PERMISSION"));
                }

                ItemManager.askClearAllItems();
                EssLang.Send(src, "CLEAR_ITEMS");
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 30
0
        public override void OnExecute( ICommandSource source, ICommandArgs parameters )
        {
            if ( parameters.Length == 0 || ( parameters.Length == 1 && source.IsConsole ) )
            {
                source.SendMessage( source.IsAdmin ? 
                    UsageMessage : "Use /kit [kit_name]" );
            }
            else if ( parameters.Length == 1 )
            {
                var player = source.ToPlayer();

                if ( EssProvider.KitManager.Contains( parameters[0].ToString() ) )
                {
                    var kitName = parameters[0].ToLowerString;
                    var requestedKit = EssProvider.KitManager.GetByName(kitName);

                    if ( !requestedKit.CanUse( player ) )
                    {
                        EssLang.KIT_NO_PERMISSION.SendTo( player );
                    }
                    else
                    {
                        var steamPlayerId    = player.CSteamId.m_SteamID;
                        var kitCooldown      = requestedKit.Cooldown;

                        if ( !source.HasPermission("essentials.kits.bypasscooldown") )
                        {
                            if ( !Cooldowns.ContainsKey( steamPlayerId ) )
                            {
                                Cooldowns.Add( steamPlayerId, new Dictionary<string, DateTime>() );
                            }
                            if ( Cooldowns[steamPlayerId].ContainsKey( kitName ) )
                            {
                                var remainingTime = DateTime.Now - Cooldowns[steamPlayerId][kitName];
                                if ( remainingTime.TotalSeconds > kitCooldown )
                                {
                                    Console.WriteLine( "3" );
                                    Cooldowns[steamPlayerId][kitName] = DateTime.Now;
                                }
                                else
                                {
                                    EssLang.KIT_COOLDOWN.SendTo( source, FormatSeconds(
                                        (uint) (kitCooldown - remainingTime.TotalSeconds)
                                    ));
                                    return;
                                }
                            }
                            else
                            {
                                Cooldowns[steamPlayerId].Add( kitName, DateTime.Now );
                            }
                        }
                        EssProvider.KitManager.GetByName( kitName ).GiveTo( player );
                    }
                }
                else
                {
                    EssLang.KIT_NOT_EXIST.SendTo( player, parameters[0] );
                }
            }
            else if ( parameters.Length == 2 )
            {
                var kitName = parameters[0].ToString();

                if ( !source.HasPermission( $"essentials.kit.{kitName}.other" ) )
                {
                    return;
                }

                var target = parameters[1].ToPlayer;

                if ( target == null )
                {
                    EssLang.PLAYER_NOT_FOUND.SendTo( source, parameters[1] );
                }
                else if ( EssProvider.KitManager.Contains( kitName ) )
                {
                    EssProvider.KitManager.GetByName(kitName).GiveTo( target );
                    EssLang.KIT_GIVEN_SENDER.SendTo( source, kitName, target );
                }
                else
                {
                    EssLang.KIT_NOT_EXIST.SendTo( source, kitName );
                }
            }
        }
Exemplo n.º 31
0
        private CommandResult VehicleCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            switch (args.Length)
            {
            case 1:
                if (src.IsConsole)
                {
                    return(CommandResult.ShowUsage());
                }

                var optAsset = VehicleUtil.GetVehicle(args[0].ToString());

                if (optAsset.IsAbsent)
                {
                    return(CommandResult.Lang("INVALID_VEHICLE_ID", args[0]));
                }

                var id = optAsset.Value.id;

                if (UEssentials.Config.VehicleBlacklist.Contains(id) &&
                    !src.HasPermission("essentials.bypass.blacklist.vehicle"))
                {
                    return(CommandResult.Lang("BLACKLISTED_VEHICLE", $"{optAsset.Value.vehicleName} ({id})"));
                }

                VehicleTool.giveVehicle(src.ToPlayer().UnturnedPlayer, id);

                EssLang.Send(src, "RECEIVED_VEHICLE", optAsset.Value.vehicleName, id);
                break;

            case 2:
                if (!src.HasPermission($"{cmd.Permission}.other"))
                {
                    return(CommandResult.Lang("COMMAND_NO_PERMISSION"));
                }

                optAsset = VehicleUtil.GetVehicle(args[1].ToString());

                if (optAsset.IsAbsent)
                {
                    return(CommandResult.Lang("INVALID_VEHICLE_ID", args[1]));
                }

                var vehAsset = optAsset.Value;

                if (args[0].Equals("*"))
                {
                    UServer.Players.ForEach(p => {
                        VehicleTool.giveVehicle(p.UnturnedPlayer, vehAsset.id);
                    });

                    EssLang.Send(src, "GIVEN_VEHICLE_ALL", vehAsset.vehicleName, vehAsset.id);
                }
                else if (!args[0].IsValidPlayerIdentifier)
                {
                    return(CommandResult.Lang("PLAYER_NOT_FOUND", args[0]));
                }
                else
                {
                    var target = args[0].ToPlayer;
                    VehicleTool.giveVehicle(target.UnturnedPlayer, vehAsset.id);

                    EssLang.Send(src, "GIVEN_VEHICLE", vehAsset.vehicleName, vehAsset.id, target.DisplayName);
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 32
0
        CommandResult ItemFeaturesCommand(ICommandSource src, ICommandArgs args, ICommand cmd)
        {
            if (args.Length != 2)
            {
                return(CommandResult.ShowUsage());
            }

            bool toggleValue;

            if (args[1].IsOneOf(new[] { "1", "on", "true" }))
            {
                toggleValue = true;
            }
            else if (args[1].IsOneOf(new[] { "0", "off", "false" }))
            {
                toggleValue = false;
            }
            else
            {
                return(CommandResult.ShowUsage());
            }

            var player    = src.ToPlayer();
            var component = player.GetComponent <ItemFeatures>() ?? player.AddComponent <ItemFeatures>();

            switch (args[0].ToLowerString)
            {
            case "autoreload":
                if (!src.HasPermission($"{cmd.Permission}.autoreload"))
                {
                    return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                }
                if (toggleValue)
                {
                    component.AutoReload = true;
                    EssLang.AUTO_RELOAD_ENABLED.SendTo(src);
                }
                else
                {
                    component.AutoReload = false;
                    EssLang.AUTO_RELOAD_DISABLED.SendTo(src);
                }
                break;

            case "autorepair":
                if (!src.HasPermission($"{cmd.Permission}.autorepair"))
                {
                    return(CommandResult.Lang(EssLang.COMMAND_NO_PERMISSION));
                }
                if (toggleValue)
                {
                    component.AutoRepair = true;
                    EssLang.AUTO_REPAIR_ENABLED.SendTo(src);
                }
                else
                {
                    component.AutoRepair = false;
                    EssLang.AUTO_REPAIR_DISABLED.SendTo(src);
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            return(CommandResult.Success());
        }
Exemplo n.º 33
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty && src.IsConsole)
            {
                return(CommandResult.ShowUsage());
            }

            if (!args.IsEmpty && !src.HasPermission(Permission + ".other"))
            {
                return(CommandResult.NoPermission($"{Permission}.other"));
            }

            var player = args.Length > 0 ? args[0].ToPlayer : src.ToPlayer();

            if (player == null)
            {
                return(CommandResult.Lang("PLAYER_NOT_FOUND", args[0]));
            }

            var playerInv = player.Inventory;

            // "Remove "models" of items from player "body""
            player.Channel.send("tellSlot", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER,
                                (byte)0, (byte)0, EMPTY_BYTE_ARRAY);
            player.Channel.send("tellSlot", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER,
                                (byte)1, (byte)0, EMPTY_BYTE_ARRAY);

            // Remove items
            for (byte page = 0; page < 8; page++)
            {
                var count = playerInv.getItemCount(page);

                for (byte index = 0; index < count; index++)
                {
                    playerInv.removeItem(page, 0);
                }
            }

            // Remove clothes

            // Remove unequipped cloths
            System.Action removeUnequipped = () => {
                for (byte i = 0; i < playerInv.getItemCount(2); i++)   //TODO isso é necessario?
                {
                    playerInv.removeItem(2, 0);
                }
            };

            // Unequip & remove from inventory
            player.UnturnedPlayer.clothing.askWearBackpack(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            player.UnturnedPlayer.clothing.askWearGlasses(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            player.UnturnedPlayer.clothing.askWearHat(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            player.UnturnedPlayer.clothing.askWearPants(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            player.UnturnedPlayer.clothing.askWearMask(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            player.UnturnedPlayer.clothing.askWearShirt(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            player.UnturnedPlayer.clothing.askWearVest(0, 0, EMPTY_BYTE_ARRAY, true);
            removeUnequipped();

            EssLang.Send(player, "INVENTORY_CLEAN");

            return(CommandResult.Success());
        }
Exemplo n.º 34
0
 /// <summary>
 /// <returns> If determinated player has permission for this kit </returns>
 /// </summary>
 public bool CanUse(ICommandSource player)
 {
     return(player.HasPermission($"essentials.kit.{Name}"));
 }