diff --git a/.gitignore b/.gitignore index ad9c598..95a42e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,122 @@ -.idea/ -libs/ -out/ -ArmorStand.iml -/bin/ +### Java template +target/classes/io/github/archemedes/knockoutplus/corpse/CorpseRegistry.class +/.idea -*.project -.classpath \ No newline at end of file +# Mobile Tools for Java (J2ME) +.mtj.tmp/ +/knockoutplus.iml + +# Package Files # +*.war +*.ear + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +### Eclipse template + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# Eclipse Core +.project + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/workspace.xml +.idea/tasks.xml +.idea/dictionaries +.idea/vcs.xml +.idea/jsLibraryMappings.xml + +# Sensitive or high-churn files: +.idea/dataSources.ids +.idea/dataSources.xml +.idea/dataSources.local.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml + +# Gradle: +.idea/gradle.xml +.idea/libraries + +# Mongo Explorer plugin: +.idea/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### Maven template +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# Created by .ignore support plugin (hsz.mobi) diff --git a/README.md b/README.md index 4156f1e..46ef8ef 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ I wanted to create an armor stand for each kit in my mini-game, and I quickly be Compatibility ------------- -- Armor Stand Tools v3.x.x - Spigot/CraftBukkit 1.13 to 1.15 only +- Armor Stand Tools v3.x.x - Spigot/CraftBukkit 1.13 to 1.16.4 only - Armor Stand Tools v2.4.3 - Spigot/CraftBukkit 1.8, 1.9, 1.10, 1.11, 1.12 (https://www.spigotmc.org/resources/armor-stand-tools.2237/download?version=175162) Features diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..35a98a5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,80 @@ + + +4.0.0 +com.gmail.St3venAU.plugins +ArmorStandTools +3.7.0 +ArmorStandTools + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + + + + sk89q-repo + http://maven.sk89q.com/repo/ + + + + IntellectualSites + https://mvn.intellectualsites.com/content/groups/public/ + + + + + + org.spigotmc + spigot-api + 1.16.4-R0.1-SNAPSHOT + provided + + + com.sk89q.worldguard + worldguard-bukkit + 7.0.2 + provided + + + com.sk89q.worldedit + worldedit-core + 7.2.0-SNAPSHOT + provided + + + + com.plotsquared + PlotSquared-Core + 5.13.0 + + + + + clean package install + src/main/java + ${project.name}-${project.version} + + + src/main/resources + true + + **/*.yml + + + + + + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + + + + + + \ No newline at end of file diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandCmd.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandCmd.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandCmd.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandCmd.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandGUI.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandGUI.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandGUI.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandGUI.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandTool.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandTool.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandTool.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/ArmorStandTool.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Commands.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Commands.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/Commands.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Commands.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Config.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Main.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Main.java similarity index 93% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/Main.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Main.java index a9f7833..a706e68 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Main.java +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Main.java @@ -4,6 +4,7 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.managers.RegionManager; +import com.sk89q.worldguard.protection.regions.RegionContainer; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -24,7 +25,7 @@ import java.util.logging.Level; public class Main extends JavaPlugin { - private static final String LATEST_VERSION = "v1_14_R1"; + private static final String LATEST_VERSION = "v1_16_R4"; private static Object WG_AST_FLAG; @@ -172,7 +173,7 @@ public class Main extends JavaPlugin { p.sendMessage(ChatColor.RED + Config.noAirError); return; } - b.setType(Material.SIGN); + b.setType(Material.OAK_SIGN); nms.openSign(p, b); b.setMetadata("armorStand", new FixedMetadataValue(this, as.getUniqueId())); b.setMetadata("setName", new FixedMetadataValue(this, true)); @@ -184,7 +185,7 @@ public class Main extends JavaPlugin { p.sendMessage(ChatColor.RED + Config.noAirError); return; } - b.setType(Material.SIGN); + b.setType(Material.OAK_SIGN); nms.openSign(p, b); b.setMetadata("armorStand", new FixedMetadataValue(this, as.getUniqueId())); b.setMetadata("setSkull", new FixedMetadataValue(this, true)); @@ -212,9 +213,14 @@ public class Main extends JavaPlugin { } private boolean getWorldGuardAstFlag(Location l) { - RegionManager regions = WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(l.getWorld())); - if(regions == null) return true; - return regions.getApplicableRegions(BukkitAdapter.asBlockVector(l)).testState(null, (StateFlag) WG_AST_FLAG); + if (l != null) { + RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer(); + RegionManager regions = regionContainer.get(BukkitAdapter.adapt(l.getWorld())); + if (regions == null) return true; + return regions.getApplicableRegions(BukkitAdapter.asBlockVector(l)).testState(null, (StateFlag) WG_AST_FLAG); + } else { + return false; + } } boolean playerHasPermission(Player p, Block b, ArmorStandTool tool) { diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java similarity index 99% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java index 623b81b..93ab583 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/MainListener.java @@ -424,7 +424,7 @@ public class MainListener implements Listener { @EventHandler public void onBlockBreak(BlockBreakEvent event) { Block b = event.getBlock(); - if((b.getType() == Material.PLAYER_HEAD && b.hasMetadata("protected")) || (b.getType() == Material.SIGN && b.hasMetadata("armorStand"))) { + if((b.getType() == Material.PLAYER_HEAD && b.hasMetadata("protected")) || (b.getType() == Material.OAK_SIGN && b.hasMetadata("armorStand"))) { event.setCancelled(true); } } diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS.java similarity index 84% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS.java index 045ca15..8265dbb 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS.java +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS.java @@ -165,10 +165,10 @@ abstract class NMS { + (as.getCustomName() == null ? "" : ("CustomName:\"\\\"" + as.getCustomName() + "\\\"\",") ) + (as.getLocation().getYaw() == 0F ? "" : ("Rotation:[" + Utils.twoDec(as.getLocation().getYaw()) + "f],")) + "ArmorItems:[" - + (as.getBoots() == null ? "{}," : ("{id:" + as.getBoots().getType().getKey().getKey() + ",Count:" + as.getBoots().getAmount() + ",tag:{Damage:" + as.getBoots().getDurability() + getItemStackTags(as.getBoots()) + "}},")) - + (as.getLeggings() == null ? "{}," : ("{id:" + as.getLeggings().getType().getKey().getKey() + ",Count:" + as.getLeggings().getAmount() + ",tag:{Damage:" + as.getLeggings().getDurability() + getItemStackTags(as.getLeggings()) + "}},")) - + (as.getChestplate() == null ? "{}," : ("{id:" + as.getChestplate().getType().getKey().getKey() + ",Count:" + as.getChestplate().getAmount() + ",tag:{Damage:" + as.getChestplate().getDurability() + getItemStackTags(as.getChestplate()) + "}},")) - + (as.getHelmet() == null ? "{}" : ("{id:" + as.getHelmet().getType().getKey().getKey() + ",Count:" + as.getHelmet().getAmount() + ",tag:{Damage:" + as.getHelmet().getDurability() + getItemStackTags(as.getHelmet()) + skullOwner(as.getHelmet()) + "}}" )) + + (as.getEquipment() != null && as.getEquipment().getBoots() == null ? "{}," : ("{id:" + as.getEquipment().getBoots().getType().getKey().getKey() + ",Count:" + as.getEquipment().getBoots().getAmount() + ",tag:{Damage:" + as.getEquipment().getBoots().getDurability() + getItemStackTags(as.getEquipment().getBoots()) + "}},")) + + (as.getEquipment() != null && as.getEquipment().getLeggings() == null ? "{}," : ("{id:" + as.getEquipment().getLeggings().getType().getKey().getKey() + ",Count:" + as.getEquipment().getLeggings().getAmount() + ",tag:{Damage:" + as.getEquipment().getLeggings().getDurability() + getItemStackTags(as.getEquipment().getLeggings()) + "}},")) + + (as.getEquipment() != null && as.getEquipment().getChestplate() == null ? "{}," : ("{id:" + as.getEquipment().getChestplate().getType().getKey().getKey() + ",Count:" + as.getEquipment().getChestplate().getAmount() + ",tag:{Damage:" + as.getEquipment().getChestplate().getDurability() + getItemStackTags(as.getEquipment().getChestplate()) + "}},")) + + (as.getEquipment() != null && as.getEquipment().getHelmet() == null ? "{}" : ("{id:" + as.getEquipment().getHelmet().getType().getKey().getKey() + ",Count:" + as.getEquipment().getHelmet().getAmount() + ",tag:{Damage:" + as.getEquipment().getHelmet().getDurability() + getItemStackTags(as.getEquipment().getHelmet()) + skullOwner(as.getEquipment().getHelmet()) + "}}" )) + "]," + "HandItems:[" + (as.getEquipment().getItemInMainHand() == null ? "{}," : ("{id:" + as.getEquipment().getItemInMainHand().getType().getKey().getKey() + ",Count:" + as.getEquipment().getItemInMainHand().getAmount() + ",tag:{Damage:" + as.getEquipment().getItemInMainHand().getDurability() + getItemStackTags(as.getEquipment().getItemInMainHand()) + "}},")) @@ -190,10 +190,10 @@ abstract class NMS { ArmorStand clone(ArmorStand as) { ArmorStand clone = (ArmorStand) as.getWorld().spawnEntity(as.getLocation().add(1, 0, 0), EntityType.ARMOR_STAND); clone.setGravity(as.hasGravity()); - clone.setHelmet(as.getHelmet()); - clone.setChestplate(as.getChestplate()); - clone.setLeggings(as.getLeggings()); - clone.setBoots(as.getBoots()); + clone.getEquipment().setHelmet(as.getEquipment().getHelmet()); + clone.getEquipment().setChestplate(as.getEquipment().getChestplate()); + clone.getEquipment().setLeggings(as.getEquipment().getLeggings()); + clone.getEquipment().setBoots(as.getEquipment().getBoots()); clone.getEquipment().setItemInMainHand(as.getEquipment().getItemInMainHand()); clone.getEquipment().setItemInOffHand(as.getEquipment().getItemInOffHand()); clone.setHeadPose(as.getHeadPose()); diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R1.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R1.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R1.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R1.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R2.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R2.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R2.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_13_R2.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_14_R1.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_14_R1.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_14_R1.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_14_R1.java diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_15_R1.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_15_R1.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_15_R1.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_15_R1.java diff --git a/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R1.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R1.java new file mode 100644 index 0000000..3a6ed40 --- /dev/null +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R1.java @@ -0,0 +1,13 @@ +package com.gmail.St3venAU.plugins.ArmorStandTools; + +@SuppressWarnings("unused") +class NMS_v1_16_R1 extends NMS { + + public NMS_v1_16_R1(String nmsVersion) { + super( + nmsVersion, + "bA" + ); + } + +} diff --git a/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R2.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R2.java new file mode 100644 index 0000000..09cfbb2 --- /dev/null +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R2.java @@ -0,0 +1,13 @@ +package com.gmail.St3venAU.plugins.ArmorStandTools; + +@SuppressWarnings("unused") +class NMS_v1_16_R2 extends NMS { + + public NMS_v1_16_R2(String nmsVersion) { + super( + nmsVersion, + "bv" + ); + } + +} diff --git a/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R3.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R3.java new file mode 100644 index 0000000..ba2c03a --- /dev/null +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R3.java @@ -0,0 +1,13 @@ +package com.gmail.St3venAU.plugins.ArmorStandTools; + +@SuppressWarnings("unused") +class NMS_v1_16_R3 extends NMS { + + public NMS_v1_16_R3(String nmsVersion) { + super( + nmsVersion, + "disabledSlots" + ); + } + +} \ No newline at end of file diff --git a/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R4.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R4.java new file mode 100644 index 0000000..1175083 --- /dev/null +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/NMS_v1_16_R4.java @@ -0,0 +1,13 @@ +package com.gmail.St3venAU.plugins.ArmorStandTools; + +@SuppressWarnings("unused") +class NMS_v1_16_R4 extends NMS { + + public NMS_v1_16_R4(String nmsVersion) { + super( + nmsVersion, + "disabledSlots" + ); + } + +} \ No newline at end of file diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java similarity index 67% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java index b4a37d2..cd7ee08 100644 --- a/src/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java +++ b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/PlotSquaredHook.java @@ -1,10 +1,9 @@ package com.gmail.St3venAU.plugins.ArmorStandTools; -import com.github.intellectualsites.plotsquared.api.PlotAPI; -import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; +import com.plotsquared.core.api.PlotAPI; +import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; +import com.plotsquared.core.plot.PlotArea; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -25,7 +24,10 @@ class PlotSquaredHook { } public static boolean checkPermission(Player player, Location location) { - com.github.intellectualsites.plotsquared.plot.object.Location plotLocation = BukkitUtil.getLocation(location); + com.plotsquared.core.location.Location plotLocation = new com.plotsquared.core.location.Location(location.getWorld().getName(), + location.getBlockX(), + location.getBlockY(), + location.getBlockZ()); PlotArea plotArea = plotLocation.getPlotArea(); if(plotArea == null) { plugin.debug("plots.admin.build.road: " + player.hasPermission("plots.admin.build.road")); diff --git a/src/com/gmail/St3venAU/plugins/ArmorStandTools/Utils.java b/src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Utils.java similarity index 100% rename from src/com/gmail/St3venAU/plugins/ArmorStandTools/Utils.java rename to src/main/java/com/gmail/St3venAU/plugins/ArmorStandTools/Utils.java diff --git a/src/config.yml b/src/main/resources/config.yml similarity index 100% rename from src/config.yml rename to src/main/resources/config.yml diff --git a/src/language.yml b/src/main/resources/language.yml similarity index 100% rename from src/language.yml rename to src/main/resources/language.yml diff --git a/src/plugin.yml b/src/main/resources/plugin.yml similarity index 87% rename from src/plugin.yml rename to src/main/resources/plugin.yml index 615cb77..02ca7ad 100644 --- a/src/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ main: com.gmail.St3venAU.plugins.ArmorStandTools.Main name: ArmorStandTools -version: 3.5.0 -api-version: 1.15 +version: ${project.version} +api-version: 1.16 author: St3venAU description: Armor stand manipulation tools softdepend: [WorldGuard, PlotSquared]