From d046c9c03a180f4cc35c39907071ed6691c46fc5 Mon Sep 17 00:00:00 2001 From: Pyrbu Date: Thu, 20 Apr 2023 19:52:37 +0100 Subject: [PATCH] remove nms dependency, fix basic 1.8 support by shading libraries, remove idea files --- .gitignore | 4 +- .idea/.gitignore | 3 - .idea/discord.xml | 7 - .idea/gradle.xml | 18 --- .idea/inspectionProfiles/Project_Default.xml | 50 ------- .idea/misc.xml | 13 -- .idea/uiDesigner.xml | 124 ------------------ .idea/vcs.xml | 6 - build.gradle | 15 ++- .../commands/list/DefaultCommand.java | 2 +- .../github/znetworkw/znpcservers/npc/NPC.java | 7 +- .../znetworkw/znpcservers/utility/Utils.java | 2 +- 12 files changed, 21 insertions(+), 230 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/discord.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/uiDesigner.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index 595ede8..f3a0418 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ build/ !**/src/test/**/build/ ### IntelliJ IDEA ### +/.idea/* .idea/modules.xml .idea/jarRepositories.xml .idea/compiler.xml @@ -41,4 +42,5 @@ bin/ ### Mac OS ### .DS_Store -/run/ \ No newline at end of file +/run/ +/.idea/ diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/discord.xml b/.idea/discord.xml deleted file mode 100644 index d8e9561..0000000 --- a/.idea/discord.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 26dd40c..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index a414ae3..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 59d7055..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 2b63946..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1539ab1..f5bcd36 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { id "java" id "com.github.johnrengelman.shadow" version "8.1.1" - id "io.papermc.paperweight.userdev" version "1.5.4" id "xyz.jpenilla.run-paper" version "2.0.1" } @@ -16,9 +15,16 @@ repositories { } dependencies { - paperweight.paperDevBundle "1.19.4-R0.1-SNAPSHOT" compileOnly "io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT" compileOnly "me.clip:placeholderapi:2.11.1" + + compileOnly "com.mojang:authlib:3.4.40" + compileOnly "com.mojang:datafixerupper:6.0.8" + compileOnly "io.netty:netty-all:4.1.87.Final" + + implementation "org.apache.commons:commons-lang3:3.12.0" + implementation "commons-io:commons-io:2.11.0" + implementation "com.google.code.gson:gson:2.10.1" implementation "org.bstats:bstats-bukkit:3.0.2" } @@ -30,7 +36,10 @@ compileJava { } shadowJar { + archiveClassifier.set "" relocate "org.bstats", "lol.pyr.znpcsplus.lib.bstats" + relocate "org.apache.commons", "lol.pyr.znpcsplus.lib.commons" + relocate "com.google.gson", "lol.pyr.znpcsplus.lib.gson" minimize() } @@ -42,5 +51,5 @@ runServer { minecraftVersion "1.19.4" } -tasks.assemble.dependsOn reobfJar +tasks.assemble.dependsOn shadowJar tasks.compileJava.dependsOn clean diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java b/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java index 4c0a0e2..1b35497 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java @@ -47,7 +47,7 @@ public class DefaultCommand extends Command { @CommandInformation(arguments = {}, name = "", permission = "") public void defaultCommand(CommandSender sender, Map args) { sender.sendMessage("&6&m------------------------------------------"); - sender.sendMessage("&b&lZNPCS &8\u00BB &7ZNetwork & Pyr"); + sender.sendMessage("&b&lZNPCsPlus &8\u00BB &7ZNetwork & Pyr"); sender.sendMessage("&6https://www.spigotmc.org/resources/znpcsplus.109380/"); Objects.requireNonNull(sender); getCommands().forEach(sender::sendMessage); diff --git a/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java b/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java index 3bfefa0..8e52fea 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java +++ b/src/main/java/io/github/znetworkw/znpcservers/npc/NPC.java @@ -13,6 +13,7 @@ import io.github.znetworkw.znpcservers.user.ZUser; import io.github.znetworkw.znpcservers.utility.Utils; import io.github.znetworkw.znpcservers.utility.location.ZLocation; import lol.pyr.znpcsplus.ZNPCsPlus; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -20,6 +21,7 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +@SuppressWarnings("deprecation") public class NPC { private static final ConcurrentMap NPC_MAP = new ConcurrentHashMap<>(); private final Set viewers = new HashSet<>(); @@ -69,9 +71,8 @@ public class NPC { } public void onLoad() { - if (NPC_MAP.containsKey(getNpcPojo().getId())) - throw new IllegalStateException("npc with id " + getNpcPojo().getId() + " already exists."); - this.gameProfile = new GameProfile(UUID.randomUUID(), "[ZNPC] " + this.npcName); + if (NPC_MAP.containsKey(getNpcPojo().getId())) throw new IllegalStateException("npc with id " + getNpcPojo().getId() + " already exists."); + this.gameProfile = new GameProfile(UUID.randomUUID(), ChatColor.GRAY + "[ZNPC] " + this.npcName); this.gameProfile.getProperties().put("textures", new Property("textures", this.npcPojo.getSkin(), this.npcPojo.getSignature())); changeType(this.npcPojo.getNpcType()); updateProfile(this.gameProfile.getProperties()); diff --git a/src/main/java/io/github/znetworkw/znpcservers/utility/Utils.java b/src/main/java/io/github/znetworkw/znpcservers/utility/Utils.java index 522f93e..1cfa916 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/utility/Utils.java +++ b/src/main/java/io/github/znetworkw/znpcservers/utility/Utils.java @@ -4,7 +4,7 @@ import io.github.znetworkw.znpcservers.cache.CacheRegistry; import io.github.znetworkw.znpcservers.configuration.ConfigurationConstants; import io.github.znetworkw.znpcservers.user.ZUser; import me.clip.placeholderapi.PlaceholderAPI; -import org.apache.commons.lang.math.NumberUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player;