Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Fixed customroles. Exiled 9.0.0-beta.1 release #2769

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EXILED.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<PropertyGroup>
<!-- This is the global version and is used for all projects that don't have a version -->
<Version Condition="$(Version) == ''">9.0.0-alpha.19</Version>
<Version Condition="$(Version) == ''">9.0.0-beta.1</Version>
<!-- Enables public beta warning via the PUBLIC_BETA constant -->
<PublicBeta>false</PublicBeta>

Expand Down
1 change: 0 additions & 1 deletion Exiled.API/Features/Core/EActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ protected virtual void PostInitialize()
/// </summary>
protected virtual void OnBeginPlay()
{
SubscribeEvents();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Core/EObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,4 +918,4 @@ protected virtual void OnDestroyed()
{
}
}
}
}
1 change: 0 additions & 1 deletion Exiled.API/Features/Core/GameEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ public T AddComponent<T>(string name = "")
public EActor AddComponent(Type type, string name = "")
{
EActor component = EObject.CreateDefaultSubobject(type, GameObject).Cast<EActor>();
component.Base = GameObject;

if (!component)
return null;
Expand Down
13 changes: 13 additions & 0 deletions Exiled.API/Features/Core/Generic/EBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ namespace Exiled.API.Features.Core.Generic
public abstract class EBehaviour<T> : EActor
where T : GameEntity
{
/// <summary>
/// Initializes a new instance of the <see cref="EBehaviour{T}"/> class.
/// </summary>
protected EBehaviour()
{
}

/// <summary>
/// Gets or sets the owner of the <see cref="EBehaviour{T}"/>.
/// </summary>
Expand Down Expand Up @@ -78,6 +85,12 @@ protected override void PostInitialize()
}
}

/// <inheritdoc />
protected override void OnBeginPlay()
{
base.OnBeginPlay();
}

/// <inheritdoc/>
protected override void Tick()
{
Expand Down
3 changes: 0 additions & 3 deletions Exiled.CustomModules/API/Features/CustomModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ public static void LoadAll()
/// <param name="shouldBeEnabled">Determines whether the loaded modules should be enabled after loading.</param>
public static void Load(Assembly assembly = null, bool shouldBeEnabled = false)
{
Log.InfoWithContext($"Using defined assembly? {assembly is null}");
assembly ??= Assembly.GetCallingAssembly();
Log.InfoWithContext($"{assembly.GetName().Name}");

UUModuleType FindClosestModuleType(Type t, IEnumerable<FieldInfo> source)
{
Expand All @@ -331,7 +329,6 @@ UUModuleType FindClosestModuleType(Type t, IEnumerable<FieldInfo> source)

Type runtime_ModuleType = assembly.GetTypes().FirstOrDefault(t => !t.IsAbstract && typeof(UUModuleType).IsAssignableFrom(t)) ?? typeof(UUModuleType);
IEnumerable<FieldInfo> moduleTypeValuesInfo = runtime_ModuleType.GetFields(BindingFlags.Static | BindingFlags.Public).Where(f => f.GetValue(null) is UUModuleType);
Log.InfoWithContext($"DB1");

foreach (Type type in assembly.GetTypes())
{
Expand Down
22 changes: 5 additions & 17 deletions Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ protected override void PostInitialize()
protected override void OnBeginPlay()
{
base.OnBeginPlay();

if (!Owner)
{
Log.WarnWithContext("Owner is null");
Destroy();
return;
}
Expand All @@ -369,6 +369,8 @@ protected override void OnBeginPlay()
Owner.ChangeAppearance(FakeAppearance, false);

PermanentEffects?.ForEach(x => Owner.SyncEffect(x));

SubscribeEvents();
}

/// <inheritdoc/>
Expand Down Expand Up @@ -450,9 +452,6 @@ protected override void SubscribeEvents()
{
base.SubscribeEvents();

EscapingEventDispatcher.Bind(this, OnEscaping);
EscapedEventDispatcher.Bind(this, OnEscaped);

Exiled.Events.Handlers.Player.ChangingItem += ChangingItemBehaviour;
Exiled.Events.Handlers.Player.Destroying += DestroyOnLeave;
Exiled.Events.Handlers.Player.ChangingRole += DestroyOnChangingRole;
Expand All @@ -474,6 +473,8 @@ protected override void SubscribeEvents()
Exiled.Events.Handlers.Player.Handcuffing += HandcuffingBehavior;
Exiled.Events.Handlers.Map.PlacingBlood += PlacingBloodBehavior;
Exiled.Events.Handlers.Player.ChangingNickname += OnInternalChangingNickname;
EscapingEventDispatcher.Bind(this, OnEscaping);
EscapedEventDispatcher.Bind(this, OnEscaped);
}

/// <inheritdoc/>
Expand Down Expand Up @@ -759,21 +760,8 @@ protected virtual void PlacingBloodBehavior(PlacingBloodEventArgs ev)
/// <inheritdoc cref="Exiled.Events.Handlers.Player.OnEnteringPocketDimension(EnteringPocketDimensionEventArgs)"/>
protected virtual void DroppingItemBehavior(DroppingItemEventArgs ev)
{
if (ev.Item is null)
{
Log.Error("Item is null");
}

Log.InfoWithContext($"{ev.Player} is trying to drop {ev.Item.Type}");

Log.WarnWithContext(Settings.CanDropItems);
if (!Check(ev.Player) || Settings.CanDropItems)
{
Log.InfoWithContext($"{ev.Player} is not {CustomRole.Name} or can drop items as {CustomRole.Name}");
return;
}

Log.InfoWithContext($"{ev.Player} cannot drop items");

ev.IsAllowed = false;
}
Expand Down
Loading