Skip to content

Commit

Permalink
Remove WhereNot extension
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardosnt committed Nov 13, 2016
1 parent 92ec44a commit 15d11a2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/Commands/CommandKillAnimals.cs
Expand Up @@ -21,7 +21,7 @@
*/
#endregion


using System.Linq;
using Essentials.Api.Command;
using Essentials.Api.Command.Source;
using Essentials.Api.Unturned;
Expand All @@ -42,7 +42,7 @@ public class CommandKillAnimals : EssCommand {
public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) {
var killedCount = 0;

UWorld.Animals.WhereNot(animal => animal.isDead).ForEach(animal => {
UWorld.Animals.Where(animal => !animal.isDead).ForEach(animal => {
AnimalManager.sendAnimalDead(animal, Vector3.zero);
killedCount++;
});
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/CommandKillZombies.cs
Expand Up @@ -21,7 +21,7 @@
*/
#endregion


using System.Linq;
using Essentials.Api.Command;
using Essentials.Api.Command.Source;
using Essentials.Api.Unturned;
Expand All @@ -42,7 +42,7 @@ public class CommandKillZombies : EssCommand {
public override CommandResult OnExecute(ICommandSource src, ICommandArgs args) {
var killedCount = 0;

UWorld.Zombies.WhereNot(zombie => zombie.isDead).ForEach(zombie => {
UWorld.Zombies.Where(zombie => !zombie.isDead).ForEach(zombie => {
ZombieManager.sendZombieDead(zombie, Vector3.zero);
killedCount++;
});
Expand Down
3 changes: 2 additions & 1 deletion src/Commands/CommandRefuelVehicle.cs
Expand Up @@ -21,6 +21,7 @@
*/
#endregion

using System.Linq;
using Essentials.Api.Command;
using Essentials.Api.Command.Source;
using Essentials.Api.Unturned;
Expand Down Expand Up @@ -60,7 +61,7 @@ public class CommandRefuelVehicle : EssCommand {

lock (UWorld.Vehicles) {
UWorld.Vehicles
.WhereNot(veh => veh.isExploded || veh.isUnderwater)
.Where(veh => !veh.isExploded && !veh.isUnderwater)
.ForEach(RefuelVehicle);

EssLang.Send(src, "VEHICLE_REFUELED_ALL");
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CommandRepairVehicle.cs
Expand Up @@ -61,7 +61,7 @@ public class CommandRepairVehicle : EssCommand {

lock (UWorld.Vehicles) {
UWorld.Vehicles
.WhereNot(veh => veh.isExploded || veh.isUnderwater)
.Where(veh => !veh.isExploded && !veh.isUnderwater)
.ToList()
.ForEach(vehicle => {
VehicleManager.sendVehicleHealth(vehicle, vehicle.asset.health);
Expand Down
4 changes: 0 additions & 4 deletions src/Common/Extensions.cs
Expand Up @@ -56,10 +56,6 @@ public static class EnumerableExtensions {
}
}

public static IEnumerable<T> WhereNot<T>(this IEnumerable<T> src, Func<T, bool> predicate) {
return src.Where(t => !predicate(t));
}

public static bool None<T>(this IEnumerable<T> src, Func<T, bool> predicate) {
return !src.Any(predicate);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/EssCore.cs
Expand Up @@ -199,7 +199,7 @@ public sealed class EssCore : RocketPlugin {
// Load native modules
Assembly.GetTypes()
.Where(t => typeof(NativeModule).IsAssignableFrom(t))
.WhereNot(t => t.IsAbstract)
.Where(t => !t.IsAbstract)
.Where(t => {
var moduleInfo = (ModuleInfo) t.GetCustomAttributes(typeof(ModuleInfo), false)[0];
return Config.EnabledSystems.Any(s => s.Equals(moduleInfo.Name, StringComparison.OrdinalIgnoreCase));
Expand Down

0 comments on commit 15d11a2

Please sign in to comment.