当前位置: 首页>>代码示例>>C#>>正文


C# TSPlayer.SendErrorMessage方法代码示例

本文整理汇总了C#中TShockAPI.TSPlayer.SendErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TSPlayer.SendErrorMessage方法的具体用法?C# TSPlayer.SendErrorMessage怎么用?C# TSPlayer.SendErrorMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TShockAPI.TSPlayer的用法示例。


在下文中一共展示了TSPlayer.SendErrorMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckPermissions

        public bool CheckPermissions(TSPlayer player)
        {
            if (player == null) return false;

              var sPly = SignCommands.ScPlayers[player.Index];
              if (sPly == null) {
            TShock.Log.ConsoleError("An error occured while executing a sign command."
                         + "TSPlayer {0} at index {1} does not exist as an ScPlayer",
            player.Name, player.Index);
            player.SendErrorMessage("An error occured. Please try again");
            return false;
              }

              if (freeAccess) return true;

              if (!string.IsNullOrEmpty(requiredPermission))
            if (player.Group.HasPermission(requiredPermission))
              return true;
            else {
              if (sPly.AlertPermissionCooldown == 0) {
            player.SendErrorMessage("You do not have the required permission to use this sign.");
            sPly.AlertPermissionCooldown = 3;
              }
              return false;
            }

              if (commands.Values.All(command => command.CanRun(player)))
            return true;

              if (sPly.AlertPermissionCooldown == 0) {
            player.SendErrorMessage("You do not have access to the commands on this sign.");
            sPly.AlertPermissionCooldown = 3;
              }
              return false;
        }
开发者ID:Stealownz,项目名称:Essentials-SignCommands-1,代码行数:35,代码来源:scSign.cs

示例2: InvalidNewBountyUsage

 public static void InvalidNewBountyUsage(TSPlayer player)
 {
     player.SendErrorMessage("Invalid usage! Proper usages:");
     player.SendErrorMessage("/nbty <bounty name> <target>");
     player.SendErrorMessage("/nbty <-setrewards> [SEconomy currency amount]");
     player.SendErrorMessage("/nbty <-confirm/-cancel>");
 }
开发者ID:bippity,项目名称:BountyHunt,代码行数:7,代码来源:Utils.cs

示例3: ReloadConfig

        public void ReloadConfig(bool console = false, TSPlayer receiver = null)
        {
            var configPath = Path.Combine(TShock.SavePath, "BossConfig.json");
            (AutoBoss.config = Config.Read(configPath)).Write(configPath);

            var invalidRegions = new List<string>();

            foreach (var arena in AutoBoss.config.BossArenas.Where(a => a.Value))
            {
                var region = TShock.Regions.GetRegionByName(arena.Key);
                if (region == null)
                {
                    invalidRegions.Add(arena.Key);
                    continue;
                }
                if (!AutoBoss.ActiveArenas.Contains(region)) AutoBoss.ActiveArenas.Add(region);
            }

            arenaCount = AutoBoss.ActiveArenas.Count;

            if (invalidRegions.Count == 0)
            {
                AutoBoss.Timers = new BossTimer();
                return;
            }
            TShock.Log.ConsoleError("Invalid regions encountered: " + string.Join(", ", invalidRegions));

            if (!console && receiver != null)
                receiver.SendErrorMessage("Invalid regions encountered: " + string.Join(", ", invalidRegions));
        }
开发者ID:WhiteXZ,项目名称:AutoBoss,代码行数:30,代码来源:AbsTools.cs

示例4: Error

 public static void Error(TSPlayer to, string message)
 {
     if (to is TSServerPlayer)
     {
         to.SendErrorMessage(message);
         return;
     }
     to.SendMessage(message, Color.OrangeRed);
 }
开发者ID:Brunban2,项目名称:Essentials-SignCommands,代码行数:9,代码来源:Send.cs

示例5: MatchPlayerByName

        public static bool MatchPlayerByName(
            string name, out TSPlayer matchedPlayer, TSPlayer messagesReceiver = null
            )
        {
            matchedPlayer = null;
              List<TSPlayer> matchedPlayers = TShock.Utils.FindPlayer(name);
              if (matchedPlayers.Count == 0) {
            if (messagesReceiver != null)
              messagesReceiver.SendErrorMessage(string.Format("Could not match any players for \"{0}\".", name));

            return false;
              } if (matchedPlayers.Count > 1) {
            if (messagesReceiver != null) {
              messagesReceiver.SendErrorMessage(
            "More than one player matched! Matches: " + string.Join(", ", matchedPlayers.Select(p => p.Name))
              );
            }
            return false;
              }

              matchedPlayer = matchedPlayers[0];
              return true;
        }
开发者ID:Tygra,项目名称:PluginCommonLibrary,代码行数:23,代码来源:TShockEx.cs

示例6: EndTrivia

        public void EndTrivia(TSPlayer ts)
        {
            Reset();
            TSPlayer.All.SendInfoMessage(string.Format("{0} answered the trivia correctly! the answer{1} {2}", ts.Name, CurrentQandA.Answers.Count > 1 ? "s were" : " was", string.Join(", ", CurrentQandA.Answers)));
            if (Config.DisplayWrongAnswers && WrongAnswers.Count > 0)
                TSPlayer.All.SendErrorMessage(string.Format("Wrong answers were: {0}", string.Join(", ", WrongAnswers)));
            WrongAnswers.Clear();

            if (SEconomyPlugin.Instance != null)
            {
                IBankAccount Server = SEconomyPlugin.Instance.GetBankAccount(TSServerPlayer.Server.UserID);
                IBankAccount Player = SEconomyPlugin.Instance.GetBankAccount(ts.Index);
                Server.TransferToAsync(Player, Config.CurrencyAmount, BankAccountTransferOptions.AnnounceToReceiver, "answering the trivia question correctly", "Answered trivia question");
            }
            else
                ts.SendErrorMessage("[Trivia] Transaction failed because SEconomy is disabled!");
        }
开发者ID:CrazyLegsSteph,项目名称:Trivia,代码行数:17,代码来源:TriviaManager.cs

示例7: Read

        public Config Read(TSPlayer ts = null)
        {
            if (!File.Exists(ConfigPath))
                write();

            try
            {
                Config res = JsonConvert.DeserializeObject<Config>(File.ReadAllText(ConfigPath));
                return res;
            }
            catch (Exception ex)
            {
                if (ts == null)
                {
                    Console.WriteLine("[Clans] an error has occurred while reading the config file! See below for more info:");
                    Console.WriteLine(ex.ToString());
                }
                else
                    ts.SendErrorMessage("[Clans] There was an error reloading the config file, check the console for more info!");
                return this;
            }
        }
开发者ID:MichaelMan57,项目名称:Clans,代码行数:22,代码来源:Config.cs

示例8: Read

        public Config Read(string path, TSPlayer ts = null)
        {
            if (!File.Exists(path))
            {
                Write(path);
            }

            try
            {
                Config res = JsonConvert.DeserializeObject<Config>(File.ReadAllText(path));
                return res;
            }
            catch (System.Exception e)
            {
                if (ts != null)
                {
                    ts.SendErrorMessage("[ChatChannels] Config reading failed. See logs for more details.");
                }
                TShock.Log.ConsoleError($"[ChatChannels] Config reading failed: {e}");
                return null;
            }
        }
开发者ID:Jewsus,项目名称:ChatChannels,代码行数:22,代码来源:Config.cs

示例9: processAccept

 internal void processAccept(TSPlayer player, OfferObj obj)
 {
     //deactivate offer in db
     main.Database.Query("UPDATE storeoffer SET Active = @0 WHERE ID = @1", 0, obj.ID);
     //remove trade and create offer inplace of trade
     if (obj.Type != -1)
     {
         TradeObj obj2 = TradeObjByID(obj.Type);
         if (obj2 == null)
         {
             player.SendErrorMessage("Error: Major Database Desync has occured - Transaction ID: {0} does not exist!", obj.Type);
             return;
         }
         main.Database.Query("UPDATE storetrade SET TradeID = @0 WHERE ID = @1 AND Active = @2",0 ,obj2.ID, 1);
         main.Database.Query("INSERT INTO storeoffer(ID, User, ItemID, Stack, TradeID, Active) VALUES(@0,@1,@2,@3,@4,@5)", offerID, obj.User, obj2.ItemID, obj2.Stack, -1, 1);
         offerObj.Add(new OfferObj(offerID, obj.User, obj2.ItemID, obj2.Stack, -1, 1));
         offerID += 1;
         obj2.Active = 0;
     }
     obj.Active = 0;
 }
开发者ID:Tygra,项目名称:Shop,代码行数:21,代码来源:TradeData.cs

示例10: getItem

 private Item getItem(TSPlayer player, string itemNameOrId, int stack)
 {
     Item item = new Item();
     List<Item> matchedItems = TShock.Utils.GetItemByIdOrName(itemNameOrId);
     if (matchedItems == null || matchedItems.Count == 0)
     {
         player.SendErrorMessage("Error: Incorrect item name or ID, please use quotes if the item has a space in it!");
         player.SendErrorMessage("Error: You have entered: {0}", itemNameOrId);
         return null;
     }
     else if (matchedItems.Count > 1)
     {
         TShock.Utils.SendMultipleMatchError(player, matchedItems.Select(i => i.name));
         return null;
     }
     else
     {
         item = matchedItems[0];
     }
     if (stack > item.maxStack)
     {
         player.SendErrorMessage("Error: Stacks entered is greater then maximum stack size");
         return null;
     }
     //all checks passed return true;
     return item;
 }
开发者ID:Tygra,项目名称:Shop,代码行数:27,代码来源:Shop.cs

示例11: freeSlots

 private Boolean freeSlots(TSPlayer player, Item item, int itemAmount)
 {
     if (player.InventorySlotAvailable || (item.name.Contains("Coin") && item.type != 905) || item.type == 58 || item.type == 184)
     {
         if (player.GiveItemCheck(item.type, item.name, item.width, item.height, itemAmount))
         {
             return true;
         }
         player.SendErrorMessage("Error: An unknown error has occured - this code should not be reachable!");
         return false;
     }
     else
     {
         player.SendErrorMessage("Error: Your inventory seems to be full!");
         return false;
     }
 }
开发者ID:Tygra,项目名称:Shop,代码行数:17,代码来源:Shop.cs

示例12: HandleChestPlace

        public virtual bool HandleChestPlace(TSPlayer player, DPoint location, int storageType, int storageStyle)
        {
            if (this.IsDisposed)
            return false;

              ushort tileToPlace = TileID.Containers;
              bool isDresser = (storageType == 2);
              if (isDresser)
            tileToPlace = TileID.Dressers;

              try {
            this.ChestManager.PlaceChest(tileToPlace, storageStyle, location);
              } catch (LimitEnforcementException ex) {
            player.SendTileSquare(location.X, location.Y, 2);
            player.SendErrorMessage("The limit of maximum possible chests has been reached. Please report this to a server administrator.");
            this.PluginTrace.WriteLineWarning($"Chest limit of {Main.chest.Length + this.Config.MaxProtectorChests - 1} has been reached!");
              }

              if (this.Config.AutoProtectedTiles[tileToPlace])
            this.TryCreateAutoProtection(player, location);

              return true;
        }
开发者ID:CoderCow,项目名称:Protector-Plugin,代码行数:23,代码来源:UserInteractionHandler.cs

示例13: TryRemoveProtection

        private bool TryRemoveProtection(TSPlayer player, DPoint tileLocation, bool sendFailureMessages = true)
        {
            if (!player.IsLoggedIn) {
            if (sendFailureMessages)
              player.SendErrorMessage("You have to be logged in to alter protections.");

            return false;
              }

              try {
            this.ProtectionManager.RemoveProtection(player, tileLocation);

            BlockType blockType = (BlockType)TerrariaUtils.Tiles[tileLocation].type;
            player.SendSuccessMessage(
              string.Format("This {0} is not protected anymore.", TerrariaUtils.Tiles.GetBlockTypeName(blockType))
            );

            return true;
              } catch (InvalidBlockTypeException ex) {
            if (sendFailureMessages) {
              string messageFormat;
              if (TerrariaUtils.Tiles.IsSolidBlockType(ex.BlockType, true))
            messageFormat = "Deprotecting {0} blocks is not allowed.";
              else
            messageFormat = "Deprotecting {0} objects is not allowed.";

              player.SendErrorMessage(string.Format(messageFormat, TerrariaUtils.Tiles.GetBlockTypeName(ex.BlockType)));
            }

            return false;
              } catch (NoProtectionException) {
            BlockType blockType = (BlockType)TerrariaUtils.Tiles[tileLocation].type;
            if (sendFailureMessages) {
              player.SendErrorMessage(string.Format(
            "This {0} is not protected by Protector at all.", TerrariaUtils.Tiles.GetBlockTypeName(blockType)
              ));
            }

            return false;
              } catch (TileProtectedException) {
            BlockType blockType = (BlockType)TerrariaUtils.Tiles[tileLocation].type;
            player.SendErrorMessage(string.Format(
              "This {0} is owned by someone else, you can't deprotect it.", TerrariaUtils.Tiles.GetBlockTypeName(blockType)
            ));

            return false;
              }
        }
开发者ID:CoderCow,项目名称:Protector-Plugin,代码行数:48,代码来源:UserInteractionHandler.cs

示例14: ParseSpawnMob

        private void ParseSpawnMob(IEnumerable<string> args, TSPlayer player)
        {
            //>sm "blue slime":10 zombie:100
            var list = new List<string>(args);
            list.RemoveAt(0);
            foreach (var obj in list)
            {
                try
                {
                    var mob = obj.Split(':')[0];
                    var num = obj.Split(':')[1];

                    int spawnCount;
                    if (!int.TryParse(num, out spawnCount))
                        continue;

                    _mobs.Add(mob, spawnCount);
                }
                catch
                {
                    player.SendErrorMessage("Invalid naming format. Format: \"mobname:spawncount\"");
                }
            }
        }
开发者ID:Denwey,项目名称:SignCommands,代码行数:24,代码来源:scSign.cs

示例15: HandleCommand

        public static bool HandleCommand(TSPlayer player, string text)
        {
            string cmdText = text.Remove(0, 1);
            string cmdPrefix = text[0].ToString();
            bool silent = false;

            if (cmdPrefix == SilentSpecifier)
                silent = true;

            var args = ParseParameters(cmdText);
            if (args.Count < 1)
                return false;

            string cmdName = args[0].ToLower();
            args.RemoveAt(0);

            IEnumerable<Command> cmds = ChatCommands.FindAll(c => c.HasAlias(cmdName));

            if (Hooks.PlayerHooks.OnPlayerCommand(player, cmdName, cmdText, args, ref cmds, cmdPrefix))
                return true;

            if (cmds.Count() == 0)
            {
                if (player.AwaitingResponse.ContainsKey(cmdName))
                {
                    Action<CommandArgs> call = player.AwaitingResponse[cmdName];
                    player.AwaitingResponse.Remove(cmdName);
                    call(new CommandArgs(cmdText, player, args));
                    return true;
                }
                player.SendErrorMessage("Invalid command entered. Type {0}help for a list of valid commands.", Specifier);
                return true;
            }
            foreach (Command cmd in cmds)
            {
                if (!cmd.CanRun(player))
                {
                    TShock.Utils.SendLogs(string.Format("{0} tried to execute {1}{2}.", player.Name, Specifier, cmdText), Color.PaleVioletRed, player);
                    player.SendErrorMessage("You do not have access to this command.");
                }
                else if (!cmd.AllowServer && !player.RealPlayer)
                {
                    player.SendErrorMessage("You must use this command in-game.");
                }
                else
                {
                    if (cmd.DoLog)
                        TShock.Utils.SendLogs(string.Format("{0} executed: {1}{2}.", player.Name, silent ? SilentSpecifier : Specifier, cmdText), Color.PaleVioletRed, player);
                    cmd.Run(cmdText, silent, player, args);
                }
            }
            return true;
        }
开发者ID:CXUtk,项目名称:TShock,代码行数:53,代码来源:Commands.cs


注:本文中的TShockAPI.TSPlayer.SendErrorMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。