diff --git a/APITestMod/IQSBAPI.cs b/APITestMod/IQSBAPI.cs
index d3579700..197ce867 100644
--- a/APITestMod/IQSBAPI.cs
+++ b/APITestMod/IQSBAPI.cs
@@ -4,6 +4,8 @@ using UnityEngine.Events;
public interface IQSBAPI
{
+ #region General
+
///
/// If called, all players connected to YOUR hosted game must have this mod installed.
///
@@ -19,6 +21,20 @@ public interface IQSBAPI
///
bool GetIsInMultiplayer();
+ ///
+ /// Invoked on the host when the server is first started.
+ ///
+ UnityEvent OnStartHost();
+
+ ///
+ /// Invoked on the host when the server is closed.
+ ///
+ UnityEvent OnStopHost();
+
+ #endregion
+
+ #region Player
+
///
/// Returns the player ID of the current player.
///
@@ -69,16 +85,6 @@ public interface IQSBAPI
///
UnityEvent OnPeerLeave();
- ///
- /// Invoked on the host when the server is first started.
- ///
- UnityEvent OnStartHost();
-
- ///
- /// Invoked on the host when the server is closed.
- ///
- UnityEvent OnStopHost();
-
///
/// Sets some arbitrary data for a given player.
///
@@ -97,6 +103,10 @@ public interface IQSBAPI
/// The data requested. If key is not valid, returns default.
T GetCustomData(uint playerId, string key);
+ #endregion
+
+ #region Messaging
+
///
/// Sends a message containing arbitrary data to every player.
///
@@ -116,4 +126,6 @@ public interface IQSBAPI
/// The unique key of the message.
/// The action to be ran when the message is received. The uint is the player ID that sent the messsage.
void RegisterHandler(string messageType, Action handler);
+
+ #endregion
}
diff --git a/QSB/API/IQSBAPI.cs b/QSB/API/IQSBAPI.cs
index d3579700..197ce867 100644
--- a/QSB/API/IQSBAPI.cs
+++ b/QSB/API/IQSBAPI.cs
@@ -4,6 +4,8 @@ using UnityEngine.Events;
public interface IQSBAPI
{
+ #region General
+
///
/// If called, all players connected to YOUR hosted game must have this mod installed.
///
@@ -19,6 +21,20 @@ public interface IQSBAPI
///
bool GetIsInMultiplayer();
+ ///
+ /// Invoked on the host when the server is first started.
+ ///
+ UnityEvent OnStartHost();
+
+ ///
+ /// Invoked on the host when the server is closed.
+ ///
+ UnityEvent OnStopHost();
+
+ #endregion
+
+ #region Player
+
///
/// Returns the player ID of the current player.
///
@@ -69,16 +85,6 @@ public interface IQSBAPI
///
UnityEvent OnPeerLeave();
- ///
- /// Invoked on the host when the server is first started.
- ///
- UnityEvent OnStartHost();
-
- ///
- /// Invoked on the host when the server is closed.
- ///
- UnityEvent OnStopHost();
-
///
/// Sets some arbitrary data for a given player.
///
@@ -97,6 +103,10 @@ public interface IQSBAPI
/// The data requested. If key is not valid, returns default.
T GetCustomData(uint playerId, string key);
+ #endregion
+
+ #region Messaging
+
///
/// Sends a message containing arbitrary data to every player.
///
@@ -116,4 +126,6 @@ public interface IQSBAPI
/// The unique key of the message.
/// The action to be ran when the message is received. The uint is the player ID that sent the messsage.
void RegisterHandler(string messageType, Action handler);
+
+ #endregion
}
diff --git a/QSB/API/QSBAPI.cs b/QSB/API/QSBAPI.cs
index 13917026..025f2f27 100644
--- a/QSB/API/QSBAPI.cs
+++ b/QSB/API/QSBAPI.cs
@@ -19,6 +19,9 @@ public class QSBAPI : IQSBAPI
public bool GetIsHost() => QSBCore.IsHost;
public bool GetIsInMultiplayer() => QSBCore.IsInMultiplayer;
+ public UnityEvent OnStartHost() => QSBAPIEvents.OnStartHostEvent;
+ public UnityEvent OnStopHost() => QSBAPIEvents.OnStopHostEvent;
+
public uint GetLocalPlayerID() => QSBPlayerManager.LocalPlayerId;
public string GetPlayerName(uint playerId) => QSBPlayerManager.GetPlayer(playerId).Name;
public uint[] GetPlayerIDs() => QSBPlayerManager.PlayerList.Select(x => x.PlayerId).ToArray();
@@ -32,9 +35,6 @@ public class QSBAPI : IQSBAPI
public UnityEvent OnPeerJoin() => QSBAPIEvents.OnPeerJoinEvent;
public UnityEvent OnPeerLeave() => QSBAPIEvents.OnPeerLeaveEvent;
- public UnityEvent OnStartHost() => QSBAPIEvents.OnStartHostEvent;
- public UnityEvent OnStopHost() => QSBAPIEvents.OnStopHostEvent;
-
public void SetCustomData(uint playerId, string key, T data) => QSBPlayerManager.GetPlayer(playerId).SetCustomData(key, data);
public T GetCustomData(uint playerId, string key) => QSBPlayerManager.GetPlayer(playerId).GetCustomData(key);