Index: code/trunk/src/orxonox/interfaces/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/interfaces/CMakeLists.txt	(revision 8464)
+++ code/trunk/src/orxonox/interfaces/CMakeLists.txt	(revision 8706)
@@ -1,4 +1,5 @@
 ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   InterfaceCompilation.cc
+  NotificationListener.cc
   Pickupable.cc
   PickupCarrier.cc
Index: code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc	(revision 8464)
+++ code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc	(revision 8706)
@@ -42,4 +42,7 @@
 #include "core/CoreIncludes.h"
 
+#include "infos/PlayerInfo.h"
+#include "worldentities/pawns/Pawn.h"
+
 namespace orxonox
 {
@@ -59,6 +62,13 @@
         RegisterRootObject(PlayerTrigger);
 
-        this->player_ = NULL;
         this->isForPlayer_ = false;
+    }
+
+    void PlayerTrigger::setTriggeringPawn(Pawn* pawn)
+    {
+        assert(pawn);
+        this->pawn_ = WeakPtr<Pawn>(pawn);
+        if (pawn)
+            this->player_ = WeakPtr<PlayerInfo>(pawn->getPlayer());
     }
 
@@ -86,11 +96,3 @@
         RegisterRootObject(Rewardable);
     }
-
-    //----------------------------
-    // NotificationListener
-    //----------------------------
-    NotificationListener::NotificationListener()
-    {
-        RegisterRootObject(NotificationListener);
-    }
 }
Index: code/trunk/src/orxonox/interfaces/NotificationListener.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.cc	(revision 8706)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.cc	(revision 8706)
@@ -0,0 +1,161 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Damian 'Mozork' Frick
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file NotificationListener.cc
+    @brief Implementation of the NotificationListener class.
+*/
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include "network/NetworkFunction.h"
+#include "util/SubString.h"
+
+#include "interfaces/NotificationListener.h"
+
+namespace orxonox
+{
+    
+    /*static*/ const std::string NotificationListener::ALL("all");
+    /*static*/ const std::string NotificationListener::NONE("none");
+    
+    // Commands
+    /*static*/ const std::string NotificationListener::COMMAND_CLEAR("clear");
+    /*static*/ const std::string NotificationListener::COMMAND_NONE("none");
+    
+    registerStaticNetworkFunction(NotificationListener::sendHelper);
+    
+    NotificationListener::NotificationListener()
+    {
+        RegisterRootObject(NotificationListener);
+    }
+
+    /**
+    @brief
+        Helper method to send both notifications and commands over the network.
+    @param message
+        The message/command that should be sent.
+    @param sender
+        The sender that sent the notification/command.
+    @param sendMode
+        The mode in which the notification/command is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts.
+    @param clientId
+        The id of the client the notification/command should be sent to.
+    @param isCommand
+        Whether the message is a notification or a command.
+    @param messageType
+        The type of the notification, can be either 'info' or 'important'.
+    */
+    /*static*/ void NotificationListener::sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand, notificationMessageType::Value messageType)
+    {
+        // If we're in standalone mode or we're already no the right client we create and send the notification/command.
+        if(GameMode::isStandalone() || sendMode == notificationSendMode::local || (sendMode ==  notificationSendMode::network && Host::getPlayerID() == clientId))
+        {
+            sendHelper(message, sender, isCommand, messageType);
+        }
+        // If we're on the server (and the server is not the intended recipient of the notification/command) we send it over the network.
+        else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)
+        {
+            callStaticNetworkFunction(NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
+        }
+        else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)
+        {
+            // TODO: Works as intended?
+            callStaticNetworkFunction(NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
+        }
+    }
+
+    /**
+    @brief
+        Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
+    @param message
+        The notification/command to be sent/executed.
+    @param sender
+        The sender that sent the notification/command.
+    @param isCommand
+        Whether the message is a command or a notification.
+    @param messageType
+        The type of the notification.
+    */
+    /*static*/ void NotificationListener::sendHelper(const std::string& message, const std::string& sender, bool isCommand, unsigned int messageType)
+    {
+        // Iterate through all NotificationListeners and notify them by calling the method they overloaded.
+        for(ObjectList<NotificationListener>::iterator it = ObjectList<NotificationListener>::begin(); it != ObjectList<NotificationListener>::end(); ++it)
+        {
+            // If the notification is a message.
+            if(!isCommand)
+                it->registerNotification(message, sender, notificationMessageType::Value(messageType));
+
+            // If the notification is a command.
+            if(isCommand)
+            {
+                notificationCommand::Value command = str2Command(message);
+                if(command != notificationCommand::none)
+                    it->executeCommand(command, sender);
+            }
+        }
+    }
+
+    /**
+    @brief
+        Helper method. Converts a string into the enum for a command.
+    @param string
+        The string to be converted.
+    @return
+        Returns the corresponding enum, notificationCommand::none if the command doesn't exist.
+    */
+    /*static*/ notificationCommand::Value NotificationListener::str2Command(const std::string& string)
+    {
+        notificationCommand::Value command = notificationCommand::none;
+
+        if(string == NotificationListener::COMMAND_CLEAR)
+            command = notificationCommand::clear;
+
+        return command;
+    }
+
+    /**
+    @brief
+        Helper method. Converts a command enum into its corresponding string.
+    @param command
+        The command to be converted.
+    @return
+        Returns the corresponding string.
+    */
+    /*static*/ const std::string& NotificationListener::command2Str(notificationCommand::Value command)
+    {
+        switch(command)
+        {
+            case notificationCommand::clear:
+                return NotificationListener::COMMAND_CLEAR;
+            default:
+                return NotificationListener::COMMAND_NONE;
+        }
+    }
+    
+}
Index: code/trunk/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.h	(revision 8464)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.h	(revision 8706)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Fabian 'x3n' Landau
+ *      Damian 'Mozork' Frick
  *   Co-authors:
  *      ...
@@ -48,17 +48,45 @@
 namespace orxonox
 {
-    class Notification;
+    // TODO: Document.
+    namespace notificationMessageType
+    {
+        enum Value {
+            info,
+            important
+        };
+    }
+    
+    namespace notificationSendMode
+    {
+        enum Value {
+            local,
+            network,
+            broadcast
+        };
+    }
+    
+    namespace notificationCommand
+    {
+        enum Value {
+            none,
+            clear
+        };
+    }
 
+    // TODO: Update doc.
     /**
     @brief
         NotificationListener interface.
 
-        The NotificationListener interface presents a means to being informed when @ref orxonox::Notification "Notifications" in the target set of this NotificationListener change. (e.g. @ref orxonox::Notification "Notifications" were added or removed)
-        When inheriting from a NotificationListener it is important to register (in the constructor) and unregister (in the destructor) it to and from the @ref orxonox::NotificationManager "NotificationManager".
+        The NotificationListener interface (or more precisely abstract class) presents a means of being informed when a new @ref orxonox::Notification "Notification" is sent.
+        The NotificationListener can be used to send a new notification message (with NotificationListener::sendNotification() ) or a new notification command (with NotificationListener::sendCommand() ). Each NotificationListener is then informed about the new @ref orxonox::Notification "Notification" and can take appropriate action. Currently the only NotificationListener ist the @ref orxonox::NotificationManager "NotificationManager" singleton.
+
+        When inheriting from a NotificationListener it is important to provide an appropriate implementation of registerNotification() and executeCommand().
 
     @author
-        Fabian 'x3n' Landau
-
+        Damian 'Mozork' Frick
+        
     @ingroup Notifications
+    @todo Consistent terminology between message, notification and command.
     */
     class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
@@ -69,20 +97,60 @@
 
             /**
-            @brief Get the senders that are targets of this NotificationListener.
-            @return Returns the set of senders that are targets of this NotificationListener.
+            @brief Sends a Notification with the specified message to the specified client from the specified sender.
+            @param message The message that should be sent.
+            @param sender The sender that sent the notification. Default is 'none'.
+            @param messageType The type of the message, can be either 'info' or 'important'. Default is 'info'.
+            @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is notificationSendMode::local.
+            @param clientId The id of the client the notification should be sent to. Default is 0.
             */
-            virtual const std::set<std::string> & getTargetsSet(void) = 0;
+            static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageType::Value messageType = notificationMessageType::info, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
+                { NotificationListener::sendNetworkHelper(message, sender, sendMode, clientId, false, messageType); }
+            /**
+            @brief Sends a specified command to the specified client from the specified sender.
+            @param command The command that should be sent (and later executed).
+            @param sender The sender that sent the notification. Default is 'none'.
+            @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is notificationSendMode::local.
+            @param clientId The id of the client the command should be sent to. Default is 0.
+            */
+            static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
+                { NotificationListener::sendNetworkHelper(command, sender, sendMode, clientId, true); }
 
+            static void sendHelper(const std::string& message, const std::string& sender, bool isCommand = false, unsigned int messageMode = 0); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
+
+            //TODO: Make protected?
+            
             /**
-            @brief Updates the whole NotificationListener.
-                   This is called by the @ref orxonox::NotificationManager "NotificationManager" when the @ref orxonox::Notification "Notifications" have changed so much, that the NotificationListener may have to re-initialize his operations.
+            @brief Registers a notification with the NotificationListener.
+                   This needs to be overloaded by each class inheriting from NotificationListener.
+            @param message The notification's message.
+            @param sender The sender of the notification.
+            @param type The type of the notification.
+            @return Returns true if the notification was successfully registered, false if not.
             */
-            virtual void update(void) = 0;
+            virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
+                { return false; }
             /**
-            @brief Updates the NotificationListener, when a new Notification has come in at the specified time.
-            @param notification A pointer to the @ref orxonox::Notification "Notification".
-            @param time The time the @ref orxonox::Notification "Notification" has come in.
+            @brief Executes a command with the NotificationListener
+                   This needs to be overloaded by each class inheriting from NotificationListener.
+            @param command The command to be executed.
+            @param sender The sender of the command.
+            @return Returns true if the command was successfully executed, false if not.
             */
-            virtual void update(Notification* notification, const std::time_t & time) = 0;
+            virtual bool executeCommand(notificationCommand::Value command, const std::string& sender) { return false; }
+
+        public:
+            
+            static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationQueues.
+            static const std::string NONE; //!< Static string to indicate a sender that sends to no specific NotificationQueues.
+            
+            //! Commands
+            static const std::string COMMAND_CLEAR;
+            static const std::string COMMAND_NONE;
+            
+        protected:
+            static void sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand = false, notificationMessageType::Value messageType = notificationMessageType::info); // Helper method to send both notifications and commands over the network.
+
+            static notificationCommand::Value str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.
+            static const std::string& command2Str(notificationCommand::Value command); // Helper method. Converts a command enum into its corresponding string.
     };
 }
Index: code/trunk/src/orxonox/interfaces/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PlayerTrigger.h	(revision 8464)
+++ code/trunk/src/orxonox/interfaces/PlayerTrigger.h	(revision 8706)
@@ -39,4 +39,5 @@
 
 #include "core/OrxonoxClass.h"
+#include "core/WeakPtr.h"
 
 namespace orxonox
@@ -44,5 +45,5 @@
     /**
     @brief
-        PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or more precisely the @ref orxonox::Pawn "Pawn") that triggered it.
+        PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or the @ref orxonox::Pawn "Pawn") that triggered it.
 
     @author
@@ -58,13 +59,20 @@
 
         /**
-        @brief Returns the player that triggered the PlayerTrigger.
+        @brief Returns the Pawn that triggered the PlayerTrigger.
         @return Returns a pointer to the Pawn that triggered the PlayerTrigger.
         */
-        inline Pawn* getTriggeringPlayer(void) const
+        inline Pawn* getTriggeringPawn(void) const
+            { return this->pawn_.get(); }
+
+        /**
+        @brief Returns the player that triggered the PlayerTrigger.
+        @return Returns a pointer to the PlayerInfo that triggered the PlayerTrigger.
+        */
+        inline PlayerInfo* getTriggeringPlayer(void) const
             { return this->player_; }
 
         /**
-        @brief Checks whether the PlayerTrigger normally returns a Pawn.
-        @return Returns true if the PlayerTrigger normally returns a Pawn.
+        @brief Checks whether the PlayerTrigger normally returns a Pawn/PlayerInfo.
+        @return Returns true if the PlayerTrigger normally returns a Pawn/PlayerInfo.
         */
         inline bool isForPlayer(void) const
@@ -76,6 +84,5 @@
         @param player A pointer to the Pawn that triggered the PlayerTrigger.
         */
-        inline void setTriggeringPlayer(Pawn* player)
-           { this->player_ = player; }
+        void setTriggeringPawn(Pawn* pawn);
 
         /**
@@ -87,5 +94,6 @@
 
     private:
-        Pawn* player_; //!< The player that triggered the PlayerTrigger.
+        WeakPtr<PlayerInfo> player_; //!< The player that triggered the PlayerTrigger.
+        WeakPtr<Pawn> pawn_; //!< The Pawn that triggered the PlayerTrigger.
         bool isForPlayer_; //!< Is true when the PlayerTrigger should be set to normally be triggered by Pawns.
 
