/// <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(Group.GroupSave 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 OnGroupSaveEvent(method, priority, plugin));
     Organize();
 }
 /// <summary>
 /// Register this event
 /// This will call the method "method" everytime this event is triggered
 /// </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.OnPlayerConnect 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 OnPlayerConnectEvent(method, priority, plugin));
     Organize();
 }
 /// <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(Server.OnConsoleCommand 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 OnConsoleCommandEvent(method, priority, plugin));
     Organize();
 }
 /// <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.BlockchangeEventHandler 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 OnBlockChangeEvent(method, priority, plugin));
     Organize();
 }
 /// <summary>
 /// UnRegister this event
 /// </summary>
 /// <param name="plugin">The plugin object that has this event registered</param>
 public static void UnRegister(Plugin plugin)
 {
     if (Find(plugin) == null)
         throw new Exception("This plugin doesnt have this event registered!");
     else
         events.Remove(Find(plugin));
 }
 /// <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>
 /// <param name="bypass">Register more than one of the same event</param>
 public static void Register(Level.OnLevelLoaded method, Priority priority, Plugin plugin, bool bypass = false)
 {
     if (Find(plugin) != null)
         if (!bypass)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnLevelLoadedEvent(method, priority, plugin));
     Organize();
 }
 /// <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>
 /// <param name="bypass">Register more than one of the same event</param>
 public static void Register(Player.OnPlayerChat method, Priority priority, Plugin plugin, bool bypass = false)
 {
     if (Find(plugin) != null)
         if (!bypass)
         throw new Exception("The user tried to register 2 of the same event!");
     events.Add(new OnMessageRecieveEvent(method, priority, plugin));
     Organize();
 }
 /// <summary>
 /// Find a event
 /// </summary>
 /// <param name="plugin">The plugin that registered this event</param>
 /// <returns>The event</returns>
 public static OnPhysicsUpdateEvent Find(Plugin plugin)
 {
     foreach (OnPhysicsUpdateEvent p in events.ToArray())
     {
         if (p.plugin == plugin)
             return p;
     }
     return null;
 }
 public static OnBlockChangeEvent Find(Plugin plugin)
 {
     foreach (OnBlockChangeEvent p in events.ToArray())
     {
         if (p.plugin == plugin)
             return p;
     }
     return null;
 }
 /// <summary>
 /// Find a event
 /// </summary>
 /// <param name="plugin">The plugin that registered this event</param>
 /// <returns>The event</returns>
 public static OnConsoleCommandEvent Find(Plugin plugin)
 {
     foreach (OnConsoleCommandEvent p in events.ToArray())
     {
         if (p.plugin == plugin)
             return p;
     }
     return null;
 }
 /// <summary>
 /// Find a event
 /// </summary>
 /// <param name="plugin">The plugin that registered this event</param>
 /// <returns>The event</returns>
 public static OnServerErrorEvent Find(Plugin plugin)
 {
     foreach (OnServerErrorEvent p in events.ToArray())
         {
             if (p.plugin == plugin)
                 return p;
             }
             return null;
 }
 public static OnMessageRecieveEvent Find(Plugin plugin)
 {
     foreach (OnMessageRecieveEvent p in events.ToArray())
     {
         if (p.plugin == plugin)
             return p;
     }
     return null;
 }
Exemple #13
0
 /// <summary>
 /// Create a new config object
 /// </summary>
 /// <param name="p">The plugin that is using the config object</param>
 /// <param name="c">The config type you want</param>
 /// <param name="filename">The file name (DONT INCLUDE EXTENTION)</param>
 public Config(Plugin p, ConfigType c, string filename)
 {
     this.filename = filename;
     if (!Directory.Exists("plugins/" + p.name)) Directory.CreateDirectory("plugins/" + p.name);
     if (!File.Exists("plugins/" + p.name + "/" + filename + ".config") && c == ConfigType.Setting) File.Create("plugins/" + p.name + "/" + filename + ".config");
     if (!File.Exists("plugins/" + p.name + "/" + filename + ".file") && c == ConfigType.SaveFile) File.Create("plugins/" + p.name + "/" + filename + ".file");
     this.p = p;
     this.c = c;
 }
 /// <summary>
 /// Find a event
 /// </summary>
 /// <param name="plugin">The plugin that registered this event</param>
 /// <returns>The event</returns>
 public static OnLevelLoadedEvent Find(Plugin plugin)
 {
     foreach (OnLevelLoadedEvent p in events.ToArray())
     {
         if (p.plugin == plugin)
             return p;
     }
     return null;
 }
 public static OnPlayerChatEvent Find(Plugin plugin)
 {
     foreach (OnPlayerChatEvent p in events.ToArray())
     {
         if (p.plugin == plugin)
             return p;
     }
     return null;
 }
 internal OnPlayerDisconnectEvent(Player.OnPlayerDisconnect method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnMessageRecieveEvent(Player.OnPlayerChat method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnPlayerRankSetEvent(Group.RankSet method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnLevelLoadedEvent(Level.OnLevelLoaded method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnServerErrorEvent(Server.OnServerError method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal PlayerRotateEvent(Player.OnPlayerRotate method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnPlayerCommandEvent(Player.OnPlayerCommand method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 /// <summary>
 /// Unload a plugin
 /// </summary>
 /// <param name="p">The plugin to unload</param>
 /// <param name="shutdown">Is this shutdown?</param>
 public static void Unload(Plugin p, bool shutdown)
 {
     p.Unload(shutdown);
     all.Remove(p);
     Server.s.Log(p.name + " was unloaded...how ever you cant re-load it until you restart!");
 }
        /// <summary>
        /// Unload a plugin
        /// </summary>
        /// <param name="p">The plugin to unload</param>
        /// <param name="shutdown">Is this shutdown?</param>
        public static void Unload(Plugin p, bool shutdown)
        {
            try
            {
                p.Unload(shutdown);
                all.Remove(p);

                Server.s.Log(p.name + " was unloaded.");
            }
            catch { Server.s.Log("An error occurred while unloading a plugin."); }
        }
 internal OnPhysicsUpdateEvent(Level.OnPhysicsUpdate method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnBlockChangeEvent(Player.BlockchangeEventHandler method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnConsoleCommandEvent(Server.OnConsoleCommand method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnPlayerAFKEvent(Player.OnAFK method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnGroupLoadEvent(Group.GroupLoad method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }
 internal OnMySQLSaveEvent(Player.OnMySQLSave method, Priority priority, Plugin plugin)
 {
     this.plugin = plugin; this.priority = priority; this.method = method;
 }