Skip to content

Commit cfe506d

Browse files
authored
Revert "bump (#8)" (#9)
This reverts commit f7b3807.
1 parent f7b3807 commit cfe506d

File tree

9 files changed

+404
-109
lines changed

9 files changed

+404
-109
lines changed

EasyEvents/Commands/Door.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void Run(List<string> args, int i)
2222
else
2323
{
2424
List<Door2> targetDoors = new List<Door2>();
25-
foreach(Door2 door in Door2.List)
25+
foreach(Door2 door in Map.Doors)
2626
{
2727
if (door.Type == targetDoorType) targetDoors.Add(door);
2828
}

EasyEvents/CustomRole.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace EasyEvents
88
public class CustomRole
99
{
1010
public List<string> members = new List<string>();
11-
public string id;
11+
public string id = null;
1212
public int classId = -1;
13-
public bool isSubclass;
13+
public bool isSubclass = false;
1414

1515
public CustomRole(string id, int classId, bool isSubclass = false)
1616
{
@@ -21,7 +21,7 @@ public CustomRole(string id, int classId, bool isSubclass = false)
2121

2222
public List<Player> GetMembers()
2323
{
24-
return id == "all" ? Player.List.ToList() : isSubclass ? AdvancedSubclassing.GetPlayers(id.Substring(2)) : Player.List.Where(p => members.Contains(p.UserId)).ToList();
24+
return this.id == "all" ? Player.List.ToList() : this.isSubclass ? AdvancedSubclassing.GetPlayers(id.Substring(2)) : Player.List.Where(p => members.Contains(p.UserId)).ToList();
2525
}
2626
}
2727
}

EasyEvents/EasyEvents.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
4+
using Exiled.API.Enums;
35
using Exiled.API.Features;
6+
using Exiled.API.Interfaces;
7+
using Exiled.Loader;
48
using MEC;
9+
using EasyEvents.Handlers;
510
using EasyEvents.API.EventArgs;
611

712
namespace EasyEvents
813
{
914
public class EasyEvents : Plugin<Config>
1015
{
11-
public override string Name { get; } = "EasyEvents";
12-
public override string Author { get; } = "Johnodon";
13-
public override Version Version { get; } = new Version(4, 0, 0);
14-
public override Version RequiredExiledVersion { get; } = new Version(5, 1, 3);
16+
public override string Name => "EasyEvents";
17+
public override string Author => "Johnodon";
18+
public override Version Version => new Version(3, 0, 0);
19+
public override Version RequiredExiledVersion { get; } = new Version(4, 2, 2);
1520

1621
public static EasyEvents Singleton;
1722

1823
public override void OnEnabled()
1924
{
25+
base.OnEnabled();
2026
Singleton = this;
2127
ScriptStore.LoadScripts();
2228
ScriptActions.AddEvents();
2329
Exiled.Events.Handlers.Server.RestartingRound += ScriptActions.Reset;
2430
Exiled.Events.Handlers.Server.ReloadedConfigs += OnConfigUpdate;
2531
ScriptActions.Reset();
26-
base.OnEnabled();
2732
}
2833
public static void StartingEvent(StartingEventEventArgs ev)
2934
{
@@ -32,12 +37,12 @@ public static void StartingEvent(StartingEventEventArgs ev)
3237

3338
public override void OnDisabled()
3439
{
40+
base.OnDisabled();
41+
Singleton = null;
3542
ScriptStore.Scripts = new Dictionary<string, string>();
3643
ScriptActions.RemoveEvents();
3744
Exiled.Events.Handlers.Server.RestartingRound -= ScriptActions.Reset;
3845
Exiled.Events.Handlers.Server.ReloadedConfigs -= OnConfigUpdate;
39-
Singleton = null;
40-
base.OnDisabled();
4146
}
4247

4348
private static void OnConfigUpdate()

EasyEvents/EasyEvents.csproj

Lines changed: 348 additions & 63 deletions
Large diffs are not rendered by default.

EasyEvents/EventCommand.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using EasyEvents.Types;
77
using Exiled.Loader;
88
using EasyEvents.Handlers;
9+
using EasyEvents.API;
910

1011
namespace EasyEvents
1112
{
@@ -14,8 +15,8 @@ public class EventCommand : ICommand
1415
{
1516
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
1617
{
17-
bool permission;
18-
bool perPermission;
18+
var permission = false;
19+
var perPermission = false;
1920

2021
if (arguments.Array == null || arguments.Array.Length < 2)
2122
{
@@ -104,8 +105,8 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
104105
}
105106
}
106107

107-
public string Command { get; } = "event";
108-
public string[] Aliases { get; } = {"runevent", "eventrun", "events" };
109-
public string Description { get; } = "This is the command used to run custom events with EasyEvents.";
108+
public string Command => "event";
109+
public string[] Aliases => new string[] {"runevent", "eventrun", "events" };
110+
public string Description => "This is the command used to run custom events with EasyEvents.";
110111
}
111112
}

EasyEvents/Exceptions.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,67 @@
22

33
namespace EasyEvents
44
{
5-
[Serializable]
6-
public class InvalidArgumentLengthException : Exception
5+
[Serializable()]
6+
public class InvalidArgumentLengthException : System.Exception
77
{
8-
public InvalidArgumentLengthException() { }
8+
public InvalidArgumentLengthException() : base() { }
99
public InvalidArgumentLengthException(string message) : base(message) { }
10-
public InvalidArgumentLengthException(string message, Exception inner) : base(message, inner) { }
10+
public InvalidArgumentLengthException(string message, System.Exception inner) : base(message, inner) { }
1111

1212
protected InvalidArgumentLengthException(System.Runtime.Serialization.SerializationInfo info,
1313
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
1414
}
1515

16-
[Serializable]
17-
public class InvalidArgumentException : Exception
16+
[Serializable()]
17+
public class InvalidArgumentException : System.Exception
1818
{
19-
public InvalidArgumentException() { }
19+
public InvalidArgumentException() : base() { }
2020
public InvalidArgumentException(string message) : base(message) { }
21-
public InvalidArgumentException(string message, Exception inner) : base(message, inner) { }
21+
public InvalidArgumentException(string message, System.Exception inner) : base(message, inner) { }
2222

2323
protected InvalidArgumentException(System.Runtime.Serialization.SerializationInfo info,
2424
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
2525
}
2626

27-
[Serializable]
28-
public class InvalidCommandException : Exception
27+
[Serializable()]
28+
public class InvalidCommandException : System.Exception
2929
{
30-
public InvalidCommandException() { }
30+
public InvalidCommandException() : base() { }
3131
public InvalidCommandException(string message) : base(message) { }
32-
public InvalidCommandException(string message, Exception inner) : base(message, inner) { }
32+
public InvalidCommandException(string message, System.Exception inner) : base(message, inner) { }
3333

3434
protected InvalidCommandException(System.Runtime.Serialization.SerializationInfo info,
3535
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
3636
}
3737

38-
[Serializable]
39-
public class CommandErrorException : Exception
38+
[Serializable()]
39+
public class CommandErrorException : System.Exception
4040
{
41-
public CommandErrorException() { }
41+
public CommandErrorException() : base() { }
4242
public CommandErrorException(string message) : base(message) { }
43-
public CommandErrorException(string message, Exception inner) : base(message, inner) { }
43+
public CommandErrorException(string message, System.Exception inner) : base(message, inner) { }
4444

4545
protected CommandErrorException(System.Runtime.Serialization.SerializationInfo info,
4646
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
4747
}
4848

49-
[Serializable]
50-
public class EventRunErrorException : Exception
49+
[Serializable()]
50+
public class EventRunErrorException : System.Exception
5151
{
52-
public EventRunErrorException() { }
52+
public EventRunErrorException() : base() { }
5353
public EventRunErrorException(string message) : base(message) { }
54-
public EventRunErrorException(string message, Exception inner) : base(message, inner) { }
54+
public EventRunErrorException(string message, System.Exception inner) : base(message, inner) { }
5555

5656
protected EventRunErrorException(System.Runtime.Serialization.SerializationInfo info,
5757
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
5858
}
5959

60-
[Serializable]
61-
public class EventNotFoundException : Exception
60+
[Serializable()]
61+
public class EventNotFoundException : System.Exception
6262
{
63-
public EventNotFoundException() { }
63+
public EventNotFoundException() : base() { }
6464
public EventNotFoundException(string message) : base(message) { }
65-
public EventNotFoundException(string message, Exception inner) : base(message, inner) { }
65+
public EventNotFoundException(string message, System.Exception inner) : base(message, inner) { }
6666

6767
protected EventNotFoundException(System.Runtime.Serialization.SerializationInfo info,
6868
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }

EasyEvents/ScriptActions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
using EasyEvents.Types;
77
using Exiled.API.Features;
88
using MEC;
9-
using Random = UnityEngine.Random;
9+
using UnityEngine;
10+
using Random = System.Random;
1011
using Exiled.Loader;
1112
using Exiled.API.Enums;
12-
using Vector3 = UnityEngine.Vector3;
1313

1414
namespace EasyEvents
1515
{
1616
public static class ScriptActions
1717
{
18+
private static Random random = new Random();
19+
1820
public static ScriptActionsStore scriptData = new ScriptActionsStore();
1921

2022
private static Dictionary<int, ScriptActionsStore> delays = new Dictionary<int, ScriptActionsStore>();
@@ -382,7 +384,7 @@ private static void SetRoles(ScriptActionsStore dataObj)
382384

383385
for (var i = 0; i < playersTemp.Count; i++)
384386
{
385-
if (Random.Range(0, 101) > data.chance || num > data.min) continue;
387+
if (random.Next(0, 101) > data.chance || num > data.min) continue;
386388

387389
playersTemp[i].SetRole(data.role.GetRole());
388390
CustomRoles.ChangeRole(playersTemp[i], data.role.GetCustomRole());

EasyEvents/ScriptStore.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.IO;
4+
using Exiled.API.Enums;
35
using Exiled.API.Features;
46

57
namespace EasyEvents

EasyEvents/Util.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
2+
using System.Collections.Generic;
33
using System.Linq;
44
using Exiled.API.Features;
55

@@ -22,7 +22,7 @@ public static RoleInfo GetRole(this Player p)
2222
return new RoleInfo(role.id, role.classId);
2323
}
2424

25-
return new RoleInfo(null, (int) p.Role.Type);
25+
return new RoleInfo(null, (int) p.Role);
2626
}
2727

2828
public static void pop<T>(this List<T> list)

0 commit comments

Comments
 (0)