diff --git a/build.gradle.kts b/build.gradle.kts index ec183a4..260f1ab 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,23 +1,17 @@ +import xyz.jpenilla.runpaper.task.RunServer + plugins { id("java") id("com.github.johnrengelman.shadow") version "8.1.1" - id("io.papermc.paperweight.userdev") version "1.5.5" apply false - id("xyz.jpenilla.run-paper") version "2.1.0" apply false + id("io.papermc.paperweight.userdev") version "1.5.5" + id("xyz.jpenilla.run-paper") version "2.1.0" + id("net.minecrell.plugin-yml.bukkit") version "0.6.0" } group = "dev.plex" -version = "2.1" - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) -} - -subprojects { - apply(plugin = "java") - apply(plugin = "com.github.johnrengelman.shadow") - apply(plugin = "io.papermc.paperweight.userdev") - apply(plugin = "xyz.jpenilla.run-paper") +version = "2.2" +allprojects { repositories { mavenCentral() @@ -27,16 +21,24 @@ subprojects { maven { url = uri("https://maven.playpro.com/") + content { + includeGroup("net.coreprotect") + } } } +} + +subprojects { + apply(plugin = "java") + apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "io.papermc.paperweight.userdev") dependencies { if (project.name != "shared") { implementation(project(":shared")) } - - compileOnly("net.coreprotect:coreprotect:21.3") } + tasks { assemble { dependsOn("reobfJar") @@ -44,11 +46,44 @@ subprojects { } } +java { + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + +bukkit { + name = "ItemizerX" + version = rootProject.version.toString() + description = "A new way to edit your items" + authors = listOf("Focusvity", "Telesphoreo") + main = "dev.plex.itemizerx.ItemizerX" + apiVersion = "1.17" + foliaSupported = true + softDepend = listOf("CoreProtect") + commands { + register("itemizer") { + description = "The main command for ItemizerX" + aliases = listOf("ii", "it") + usage = "/" + } + } +} + +// Adapted from PlotSquared +val supportedVersions = listOf("1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20", "1.20.1") tasks { - shadowJar { - archiveBaseName.set("ItemizerX") - archiveClassifier.set("") - archiveVersion.set("") + supportedVersions.forEach { + register("runServer-$it") { + minecraftVersion(it) + pluginJars(layout.buildDirectory.file("libs/ItemizerX-${rootProject.version}.jar")) + jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true") + group = "run paper" + runDirectory.set(file("run-$it")) + } + } + + assemble { + dependsOn("shadowJar") + dependsOn("reobfJar") } compileJava { @@ -56,23 +91,21 @@ tasks { options.release.set(17) } - assemble { - dependsOn("shadowJar") - } - - jar { - enabled = false + shadowJar { + relocate("org.bstats", "dev.plex") } } dependencies { - implementation(project(path = ":core", configuration = "shadow")) + paperDevBundle("1.20.1-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") + compileOnly("net.coreprotect:coreprotect:21.3") + implementation("org.bstats:bstats-base:3.0.2") + implementation("org.bstats:bstats-bukkit:3.0.2") implementation(project(path = ":shared", configuration = "shadow")) implementation(project(path = ":v1_20_R1", configuration = "shadow")) implementation(project(path = ":v1_19_R3", configuration = "shadow")) implementation(project(path = ":v1_19_R2", configuration = "shadow")) implementation(project(path = ":v1_19_R1", configuration = "shadow")) implementation(project(path = ":v1_18_R2", configuration = "shadow")) - implementation(project(path = ":v1_18_R1", configuration = "shadow")) - implementation(project(path = ":v1_17_R1", configuration = "shadow")) } \ No newline at end of file diff --git a/core/.gitignore b/core/.gitignore deleted file mode 100644 index b63da45..0000000 --- a/core/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ - -### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ -*.iws -*.iml -*.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ - -### Eclipse ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -bin/ -!**/src/main/**/bin/ -!**/src/test/**/bin/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ - -### Mac OS ### -.DS_Store \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts deleted file mode 100644 index a2c25c9..0000000 --- a/core/build.gradle.kts +++ /dev/null @@ -1,13 +0,0 @@ -apply(plugin = "io.papermc.paperweight.userdev") - -dependencies { - implementation(project(":v1_20_R1")) - implementation(project(":v1_19_R3")) - implementation(project(":v1_19_R2")) - implementation(project(":v1_19_R1")) - implementation(project(":v1_18_R2")) - implementation(project(":v1_18_R1")) - implementation(project(":v1_17_R1")) - compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") - paperDevBundle("1.20.1-R0.1-SNAPSHOT") -} \ No newline at end of file diff --git a/core/src/main/resources/plugin.yml b/core/src/main/resources/plugin.yml deleted file mode 100644 index 885d52e..0000000 --- a/core/src/main/resources/plugin.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: ItemizerX -version: 2.1 -api-version: 1.17 -description: A rewrite of Itemizer -author: Focusvity, Telesphoreo -main: dev.plex.itemizerx.ItemizerX -folia-supported: true -softdepend: - - CoreProtect -commands: - itemizer: - description: The main command for ItemizerX - usage: / - aliases: [ii, it] diff --git a/settings.gradle.kts b/settings.gradle.kts index 842b0ac..088735d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,14 +3,11 @@ plugins { } rootProject.name = "ItemizerX" -include("core") include("shared") include("v1_20_R1") include("v1_19_R3") include("v1_19_R2") include("v1_19_R1") include("v1_18_R2") -include("v1_18_R1") -include("v1_17_R1") diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 7d01ba5..ce07f75 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,6 +1,5 @@ -apply(plugin = "io.papermc.paperweight.userdev") - dependencies { compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") paperDevBundle("1.20.1-R0.1-SNAPSHOT") + compileOnly("net.coreprotect:coreprotect:21.3") } \ No newline at end of file diff --git a/core/src/main/java/dev/plex/itemizerx/ItemizerX.java b/src/main/java/dev/plex/itemizerx/ItemizerX.java similarity index 61% rename from core/src/main/java/dev/plex/itemizerx/ItemizerX.java rename to src/main/java/dev/plex/itemizerx/ItemizerX.java index 131a3d3..aca13fc 100644 --- a/core/src/main/java/dev/plex/itemizerx/ItemizerX.java +++ b/src/main/java/dev/plex/itemizerx/ItemizerX.java @@ -1,68 +1,70 @@ package dev.plex.itemizerx; +import org.bstats.bukkit.Metrics; import org.bukkit.plugin.java.JavaPlugin; -public class ItemizerX extends JavaPlugin { +public class ItemizerX extends JavaPlugin +{ public static ItemizerX plugin; CoreProtectBridge cpb = new CoreProtectBridge(); IAttributeManager attr; @Override - public void onLoad() { + public void onLoad() + { plugin = this; } @Override - public void onEnable() { + public void onEnable() + { plugin = this; + // Metrics at https://bstats.org/plugin/bukkit/ItemizerX/19104 + new Metrics(this, 19104); cpb.getCoreProtect(); getCommand("itemizer").setExecutor(new ItemizerXCommand()); getCommand("itemizer").setTabCompleter(new ItemizerXTab()); - switch (getNMSVersion()) { - case "v1_20_R1": { + switch (getNMSVersion()) + { + case "v1_20_R1" -> + { attr = new dev.plex.itemizerx.v1_20_R1.AttributeManager(); - return; } - case "v1_19_R3": { + case "v1_19_R3" -> + { attr = new dev.plex.itemizerx.v1_19_R3.AttributeManager(); - return; } - case "v1_19_R2": { + case "v1_19_R2" -> + { attr = new dev.plex.itemizerx.v1_19_R2.AttributeManager(); - return; } - case "v1_19_R1": { + case "v1_19_R1" -> + { attr = new dev.plex.itemizerx.v1_19_R1.AttributeManager(); - return; } - case "v1_18_R2": { + case "v1_18_R2" -> + { attr = new dev.plex.itemizerx.v1_18_R2.AttributeManager(); - return; } - case "v1_18_R1": { - attr = new dev.plex.itemizerx.v1_18_R1.AttributeManager(); - return; - } - case "v1_17_R1": { - attr = new dev.plex.itemizerx.v1_17_R1.AttributeManager(); - return; - } - default: { + default -> + { getLogger().severe("You are trying to run ItemizerX on an incompatible server version."); - getLogger().severe("ItemizerX only supports versions 1.17 to 1.20.1, disabling plugin."); + getLogger().severe("ItemizerX only supports versions 1.18.2 to 1.20.1, disabling plugin."); getServer().getPluginManager().disablePlugin(this); } } } - public String getNMSVersion() { + public String getNMSVersion() + { String v = getServer().getClass().getPackage().getName(); return v.substring(v.lastIndexOf('.') + 1); } @Override - public void onDisable() { + public void onDisable() + { plugin = null; } } diff --git a/core/src/main/java/dev/plex/itemizerx/ItemizerXBase.java b/src/main/java/dev/plex/itemizerx/ItemizerXBase.java similarity index 100% rename from core/src/main/java/dev/plex/itemizerx/ItemizerXBase.java rename to src/main/java/dev/plex/itemizerx/ItemizerXBase.java diff --git a/core/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java b/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java similarity index 99% rename from core/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java rename to src/main/java/dev/plex/itemizerx/ItemizerXCommand.java index 0d790b4..d2d666e 100644 --- a/core/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java +++ b/src/main/java/dev/plex/itemizerx/ItemizerXCommand.java @@ -518,6 +518,7 @@ public class ItemizerXCommand implements CommandExecutor, ItemizerXBase sender.sendMessage(mm.deserialize("You don't have permission to use this command!")); return true; } + // NPE to fix here plugin.attr.removeAttr(player, args[2]); return true; } diff --git a/core/src/main/java/dev/plex/itemizerx/ItemizerXTab.java b/src/main/java/dev/plex/itemizerx/ItemizerXTab.java similarity index 100% rename from core/src/main/java/dev/plex/itemizerx/ItemizerXTab.java rename to src/main/java/dev/plex/itemizerx/ItemizerXTab.java diff --git a/v1_17_R1/.gitignore b/v1_17_R1/.gitignore deleted file mode 100644 index b63da45..0000000 --- a/v1_17_R1/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ - -### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ -*.iws -*.iml -*.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ - -### Eclipse ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -bin/ -!**/src/main/**/bin/ -!**/src/test/**/bin/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ - -### Mac OS ### -.DS_Store \ No newline at end of file diff --git a/v1_17_R1/build.gradle.kts b/v1_17_R1/build.gradle.kts deleted file mode 100644 index ec08643..0000000 --- a/v1_17_R1/build.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -apply(plugin = "io.papermc.paperweight.userdev") -apply(plugin = "xyz.jpenilla.run-paper") - -dependencies { - paperDevBundle("1.17.1-R0.1-SNAPSHOT") - implementation("net.kyori:adventure-text-minimessage:4.14.0") -} \ No newline at end of file diff --git a/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java b/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java deleted file mode 100644 index ac44e51..0000000 --- a/v1_17_R1/src/main/java/dev/plex/itemizerx/v1_17_R1/AttributeManager.java +++ /dev/null @@ -1,167 +0,0 @@ -package dev.plex.itemizerx.v1_17_R1; - -import dev.plex.itemizerx.Attributes; -import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import net.kyori.adventure.text.minimessage.MiniMessage; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.ItemStack; -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; -import org.bukkit.entity.Player; - -public class AttributeManager implements IAttributeManager -{ - private final MiniMessage mm = MiniMessage.miniMessage(); - - @Override - public ListTag getAttrList(final ItemStack item) - { - ListTag attrmod = item.getOrCreateTag().getList("AttributeModifiers", 10); - if (attrmod == null) - { - item.getTag().put("AttributeModifiers", new CompoundTag()); - } - return item.getTag().getList("AttributeModifiers", 10); - } - - @Override - public void addAttr(final Player player, final String[] args) - { - int op; - if (args.length < 4) - { - player.sendMessage(mm.deserialize("/itemizer attr add <name> <strength>" + - "[slot] - Add an attribute")); - return; - } - final Attributes a = Attributes.get(args[2]); - if (a == null) - { - player.sendMessage(mm.deserialize("\"" + args[2] + "\" is not a valid attribute type.")); - return; - } - double amount; - try - { - amount = Double.parseDouble(args[3]); - } - catch (NumberFormatException ex) - { - player.sendMessage(mm.deserialize("\"" + args[3] + "\" is not a valid number.")); - return; - } - if (Double.isNaN(amount)) - { - player.sendMessage(mm.deserialize("Please do not use 'NaN (Not a Number)'")); - return; - } - final ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand()); - final ListTag attrmod = getAttrList(nms); - for (Tag nbtBase : attrmod) - { - final CompoundTag c = (CompoundTag)nbtBase; - if (c.getString("Name").equals(args[2])) - { - player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); - return; - } - } - final CompoundTag c = new CompoundTag(); - c.putString("Name", args[2]); - c.putString("AttributeName", a.mcName); - c.putDouble("Amount", amount); - op = a.op; - c.putInt("Operation", op); - final Random random = new Random(); - c.putIntArray("UUID", new int[] - { - random.nextInt(), - random.nextInt(), - random.nextInt(), - random.nextInt() - }); - if (args.length == 5) - { - final List options = new ArrayList<>(); - options.add("mainhand"); - options.add("offhand"); - options.add("head"); - options.add("chest"); - options.add("legs"); - options.add("feet"); - if (!options.contains(args[4].toLowerCase())) - { - player.sendMessage(mm.deserialize("Supported options:")); - player.sendMessage(mm.deserialize("" + StringUtils.join(options, ", "))); - return; - } - c.putString("Slot", args[4].toLowerCase()); - } - attrmod.add(c); - nms.getTag().put("AttributeModifiers", attrmod); - final org.bukkit.inventory.ItemStack is = CraftItemStack.asCraftMirror(nms); - player.getInventory().setItemInMainHand(is); - player.sendMessage(mm.deserialize("Attribute added!")); - } - - @Override - public void removeAttr(final Player player, final String string) - { - final ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand()); - final ListTag attrmod = getAttrList(nms); - final ListTag newList = new ListTag(); - boolean r = false; - for (Tag nbtBase : attrmod) - { - final CompoundTag c = (CompoundTag)nbtBase; - if (!c.getString("Name").equals(string)) - { - newList.add(nbtBase); - } - else - { - r = true; - } - } - if (!r) - { - player.sendMessage(mm.deserialize("The attribute \"" + string + "\" doesn't exist!")); - return; - } - nms.getTag().put("AttributeModifiers", newList); - final org.bukkit.inventory.ItemStack is = CraftItemStack.asCraftMirror(nms); - player.getInventory().setItemInMainHand(is); - player.sendMessage(mm.deserialize("Attribute removed!")); - } - - @Override - public void listAttr(final Player player) - { - final ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand()); - final ListTag attrmod = getAttrList(nms); - if (attrmod.size() == 0) - { - player.sendMessage(mm.deserialize("This item has no attributes.")); - return; - } - player.sendMessage(mm.deserialize("Item attributes: ")); - for (Tag nbtBase : attrmod) - { - final CompoundTag c = (CompoundTag)nbtBase; - player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName - + ", " + c.getDouble("Amount"))); - } - } - - @Override - public String colorize(String string) - { - return ChatColor.translateAlternateColorCodes('&', string); - } -} diff --git a/v1_18_R1/.gitignore b/v1_18_R1/.gitignore deleted file mode 100644 index b63da45..0000000 --- a/v1_18_R1/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ - -### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ -*.iws -*.iml -*.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ - -### Eclipse ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache -bin/ -!**/src/main/**/bin/ -!**/src/test/**/bin/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ - -### Mac OS ### -.DS_Store \ No newline at end of file diff --git a/v1_18_R1/build.gradle.kts b/v1_18_R1/build.gradle.kts deleted file mode 100644 index c4b5b6d..0000000 --- a/v1_18_R1/build.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -apply(plugin = "io.papermc.paperweight.userdev") -apply(plugin = "xyz.jpenilla.run-paper") - -dependencies { - paperDevBundle("1.18.1-R0.1-SNAPSHOT") - implementation("net.kyori:adventure-text-minimessage:4.14.0") -} \ No newline at end of file diff --git a/v1_18_R1/src/main/java/dev/plex/itemizerx/v1_18_R1/AttributeManager.java b/v1_18_R1/src/main/java/dev/plex/itemizerx/v1_18_R1/AttributeManager.java deleted file mode 100644 index d38af25..0000000 --- a/v1_18_R1/src/main/java/dev/plex/itemizerx/v1_18_R1/AttributeManager.java +++ /dev/null @@ -1,167 +0,0 @@ -package dev.plex.itemizerx.v1_18_R1; - -import dev.plex.itemizerx.Attributes; -import dev.plex.itemizerx.IAttributeManager; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import net.kyori.adventure.text.minimessage.MiniMessage; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.ItemStack; -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; -import org.bukkit.entity.Player; - -public class AttributeManager implements IAttributeManager -{ - private final MiniMessage mm = MiniMessage.miniMessage(); - - @Override - public ListTag getAttrList(final ItemStack item) - { - ListTag attrmod = item.getOrCreateTag().getList("AttributeModifiers", 10); - if (attrmod == null) - { - item.getTag().put("AttributeModifiers", new CompoundTag()); - } - return item.getTag().getList("AttributeModifiers", 10); - } - - @Override - public void addAttr(final Player player, final String[] args) - { - int op; - if (args.length < 4) - { - player.sendMessage(mm.deserialize("/itemizer attr add <name> <strength>" + - "[slot] - Add an attribute")); - return; - } - final Attributes a = Attributes.get(args[2]); - if (a == null) - { - player.sendMessage(mm.deserialize("\"" + args[2] + "\" is not a valid attribute type.")); - return; - } - double amount; - try - { - amount = Double.parseDouble(args[3]); - } - catch (NumberFormatException ex) - { - player.sendMessage(mm.deserialize("\"" + args[3] + "\" is not a valid number.")); - return; - } - if (Double.isNaN(amount)) - { - player.sendMessage(mm.deserialize("Please do not use 'NaN (Not a Number)'")); - return; - } - final ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand()); - final ListTag attrmod = getAttrList(nms); - for (Tag nbtBase : attrmod) - { - final CompoundTag c = (CompoundTag)nbtBase; - if (c.getString("Name").equals(args[2])) - { - player.sendMessage(mm.deserialize("An attribute with the name \"" + args[2] + "\" already exists!")); - return; - } - } - final CompoundTag c = new CompoundTag(); - c.putString("Name", args[2]); - c.putString("AttributeName", a.mcName); - c.putDouble("Amount", amount); - op = a.op; - c.putInt("Operation", op); - final Random random = new Random(); - c.putIntArray("UUID", new int[] - { - random.nextInt(), - random.nextInt(), - random.nextInt(), - random.nextInt() - }); - if (args.length == 5) - { - final List options = new ArrayList<>(); - options.add("mainhand"); - options.add("offhand"); - options.add("head"); - options.add("chest"); - options.add("legs"); - options.add("feet"); - if (!options.contains(args[4].toLowerCase())) - { - player.sendMessage(mm.deserialize("Supported options:")); - player.sendMessage(mm.deserialize("" + StringUtils.join(options, ", "))); - return; - } - c.putString("Slot", args[4].toLowerCase()); - } - attrmod.add(c); - nms.getTag().put("AttributeModifiers", attrmod); - final org.bukkit.inventory.ItemStack is = CraftItemStack.asCraftMirror(nms); - player.getInventory().setItemInMainHand(is); - player.sendMessage(mm.deserialize("Attribute added!")); - } - - @Override - public void removeAttr(final Player player, final String string) - { - final ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand()); - final ListTag attrmod = getAttrList(nms); - final ListTag newList = new ListTag(); - boolean r = false; - for (Tag nbtBase : attrmod) - { - final CompoundTag c = (CompoundTag)nbtBase; - if (!c.getString("Name").equals(string)) - { - newList.add(nbtBase); - } - else - { - r = true; - } - } - if (!r) - { - player.sendMessage(mm.deserialize("The attribute \"" + string + "\" doesn't exist!")); - return; - } - nms.getTag().put("AttributeModifiers", newList); - final org.bukkit.inventory.ItemStack is = CraftItemStack.asCraftMirror(nms); - player.getInventory().setItemInMainHand(is); - player.sendMessage(mm.deserialize("Attribute removed!")); - } - - @Override - public void listAttr(final Player player) - { - final ItemStack nms = CraftItemStack.asNMSCopy(player.getInventory().getItemInMainHand()); - final ListTag attrmod = getAttrList(nms); - if (attrmod.size() == 0) - { - player.sendMessage(mm.deserialize("This item has no attributes.")); - return; - } - player.sendMessage(mm.deserialize("Item attributes: ")); - for (Tag nbtBase : attrmod) - { - final CompoundTag c = (CompoundTag)nbtBase; - player.sendMessage(mm.deserialize("" + Attributes.get(c.getString("AttributeName")).mcName - + ", " + c.getDouble("Amount"))); - } - } - - @Override - public String colorize(String string) - { - return ChatColor.translateAlternateColorCodes('&', string); - } -} diff --git a/v1_18_R2/build.gradle.kts b/v1_18_R2/build.gradle.kts index 85c85c7..94ed81a 100644 --- a/v1_18_R2/build.gradle.kts +++ b/v1_18_R2/build.gradle.kts @@ -1,6 +1,3 @@ -apply(plugin = "io.papermc.paperweight.userdev") -apply(plugin = "xyz.jpenilla.run-paper") - dependencies { paperDevBundle("1.18.2-R0.1-SNAPSHOT") } \ No newline at end of file diff --git a/v1_19_R1/build.gradle.kts b/v1_19_R1/build.gradle.kts index 86a4664..c2738d6 100644 --- a/v1_19_R1/build.gradle.kts +++ b/v1_19_R1/build.gradle.kts @@ -1,6 +1,3 @@ -apply(plugin = "io.papermc.paperweight.userdev") -apply(plugin = "xyz.jpenilla.run-paper") - dependencies { paperDevBundle("1.19.2-R0.1-SNAPSHOT") } \ No newline at end of file diff --git a/v1_19_R2/build.gradle.kts b/v1_19_R2/build.gradle.kts index 47c91cd..574735b 100644 --- a/v1_19_R2/build.gradle.kts +++ b/v1_19_R2/build.gradle.kts @@ -1,6 +1,3 @@ -apply(plugin = "io.papermc.paperweight.userdev") -apply(plugin = "xyz.jpenilla.run-paper") - dependencies { paperDevBundle("1.19.3-R0.1-SNAPSHOT") } \ No newline at end of file diff --git a/v1_19_R3/build.gradle.kts b/v1_19_R3/build.gradle.kts index 0b87cbd..5efa8f0 100644 --- a/v1_19_R3/build.gradle.kts +++ b/v1_19_R3/build.gradle.kts @@ -1,6 +1,3 @@ -apply(plugin = "io.papermc.paperweight.userdev") -apply(plugin = "xyz.jpenilla.run-paper") - dependencies { paperDevBundle("1.19.4-R0.1-SNAPSHOT") } \ No newline at end of file