This commit is contained in:
zznty
2023-11-20 19:36:35 +07:00
parent 3e09ef63fb
commit e1ca099dd9
14 changed files with 45 additions and 15 deletions

View File

@@ -4,6 +4,8 @@ using System.Linq;
using ikvm.extensions;
using ikvm.runtime;
using java.lang;
using LuckPerms.Torch.Api;
using LuckPerms.Torch.Api.Managers;
using LuckPerms.Torch.Extensions;
using LuckPerms.Torch.Utils.Extensions;
using Torch.API;
@@ -22,7 +24,7 @@ public class ModApiManager : IManager
MyScriptCompiler.Static.AddReferencedAssemblies(
typeof(net.luckperms.api.LuckPerms).Assembly.Location, // net.luckperms.api.dll
typeof(java.lang.Boolean).Assembly.Location, // IKVM.Java.dll
typeof(ModApiManager).Assembly.Location, // LuckPerms.Torch.dll
typeof(ILuckPermsPlatformManager).Assembly.Location, // LuckPerms.Torch.Utils.dll
typeof(ITorchBase).Assembly.Location // Torch.API.dll
);
@@ -48,7 +50,7 @@ public class ModApiManager : IManager
whitelist.AllowNamespaceOfTypes(MyWhitelistTarget.ModApi, typeof(UuidExtensions));
whitelist.AllowTypes(MyWhitelistTarget.ModApi, typeof(TorchApi), typeof(IDependencyProvider), typeof(IManager),
typeof(DependencyProviderExtensions), typeof(IMultiplayerManagerServer), typeof(IMultiplayerManagerBase),
typeof(IPlayer), typeof(ConnectionState));
typeof(IPlayer), typeof(ConnectionState), typeof(ILpPlayerModel));
}
public void Detach()

View File

@@ -1,12 +0,0 @@
using Torch;
using Torch.API.Managers;
namespace LuckPerms.Torch.ModApi;
public static class TorchApi
{
public static IDependencyProvider Managers =>
#pragma warning disable CS0618 // Type or member is obsolete
TorchBase.Instance.CurrentSession?.Managers ?? TorchBase.Instance.Managers;
#pragma warning restore CS0618 // Type or member is obsolete
}

View File

@@ -1,4 +1,5 @@
using LuckPerms.Torch.Impl;
using LuckPerms.Torch.Api;
using LuckPerms.Torch.Impl;
using me.lucko.luckperms.common.context.manager;
using me.lucko.luckperms.common.model;
using me.lucko.luckperms.common.verbose.@event;
@@ -8,7 +9,7 @@ using Torch.ViewModels;
namespace LuckPerms.Torch.PlatformApi;
public class LpPlayerModel(ulong steamId, string? name = null) : PlayerViewModel(steamId, name)
public class LpPlayerModel(ulong steamId, string? name = null) : PlayerViewModel(steamId, name), ILpPlayerModel
{
public QueryOptionsCache? QueryOptionsCache { get; private set; }
public User? LpUser { get; private set; }

View File

@@ -1,18 +1,21 @@
using System.IO;
using System;
using System.IO;
using java.lang;
using LuckPerms.Torch.Api.Managers;
using LuckPerms.Torch.Impl;
using NLog;
using Torch;
using Torch.API;
using Torch.API.Managers;
using Exception = System.Exception;
namespace LuckPerms.Torch.PlatformApi;
public class LuckPermsPlatformManager : IManager
public class LuckPermsPlatformManager : ILuckPermsPlatformManager
{
private readonly ILogger _log = LogManager.GetCurrentClassLogger();
private readonly LpTorchBootstrap _bootstrap;
public net.luckperms.api.LuckPerms Api => _bootstrap.EnableLatch.getCount() == 0 ? _bootstrap.Plugin.getApiProvider() : throw new InvalidOperationException("Api is not initialized");
public LuckPermsPlatformManager(TorchPluginBase plugin, ITorchServer server, ILogger log)
{

View File

@@ -2,5 +2,5 @@
<PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>LuckPerms.Torch</Name>
<Guid>7E4B3CC8-64FA-416E-8910-AACDF2DA5E2C</Guid>
<Version>v5.4.106.5</Version>
<Version>v5.4.106.6</Version>
</PluginManifest>