本文整理汇总了C#中TShockAPI.CommandArgs类的典型用法代码示例。如果您正苦于以下问题:C# CommandArgs类的具体用法?C# CommandArgs怎么用?C# CommandArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandArgs类属于TShockAPI命名空间,在下文中一共展示了CommandArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: freeze
public void freeze(CommandArgs args)
{
if (args.Player != null)
{
if (args.Parameters.Count != 1)
{
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /freeze [player]");
return;
}
var foundplr = TShock.Utils.FindPlayer(args.Parameters[0]);
if (foundplr.Count == 0)
{
args.Player.SendErrorMessage("Invalid player!");
return;
}
else if (foundplr.Count > 1)
{
args.Player.SendErrorMessage(string.Format("More than one ({0}) player matched!", args.Parameters.Count));
return;
}
var plr = foundplr[0];
if (FrozenPlayers.FindIndex(p => p.Index == plr.Index) < 0)
{
FrozenPlayers.Add(new FrozenPlayer(plr.Index));
TSPlayer.All.SendInfoMessage(string.Format("{0} froze {1}", args.Player.Name, plr.Name));
return;
}
else
{
FrozenPlayers.RemoveAll(p => p.Index == plr.Index);
TSPlayer.All.SendInfoMessage(string.Format("{0} unfroze {1}", args.Player.Name, plr.Name));
return;
}
}
}
开发者ID:CrazyLegsSteph,项目名称:Freeze,代码行数:35,代码来源:main.cs
示例2: SetPasswordChest
private static void SetPasswordChest(CommandArgs args)
{
if (ChestControl.Players[args.Player.Index].GetState() == SettingState.PasswordSetting ||
ChestControl.Players[args.Player.Index].GetState() == SettingState.PasswordUnSetting)
{
ChestControl.Players[args.Player.Index].SetState(SettingState.None);
args.Player.SendMessage("You are no longer selecting a chest.", Color.BlueViolet);
}
else
{
if (args.Parameters.Count != 1)
{
args.Player.SendMessage(
"You must enter password! Or use \"remove\" as password to remove password.", Color.Red);
return;
}
if (args.Parameters[0] == "del" || args.Parameters[0] == "delete" || args.Parameters[0] == "rm" ||
args.Parameters[0] == "remove" || args.Parameters[0] == "unlock" || args.Parameters[0] == "unset")
{
ChestControl.Players[args.Player.Index].SetState(SettingState.PasswordUnSetting);
args.Player.SendMessage("Open a chest to remove password.", Color.BlueViolet);
}
else
{
ChestControl.Players[args.Player.Index].PasswordForChest = args.Parameters[0];
ChestControl.Players[args.Player.Index].SetState(SettingState.PasswordSetting);
args.Player.SendMessage("Open a chest to set password.", Color.BlueViolet);
}
}
}
开发者ID:HySpeed,项目名称:Chest-Control,代码行数:30,代码来源:Commands.cs
示例3: PlayerInfo
// PlayerInfo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public static void PlayerInfo( CommandArgs args )
{
if ( args.Parameters.Count <= 1 )
{
args.Player.SendMessage( "Invalid syntax. Proper Syntax: /pinfo <player> [ Life | Buffs ]", Color.Red );
} // if
else if ( args.Parameters.Count > 1 )
{
TShockAPI.TSPlayer player;
string action;
player = findPlayer( args, args.Parameters[0] );
if ( player != null )
{
action = args.Parameters[1].ToUpper();
if ( action.StartsWith( "L" ) ) { showLifeMana( args, player ); } // if
else if ( action.StartsWith( "B" ) ) { showBuffs( args, player ); } // if
else
{
args.Player.SendMessage( string.Format( "Invalid action: {0}. Proper Syntax: /pinfo <player> [ Life | Buffs ]", action ), Color.Red );
} // else
} // if
} // else if
}
开发者ID:HySpeed,项目名称:PlayerInfo,代码行数:27,代码来源:Commands.cs
示例4: LoadQuestData
public static void LoadQuestData(CommandArgs args)
{
QTools.LoadPlayers();
QTools.LoadQuests();
QTools.LoadRegions();
args.Player.SendMessage("Successfully reloaded QuestSystem data.", Color.Yellow);
}
开发者ID:Ijwu,项目名称:TShock-Quest-System,代码行数:7,代码来源:QCommands.cs
示例5: Execute
public override void Execute(CommandArgs args)
{
if (args.Parameters.Count == 3)
{
string boxName = args.Parameters[1];
if(IsOwner(args.Player,boxman.GetBoxByName(boxName)))
{
if (args.Parameters[2].ToLower() == "true")
{
if (boxman.SetBoxProtected(boxName, true))
ChatHandler.communicate(ChatHandler.CustomSuccess, args.Player, "Box " + boxName + " protected");
else
ChatHandler.communicate(ChatHandler.BoxNotFound, args.Player, boxName);
}
else if (args.Parameters[2].ToLower() == "false")
{
if (boxman.SetBoxProtected(boxName, false))
ChatHandler.communicate(ChatHandler.CustomWarning, args.Player, "Box " + boxName + " unprotected");
else
ChatHandler.communicate(ChatHandler.BoxNotFound, args.Player, boxName);
}
else
ChatHandler.communicate(ChatHandler.InvalidSyntax, args.Player, "protect [name] [true/false]");
}
else
ChatHandler.communicate(ChatHandler.NoPermission, args.Player, boxName);
}
else
ChatHandler.communicate(ChatHandler.InvalidSyntax, args.Player, "protect [name] [true/false]");
}
开发者ID:mawize,项目名称:Boxes,代码行数:30,代码来源:Protect.cs
示例6: CmdMore
private static void CmdMore(CommandArgs args)
{
if (args.Parameters.Count > 0 && args.Parameters[0].ToLower() == "all") {
var full = true;
foreach (var item in args.TPlayer.inventory) {
if (item == null || item.stack == 0) continue;
var amtToAdd = item.maxStack - item.stack;
if (item.stack > 0 && amtToAdd > 0 && !item.name.ToLower().Contains("coin")) {
full = false;
args.Player.GiveItem(item.type, item.name, item.width, item.height, amtToAdd);
}
}
if (!full)
args.Player.SendSuccessMessage("Filled all your items.");
else
args.Player.SendErrorMessage("Your inventory is already full.");
}
else {
var holding = args.Player.TPlayer.inventory[args.TPlayer.selectedItem];
var amtToAdd = holding.maxStack - holding.stack;
if (holding.stack > 0 && amtToAdd > 0)
args.Player.GiveItem(holding.type, holding.name, holding.width, holding.height, amtToAdd);
if (amtToAdd == 0)
args.Player.SendErrorMessage("Your {0} is already full.", holding.name);
else
args.Player.SendSuccessMessage("Filled up your {0}.", holding.name);
}
}
开发者ID:Stealownz,项目名称:Essentials-SignCommands-1,代码行数:28,代码来源:esMain.cs
示例7: DebugConfiguration
public static void DebugConfiguration(CommandArgs args)
{
int ply = args.PlayerID;
var commands = TShock.commandList;
if (TShock.players[ply].IsAdmin())
commands = TShock.admincommandList;
Tools.SendMessage(ply, "TShock Config:");
string lineOne = "";
lineOne += "KickCheater : " + ConfigurationManager.kickCheater + ", ";
lineOne += "BanCheater : " + ConfigurationManager.banCheater + ", ";
lineOne += "KickGriefer : " + ConfigurationManager.kickGriefer + ", ";
lineOne += "BanGriefer : " + ConfigurationManager.banGriefer;
Tools.SendMessage(ply, lineOne, new float[] { 255f, 255f, 0f });
string lineTwo = "";
lineTwo += "BanTnt : " + ConfigurationManager.banTnt + ", ";
lineTwo += "KickTnt : " + ConfigurationManager.kickTnt + ", ";
lineTwo += "BanBoom : " + ConfigurationManager.banBoom + ", ";
lineTwo += "KickBoom : " + ConfigurationManager.kickBoom;
Tools.SendMessage(ply, lineTwo, new float[] { 255f, 255f, 0f });
string lineThree = "";
lineThree += "InvMultiplier : " + ConfigurationManager.invasionMultiplier + ", ";
lineThree += "ProtectS : " + ConfigurationManager.spawnProtect + ", ";
lineThree += "ProtectR : " + ConfigurationManager.spawnProtectRadius + ", ";
lineThree += "DMS : " + ConfigurationManager.defaultMaxSpawns + ", ";
lineThree += "SpawnRate: " + ConfigurationManager.defaultSpawnRate + ", ";
Tools.SendMessage(ply, lineThree, new float[] { 255f, 255f, 0f});
}
开发者ID:ARTdrakon,项目名称:TShock,代码行数:27,代码来源:Commands.cs
示例8: DayregionCommand
public static void DayregionCommand(CommandArgs args)
{
if (args.Parameters.Count > 1)
{
var region = TShock.Regions.GetRegionByName(args.Parameters[1]);
if (region != null && region.Name != "")
{
if (args.Parameters[0] == "add" && DayRegions_Add(region.Name))
{
RegionList.Add(region);
args.Player.SendMessage(String.Format("Region '{0}' added to Day Region list", region.Name), Color.BurlyWood);
return;
}
else if (args.Parameters[0] == "del")
{
DayRegions_Delete(region);
args.Player.SendMessage(String.Format("Region '{0}' deleted from Day Region list", region.Name), Color.BurlyWood);
return;
}
return;
}
else
{
args.Player.SendMessage(String.Format("Region '{0}' not found", args.Parameters[1]), Color.Red);
return;
}
}
args.Player.SendMessage("Syntax: /dayregion [add | del] \"region name\"", Color.Red);
}
开发者ID:Enerdy,项目名称:DayRegions,代码行数:29,代码来源:DayRegions.cs
示例9: AddTile
private void AddTile(CommandArgs args)
{
if( args.Parameters.Count < 1 )
{
args.Player.SendMessage("You must specify a tile to add.", Color.Red);
return;
}
string tile = args.Parameters[0];
int id;
if( !int.TryParse(tile, out id) )
{
args.Player.SendMessage(String.Format("Tile id '{0}' is not a valid number.", id), Color.Red);
return;
}
String query = "INSERT INTO BlacklistedTiles (ID, Type) VALUES (@0,@1);";
if(db.Query(query, id,0) != 1)
{
TShock.Log.ConsoleError("Inserting into the database has failed!");
args.Player.SendMessage(String.Format("Inserting into the database has failed!", id), Color.Red);
}
else
{
args.Player.SendMessage(String.Format("Successfully banned {0}",id), Color.Red);
blacklistedTiles.Add(id);
}
}
开发者ID:Olink,项目名称:Invincible-Tiles,代码行数:28,代码来源:InvincibleTiles.cs
示例10: CancelSet
private static void CancelSet(CommandArgs args)
{
SignControl.Players[args.Player.Index].PasswordForSign = "";
SignControl.Players[args.Player.Index].WarpForSign = "";
SignControl.Players[args.Player.Index].SetState(SettingState.None);
args.Player.SendMessage(Messages.stopSelecting, Color.BlueViolet);
}
开发者ID:bippity,项目名称:Sign-Control,代码行数:7,代码来源:Commands.cs
示例11: Ghost
public static void Ghost(CommandArgs args)
{
int tempTeam = args.Player.TPlayer.team;
args.Player.TPlayer.team = 0;
NetMessage.SendData(45, -1, -1, "", args.Player.Index);
args.Player.TPlayer.team = tempTeam;
if (!isGhost[args.Player.Index])
{
args.Player.SendMessage("Ghost Mode activated!");
}
else
{
args.Player.SendMessage("Ghost Mode deactivated!");
}
isGhost[args.Player.Index] = !isGhost[args.Player.Index];
args.Player.TPlayer.position.X = 0;
args.Player.TPlayer.position.Y = 0;
cansend = true;
NetMessage.SendData(13, -1, -1, "", args.Player.Index);
cansend = false;
}
开发者ID:DaGamesta,项目名称:TShock-Plugins,代码行数:25,代码来源:PluginMain.cs
示例12: CancelVote
public static void CancelVote(CommandArgs args)
{
if (C3Mod.VoteRunning)
{
C3Mod.VoteRunning = false;
C3Tools.BroadcastMessageToGametype("", args.Player.Name + " stopped the current vote!", Color.DarkCyan);
switch (C3Mod.VoteType)
{
case "ctf":
{
foreach (C3Player player in C3Mod.C3Players)
{
if(player.GameType == "ctf")
{
player.GameType = "";
player.Team = 0;
}
}
break;
}
}
}
else
args.Player.SendMessage("No vote running!", Color.DarkCyan);
}
开发者ID:RogerPaladin,项目名称:TwitchysPlugins,代码行数:26,代码来源:C3Commands.cs
示例13: ChanName
private void ChanName(CommandArgs args)
{
if (args.Player == null) return;
if (args.Parameters.Count < 2)
{
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /chname [player] [newname]");
return;
}
var foundplr = TShock.Utils.FindPlayer(args.Parameters[0]);
if (foundplr.Count == 0)
{
args.Player.SendErrorMessage("Invalid player!");
return;
}
else if (foundplr.Count > 1)
{
args.Player.SendErrorMessage(string.Format("More than one ({0}) player matched!", args.Parameters.Count));
return;
}
string newName = args.Parameters[1];
bool hidden = args.Parameters.Count > 2;
var plr = foundplr[0];
string oldName = plr.TPlayer.name;
if (!hidden) TShock.Utils.Broadcast(string.Format("{0} has changed {1}'s name to {2}.", args.Player.Name, oldName, newName), Color.DeepPink);
else args.Player.SendMessage(string.Format("You have secretly changed {0}'s name to {1}.", oldName, newName), Color.DeepPink);
plr.TPlayer.name = newName;
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, -1, plr.TPlayer.name, args.Player.Index, 0, 0, 0, 0);
oldNames[newName] = oldName;
}
开发者ID:Patrikkk,项目名称:ChangeName,代码行数:33,代码来源:ChangeName.cs
示例14: SilentTime
private void SilentTime(CommandArgs args)
{
if (args.Parameters.Count == 0)
{
double time = Main.time / 3600.0;
time += 4.5;
if (!Main.dayTime)
time += 15.0;
time = time % 24.0;
args.Player.SendInfoMessage("The current time is {0}:{1:D2}.", (int)Math.Floor(time), (int)Math.Round((time % 1.0) * 60.0));
return;
}
switch (args.Parameters[0].ToLower())
{
case "day":
TSPlayer.Server.SetTime(true, 0.0);
break;
case "night":
TSPlayer.Server.SetTime(false, 0.0);
break;
case "noon":
TSPlayer.Server.SetTime(true, 27000.0);
break;
case "midnight":
TSPlayer.Server.SetTime(false, 16200.0);
break;
default:
string[] array = args.Parameters[0].Split(':');
if (array.Length != 2)
{
args.Player.SendErrorMessage("Invalid time string! Proper format: hh:mm, in 24-hour time.");
return;
}
int hours;
int minutes;
if (!int.TryParse(array[0], out hours) || hours < 0 || hours > 23
|| !int.TryParse(array[1], out minutes) || minutes < 0 || minutes > 59)
{
args.Player.SendErrorMessage("Invalid time string! Proper format: hh:mm, in 24-hour time.");
return;
}
decimal time = hours + (minutes / 60.0m);
time -= 4.50m;
if (time < 0.00m)
time += 24.00m;
if (time >= 15.00m)
{
TSPlayer.Server.SetTime(false, (double)((time - 15.00m) * 3600.0m));
}
else
{
TSPlayer.Server.SetTime(true, (double)(time * 3600.0m));
}
break;
}
}
开发者ID:srcanseco,项目名称:STime,代码行数:60,代码来源:STime.cs
示例15: Check
private void Check(CommandArgs args)
{
if (args.Parameters.Count < 1)
{
args.Player.SendErrorMessage("Invalid syntax! proper syntax: /lo <username>");
return;
}
string name = string.Join(" ", args.Parameters);
TShockAPI.DB.User DbUser = new UserManager(TShock.DB).GetUserByName(name);
if (DbUser == null)
{
args.Player.SendErrorMessage("Player not found! (Doesn't exist? Also Case Sensitivity is important)");
return;
}
foreach (TSPlayer ts in TShock.Players)
{
if (ts == null)
continue;
if (ts.Name == DbUser.Name)
{
args.Player.SendErrorMessage("This player is still online!");
return;
}
}
TimeSpan t = DateTime.UtcNow.Subtract(DateTime.Parse(DbUser.LastAccessed));
args.Player.SendInfoMessage(string.Format("{0} was last seen online {1} ago", DbUser.Name, GetTimeFormat(t)));
}
开发者ID:CrazyLegsSteph,项目名称:LastOnline,代码行数:28,代码来源:main.cs
示例16: AutoKill
public static void AutoKill(CommandArgs args)
{
if (args.Parameters.Count > 0)
{
var plyList = TShockAPI.TShock.Utils.FindPlayer(args.Parameters[0]);
if (plyList.Count > 1)
TShock.Utils.SendMultipleMatchError(args.Player, plyList.Select(p => p.Name));
else if (plyList.Count < 1)
args.Player.SendErrorMessage(plyList.Count.ToString() + " players matched.");
else
if (!plyList[0].Group.HasPermission("mac.kill") || args.Player == plyList[0])
{
var player = Utils.GetPlayers(plyList[0].Index);
player.autoKill = !player.autoKill;
args.Player.SendSuccessMessage(string.Format("{0}abled auto-killed on {1}",
player.autoKill ? "En" : "Dis", player.name));
player.TSPlayer.SendInfoMessage(string.Format("You are {0} being auto-killed",
player.autoKill ? "now" : "no longer"));
if (player.autoKill)
{
if (!updateTimers.autoKillTimer.Enabled)
updateTimers.autoKillTimer.Enabled = true;
}
}
else
args.Player.SendErrorMessage("You cannot autokill this player!");
}
else
args.Player.SendErrorMessage("Invalid syntax: {0}autokill <playerName>", (args.Silent ? TShock.Config.CommandSilentSpecifier : TShock.Config.CommandSpecifier));
}
开发者ID:Zaicon,项目名称:MoreAdminCommandsV3,代码行数:35,代码来源:Commands.cs
示例17: ChangeLock
public static void ChangeLock(CommandArgs args)
{
if (args.Parameters.Count > 0)
{
string houseName = "";
for (int i = 0; i < args.Parameters.Count; i++)
{
if (houseName == "")
{
houseName = args.Parameters[i];
}
else
{
houseName = houseName + " " + args.Parameters[i];
}
}
if (HTools.OwnsHouse(args.Player.UserID.ToString(), houseName))
{
bool locked = HouseTools.ChangeLock(houseName);
if (locked)
args.Player.SendMessage("House: " + houseName + " locked", Color.Yellow);
else
args.Player.SendMessage("House: " + houseName + " unlocked", Color.Yellow);
}
else
args.Player.SendMessage("You do not own House: " + houseName, Color.Yellow);
}
else
args.Player.SendMessage("Invalid syntax! Proper syntax: /changelock [house]", Color.Red);
}
开发者ID:RogerPaladin,项目名称:TwitchysPlugins,代码行数:33,代码来源:HCommands.cs
示例18: IrcInfo
// IrcInfo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public static void IrcInfo( CommandArgs args )
{
if ( args.Parameters.Count <= 1 )
{
TerrariaIRC.sendIRCMessage( "Invalid syntax. Proper Syntax: /iinfo <player> [ Life | Buffs ]" );
} // if
else if ( args.Parameters.Count > 1 )
{
TShockAPI.TSPlayer player;
string playerName, action;
playerName = args.Parameters[0];
player = findPlayer( playerName );
if ( player != null )
{
action = args.Parameters[1].ToUpper();
if ( action.StartsWith( "L" ) ) { showLifeMana( player ); } // if
else if ( action.StartsWith( "B" ) ) { showBuffs( player ); } // if
else
{
TerrariaIRC.sendIRCMessage( string.Format( "Invalid action: {0}. Proper Syntax: /iinfo <player> [ Life | Buffs ]", action ) );
} // else
} // if
} // else if
}
开发者ID:HySpeed,项目名称:TerrariaPlugins,代码行数:28,代码来源:Commands.cs
示例19: BoxesQuota
public void BoxesQuota(CommandArgs args)
{
string cmd = "help";
if (args.Parameters.Count > 0)
{
cmd = args.Parameters[0].ToLower();
}
switch (cmd)
{
case "show":
// NOT IMPLEMENTED
// show quota usage of a specific player
case "extend":
// NOT IMPLEMENTED
// extend quota limit of a specific player
case "shrink":
// NOT IMPLEMENTED
// reduce quota limit of a specific player
case "help":
default:
int boxed = boxman.GetUsersBoxedTiles(args.Player.Name);
int limit;
int.TryParse(BoxesQuotaPlugin.getConfig.UserTilesQuota, out limit);
args.Player.SendMessage(string.Format ("{0}", limit));
args.Player.SendMessage(string.Format ("AlreadyBoxed: {0}, Limit: {1}", boxed, limit));
break;
}
}
开发者ID:mawize,项目名称:Boxes,代码行数:29,代码来源:Commands.cs
示例20: ListQuest
public static void ListQuest(CommandArgs args)
{
QPlayer Player = QTools.GetPlayerByID(args.Player.Index);
if (Player.IsLoggedIn)
{
Rectangle ply = new Rectangle((int)args.Player.X / 16, (int)args.Player.Y / 16, 1, 1);
string availquests = "Available Quests: ";
foreach (QuestRegion qr in QMain.QuestRegions)
{
if (ply.Intersects(qr.Area))
{
foreach (Quest q in qr.Quests)
{
QuestPlayerData data = QTools.GetPlayerQuestData(q.Name, Player);
if (QTools.AbleToRunQuest(q) && (q.MinQuestsNeeded == 0 || q.MinQuestsNeeded <= QTools.GetQuestsCompleted(Player.MyDBPlayer.QuestPlayerData)) && (q.MaxAttemps == 0 || data == null || QTools.GetPlayerQuestData(q.Name, Player).Attempts < q.MaxAttemps))
{
availquests = availquests + q.Name + ", ";
}
}
}
}
if (availquests != "Available Quests: ")
{
availquests = availquests.Substring(0, availquests.Length - 2);
Player.TSPlayer.SendMessage(availquests, Color.Magenta);
Player.TSPlayer.SendMessage("Use /startquest [Quest Name], to begin that quest", Color.Magenta);
}
else
Player.TSPlayer.SendMessage("No Available Quests", Color.Red);
}
else
Player.TSPlayer.SendMessage("You are not Logged in", Color.Red);
}
开发者ID:Olink,项目名称:Twitchys-Quest-Mod,代码行数:35,代码来源:QCommands.cs
注:本文中的TShockAPI.CommandArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论