• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MCForge.Player类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MCForge.Player的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Player类属于MCForge命名空间,在下文中一共展示了Player类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Blockchange1

        public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
        {
            p.ClearBlockchange();
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            cpos.message = cpos.message.Replace("'", "\\'");

            DataTable Messages = MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            Messages.Dispose();

            if (Messages.Rows.Count == 0)
            {
                MySQL.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
            }
            else
            {
                MySQL.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
            }

            Player.SendMessage(p, "Message block placed.");
            p.level.Blockchange(p, x, y, z, cpos.type);
            p.SendBlockchange(x, y, z, cpos.type);

            if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:Jack13122,项目名称:MCForge-Vanilla,代码行数:25,代码来源:CmdMessageBlock.cs


示例2: Help

 public override void Help(Player p)
 {
     Player.SendMessage(p, "/setrank <player> <rank> <yay> - Sets or returns a players rank.");
     Player.SendMessage(p, "You may use /rank as a shortcut");
     Player.SendMessage(p, "Valid Ranks are: " + Group.concatList(true, true));
     Player.SendMessage(p, "<yay> is a celebratory message");
 }
开发者ID:Techjar,项目名称:MCaznowl-Lava,代码行数:7,代码来源:CmdSetRank.cs


示例3: Use

        public override void Use(Player p, string message)
        {
            Level lvl = null;

            if (p == null)
            {
                Player.SendMessage(p, "You have to be ingame to do that!");
                return;
            }

            if (message == "") { Help(p); return; } else { lvl = Level.Find(message); }

            if (lvl == null)
            {
                Player.SendMessage(p, "Level not found!");
                return;
            }

            if (lvl.name.Split('.')[1].ToLower() == p.name.ToLower())
            {
                Player.SendMessage(p, "You cannot dislike your own map!");
                return;
            }

            lvl.like(p.name, true);
            Player.SendMessage(p, "Added map to your dislike list");
        }
开发者ID:Cazzar,项目名称:MCaznowl-Build,代码行数:27,代码来源:CmdDislike.cs


示例4: Use

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }

            Group foundGroup = Group.Find(message);
            if (foundGroup == null)
            {
                Player.SendMessage(p, "Could not find group");
                return;
            }

            string totalList = "";
            foreach (string s in foundGroup.playerList.All())
            {
                totalList += ", " + s;
            }

            if (totalList == "")
            {
                Player.SendMessage(p, "No one has the rank of " + foundGroup.color + foundGroup.name);
                return;
            }

            Player.SendMessage(p, "People with the rank of " + foundGroup.color + foundGroup.name + ":");
            Player.SendMessage(p, totalList.Remove(0, 2));
        }
开发者ID:EricKilla,项目名称:mcforge,代码行数:26,代码来源:CmdViewRanks.cs


示例5: BlankMessage

 //Yes this does work
 //Trust me...I'm a doctor
 public void BlankMessage(Player p)
 {
     byte[] buffer = new byte[65];
     Player.StringFormat(" ", 64).CopyTo(buffer, 1);
     p.SendRaw(13, buffer);
     buffer = null;
 }
开发者ID:Pinguin895,项目名称:MCaznowl-Build,代码行数:9,代码来源:CmdPlayerCLS.cs


示例6: Use

        public override void Use(Player p, string message)
        {
            string alltext = File.ReadAllText("text/tempranks.txt");
            if (alltext.Contains(message) == false)
            {
                Player.SendMessage(p, "&cPlayer &a" + message + "&c Has not been assigned a temporary rank. Cannot unnasign.");
                goto end;
            }
            string alltempranks = "";
               Player who = Player.Find(message);
               foreach (string line in File.ReadAllLines("text/tempranks.txt"))
               {
               if (line.Contains(message))
               {
                   string group = line.Split(' ')[2];
                   Group oldgroup = Group.findPlayerGroup(who.name);
                   Group newgroup = Group.Find(group);
                   Command.all.Find("setrank").Use(null, who.name + " " + newgroup.name);
                   Player.SendMessage(p, "&eTemporary rank of &a" + message + "&e has been unassigned");
                   Player.SendMessage(who, "&eYour temporary rank has been unassigned");
               }
               if (!line.Contains(message))
               {
                   alltempranks = alltempranks + line + "\r\n";
               }
               }
               File.WriteAllText("text/tempranks.txt", alltempranks);

            end:
            System.Threading.Thread.Sleep(0);
        }
开发者ID:Nerketur,项目名称:MCForge-Vanilla,代码行数:31,代码来源:CmdDelTempRank.cs


示例7: Use

        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                Player.SendMessage(p, "You have to be ingame to do that!");
                return;
            }

            if (message == "") { Help(p); return; }

            string mapnumber = null;
            if (message.Split(' ').Length == 2)
                mapnumber = message.Split(' ')[1];
            message = message.Split(' ')[0];

            string path = "levels/" + p.name;
            if (!string.IsNullOrEmpty(mapnumber))
                path += "." + mapnumber;
            path += ".lvl";
            string dest = "levels/submit/" + message + "." + p.name + ".lvl";

            if (System.IO.File.Exists(path))
            {
                if (!System.IO.Directory.Exists("levels/submit"))
                    System.IO.Directory.CreateDirectory("levels/submit"); //if not then make it
                System.IO.File.Copy(path, dest);
                Player.SendMessage(p, "Level submitted as " + message);
            }
            else
            {
                Player.SendMessage(p, "Level not found!");
            }
        }
开发者ID:Cazzar,项目名称:MCaznowl-Build,代码行数:33,代码来源:CmdSubmit.cs


示例8: Help

 public void Help(Player p)
 {
     p.SendMessage("/calculate <num1> <method> <num2> - Evaluates two number using a method.");
     p.SendMessage("Available methods for two numbers: /, x, -, +, ^(Exponent),");
     p.SendMessage("/calculate <num1> <method> - Evaluates a number using a complex method.");
     p.SendMessage("Available methods for one number: square, root, pi, cube");
 }
开发者ID:hirsty,项目名称:MCForge-Vanilla-1,代码行数:7,代码来源:CmdCalculate.cs


示例9: Use

        public override void Use(Player p, string message)
        {
            if (message == "")
            {
                p.whisper = !p.whisper; p.whisperTo = "";
                if (p.whisper) Player.SendMessage(p, "All messages sent will now auto-whisper");
                else Player.SendMessage(p, "Whisper chat turned off");
            }
            else
            {
                Player who = Player.Find(message);
                if (who == null) { p.whisperTo = ""; p.whisper = false; Player.SendMessage(p, "Could not find player."); return; }
                if (who.hidden)
                {
                    if (p.hidden == false || who.group.Permission > p.group.Permission)
                    {
                        Player.SendMessage(p, "Could not find player.");
                        return;
                    }
                }

                p.whisper = true;
                p.whisperTo = who.name;
                Player.SendMessage(p, "Auto-whisper enabled.  All messages will now be sent to " + who.name + ".");
            }
        }
开发者ID:EricKilla,项目名称:MCForge-Vanilla,代码行数:26,代码来源:CmdWhisper.cs


示例10: Use

 public override void Use(Player p, string message)
 {
     if (message == "" || message.Split(' ').Length > 2) { Help(p); return; }
     Player who = Player.Find(message);
     if (who == null)
     {
         if (Server.muted.Contains(message))
         {
             Server.muted.Remove(message);
             Player.GlobalMessage(message + Server.DefaultColor + " is not online but they have been &bun-muted");
             Server.muted.Save("muted.txt");
             return;
         }
         Player.SendMessage(p, "The player entered is not online.");
         return;
     }
     if (who.muted)
     {
         who.muted = false;
         Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " has been &bun-muted", false);
     }
     else
     {
         if (p != null)
         {
             if (who != p) if (who.group.Permission > p.group.Permission) { Player.SendMessage(p, "Cannot mute someone of a higher rank."); return; }
         }
         who.muted = true;
         Player.GlobalChat(who, who.color + who.name + Server.DefaultColor + " has been &8muted", false);
         Server.muted.Save("muted.txt");
     }
 }
开发者ID:Nerketur,项目名称:MCForge-Vanilla,代码行数:32,代码来源:CmdMute.cs


示例11: Register

 /// <summary>
 /// Register this event
 /// </summary>
 /// <param name="method">This is the delegate that will get called when this event occurs</param>
 /// <param name="priority">The priority (imporantce) of this call</param>
 /// <param name="plugin">The plugin object that is registering the event</param>
 public static void Register(Player.OnAFK method, Priority priority, Plugin plugin)
 {
     if (Find(plugin) != null)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnPlayerAFKEvent(method, priority, plugin));
     Organize();
 }
开发者ID:Cazzar,项目名称:MCaznowl-Build,代码行数:13,代码来源:OnPlayerAFKEvent.cs


示例12: Use

        public override void Use(Player p, string message)
        {
            string newsFile = "text/news.txt";
            if (!File.Exists(newsFile) || (File.Exists(newsFile) && File.ReadAllLines(newsFile).Length == -1))
            {
                using (var SW = new StreamWriter(newsFile))
                {
                    SW.WriteLine("News have not been created. Put News in '" + newsFile + "'.");
                }
                return;
            }
            string[] strArray = File.ReadAllLines(newsFile);
            if (message == "")
            {
                foreach (string t in strArray)
                {
                    Player.SendMessage(p, t);
                }
            }
            else
            {
                string[] split = message.Split(' ');
                if (split[0] == "all") { if ((int)p.group.Permission < CommandOtherPerms.GetPerm(this)) { Player.SendMessage(p, "You must be at least " + Group.findPermInt(CommandOtherPerms.GetPerm(this)).name + " to send this to all players."); return; } for (int k = 0; k < strArray.Length; k++) { Player.GlobalMessage(strArray[k]); } return; }
                Player player = Player.Find(split[0]);
                if (player == null) { Player.SendMessage(p, "Could not find player \"" + split[0] + "\"!"); return; }
                foreach (string t in strArray)
                {
                    Player.SendMessage(player, t);
                }
                Player.SendMessage(p, "The News were successfully sent to " + player.name + ".");

            }
        }
开发者ID:ProLoks,项目名称:MCForge-Vanilla-1,代码行数:33,代码来源:CmdNews.cs


示例13: Help

        public override void Help(Player p)
        {
            p.SendMessage(c.lime + "To purchase an item, type /buy [item number] [amount] (except for item 5)");
            p.SendMessage(c.blue + "1. " + Server.DefaultColor + "Title - 250 " + Server.moneys);
            p.SendMessage(c.blue + "2. " + Server.DefaultColor + "Title Color - 150 " + Server.moneys);
            p.SendMessage(c.blue + "3. " + Server.DefaultColor + "Lives - 1 " + Server.moneys + " per life");
            p.SendMessage(c.blue + "4. " + Server.DefaultColor + "Sponges - 10 " + Server.moneys + " per sponge");
            p.SendMessage(c.blue + "5. " + Server.DefaultColor + "Sponge Pack - 55 " + Server.moneys + " for 8 sponges");
                if (p.group.name.ToLower() == "guest" && p.money >= 50)
                    p.SendMessage(c.blue + "6. " + Server.DefaultColor + "Rank Up - 50 (builder)" + Server.moneys);
                else if (p.group.name.ToLower() == "builder" && p.money >= 150)
                    p.SendMessage(c.blue + "6. " + Server.DefaultColor + "Rank Up - 150 (advbuilder)" + Server.moneys);
                else if (p.group.name.ToLower() == "advbuilder" && p.money >= 300)
                    p.SendMessage(c.blue + "6. " + Server.DefaultColor + "Rank Up - 300 (masterbuilder" + Server.moneys);
                else if (p.group.name.ToLower() == "guest" && p.money <= 50)
                    p.SendMessage("You do not have enough " + Server.moneys + " (50)");
                else if (p.group.name.ToLower() == "builder" && p.money <= 150)
                    p.SendMessage("You do not have enough " + Server.moneys + " (150)");
                else if (p.group.name.ToLower() == "advbuilder" && p.money <= 300)
                    p.SendMessage("You do not have enough " + Server.moneys + " (300)");
                else
                    p.SendMessage("Out of stock!");

            p.SendMessage(c.blue + "7. " + Server.DefaultColor + "Login Message - 200 " + Server.moneys);
            p.SendMessage(c.blue + "8. " + Server.DefaultColor + "Logout Message - 200 " + Server.moneys);
            return;
        }
开发者ID:Techjar,项目名称:MCaznowl-Lava,代码行数:27,代码来源:CmdStore.cs


示例14: Use

        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; }

            Player who = Player.Find(message.Split(' ')[0]);

            string whoTo, fromname;
            if (who != null) whoTo = who.name;
            else whoTo = message.Split(' ')[0];
            if (p != null) fromname = p.name;
            else fromname = "Console";

            message = message.Substring(message.IndexOf(' ') + 1);

            //DB
            if (message.Length > 255 && Server.useMySQL) { Player.SendMessage(p, "Message was too long. The text below has been trimmed."); Player.SendMessage(p, message.Substring(256)); message = message.Remove(256); }
                Database.executeQuery("CREATE TABLE if not exists `Inbox" + whoTo + "` (PlayerFrom CHAR(20), TimeSent DATETIME, Contents VARCHAR(255));");
                if (!Server.useMySQL)
                    Server.s.Log(message.Replace("'", "\\'"));
                Database.executeQuery("INSERT INTO `Inbox" + whoTo + "` (PlayerFrom, TimeSent, Contents) VALUES ('" + fromname + "', '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', '" + message.Replace("'", (Server.useMySQL ? "\\'" : "''")) + "')");
            //DB

            Player.SendMessage(p, "Message sent to &5" + whoTo + ".");
            if (who != null) who.SendMessage("Message recieved from &5" + fromname + Server.DefaultColor + ".");
        }
开发者ID:Nerketur,项目名称:MCForge-Vanilla,代码行数:25,代码来源:CmdSend.cs


示例15: Use

        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            Player who = Player.Find(message.Split(' ')[0]);
            if (who == null) { Player.SendMessage(p, "Could not find player specified."); return; }
            if (message.Split(' ').Length > 1)
                message = message.Substring(message.IndexOf(' ') + 1);
            else
                if (p == null && Server.devs.Contains(who.name.ToLower()) == false) message = "You were kicked by an IRC controller!"; else message = "You were kicked by " + p.name + "!";

            if (p != null)
                if (who == p)
                {
                    Player.SendMessage(p, "You cannot kick yourself!");
                    return;
                }
                else if (who.group.Permission >= p.group.Permission && p != null)
                {
                    Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " tried to kick " + who.color + who.name + " but failed.", false);
                    return;
                }
            if (Server.devs.Contains(who.name.ToLower()))
            {
                if (!Server.devs.Contains(p.name.ToLower()))
                {
                    Player.SendMessage(p, "You can't kick a MCForge Developer!");
                    Player.GlobalChat(p, p.color + p.name + Server.DefaultColor + " tried to kick " + who.color + who.name + Server.DefaultColor + " but failed, because " + who.color + who.name + Server.DefaultColor + " is a developer", false);
                    return;
            }
            }
            who.Kick(message);
        }
开发者ID:Cazzar,项目名称:MCaznowl-Build,代码行数:32,代码来源:CmdKick.cs


示例16: Use

 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         Help(p);
     }
     else
     {
         Player.SendMessage(p, "This server's name is &b" + Server.name + Server.DefaultColor + ".");
         Player.SendMessage(p, "There are currently " + Player.number + " players on this server");
         Player.SendMessage(p, "This server currently has $banned people that are &8banned" + Server.DefaultColor + ".");
         Player.SendMessage(p, "This server currently has " + Server.levels.Count + " levels loaded.");
         Player.SendMessage(p, "This server's currency is: " + Server.moneys);
         Player.SendMessage(p, "This server runs on &bMCForge" + Server.DefaultColor + ", which is based on &bMCLawl" + Server.DefaultColor + ".");
         Player.SendMessage(p, "This server's version: &a" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
         Command.all.Find("devs").Use(p, "");
         TimeSpan up = DateTime.Now - Server.timeOnline;
         string upTime = "Time online: &b";
         if (up.Days == 1) upTime += up.Days + " day, ";
         else if (up.Days > 0) upTime += up.Days + " days, ";
         if (up.Hours == 1) upTime += up.Hours + " hour, ";
         else if (up.Days > 0 || up.Hours > 0) upTime += up.Hours + " hours, ";
         if (up.Minutes == 1) upTime += up.Minutes + " minute and ";
         else if (up.Hours > 0 || up.Days > 0 || up.Minutes > 0) upTime += up.Minutes + " minutes and ";
         if (up.Seconds == 1) upTime += up.Seconds + " second";
         else upTime += up.Seconds + " seconds";
         Player.SendMessage(p, upTime);
         if (Server.updateTimer.Interval > 1000) Player.SendMessage(p, "This server is currently in &5Low Lag" + Server.DefaultColor + " mode.");
     }
 }
开发者ID:Jack13122,项目名称:MCForge-Vanilla,代码行数:30,代码来源:CmdInfo.cs


示例17: Help

 public override void Help(Player p)
 {
     Player.SendMessage(p, "/reveal <name> - Reveals the map for <name>.");
     Player.SendMessage(p, "/reveal all - Reveals for all in the map");
     Player.SendMessage(p, "/reveal all <map> - Reveals for all in <map>");
     Player.SendMessage(p, "Will reload the map for anyone. (incl. banned)");
 }
开发者ID:ProLoks,项目名称:MCForge-Vanilla-1,代码行数:7,代码来源:CmdReveal.cs


示例18: Use

 public override void Use(Player p, string message)
 {
     string endresult = "";
     foreach (string line in File.ReadAllLines("ranks/banned.txt"))
     {
         if (Ban.Isbanned(line))
         {
             endresult = endresult + "&a" + line + Server.DefaultColor + ", ";
         }
         else
         {
             endresult = endresult + "&c" + line + Server.DefaultColor + ", ";
         }
     }
     if (endresult == "")
     {
         Player.SendMessage(p, "There are no players banned");
     }
     else
     {
         endresult = endresult.Remove(endresult.Length - 2, 2);
         endresult = "&9Banned players: " + Server.DefaultColor + endresult + Server.DefaultColor + ".";
         Player.SendMessage(p, endresult);
     }
 }
开发者ID:ProLoks,项目名称:MCForge-Vanilla-1,代码行数:25,代码来源:CmdBanlist.cs


示例19: CaptureFlag

 public static void CaptureFlag(Player p, CTFTeam team)
 {
     if (!gameOn) { return; }
     team.hasFlag = null;
     ReturnFlag(team, false);
     p.carryingFlag = false;
     Player.GlobalMessage("&f- " + p.color + p.name + "&S captured the " + team.color + team.name + "&S flag!");
     Server.s.Log(p.name + " captured the " + team.name + " flag!");
     p.Reward(captureFlagReward);
     p.team.points++;
     UpdateScore();
     p.captureStreak++;
     p.captureCount++;
     if (team.capturedFlag == p)
     {
         Player.GlobalMessage("&f- " + p.color + p.name + "&6 is on a streak of &5" + p.captureStreak + "&6!");
     }
     else
     {
         p.captureStreak = 1;
     }
     team.capturedFlag = p;
     if (p.team.points >= scoreLimit)
     {
         GameEnd(p.team);
     }
 }
开发者ID:Goodlyay,项目名称:MCForge-Vanilla-Redux,代码行数:27,代码来源:CTF.cs


示例20: Use

        public override void Use(Player p, string message)
        {
            if (message == "" || message.IndexOf(' ') == -1) { Help(p); return; }

            string foundBlah = Command.all.FindShort(message.Split(' ')[0]);

            Command foundCmd;
            if (foundBlah == "") foundCmd = Command.all.Find(message.Split(' ')[0]);
            else foundCmd = Command.all.Find(foundBlah);

            if (foundCmd == null) { Player.SendMessage(p, "Could not find command entered"); return; }
            if (p != null && !p.group.CanExecute(foundCmd)) { Player.SendMessage(p, "This command is higher than your rank."); return; }

            LevelPermission newPerm = Level.PermissionFromName(message.Split(' ')[1]);
            if (newPerm == LevelPermission.Null) { Player.SendMessage(p, "Could not find rank specified"); return; }
            if (p != null && newPerm > p.group.Permission) { Player.SendMessage(p, "Cannot set to a rank higher than yourself."); return; }

            GrpCommands.rankAllowance newCmd = GrpCommands.allowedCommands.Find(rA => rA.commandName == foundCmd.name);
            newCmd.lowestRank = newPerm;
            GrpCommands.allowedCommands[GrpCommands.allowedCommands.FindIndex(rA => rA.commandName == foundCmd.name)] = newCmd;

            GrpCommands.Save(GrpCommands.allowedCommands);
            GrpCommands.fillRanks();
            Player.GlobalMessage("&d" + foundCmd.name + Server.DefaultColor + "'s permission was changed to " + Level.PermissionToName(newPerm));
            //if (p == null) ; // this is useless?
            //{
                Player.SendMessage(p, foundCmd.name + "'s permission was changed to " + Level.PermissionToName(newPerm));
                return;
            //}
        }
开发者ID:Nerketur,项目名称:MCForge-Vanilla,代码行数:30,代码来源:CmdCmdSet.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MCForge.Plugin类代码示例发布时间:2022-05-26
下一篇:
C# MCForge.Level类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap