Beispiel #1
0
        public bool RemoveAlias(object aliasObject)
        {
            JScriptAliasCommand alias = null;

            if ((alias = aliasEngine.GetAlias(aliasObject)) == null)
            {
                return(false);
            }

            try {
                aliasEngine.RemoveAlias(alias);
            } catch (Exception ex) {
                Jist.ScriptLog.ErrorFormat("aliascmd", "RemoveAlias failed: " + ex.Message);
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        public bool SetCooldown(object player, object aliasObject, int cooldownSeconds)
        {
            JScriptAliasCommand alias = null;

            TShockAPI.TSPlayer tsPlayer = null;

            if ((alias = aliasEngine.GetAlias(aliasObject)) == null ||
                (tsPlayer = JistPlugin.Instance.stdTshock.GetPlayer(player)) == null)
            {
                return(false);
            }

            KeyValuePair <string, AliasCommand> cooldownReference =
                new KeyValuePair <string, AliasCommand>(tsPlayer.User.Name, alias);

            aliasEngine.PopulateCooldownList(cooldownReference, TimeSpan.FromSeconds(cooldownSeconds));

            return(true);
        }
Beispiel #3
0
        public bool ResetCooldown(object player, object aliasObject)
        {
            JScriptAliasCommand alias = null;

            TShockAPI.TSPlayer tsPlayer = null;

            if ((alias = aliasEngine.GetAlias(aliasObject)) == null ||
                (tsPlayer = JistPlugin.Instance.stdTshock.GetPlayer(player)) == null)
            {
                return(false);
            }

            KeyValuePair <string, AliasCommand> cooldownReference =
                new KeyValuePair <string, AliasCommand>(tsPlayer.User.Name, alias);

            if (aliasEngine.CooldownList.ContainsKey(cooldownReference))
            {
                aliasEngine.CooldownList.Remove(cooldownReference);
            }

            return(true);
        }