Skip to content

Commit

Permalink
Revert "Revert "bump (#8)" (#9)" (#10)
Browse files Browse the repository at this point in the history
This reverts commit cfe506d.
  • Loading branch information
JohnodonCode authored Apr 28, 2022
1 parent cfe506d commit a4fc43f
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 404 deletions.
2 changes: 1 addition & 1 deletion EasyEvents/Commands/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void Run(List<string> args, int i)
else
{
List<Door2> targetDoors = new List<Door2>();
foreach(Door2 door in Map.Doors)
foreach(Door2 door in Door2.List)
{
if (door.Type == targetDoorType) targetDoors.Add(door);
}
Expand Down
6 changes: 3 additions & 3 deletions EasyEvents/CustomRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace EasyEvents
public class CustomRole
{
public List<string> members = new List<string>();
public string id = null;
public string id;
public int classId = -1;
public bool isSubclass = false;
public bool isSubclass;

public CustomRole(string id, int classId, bool isSubclass = false)
{
Expand All @@ -21,7 +21,7 @@ public CustomRole(string id, int classId, bool isSubclass = false)

public List<Player> GetMembers()
{
return this.id == "all" ? Player.List.ToList() : this.isSubclass ? AdvancedSubclassing.GetPlayers(id.Substring(2)) : Player.List.Where(p => members.Contains(p.UserId)).ToList();
return id == "all" ? Player.List.ToList() : isSubclass ? AdvancedSubclassing.GetPlayers(id.Substring(2)) : Player.List.Where(p => members.Contains(p.UserId)).ToList();
}
}
}
19 changes: 7 additions & 12 deletions EasyEvents/EasyEvents.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Exiled.API.Enums;
using Exiled.API.Features;
using Exiled.API.Interfaces;
using Exiled.Loader;
using MEC;
using EasyEvents.Handlers;
using EasyEvents.API.EventArgs;

namespace EasyEvents
{
public class EasyEvents : Plugin<Config>
{
public override string Name => "EasyEvents";
public override string Author => "Johnodon";
public override Version Version => new Version(3, 0, 0);
public override Version RequiredExiledVersion { get; } = new Version(4, 2, 2);
public override string Name { get; } = "EasyEvents";
public override string Author { get; } = "Johnodon";
public override Version Version { get; } = new Version(4, 0, 0);
public override Version RequiredExiledVersion { get; } = new Version(5, 1, 3);

public static EasyEvents Singleton;

public override void OnEnabled()
{
base.OnEnabled();
Singleton = this;
ScriptStore.LoadScripts();
ScriptActions.AddEvents();
Exiled.Events.Handlers.Server.RestartingRound += ScriptActions.Reset;
Exiled.Events.Handlers.Server.ReloadedConfigs += OnConfigUpdate;
ScriptActions.Reset();
base.OnEnabled();
}
public static void StartingEvent(StartingEventEventArgs ev)
{
Expand All @@ -37,12 +32,12 @@ public static void StartingEvent(StartingEventEventArgs ev)

public override void OnDisabled()
{
base.OnDisabled();
Singleton = null;
ScriptStore.Scripts = new Dictionary<string, string>();
ScriptActions.RemoveEvents();
Exiled.Events.Handlers.Server.RestartingRound -= ScriptActions.Reset;
Exiled.Events.Handlers.Server.ReloadedConfigs -= OnConfigUpdate;
Singleton = null;
base.OnDisabled();
}

private static void OnConfigUpdate()
Expand Down
411 changes: 63 additions & 348 deletions EasyEvents/EasyEvents.csproj

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions EasyEvents/EventCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using EasyEvents.Types;
using Exiled.Loader;
using EasyEvents.Handlers;
using EasyEvents.API;

namespace EasyEvents
{
Expand All @@ -15,8 +14,8 @@ public class EventCommand : ICommand
{
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
var permission = false;
var perPermission = false;
bool permission;
bool perPermission;

if (arguments.Array == null || arguments.Array.Length < 2)
{
Expand Down Expand Up @@ -105,8 +104,8 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
}
}

public string Command => "event";
public string[] Aliases => new string[] {"runevent", "eventrun", "events" };
public string Description => "This is the command used to run custom events with EasyEvents.";
public string Command { get; } = "event";
public string[] Aliases { get; } = {"runevent", "eventrun", "events" };
public string Description { get; } = "This is the command used to run custom events with EasyEvents.";
}
}
48 changes: 24 additions & 24 deletions EasyEvents/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,67 @@

namespace EasyEvents
{
[Serializable()]
public class InvalidArgumentLengthException : System.Exception
[Serializable]
public class InvalidArgumentLengthException : Exception
{
public InvalidArgumentLengthException() : base() { }
public InvalidArgumentLengthException() { }
public InvalidArgumentLengthException(string message) : base(message) { }
public InvalidArgumentLengthException(string message, System.Exception inner) : base(message, inner) { }
public InvalidArgumentLengthException(string message, Exception inner) : base(message, inner) { }

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

[Serializable()]
public class InvalidArgumentException : System.Exception
[Serializable]
public class InvalidArgumentException : Exception
{
public InvalidArgumentException() : base() { }
public InvalidArgumentException() { }
public InvalidArgumentException(string message) : base(message) { }
public InvalidArgumentException(string message, System.Exception inner) : base(message, inner) { }
public InvalidArgumentException(string message, Exception inner) : base(message, inner) { }

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

[Serializable()]
public class InvalidCommandException : System.Exception
[Serializable]
public class InvalidCommandException : Exception
{
public InvalidCommandException() : base() { }
public InvalidCommandException() { }
public InvalidCommandException(string message) : base(message) { }
public InvalidCommandException(string message, System.Exception inner) : base(message, inner) { }
public InvalidCommandException(string message, Exception inner) : base(message, inner) { }

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

[Serializable()]
public class CommandErrorException : System.Exception
[Serializable]
public class CommandErrorException : Exception
{
public CommandErrorException() : base() { }
public CommandErrorException() { }
public CommandErrorException(string message) : base(message) { }
public CommandErrorException(string message, System.Exception inner) : base(message, inner) { }
public CommandErrorException(string message, Exception inner) : base(message, inner) { }

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

[Serializable()]
public class EventRunErrorException : System.Exception
[Serializable]
public class EventRunErrorException : Exception
{
public EventRunErrorException() : base() { }
public EventRunErrorException() { }
public EventRunErrorException(string message) : base(message) { }
public EventRunErrorException(string message, System.Exception inner) : base(message, inner) { }
public EventRunErrorException(string message, Exception inner) : base(message, inner) { }

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

[Serializable()]
public class EventNotFoundException : System.Exception
[Serializable]
public class EventNotFoundException : Exception
{
public EventNotFoundException() : base() { }
public EventNotFoundException() { }
public EventNotFoundException(string message) : base(message) { }
public EventNotFoundException(string message, System.Exception inner) : base(message, inner) { }
public EventNotFoundException(string message, Exception inner) : base(message, inner) { }

protected EventNotFoundException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
Expand Down
8 changes: 3 additions & 5 deletions EasyEvents/ScriptActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
using EasyEvents.Types;
using Exiled.API.Features;
using MEC;
using UnityEngine;
using Random = System.Random;
using Random = UnityEngine.Random;
using Exiled.Loader;
using Exiled.API.Enums;
using Vector3 = UnityEngine.Vector3;

namespace EasyEvents
{
public static class ScriptActions
{
private static Random random = new Random();

public static ScriptActionsStore scriptData = new ScriptActionsStore();

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

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

playersTemp[i].SetRole(data.role.GetRole());
CustomRoles.ChangeRole(playersTemp[i], data.role.GetCustomRole());
Expand Down
4 changes: 1 addition & 3 deletions EasyEvents/ScriptStore.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using Exiled.API.Enums;
using Exiled.API.Features;

namespace EasyEvents
Expand Down
4 changes: 2 additions & 2 deletions EasyEvents/Util.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Exiled.API.Features;

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

return new RoleInfo(null, (int) p.Role);
return new RoleInfo(null, (int) p.Role.Type);
}

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

0 comments on commit a4fc43f

Please sign in to comment.