fix build.gradle publishing wrong artifact

This commit is contained in:
Taah 2022-04-10 17:22:22 -07:00
parent f8d25491d5
commit 9b0b7537c2
4 changed files with 48 additions and 23 deletions

View File

@ -43,6 +43,7 @@ dependencies {
library "org.eclipse.jetty:jetty-proxy:11.0.9"
library "com.google.code.gson:gson:2.9.0"
compileOnly "io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT"
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
implementation "org.bstats:bstats-base:3.0.0"
implementation "org.bstats:bstats-bukkit:3.0.0"
}
@ -71,6 +72,7 @@ bukkit {
main = "dev.plex.Plex"
website = "https://plex.us.org"
authors = ["Telesphoreo", "taahanis", "super"]
softDepend = ["Vault"]
apiVersion = "1.18"
}
@ -124,18 +126,28 @@ publishing {
publications {
maven(MavenPublication) {
pom.withXml {
def dependenciesNode = asNode().appendNode("dependencies")
config.getAllDependencies().each { dependency ->
asNode().dependencies[0].appendNode("dependency").with {
dependenciesNode.appendNode("dependency").with {
it.appendNode("groupId", dependency.group)
it.appendNode("artifactId", dependency.name)
it.appendNode("version", dependency.version)
it.appendNode("scope", "provided")
}
}
configurations.getByName("implementation").getAllDependencies().each { dependency ->
dependenciesNode.appendNode("dependency").with {
it.appendNode("groupId", dependency.group)
it.appendNode("artifactId", dependency.name)
it.appendNode("version", dependency.version)
it.appendNode("scope", "runtime")
}
from(components.java)
}
}
artifacts = [shadowJar]
}
}
repositories {
maven {
def releasesRepoUrl = uri("https://nexus.telesphoreo.me/repository/plex-releases/")

View File

@ -26,8 +26,10 @@ import dev.plex.util.UpdateChecker;
import dev.plex.world.CustomWorld;
import lombok.Getter;
import lombok.Setter;
import net.milkbowl.vault.permission.Permission;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
@ -68,6 +70,8 @@ public class Plex extends JavaPlugin
private UpdateChecker updateChecker;
private String system;
private Permission permissions;
public static Plex get()
{
return plugin;
@ -122,6 +126,11 @@ public class Plex extends JavaPlugin
e.printStackTrace();
}
if (!setupPermissions() && system.equalsIgnoreCase("permissions") && !getServer().getPluginManager().isPluginEnabled("Vault"))
{
throw new RuntimeException("Vault is required to run on the server if you use 'permissions!'");
}
updateChecker = new UpdateChecker();
PlexLog.log("Update checking enabled");
@ -255,4 +264,11 @@ public class Plex extends JavaPlugin
}
}
}
public boolean setupPermissions()
{
RegisteredServiceProvider<Permission> rsp = Bukkit.getServicesManager().getRegistration(Permission.class);
permissions = rsp.getProvider();
return permissions != null;
}
}

View File

@ -167,12 +167,11 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
/*if (!player.hasPermission(perms.permission()))
if (!plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
}*/
//TODO: how do we check a bukkit telnet player's permissions? do we depend on vault?
}
} else
{
PlexLog.error("Neither permissions or ranks were selected to be used in the configuration file!");
@ -282,11 +281,10 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
/*if (!player.hasPermission(permission))
if (!plugin.getPermissions().playerHas(null, Bukkit.getOfflinePlayer(plexPlayer.getUuid()), permission))
{
throw new CommandFailException(PlexUtils.messageString("noPermissionNode", permission));
}*/
//TODO: can't check telnet player's perms w/o something like vault being depended on
}
}
}
return true;

View File

@ -9,11 +9,6 @@ import dev.plex.command.source.RequiredCommandSource;
import dev.plex.module.PlexModule;
import dev.plex.module.PlexModuleFile;
import dev.plex.rank.enums.Rank;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
import net.kyori.adventure.text.Component;
@ -23,6 +18,11 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@CommandPermissions(level = Rank.OP, permission = "plex.plex", source = RequiredCommandSource.ANY)
@CommandParameters(name = "plex", usage = "/<command> [reload | redis | modules [reload]]", description = "Show information about Plex or reload it")
public class PlexCMD extends PlexCommand
@ -57,13 +57,16 @@ public class PlexCMD extends PlexCommand
plugin.getRankManager().importDefaultRanks();
send(sender, "Imported ranks");
plugin.setSystem(plugin.config.getString("system"));
if (!plugin.setupPermissions() && plugin.getSystem().equalsIgnoreCase("permissions") && !plugin.getServer().getPluginManager().isPluginEnabled("Vault"))
{
throw new RuntimeException("Vault is required to run on the server if you use 'permissions!'");
}
plugin.getServiceManager().endServices();
plugin.getServiceManager().startServices();
PlexLog.debug("Restarted services");
send(sender, "Plex successfully reloaded.");
return null;
}
else if (args[0].equalsIgnoreCase("redis"))
} else if (args[0].equalsIgnoreCase("redis"))
{
checkRank(sender, Rank.SENIOR_ADMIN, "plex.redis");
if (!plugin.getRedisConnection().isEnabled())
@ -75,8 +78,7 @@ public class PlexCMD extends PlexCommand
send(sender, plugin.getRedisConnection().getJedis().get("test"));
plugin.getRedisConnection().getJedis().close();
return null;
}
else if (args[0].equalsIgnoreCase("modules"))
} else if (args[0].equalsIgnoreCase("modules"))
{
if (args.length == 1)
{
@ -91,8 +93,7 @@ public class PlexCMD extends PlexCommand
plugin.getModuleManager().enableModules();
return mmString("<green>All modules reloaded!");
}
}
else if (args[0].equalsIgnoreCase("update"))
} else if (args[0].equalsIgnoreCase("update"))
{
if (sender instanceof Player player && !PlexUtils.DEVELOPERS.contains(player.getUniqueId().toString()))
{
@ -104,8 +105,7 @@ public class PlexCMD extends PlexCommand
}
plugin.getUpdateChecker().updateJar(sender);
return null;
}
else
} else
{
return usage();
}
@ -118,8 +118,7 @@ public class PlexCMD extends PlexCommand
if (args.length == 1)
{
return Arrays.asList("reload", "redis", "modules");
}
else if (args[0].equalsIgnoreCase("modules"))
} else if (args[0].equalsIgnoreCase("modules"))
{
return List.of("reload");
}