diff --git a/RageCoop.Client/Scripting/API.cs b/RageCoop.Client/Scripting/API.cs
index 9738f00..503dc29 100644
--- a/RageCoop.Client/Scripting/API.cs
+++ b/RageCoop.Client/Scripting/API.cs
@@ -43,7 +43,7 @@ namespace RageCoop.Client.Scripting
get { return Main.Settings.Username; }
set
{
- if (IsOnServer || string.IsNullOrEmpty(value))
+ if (Networking.IsOnServer || string.IsNullOrEmpty(value))
{
return;
}
@@ -155,51 +155,7 @@ namespace RageCoop.Client.Scripting
#endregion
}
- #region FUNCTIONS
- ///
- /// Send a local chat message to this player
- ///
- /// Name of the sender
- /// The player's message
- public static void LocalChatMessage(string from, string message)
- {
- Main.MainChat.AddMessage(from, message);
- }
-
- ///
- /// Get a that RAGECOOP is currently using.
- ///
- ///
- public static Logger Logger
- {
- get
- {
- return Main.Logger;
- }
- }
- ///
- /// Queue an action to be executed on next tick.
- ///
- ///
- public static void QueueAction(Action a)
- {
- Main.QueueAction(a);
- }
- ///
- /// Disconnect from the server
- ///
- public static void Disconnect()
- {
- Networking.ToggleConnection(null);
- }
-
- ///
- /// Check if the player is already on a server
- ///
- public static bool IsOnServer
- {
- get { return Networking.IsOnServer; }
- }
+ #region PROPERTIES
///
/// Get the local player's ID
@@ -241,6 +197,48 @@ namespace RageCoop.Client.Scripting
{
get { return Main.CurrentVersion; }
}
+
+
+ ///
+ /// Get a that RAGECOOP is currently using.
+ ///
+ ///
+ public static Logger Logger
+ {
+ get
+ {
+ return Main.Logger;
+ }
+ }
+ #endregion
+
+ #region FUNCTIONS
+ ///
+ /// Send a local chat message to this player
+ ///
+ /// Name of the sender
+ /// The player's message
+ public static void LocalChatMessage(string from, string message)
+ {
+ Main.MainChat.AddMessage(from, message);
+ }
+
+ ///
+ /// Queue an action to be executed on next tick.
+ ///
+ ///
+ public static void QueueAction(Action a)
+ {
+ Main.QueueAction(a);
+ }
+ ///
+ /// Disconnect from the server
+ ///
+ public static void Disconnect()
+ {
+ Networking.ToggleConnection(null);
+ }
+
///
/// Send an event and data to the server.
///
@@ -263,10 +261,9 @@ namespace RageCoop.Client.Scripting
/// An handler to be invoked when the event is received from the server.
public static void RegisterCustomEventHandler(int hash, Action handler)
{
- List> handlers;
lock (CustomEventHandlers)
{
- if (!CustomEventHandlers.TryGetValue(hash, out handlers))
+ if (!CustomEventHandlers.TryGetValue(hash, out List> handlers))
{
CustomEventHandlers.Add(hash, handlers = new List>());
}