public static bool CanCreate(TSPlayer player, scSign sign) { foreach (scCommand cmd in sign.Commands) if (!player.Group.HasPermission(string.Concat("essentials.signs.create.", cmd.command))) return false; return true; }
private bool OnSignHit(int X, int Y, string text, int who) { if (!text.ToLower().StartsWith(Config.DefineSignCommands.ToLower())) { return(false); } TSPlayer tPly = TShock.Players[who]; scPlayer sPly = scPlayers[who]; scSign sign = new scSign(text, new Point(X, Y)); bool CanBreak = scUtils.CanBreak(tPly, sign); if (sPly.DestroyMode && CanBreak) { return(false); } if (Config.ShowDestroyMessage && CanBreak && sPly.AlertDestroyCooldown == 0) { tPly.SendInfoMessage("To destroy this sign, Type \"/destsign\"."); sPly.AlertDestroyCooldown = 10; } sign.ExecuteCommands(sPly); return(true); }
public static bool CanCreate(TSPlayer player, scSign sign) { foreach (scCommand cmd in sign.Commands) { if (!player.Group.HasPermission(string.Concat("essentials.signs.create.", cmd.command))) { return(false); } } return(true); }
public void SignCommands_ExecuteSignCommand(TSPlayer player, DPoint signLocation, string text) { scPlayer scPlayer = SignCommands.SignCommands.scPlayers[player.Index]; if (scPlayer == null) throw new InvalidOperationException("Sign Commands does not recognize the given player."); try { scSign scSign = new scSign(text, new Point(signLocation.X, signLocation.Y)); scSign.ExecuteCommands(scPlayer); } catch (Exception ex) { throw new CooperatingPluginException(null, ex); } }
private bool OnSignEdit(int X, int Y, string text, int who) { if (!text.ToLower().StartsWith(Config.DefineSignCommands.ToLower())) { return(false); } TSPlayer tPly = TShock.Players[who]; scSign sign = new scSign(text, new Point(X, Y)); if (scUtils.CanCreate(tPly, sign)) { return(false); } tPly.SendErrorMessage("You do not have permission to create that sign command."); return(true); }
private bool OnSignKill(int X, int Y, string text, int who) { if (!text.ToLower().StartsWith(Config.DefineSignCommands.ToLower())) { return(false); } var sPly = scPlayers[who]; scSign sign = new scSign(text, new Point(X, Y)); if (sPly.DestroyMode && scUtils.CanBreak(sPly.TSPlayer, sign)) { sPly.DestroyMode = false; string id = new Point(X, Y).ToString(); List <string> OfflinePlayers = new List <string>(OfflineCooldowns.Keys); foreach (var p in OfflinePlayers) { if (OfflineCooldowns[p].ContainsKey(id)) { OfflineCooldowns[p].Remove(id); } } foreach (var Ply in scPlayers) { if (Ply == null || !Ply.Cooldowns.ContainsKey(id)) { continue; } Ply.Cooldowns.Remove(id); } return(false); } sign.ExecuteCommands(sPly); return(true); }
private bool OnSignKill(int X, int Y, string text, int who) { if (!text.ToLower().StartsWith(getConfig.DefineSignCommands.ToLower())) return false; var sPly = scPlayers[who]; scSign sign = new scSign(text, new Point(X, Y)); if (sPly.DestroyMode && scUtils.CanBreak(sPly.TSPlayer, sign)) { sPly.DestroyMode = false; string id = new Point(X, Y).ToString(); List<string> OfflinePlayers = new List<string>(OfflineCooldowns.Keys); foreach (var p in OfflinePlayers) { if (OfflineCooldowns[p].ContainsKey(id)) OfflineCooldowns[p].Remove(id); } foreach (var Ply in scPlayers) { if (Ply == null || !Ply.Cooldowns.ContainsKey(id)) continue; Ply.Cooldowns.Remove(id); } return false; } sign.ExecuteCommands(sPly); return true; }
private bool OnSignHit(int X, int Y, string text, int who) { if (!text.ToLower().StartsWith(getConfig.DefineSignCommands.ToLower())) return false; TSPlayer tPly = TShock.Players[who]; scPlayer sPly = scPlayers[who]; scSign sign = new scSign(text, new Point(X, Y)); bool CanBreak = scUtils.CanBreak(tPly, sign); if (sPly.DestroyMode && CanBreak) return false; if (getConfig.ShowDestroyMessage && CanBreak && sPly.AlertDestroyCooldown == 0) { tPly.SendMessage("To destroy this sign, Type \"/destsign\"", Color.Orange); sPly.AlertDestroyCooldown = 10; } sign.ExecuteCommands(sPly); return true; }
private bool OnSignEdit(int X, int Y, string text, int who) { if (!text.ToLower().StartsWith(getConfig.DefineSignCommands.ToLower())) return false; TSPlayer tPly = TShock.Players[who]; scSign sign = new scSign(text, new Point(X, Y)); if (scUtils.CanCreate(tPly, sign)) return false; tPly.SendMessage("You do not have permission to create that sign command!", Color.IndianRed); return true; }
public scCommand(scSign parent, string command, List<string> args) { this.command = command.ToLower(); this.args = args; }
public scCommand(scSign parent, string command, List <string> args) { this.command = command.ToLower(); this.args = args; }