mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-08-19 21:01:23 +02:00
Implement jar-in-jar loader system (#2899)
This fixes an issue that prevented LuckPerms from loading on Java 16
This commit is contained in:
33
bukkit/loader/build.gradle
Normal file
33
bukkit/loader/build.gradle
Normal file
@@ -0,0 +1,33 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url 'https://papermc.io/repo/repository/maven-public/' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'com.destroystokyo.paper:paper-api:1.15.2-R0.1-SNAPSHOT'
|
||||
|
||||
compile project(':api')
|
||||
compile project(':common:loader-utils')
|
||||
}
|
||||
|
||||
processResources {
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
expand 'pluginVersion': project.ext.fullVersion
|
||||
include 'plugin.yml'
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveName = "LuckPerms-Bukkit-${project.ext.fullVersion}.jar"
|
||||
|
||||
from {
|
||||
project(':bukkit').tasks.shadowJar.archiveFile
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives shadowJar
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.bukkit.loader;
|
||||
|
||||
import me.lucko.luckperms.common.loader.JarInJarClassLoader;
|
||||
import me.lucko.luckperms.common.loader.LoaderBootstrap;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class BukkitLoaderPlugin extends JavaPlugin {
|
||||
private static final String JAR_NAME = "luckperms-bukkit.jarinjar";
|
||||
private static final String BOOTSTRAP_CLASS = "me.lucko.luckperms.bukkit.LPBukkitBootstrap";
|
||||
|
||||
private final LoaderBootstrap plugin;
|
||||
|
||||
public BukkitLoaderPlugin() {
|
||||
JarInJarClassLoader loader = new JarInJarClassLoader(getClass().getClassLoader(), JAR_NAME);
|
||||
this.plugin = loader.instantiatePlugin(BOOTSTRAP_CLASS, JavaPlugin.class, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
this.plugin.onLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.plugin.onEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
this.plugin.onDisable();
|
||||
}
|
||||
|
||||
}
|
||||
29
bukkit/loader/src/main/resources/plugin.yml
Normal file
29
bukkit/loader/src/main/resources/plugin.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
name: LuckPerms
|
||||
version: ${pluginVersion}
|
||||
description: A permissions plugin
|
||||
author: Luck
|
||||
website: https://luckperms.net
|
||||
main: me.lucko.luckperms.bukkit.loader.BukkitLoaderPlugin
|
||||
load: STARTUP
|
||||
|
||||
# Mark the plugin as 1.13 compatible to avoid CB having to perform quite as much unnecessary
|
||||
# remapping when the plugin is loaded. Note that despite what this setting might otherwise imply,
|
||||
# LP is still compatible with pre-1.13 releases.
|
||||
api-version: 1.13
|
||||
|
||||
# Load LuckPerms before Vault. This means that all plugins that (soft-)depend
|
||||
# on Vault depend on LuckPerms too.
|
||||
#
|
||||
# This fixes issues caused by plugins obtaining the Vault service provider instance
|
||||
# only once when they initially enable. (if they haven't depended on LP, our registration
|
||||
# won't be there yet)
|
||||
loadbefore: [Vault]
|
||||
|
||||
# Soft depend on LilyPad for messaging service impl
|
||||
# Soft depend on ViaVersion for adventure protocol facet
|
||||
softdepend: [LilyPad-Connect, ViaVersion]
|
||||
|
||||
commands:
|
||||
luckperms:
|
||||
description: Manage permissions
|
||||
aliases: [lp, perm, perms, permission, permissions]
|
||||
Reference in New Issue
Block a user