/// <summary>
        /// Determines whether a plugins has registered a hook, then fires the appropriate method if so
        /// </summary>
        /// <param name="hook">Hook to process</param>
        /// <param name="hookEvent">Event instance to pass to any hooked methods</param>
        public void processHook(Hooks hook, Event hookEvent)
        {
            foreach (Plugin plugin in plugins.Values)
            {
                try
                {
                    if (plugin.containsHook(hook))
                    {
                        switch (hook)
                        {
                            case Hooks.CONSOLE_COMMAND:
                                plugin.onConsoleCommand((ConsoleCommandEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_COMMAND:
                                plugin.onPlayerCommand((PlayerCommandEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_CHAT:
                                plugin.onPlayerChat((MessageEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_PRELOGIN:
                                plugin.onPlayerPreLogin((PlayerLoginEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_LOGIN:
                                plugin.onPlayerJoin((PlayerLoginEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_LOGOUT:
                                plugin.onPlayerLogout((PlayerLogoutEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_PARTYCHANGE:
                                plugin.onPlayerPartyChange((PartyChangeEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_TILECHANGE:
                                plugin.onPlayerTileChange((PlayerTileChangeEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_HURT:
                                plugin.onPlayerHurt((PlayerHurtEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_CHEST:
                                plugin.onPlayerOpenChest((PlayerChestOpenEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_DEATH:
                                plugin.onPlayerDeath((PlayerDeathEvent)hookEvent);
                                break;

                            case Hooks.DOOR_STATECHANGE:
                                plugin.onDoorStateChange((DoorStateChangeEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_EDITSIGN:
                                plugin.onPlayerEditSign((PlayerEditSignEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_PROJECTILE:
                                plugin.onPlayerProjectileUse((PlayerProjectileEvent)hookEvent);
                                break;

                            case Hooks.NPC_DEATH:
                                plugin.onNPCDeath((NPCDeathEvent)hookEvent);
                                break;

                            case Hooks.NPC_SPAWN:
                                plugin.onNPCSpawn((NPCSpawnEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_TELEPORT:
                                plugin.onPlayerTeleport((PlayerTeleportEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_MOVE:
                                plugin.onPlayerMove((PlayerMoveEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_KEYPRESS:
                                plugin.onPlayerKeyPress((PlayerKeyPressEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_PVPCHANGE:
                                plugin.onPlayerPvPChange((PlayerPvPChangeEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_AUTH_QUERY:
                                plugin.onPlayerAuthQuery ((PlayerLoginEvent) hookEvent);
                                break;

                            case Hooks.PLAYER_AUTH_REPLY:
                                plugin.onPlayerAuthReply ((PlayerLoginEvent) hookEvent);
                                break;

                            case Hooks.NPC_BOSSDEATH:
                                plugin.onNPCBossDeath((NPCBossDeathEvent)hookEvent);
                                break;

                            case Hooks.NPC_BOSSSUMMON:
                                plugin.onNPCBossSummon((NPCBossSummonEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_FLOWLIQUID:
                                plugin.onPlayerFlowLiquid ((PlayerFlowLiquidEvent)hookEvent);
                                break;

                            case Hooks.PLAYER_CHESTBREAK:
                                plugin.onPlayerChestBreak((PlayerChestBreakEvent)hookEvent);
                                break;

                            case Hooks.TIME_CHANGED:
                                plugin.onTimeChange((TimeChangedEvent)hookEvent);
                                break;
                        }
                    }
                }
                catch (Exception exception)
                {
                    ProgramLog.Log (exception, "Error passing event " + hook.ToString() + " to " + plugin.Name);
                }
            }
        }
Example #2
0
 public override void onPlayerDisconnect(Event Event)
 {
     SendAllMessage(GetPlayerName(((Player)Event.GetSender()).whoAmi) + " has left the server.", 255f, 240f, 20f);
 }
 public void processHook(Hooks Hook, Event Event)
 {
     foreach (Plugin plugin in pluginList)
     {
         try
         {
             if (plugin.containsHook(Hook))
             {
                 switch (Hook)
                 {
                     case Hooks.CONSOLE_COMMAND:
                         {
                             plugin.onPlayerCommandProcess((ConsoleCommandEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_COMMAND:
                         {
                             plugin.onPlayerCommand((PlayerCommandEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_CHAT:
                         {
                             plugin.onPlayerChat((PlayerChatEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_PRELOGIN:
                         {
                             plugin.onPlayerPreLogin((LoginEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_LOGIN:
                         {
                             plugin.onPlayerJoin((LoginEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_LOGOUT:
                         {
                             plugin.onPlayerLogout((LogoutEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_PARTYCHANGE:
                         {
                             plugin.onPlayerPartyChange((PartyChangeEvent)Event);
                             break;
                         }
                     case Hooks.TILE_BREAK:
                         {
                             plugin.onTileBreak((TileBreakEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_HURT:
                         {
                             plugin.onPlayerHurt((PlayerHurtEvent)Event);
                             break;
                         }
                     case Hooks.PLAYER_CHEST:
                         {
                             plugin.onPlayerOpenChest((ChestOpenEvent)Event);
                             break;
                         }
                 }
             }
         }
         catch (Exception exception)
         {
             Console.WriteLine("Error Passing Event " + Hook.ToString() + " to " + plugin.Name);
             Console.WriteLine(exception.ToString());
         }
     }
 }
 public void processHook(Hooks hook, Event hookEvent)
 {
     foreach (Plugin plugin in plugins.Values)
     {
         try
         {
             if (plugin.containsHook(hook))
             {
                 switch (hook)
                 {
                     case Hooks.CONSOLE_COMMAND:
                         {
                             plugin.onPlayerCommandProcess((ConsoleCommandEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_COMMAND:
                         {
                             plugin.onPlayerCommand((PlayerCommandEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_CHAT:
                         {
                             plugin.onPlayerChat((MessageEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_PRELOGIN:
                         {
                             plugin.onPlayerPreLogin((PlayerLoginEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_LOGIN:
                         {
                             plugin.onPlayerJoin((PlayerLoginEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_LOGOUT:
                         {
                             plugin.onPlayerLogout((PlayerLogoutEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_PARTYCHANGE:
                         {
                             plugin.onPlayerPartyChange((PartyChangeEvent)hookEvent);
                             break;
                         }
                     case Hooks.TILE_CHANGE:
                         {
                             plugin.onTileChange((PlayerTileChangeEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_HURT:
                         {
                             plugin.onPlayerHurt((PlayerHurtEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_CHEST:
                         {
                             plugin.onPlayerOpenChest((PlayerChestOpenEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_STATEUPDATE:
                         {
                             plugin.onPlayerStateUpdate((PlayerStateUpdateEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_DEATH:
                         {
                             plugin.onPlayerDeath((PlayerDeathEvent)hookEvent);
                             break;
                         }
                     case Hooks.DOOR_STATECHANGE:
                         {
                             plugin.onDoorStateChange((DoorStateChangeEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_EDITSIGN:
                         {
                             plugin.onPlayerEditSign((PlayerEditSignEvent)hookEvent);
                             break;
                         }
                     case Hooks.PLAYER_PROJECTILE:
                         {
                             plugin.onPlayerProjectileUse((PlayerProjectileEvent)hookEvent);
                             break;
                         }
                 }
             }
         }
         catch (Exception exception)
         {
             Program.tConsole.WriteLine("Error Passing Event " + hook.ToString() + " to " + plugin.Name);
             Program.tConsole.WriteLine(exception.ToString());
         }
     }
 }