Skip to content

Commit

Permalink
Fix bugs with booster integration
Browse files Browse the repository at this point in the history
  • Loading branch information
PintTheDragon committed Nov 11, 2020
1 parent 8a9cdf4 commit 88c6620
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
20 changes: 9 additions & 11 deletions SCPStats/EventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,18 @@ private static async Task CreateConnection(int delay = 0)
Pinged = false;
break;
}

if (e.Data == null || !e.Data.StartsWith("u")) return;
if (e.Data == null || !e.Data.StartsWith("u") || SCPStats.Singleton.Config.BoosterRole.Equals("fill this")) return;

var data = e.Data.Substring(1).Split(' ');

if (data[1] != "1") return;
foreach (var player in Player.List)
{
if (HandleId(player.RawUserId) != data[0]) continue;

player.GameObject.GetComponent<ServerRoles>().SetGroup(ServerStatic.PermissionsHandler.GetGroup(SCPStats.Singleton.Config.BoosterRole), false, false, false);
if (!HandleId(player.RawUserId).Equals(data[0])) continue;
if (player.RankName != "") continue;

player.ReferenceHub.serverRoles.SetGroup(ServerStatic.PermissionsHandler.GetGroup(SCPStats.Singleton.Config.BoosterRole), false, false, false);
}
};

Expand All @@ -216,11 +217,8 @@ private static async Task CreateConnection(int delay = 0)

ws.OnError += (sender, e) =>
{
Log.Warn("An error occured in SCPStats. Reconnecting in 10 seconds...");
Log.Warn("An error occured in SCPStats:");
Log.Warn(e.Message);

ws?.CloseAsync();
CreateConnection(10000);
};

ws.Connect();
Expand Down Expand Up @@ -394,7 +392,7 @@ internal static void OnDrop(DroppingItemEventArgs ev)

internal static void OnJoin(JoinedEventArgs ev)
{
SendRequest("11", HandleId(ev.Player.RawUserId));
Timing.CallDelayed(1f, () => SendRequest("11", HandleId(ev.Player.RawUserId)));

if (!Round.IsStarted && Players.Contains(ev.Player.RawUserId) || ev.Player.DoNotTrack) return;

Expand Down
4 changes: 2 additions & 2 deletions SCPStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.3")]
[assembly: AssemblyFileVersion("1.1.3")]
[assembly: AssemblyVersion("1.1.4")]
[assembly: AssemblyFileVersion("1.1.4")]
2 changes: 1 addition & 1 deletion SCPStats/SCPStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class SCPStats : Plugin<Config>
{
public override string Name { get; } = "ScpStats";
public override string Author { get; } = "PintTheDragon";
public override Version Version { get; } = new Version(1, 1, 3);
public override Version Version { get; } = new Version(1, 1, 4);
public override PluginPriority Priority { get; } = PluginPriority.Last;

internal static SCPStats Singleton;
Expand Down

0 comments on commit 88c6620

Please sign in to comment.