fix: resolve claim on load
This commit is contained in:
@@ -80,7 +80,9 @@ public class ClaimLinkCommandListener : ICommandHookListener
|
|||||||
|
|
||||||
private static void Claim(Caller caller, CmdArgs args, TextCommandResult? result)
|
private static void Claim(Caller caller, CmdArgs args, TextCommandResult? result)
|
||||||
{
|
{
|
||||||
string word = args.PeekWord();
|
string? word = args.PeekWord();
|
||||||
|
if (word == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (claimSub.TryGetValue(word, out SubHandler? handler))
|
if (claimSub.TryGetValue(word, out SubHandler? handler))
|
||||||
{
|
{
|
||||||
@@ -91,15 +93,27 @@ public class ClaimLinkCommandListener : ICommandHookListener
|
|||||||
|
|
||||||
private static void ClaimLoad(Caller caller, CmdArgs args, TextCommandResult? result)
|
private static void ClaimLoad(Caller caller, CmdArgs args, TextCommandResult? result)
|
||||||
{
|
{
|
||||||
if (result == null || result.Status != EnumCommandStatus.Success || caller.Player == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int? claimIndex = args.PopInt();
|
int? claimIndex = args.PopInt();
|
||||||
if (claimIndex == null || claimIndex < 0 || claimIndex > 999)
|
if (caller.Player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ClaimLinkModSystem.Logger.Notification($"Claim Index Loaded = {claimIndex}");
|
ClaimLinkModSystem.Logger.Notification(
|
||||||
PendingLoads[caller.Player.PlayerUID] = (int)claimIndex;
|
"CLAIM LOAD {0}",
|
||||||
|
result == null ? "BEFORE" : "AFTER"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
claimIndex != null
|
||||||
|
&& ClaimLinkModSystem.TryResolveOwnedClaim(
|
||||||
|
caller.Player.PlayerUID,
|
||||||
|
(int)claimIndex,
|
||||||
|
out _
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PendingLoads[caller.Player.PlayerUID] = (int)claimIndex;
|
||||||
|
ClaimLinkModSystem.Logger.Notification($"Claim Index Loaded = {claimIndex}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ClaimCancel(Caller caller, CmdArgs args, TextCommandResult? result)
|
private static void ClaimCancel(Caller caller, CmdArgs args, TextCommandResult? result)
|
||||||
@@ -204,6 +218,5 @@ public class ClaimLinkCommandListener : ICommandHookListener
|
|||||||
internal static void OnPlayerDisconnect(IServerPlayer player)
|
internal static void OnPlayerDisconnect(IServerPlayer player)
|
||||||
{
|
{
|
||||||
PendingLoads.Remove(player.PlayerUID);
|
PendingLoads.Remove(player.PlayerUID);
|
||||||
ClaimLinkChatCommand.PendingActions.Remove(player.PlayerUID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user