From c1fce65b88a8861ffec97d294fa2724b9a3acd72 Mon Sep 17 00:00:00 2001 From: "Larry (Wolfieheart)" Date: Thu, 12 Oct 2023 22:02:46 +0200 Subject: [PATCH] [CORE] ArmorStandEditor 1.20-44: Fixes and New UI! (#311) * [CORE] Version Bump: 1.20-44 * [CORE] Fix for #309. Add Check for ArmorStand Vulnerability and prevent destruction in Creative Mode when its Invulnerable * [CORE] Upgrade Codebase to 17 * [CORE] Bump Base API Version to 1.17 * [CORE] Autoformatting and Order Imports * [CORE] Per World Support for ArmorStandEditor * [CORE] Better Implementation for Per World Support for ArmorStandEditor. More in line with what is expected! * [CORE] Better Implementation for Per World Support for ArmorStandEditor. More in line with what is expected! * [CORE] Version Bump: 1.20-44 * [CORE] Fix for #309. Add Check for ArmorStand Vulnerability and prevent destruction in Creative Mode when its Invulnerable * [CORE] Upgrade Codebase to 17 * [CORE] Bump Base API Version to 1.17 * [CORE] Autoformatting and Order Imports * [CORE] Per World Support for ArmorStandEditor * [CORE] Better Implementation for Per World Support for ArmorStandEditor. More in line with what is expected! * [CORE] Better Implementation for Per World Support for ArmorStandEditor. More in line with what is expected! * [CORE] Config Support for Per World ArmorStandEditor. * [CI-SKIP] Something to use for later if we ever move to Paper. * [CORE] Fix for Messages not being sent properly in ASE. Bug from #315 Plus Potential Fix for #272 * [CORE] Bump ASE to 1.20.2-44 * [CORE] New UI Design #DreiFxn * [CORE] Upgrade Fix: Fix ArmorStandVisibility Not working Properly * [CORE] Bump Lands to 6.35.0 - Closes #310 and #328 * [CORE] Bump Towny to 0.99.5.20 - Closes #326 and #332 * [CORE] Bump Lombok to 1.18.30 * [CORE] Bump MavenShade to 3.5.1 * [CORE] Fixes found when Debugging 1.20.2-44: - Add in No Perm Message if a user cant run a certain toggle - Fix for the PlayerHead Menu Option - Add all new strings for NoPermOption to the Language Files - Fix Toggles * [CORE] Refactor PlotSquared Protection * [CORE] Refactor PlotSquared Protection (Part 2 - Comments + Readability) * [CORE] Stats Command #334 (Part 1) - Add the Java Logic, No Language Support or Perm Support YET! * [CI-SKIP] Tabbing was outta sync. Fixed it * [CORE] Stats (Part 2 of 3) - Add missing Language Strings to test realm * [CORE] Temporary fix for ArmorStand Names being weird and wacky when broken and placed back down. * [CORE] Temporary fix for ArmorStand Names being weird and wacky when broken and placed back down. * [CORE] Temporary fix for ArmorStand Names being weird and wacky when broken and placed back down. * [CORE] Introduce Glowing Toggle: - Requires `asedit.togglearmorstandglow` to be true - Will only Glow `white`, otherwise will need to implement a whole scoreboard system just for all the colors. Something I dont wanna impose on people. - Menu Option: `Glow Ink Sac`, Placement might vary - Add to Stats tracker - Add Language Strings for it. * [CORE] Code Review Remarks - Apparently `CodeFactor` didnt like how I was doing the Stats calculations * [CORE] Add Missing Modes to TabCompletion * [CORE/LANG] Stats (part 3) - Add translation things * [CORE] Change Version for Beta Deployment * [CORE] Fix PlotSquared Protection Error on PlotAPI * [CORE] One Final P2 Change and Bump to Final * [CORE] Fix Dependencies * [CORE] Fix Bug and Dependencies * [CORE] Bump RU_RU.yml --- .../rypofalem/apiexample/ASEventTester.java | 114 ++--- .../apiexample/ArmorStandEditorAPITest.java | 12 +- .../rypofalem/apiexample/IFEventTester.java | 84 ++-- pom.xml | 35 +- .../ArmorStandEditorPlugin.java | 206 +++++---- .../rypofalem/armorstandeditor/CommandEx.java | 227 ++++++++-- .../armorstandeditor/PlayerEditor.java | 415 ++++++++++-------- .../armorstandeditor/PlayerEditorManager.java | 128 ++++-- .../rypofalem/armorstandeditor/Scheduler.java | 7 +- .../rypofalem/armorstandeditor/Util.java | 22 +- .../armorstandeditor/api/ArmorStandEvent.java | 13 +- .../api/ArmorStandManipulatedEvent.java | 33 +- .../api/ArmorStandRenameEvent.java | 40 +- .../api/ArmorStandTargetedEvent.java | 33 +- .../armorstandeditor/api/ItemFrameEvent.java | 13 +- .../api/ItemFrameGlowEvent.java | 33 +- .../api/ItemFrameManipulatedEvent.java | 33 +- .../api/ItemFrameTargetedEvent.java | 33 +- .../api/PlayerOpenMenuEvent.java | 32 +- .../armorstandeditor/language/Language.java | 18 +- .../armorstandeditor/menu/ASEHolder.java | 8 +- .../armorstandeditor/menu/EquipmentMenu.java | 19 +- .../rypofalem/armorstandeditor/menu/Menu.java | 147 ++++--- .../modes/AdjustmentMode.java | 4 +- .../modes/ArmorStandData.java | 2 +- .../armorstandeditor/modes/Axis.java | 4 +- .../armorstandeditor/modes/CopySlots.java | 12 +- .../armorstandeditor/modes/EditMode.java | 6 +- .../protections/BentoBoxProtection.java | 23 +- .../protections/GriefDefenderProtection.java | 2 +- .../GriefPreventionProtection.java | 19 +- .../protections/LandsProtection.java | 29 +- .../protections/PlotSquaredProtection.java | 58 ++- .../protections/SkyblockProtection.java | 7 +- .../protections/TownyProtection.java | 12 +- .../protections/WorldGuardProtection.java | 9 +- src/main/resources/config.yml | 14 +- src/main/resources/lang/de_DE.yml | 40 ++ src/main/resources/lang/en_US.yml | 32 ++ src/main/resources/lang/es_ES.yml | 42 +- src/main/resources/lang/fr_FR.yml | 40 +- src/main/resources/lang/ja_JP.yml | 44 +- src/main/resources/lang/nl_NL.yml | 45 +- src/main/resources/lang/pl_PL.yml | 42 +- src/main/resources/lang/pt_BR.yml | 39 +- src/main/resources/lang/ro_RO.yml | 43 +- src/main/resources/lang/ru_RU.yml | 30 +- src/main/resources/lang/test_NA.yml | 26 +- src/main/resources/lang/uk_UA.yml | 41 +- src/main/resources/lang/zh_CN.yml | 38 +- src/main/resources/plugin.yml | 40 +- 51 files changed, 1641 insertions(+), 807 deletions(-) diff --git a/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ASEventTester.java b/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ASEventTester.java index 0dc20762..06e6d50b 100644 --- a/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ASEventTester.java +++ b/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ASEventTester.java @@ -29,66 +29,66 @@ public class ASEventTester implements Listener { - Player player; + Player player; - //ArmorStandRenameEvent - @EventHandler - public void renameArmorStand(PlayerInteractAtEntityEvent ASRenameEvent){ - player = ASRenameEvent.getPlayer(); - ASRenameEvent.setCancelled(true); - if(ASRenameEvent.isCancelled()) { - player.sendMessage("ArmorStandRenameEvent has been cancelled"); - } else{ - player.sendMessage("ArmorStandRenameEvent has not been cancelled. Continuing...."); - } - } + //ArmorStandRenameEvent + @EventHandler + public void renameArmorStand(PlayerInteractAtEntityEvent ASRenameEvent) { + player = ASRenameEvent.getPlayer(); + ASRenameEvent.setCancelled(true); + if (ASRenameEvent.isCancelled()) { + player.sendMessage("ArmorStandRenameEvent has been cancelled"); + } else { + player.sendMessage("ArmorStandRenameEvent has not been cancelled. Continuing...."); + } + } - //ArmorStandManipEvent - @EventHandler - public void manipulateArmorStand(PlayerInteractAtEntityEvent ASManipEvent){ - player = ASManipEvent.getPlayer(); - ASManipEvent.setCancelled(true); - if(ASManipEvent.isCancelled()) { - player.sendMessage("ArmorStandManipulationEvent has been cancelled"); - } else{ - player.sendMessage("ArmorStandManipulationEvent has not been cancelled. Continuing...."); - } - } + //ArmorStandManipEvent + @EventHandler + public void manipulateArmorStand(PlayerInteractAtEntityEvent ASManipEvent) { + player = ASManipEvent.getPlayer(); + ASManipEvent.setCancelled(true); + if (ASManipEvent.isCancelled()) { + player.sendMessage("ArmorStandManipulationEvent has been cancelled"); + } else { + player.sendMessage("ArmorStandManipulationEvent has not been cancelled. Continuing...."); + } + } - //ArmorStandTargetedEvent - @EventHandler - public void targetEvent(PlayerSwapHandItemsEvent targetASEvent){ - player = targetASEvent.getPlayer(); - targetASEvent.setCancelled(true); - if(targetASEvent.isCancelled()) { - player.sendMessage("ArmorStandTargetedEvent has been cancelled"); - } else{ - player.sendMessage("ArmorStandTargetedEvent has not been cancelled. Continuing...."); - } - } + //ArmorStandTargetedEvent + @EventHandler + public void targetEvent(PlayerSwapHandItemsEvent targetASEvent) { + player = targetASEvent.getPlayer(); + targetASEvent.setCancelled(true); + if (targetASEvent.isCancelled()) { + player.sendMessage("ArmorStandTargetedEvent has been cancelled"); + } else { + player.sendMessage("ArmorStandTargetedEvent has not been cancelled. Continuing...."); + } + } - //PlayerOpenMenuEvent - //onArmorStandDamage EntityDamageByEntityEvent event - @EventHandler - public void playerOpeningMenuEvent(EntityDamageByEntityEvent ASEDamageMenuOpenEvent){ - player = (Player) ASEDamageMenuOpenEvent.getDamager(); - ASEDamageMenuOpenEvent.setCancelled(true); - if(ASEDamageMenuOpenEvent.isCancelled()) { - player.sendMessage("PlayerOpenMenuEvent has been cancelled"); - } else{ - player.sendMessage("PlayerOpenMenuEvent has not been cancelled. Continuing...."); - } - } + //PlayerOpenMenuEvent + //onArmorStandDamage EntityDamageByEntityEvent event + @EventHandler + public void playerOpeningMenuEvent(EntityDamageByEntityEvent ASEDamageMenuOpenEvent) { + player = (Player) ASEDamageMenuOpenEvent.getDamager(); + ASEDamageMenuOpenEvent.setCancelled(true); + if (ASEDamageMenuOpenEvent.isCancelled()) { + player.sendMessage("PlayerOpenMenuEvent has been cancelled"); + } else { + player.sendMessage("PlayerOpenMenuEvent has not been cancelled. Continuing...."); + } + } - //Also PlayerOpenMenuEvent when RightClicking/Interacting - @EventHandler - public void playerOpeningMenuRightClickEvent(PlayerInteractEvent ASERightClickMenuOpenEvent){ - player = ASERightClickMenuOpenEvent.getPlayer(); - ASERightClickMenuOpenEvent.setCancelled(true); - if(ASERightClickMenuOpenEvent.isCancelled()) { - player.sendMessage("PlayerOpenMenuEvent has been cancelled"); - } else{ - player.sendMessage("PlayerOpenMenuEvent has not been cancelled. Continuing...."); - } - } + //Also PlayerOpenMenuEvent when RightClicking/Interacting + @EventHandler + public void playerOpeningMenuRightClickEvent(PlayerInteractEvent ASERightClickMenuOpenEvent) { + player = ASERightClickMenuOpenEvent.getPlayer(); + ASERightClickMenuOpenEvent.setCancelled(true); + if (ASERightClickMenuOpenEvent.isCancelled()) { + player.sendMessage("PlayerOpenMenuEvent has been cancelled"); + } else { + player.sendMessage("PlayerOpenMenuEvent has not been cancelled. Continuing...."); + } + } } diff --git a/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ArmorStandEditorAPITest.java b/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ArmorStandEditorAPITest.java index 53f39d22..7d366781 100644 --- a/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ArmorStandEditorAPITest.java +++ b/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/ArmorStandEditorAPITest.java @@ -23,11 +23,11 @@ public class ArmorStandEditorAPITest extends JavaPlugin { - @Override - public void onEnable(){ - this.getLogger().info("[ArmorStandEditor] API Testing Plugin v1.20.0-43 - Enable"); - this.getServer().getPluginManager().registerEvents(new ASEventTester(), this); - this.getServer().getPluginManager().registerEvents(new IFEventTester(), this); - } + @Override + public void onEnable() { + this.getLogger().info("[ArmorStandEditor] API Testing Plugin v1.20.0-43 - Enable"); + this.getServer().getPluginManager().registerEvents(new ASEventTester(), this); + this.getServer().getPluginManager().registerEvents(new IFEventTester(), this); + } } diff --git a/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/IFEventTester.java b/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/IFEventTester.java index fe18a9bd..d80bf182 100644 --- a/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/IFEventTester.java +++ b/API-Example-Plugin/src/main/java/io/github/rypofalem/apiexample/IFEventTester.java @@ -27,51 +27,51 @@ import org.bukkit.event.player.PlayerSwapHandItemsEvent; public class IFEventTester implements Listener { - Player player; + Player player; - //ItemFrameGlowEvent - @EventHandler - public void manipulateArmorStand(PlayerInteractAtEntityEvent IFGlowEvent){ - player = IFGlowEvent.getPlayer(); - IFGlowEvent.setCancelled(true); - if(IFGlowEvent.isCancelled()) { - player.sendMessage("ItemFrameGlowEvent has been cancelled"); - } else{ - player.sendMessage("ItemFrameGlowEvent has not been cancelled. Continuing...."); - } - } + //ItemFrameGlowEvent + @EventHandler + public void manipulateArmorStand(PlayerInteractAtEntityEvent IFGlowEvent) { + player = IFGlowEvent.getPlayer(); + IFGlowEvent.setCancelled(true); + if (IFGlowEvent.isCancelled()) { + player.sendMessage("ItemFrameGlowEvent has been cancelled"); + } else { + player.sendMessage("ItemFrameGlowEvent has not been cancelled. Continuing...."); + } + } - @EventHandler - public void manipulateItemFrame(EntityDamageByEntityEvent IFManipulationLeftClickEvent){ - player = (Player) IFManipulationLeftClickEvent.getDamager(); - IFManipulationLeftClickEvent.setCancelled(true); - if(IFManipulationLeftClickEvent.isCancelled()) { - player.sendMessage("ItemFrameManipulatedEvent has been cancelled"); - } else{ - player.sendMessage("ItemFrameManipulatedEvent has not been cancelled. Continuing...."); - } - } + @EventHandler + public void manipulateItemFrame(EntityDamageByEntityEvent IFManipulationLeftClickEvent) { + player = (Player) IFManipulationLeftClickEvent.getDamager(); + IFManipulationLeftClickEvent.setCancelled(true); + if (IFManipulationLeftClickEvent.isCancelled()) { + player.sendMessage("ItemFrameManipulatedEvent has been cancelled"); + } else { + player.sendMessage("ItemFrameManipulatedEvent has not been cancelled. Continuing...."); + } + } - @EventHandler - public void manipulateItemFrameRightClick(PlayerInteractAtEntityEvent IFManipulationRightClickEvent){ - player = IFManipulationRightClickEvent.getPlayer(); - IFManipulationRightClickEvent.setCancelled(true); - if(IFManipulationRightClickEvent.isCancelled()) { - player.sendMessage("ItemFrameManipulatedEvent has been cancelled"); - } else{ - player.sendMessage("ItemFrameManipulatedEvent has not been cancelled. Continuing...."); - } - } + @EventHandler + public void manipulateItemFrameRightClick(PlayerInteractAtEntityEvent IFManipulationRightClickEvent) { + player = IFManipulationRightClickEvent.getPlayer(); + IFManipulationRightClickEvent.setCancelled(true); + if (IFManipulationRightClickEvent.isCancelled()) { + player.sendMessage("ItemFrameManipulatedEvent has been cancelled"); + } else { + player.sendMessage("ItemFrameManipulatedEvent has not been cancelled. Continuing...."); + } + } - @EventHandler - public void targetEvent(PlayerSwapHandItemsEvent targetIFEvent){ - player = targetIFEvent.getPlayer(); - targetIFEvent.setCancelled(true); - if(targetIFEvent.isCancelled()) { - player.sendMessage("ItemFrameTargetedEvent has been cancelled"); - } else{ - player.sendMessage("ItemFrameTargetedEvent has not been cancelled. Continuing...."); - } - } + @EventHandler + public void targetEvent(PlayerSwapHandItemsEvent targetIFEvent) { + player = targetIFEvent.getPlayer(); + targetIFEvent.setCancelled(true); + if (targetIFEvent.isCancelled()) { + player.sendMessage("ItemFrameTargetedEvent has been cancelled"); + } else { + player.sendMessage("ItemFrameTargetedEvent has not been cancelled. Continuing...."); + } + } } diff --git a/pom.xml b/pom.xml index 92b807d7..7c614120 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.github.rypofalem.armorstandeditor armorstandeditor jar - 1.20.1-43.2 + 1.20.x-44 armorstandeditor http://maven.apache.org @@ -106,7 +106,7 @@ org.spigotmc spigot-api - 1.20.1-R0.1-SNAPSHOT + 1.20.2-R0.1-SNAPSHOT provided @@ -129,7 +129,6 @@ 7.1.0 provided - com.intellectualsites.plotsquared plotsquared-bukkit @@ -181,7 +180,7 @@ com.github.angeschossen LandsAPI - 6.34.0 + 6.35.0 provided @@ -198,17 +197,40 @@ 4.0.43 provided + org.projectlombok lombok - 1.18.28 + 1.18.30 provided + + org.openrewrite.maven + rewrite-maven-plugin + 5.4.1 + + + org.openrewrite.java.migrate.UpgradeToJava17 + org.openrewrite.java.format.AutoFormat + org.openrewrite.java.recipes.FindRecipes + org.openrewrite.java.OrderImports + org.openrewrite.java.ShortenFullyQualifiedTypeReferences + org.openrewrite.java.RemoveUnusedImports + + + + + org.openrewrite.recipe + rewrite-migrate-java + 2.0.9 + + + org.codehaus.mojo build-helper-maven-plugin @@ -237,8 +259,7 @@ maven-compiler-plugin 3.11.0 - 17 - 17 + ${java.version} diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java b/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java index 3c22191a..43179151 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java @@ -19,9 +19,12 @@ package io.github.rypofalem.armorstandeditor; -import io.github.rypofalem.armorstandeditor.language.Language; -import com.jeff_media.updatechecker.*; +import com.jeff_media.updatechecker.UpdateCheckSource; +import com.jeff_media.updatechecker.UpdateChecker; +import com.jeff_media.updatechecker.UserAgentBuilder; + import io.github.rypofalem.armorstandeditor.Metrics.*; +import io.github.rypofalem.armorstandeditor.language.Language; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -40,7 +43,7 @@ import java.util.*; import java.util.logging.Level; -public class ArmorStandEditorPlugin extends JavaPlugin{ +public class ArmorStandEditorPlugin extends JavaPlugin { //!!! DO NOT REMOVE THESE UNDER ANY CIRCUMSTANCES - Required for BStats and UpdateChecker !!! public static final int SPIGOT_RESOURCE_ID = 94503; //Used for Update Checker @@ -49,7 +52,7 @@ public class ArmorStandEditorPlugin extends JavaPlugin{ private NamespacedKey iconKey; private static ArmorStandEditorPlugin instance; private Language lang; - + //Server Version Detection: Paper or Spigot and Invalid NMS Version String nmsVersion; String languageFolderLocation = "lang/"; @@ -61,7 +64,7 @@ public class ArmorStandEditorPlugin extends JavaPlugin{ static final String SEPARATOR_FIELD = "================================"; public PlayerEditorManager editorManager; - + //Output for Updates boolean opUpdateNotification = false; boolean runTheUpdateChecker = false; @@ -76,13 +79,14 @@ public class ArmorStandEditorPlugin extends JavaPlugin{ String editToolName = null; boolean requireToolLore = false; List editToolLore = null; + List allowedWorldList = null; boolean allowCustomModelData = false; Integer customModelDataInt = Integer.MIN_VALUE; - + //GUI Settings boolean requireSneaking = false; boolean sendToActionBar = true; - + //Armor Stand Specific Settings double coarseRot; double fineRot; @@ -101,7 +105,7 @@ public class ArmorStandEditorPlugin extends JavaPlugin{ private static ArmorStandEditorPlugin plugin; - public ArmorStandEditorPlugin(){ + public ArmorStandEditorPlugin() { instance = this; } @@ -119,9 +123,9 @@ public void onEnable() { getLogger().info("Plugin Version: " + pdfFile.getVersion()); // Check if the Minecraft version is supported - if (nmsVersion.compareTo("v1_13") < 0) { - getLogger().log(Level.WARNING,warningMCVer + "{0}",nmsVersion); - getLogger().warning("ArmorStandEditor is not compatible with this version of Minecraft. Please update to at least version 1.13. Loading failed."); + if (nmsVersion.compareTo("v1_17") < 0) { + getLogger().log(Level.WARNING, warningMCVer + "{0}", nmsVersion); + getLogger().warning("ArmorStandEditor is not compatible with this version of Minecraft. Please update to at least version 1.17. Loading failed."); getServer().getPluginManager().disablePlugin(this); getLogger().info(SEPARATOR_FIELD); return; @@ -129,11 +133,11 @@ public void onEnable() { //Also Warn People to Update if using nmsVersion lower than latest if (nmsVersion.compareTo("v1_20") < 0) { - getLogger().log(Level.WARNING,warningMCVer + "{0}",nmsVersion); + getLogger().log(Level.WARNING, warningMCVer + "{0}", nmsVersion); getLogger().warning("ArmorStandEditor is compatible with this version of Minecraft, but it is not the latest supported version."); getLogger().warning("Loading continuing, but please consider updating to the latest version."); } else { - getLogger().log(Level.INFO,warningMCVer + "{0}",nmsVersion); + getLogger().log(Level.INFO, warningMCVer + "{0}", nmsVersion); getLogger().info("ArmorStandEditor is compatible with this version of Minecraft. Loading continuing."); } //Spigot Check @@ -141,16 +145,16 @@ public void onEnable() { hasPaper = getHasPaper(); //If Paper and Spigot are both FALSE - Disable the plugin - if (!hasPaper && !hasSpigot){ + if (!hasPaper && !hasSpigot) { getLogger().severe("This plugin requires either Paper, Spigot or one of its forks to run. This is not an error, please do not report this!"); getServer().getPluginManager().disablePlugin(this); getLogger().info(SEPARATOR_FIELD); return; } else { if (hasSpigot) { - getLogger().log(Level.INFO,"SpigotMC: {0}",hasSpigot); + getLogger().log(Level.INFO, "SpigotMC: {0}", hasSpigot); } else { - getLogger().log(Level.INFO,"PaperMC: {0}",hasPaper); + getLogger().log(Level.INFO, "PaperMC: {0}", hasPaper); } } @@ -191,18 +195,18 @@ public void onEnable() { getServer().getPluginManager().disablePlugin(this); return; } - + //Do we require a custom tool name? requireToolName = getConfig().getBoolean("requireToolName", false); - if(requireToolName){ + if (requireToolName) { editToolName = getConfig().getString("toolName", null); - if(editToolName != null) editToolName = ChatColor.translateAlternateColorCodes('&', editToolName); + if (editToolName != null) editToolName = ChatColor.translateAlternateColorCodes('&', editToolName); } //Custom Model Data allowCustomModelData = getConfig().getBoolean("allowCustomModelData", false); - if(allowCustomModelData){ + if (allowCustomModelData) { customModelDataInt = getConfig().getInt("customModelDataInt", Integer.MIN_VALUE); } @@ -212,16 +216,17 @@ public void onEnable() { //Is there NBT Required for the tool requireToolData = getConfig().getBoolean("requireToolData", false); - if(requireToolData) { + if (requireToolData) { editToolData = getConfig().getInt("toolData", Integer.MIN_VALUE); } requireToolLore = getConfig().getBoolean("requireToolLore", false); - if(requireToolLore) { + if (requireToolLore) { editToolLore = getConfig().getList("toolLore", null); } + allowedWorldList = getConfig().getList("allowed-worlds", null); //Require Sneaking - Wolfst0rm/ArmorStandEditor#17 requireSneaking = getConfig().getBoolean("requireSneaking", false); @@ -246,9 +251,9 @@ public void onEnable() { adminOnlyNotifications = getConfig().getBoolean("adminOnlyNotifications", true); //Run UpdateChecker - Reports out to Console on Startup ONLY! - if(!Scheduler.isFolia() && runTheUpdateChecker) { + if (!Scheduler.isFolia() && runTheUpdateChecker) { - if(opUpdateNotification){ + if (opUpdateNotification) { runUpdateCheckerWithOPNotifyOnJoinEnabled(); } else { runUpdateCheckerConsoleUpdateCheck(); @@ -280,12 +285,12 @@ private void runUpdateCheckerConsoleUpdateCheck() { getLogger().info("Update Checker does not work on Development Builds."); } else { new UpdateChecker(this, UpdateCheckSource.SPIGET, "" + SPIGOT_RESOURCE_ID + "") - .setDownloadLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/") - .setChangelogLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/history") - .setColoredConsoleOutput(true) - .setUserAgent(new UserAgentBuilder().addPluginNameAndVersion().addServerVersion()) - .checkEveryXHours(updateCheckerInterval) - .checkNow(); + .setDownloadLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/") + .setChangelogLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/history") + .setColoredConsoleOutput(true) + .setUserAgent(new UserAgentBuilder().addPluginNameAndVersion().addServerVersion()) + .checkEveryXHours(updateCheckerInterval) + .checkNow(); } } @@ -299,13 +304,13 @@ private void runUpdateCheckerWithOPNotifyOnJoinEnabled() { getLogger().info("Update Checker does not work on Development Builds."); } else { new UpdateChecker(this, UpdateCheckSource.SPIGET, "" + SPIGOT_RESOURCE_ID + "") - .setDownloadLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/") - .setChangelogLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/history") - .setColoredConsoleOutput(true) - .setNotifyOpsOnJoin(true) - .setUserAgent(new UserAgentBuilder().addPluginNameAndVersion().addServerVersion()) - .checkEveryXHours(updateCheckerInterval) - .checkNow(); + .setDownloadLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/") + .setChangelogLink("https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/history") + .setColoredConsoleOutput(true) + .setNotifyOpsOnJoin(true) + .setUserAgent(new UserAgentBuilder().addPluginNameAndVersion().addServerVersion()) + .checkEveryXHours(updateCheckerInterval) + .checkNow(); } } @@ -326,23 +331,23 @@ private void unregisterScoreboards(Scoreboard scoreboard) { getLogger().info("Removing Scoreboards required for Glowing Effects"); team = scoreboard.getTeam(lockedTeam); - if(team != null) { //Basic Sanity Check to ensure that the team is there + if (team != null) { //Basic Sanity Check to ensure that the team is there team.unregister(); - } else{ + } else { getLogger().severe("Team Already Appears to be removed. Please do not do this manually!"); } } private void updateConfig(String folder, String config) { - if(!new File(getDataFolder() + File.separator + folder + config).exists()){ + if (!new File(getDataFolder() + File.separator + folder + config).exists()) { saveResource(folder + config, false); } } @Override - public void onDisable(){ - for(Player player : Bukkit.getServer().getOnlinePlayers()){ - if(player.getOpenInventory().getTopInventory().getHolder() == editorManager.getMenuHolder()) player.closeInventory(); + public void onDisable() { + for (Player player : Bukkit.getServer().getOnlinePlayers()) { + if (player.getOpenInventory().getTopInventory().getHolder() == editorManager.getMenuHolder()) player.closeInventory(); } if (!Scheduler.isFolia()) { @@ -351,45 +356,46 @@ public void onDisable(){ } } - public String getNmsVersion(){ - return this.getServer().getClass().getPackage().getName().replace(".",",").split(",")[3]; + public String getNmsVersion() { + return this.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; } - public boolean getHasSpigot(){ + public boolean getHasSpigot() { try { Class.forName("org.spigotmc.SpigotConfig"); nmsVersionNotLatest = "SpigotMC ASAP."; return true; - } catch (ClassNotFoundException e){ + } catch (ClassNotFoundException e) { nmsVersionNotLatest = ""; return false; } } - public boolean getHasPaper(){ + public boolean getHasPaper() { try { Class.forName("com.destroystokyo.paper.PaperConfig"); nmsVersionNotLatest = "SpigotMC ASAP."; return true; - } catch (ClassNotFoundException e){ + } catch (ClassNotFoundException e) { nmsVersionNotLatest = ""; return false; } } + public String getArmorStandEditorVersion() { + return getConfig().getString("version"); + } - public String getArmorStandEditorVersion(){ return getConfig().getString("version"); } - - public boolean getArmorStandVisibility(){ + public boolean getArmorStandVisibility() { return getConfig().getBoolean("armorStandVisibility"); } - public boolean getItemFrameVisibility(){ + public boolean getItemFrameVisibility() { return getConfig().getBoolean("invisibleItemFrames"); } - public Language getLang(){ + public Language getLang() { return lang; } @@ -405,62 +411,86 @@ public boolean getRunTheUpdateChecker() { return this.getConfig().getBoolean("runTheUpdateChecker"); } - public Integer getCustomModelDataInt() { return this.getConfig().getInt("customModelDataInt"); } + public Integer getCustomModelDataInt() { + return this.getConfig().getInt("customModelDataInt"); + } //New in 1.20-43: Allow the ability to get a player head from a command - ENABLED VIA CONFIG ONLY! - public boolean getAllowedToRetrievePlayerHead() { return this.getConfig().getBoolean("allowedToRetrievePlayerHead"); } + public boolean getAllowedToRetrievePlayerHead() { + return this.getConfig().getBoolean("allowedToRetrievePlayerHead"); + } - public boolean getAdminOnlyNotifications() { return this.getConfig().getBoolean("adminOnlyNotifications"); } + public boolean getAdminOnlyNotifications() { + return this.getConfig().getBoolean("adminOnlyNotifications"); + } - public boolean isEditTool(ItemStack itemStk){ - if (itemStk == null) { return false; } - if (editTool != itemStk.getType()) { return false; } + public boolean isEditTool(ItemStack itemStk) { + if (itemStk == null) { + return false; + } + if (editTool != itemStk.getType()) { + return false; + } ItemMeta itemMeta = itemStk.getItemMeta(); - if(itemMeta == null) return false; + if (itemMeta == null) return false; //FIX: Depreciated Stack for getDurability - if (requireToolData){ + if (requireToolData) { Damageable d1 = (Damageable) itemMeta; //Get the Damageable Options for itemStk if (d1 != null) { //We do this to prevent NullPointers - if (d1.getDamage() != (short) editToolData) { return false; } + if (d1.getDamage() != (short) editToolData) { + return false; + } } } - if(requireToolName && editToolName != null){ - if(!itemStk.hasItemMeta()) { return false; } + if (requireToolName && editToolName != null) { + if (!itemStk.hasItemMeta()) { + return false; + } //Get the name of the Edit Tool - If Null, return false String itemName = itemMeta.getDisplayName(); //If the name of the Edit Tool is not the Name specified in Config then Return false - if(!itemName.equals(editToolName)) { return false; } + if (!itemName.equals(editToolName)) { + return false; + } } - if(requireToolLore && editToolLore != null){ + if (requireToolLore && editToolLore != null) { //If the ItemStack does not have Metadata then we return false - if(!itemStk.hasItemMeta()) { return false; } + if (!itemStk.hasItemMeta()) { + return false; + } //Get the lore of the Item and if it is null - Return False List itemLore = itemMeta.getLore(); //If the Item does not have Lore - Return False boolean hasTheItemLore = itemMeta.hasLore(); - if (!hasTheItemLore) { return false; } + if (!hasTheItemLore) { + return false; + } //Get the localised ListString of editToolLore List listStringOfEditToolLore = (List) editToolLore; //Return False if itemLore on the item does not match what we expect in the config. - if(!itemLore.equals(listStringOfEditToolLore)) { return false; } + if (!itemLore.equals(listStringOfEditToolLore)) { + return false; + } } if (allowCustomModelData && customModelDataInt != null) { //If the ItemStack does not have Metadata then we return false - if(!itemStk.hasItemMeta()) { return false; } + if (!itemStk.hasItemMeta()) { + return false; + } Integer itemCustomModel = itemMeta.getCustomModelData(); return itemCustomModel.equals(customModelDataInt); } @@ -501,15 +531,15 @@ public void performReload() { //Do we require a custom tool name? requireToolName = getConfig().getBoolean("requireToolName", false); - if(requireToolName){ + if (requireToolName) { editToolName = getConfig().getString("toolName", null); - if(editToolName != null) editToolName = ChatColor.translateAlternateColorCodes('&', editToolName); + if (editToolName != null) editToolName = ChatColor.translateAlternateColorCodes('&', editToolName); } //Custom Model Data allowCustomModelData = getConfig().getBoolean("allowCustomModelData", false); - if(allowCustomModelData){ + if (allowCustomModelData) { customModelDataInt = getConfig().getInt("customModelDataInt", Integer.MIN_VALUE); } @@ -519,16 +549,18 @@ public void performReload() { //Is there NBT Required for the tool requireToolData = getConfig().getBoolean("requireToolData", false); - if(requireToolData) { + if (requireToolData) { editToolData = getConfig().getInt("toolData", Integer.MIN_VALUE); } requireToolLore = getConfig().getBoolean("requireToolLore", false); - if(requireToolLore) { + if (requireToolLore) { editToolLore = getConfig().getList("toolLore", null); } + allowedWorldList = getConfig().getList("allowed-worlds", null); + //Require Sneaking - Wolfst0rm/ArmorStandEditor#17 requireSneaking = getConfig().getBoolean("requireSneaking", false); @@ -551,9 +583,9 @@ public void performReload() { updateCheckerInterval = getConfig().getDouble("updateCheckerInterval", 24); //Run UpdateChecker - Reports out to Console on Startup ONLY! - if(!Scheduler.isFolia() && runTheUpdateChecker) { + if (!Scheduler.isFolia() && runTheUpdateChecker) { - if(opUpdateNotification){ + if (opUpdateNotification) { runUpdateCheckerWithOPNotifyOnJoinEnabled(); } else { runUpdateCheckerConsoleUpdateCheck(); @@ -562,12 +594,12 @@ public void performReload() { } } - public static ArmorStandEditorPlugin instance(){ + public static ArmorStandEditorPlugin instance() { return instance; } //Metrics/bStats Support - private void getMetrics(){ + private void getMetrics() { Metrics metrics = new Metrics(this, PLUGIN_ID); @@ -603,17 +635,17 @@ private void getMetrics(){ map.put("Japanese", entry); } else if (languageUsed.startsWith("pl")) { map.put("Polish", entry); - }else if(languageUsed.startsWith("ru")){ //See PR# 41 by KPidS + } else if (languageUsed.startsWith("ru")) { //See PR# 41 by KPidS map.put("Russian", entry); - }else if(languageUsed.startsWith("ro")){ + } else if (languageUsed.startsWith("ro")) { map.put("Romanian", entry); - } else if(languageUsed.startsWith("uk")){ + } else if (languageUsed.startsWith("uk")) { map.put("Ukrainian", entry); - } else if(languageUsed.startsWith("zh")) { + } else if (languageUsed.startsWith("zh")) { map.put("Chinese", entry); - } else if(languageUsed.startsWith("pt")) { + } else if (languageUsed.startsWith("pt")) { map.put("Brazilian", entry); - } else{ + } else { map.put("English", entry); } return map; @@ -635,7 +667,7 @@ private void getMetrics(){ } public NamespacedKey getIconKey() { - if(iconKey == null) iconKey = new NamespacedKey(this, "command_icon"); + if (iconKey == null) iconKey = new NamespacedKey(this, "command_icon"); return iconKey; } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/CommandEx.java b/src/main/java/io/github/rypofalem/armorstandeditor/CommandEx.java index 0ce4c76b..409d6814 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/CommandEx.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/CommandEx.java @@ -37,6 +37,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.command.*; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; @@ -61,26 +63,28 @@ public class CommandEx implements CommandExecutor, TabCompleter { final String RELOAD = ChatColor.YELLOW + "/ase reload"; final String GIVECUSTOMMODEL = ChatColor.YELLOW + "/ase give"; final String GIVEPLAYERHEAD = ChatColor.YELLOW + "/ase playerhead "; + final String GETARMORSTATS = ChatColor.YELLOW + "/ase stats"; Gson gson = new Gson(); - public CommandEx( ArmorStandEditorPlugin armorStandEditorPlugin) { + public CommandEx(ArmorStandEditorPlugin armorStandEditorPlugin) { this.plugin = armorStandEditorPlugin; } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if(sender instanceof ConsoleCommandSender){ //Fix to Support #267 - if(args.length == 0){ + + if (sender instanceof ConsoleCommandSender) { //Fix to Support #267 + if (args.length == 0) { sender.sendMessage(VERSION); sender.sendMessage(HELP); sender.sendMessage(RELOAD); - } else{ - switch(args[0].toLowerCase()) { + } else { + switch (args[0].toLowerCase()) { case "reload" -> commandReloadConsole(sender); case "help", "?" -> commandHelpConsole(sender); case "version" -> commandVersionConsole(sender); default -> { - sender.sendMessage(plugin.getLang().getMessage("noconsolecom","warn")); + sender.sendMessage(plugin.getLang().getMessage("noconsolecom", "warn")); } } return true; @@ -88,8 +92,8 @@ public boolean onCommand(CommandSender sender, Command command, String label, St } - if(sender instanceof Player && !getPermissionBasic( (Player) sender)){ - sender.sendMessage(plugin.getLang().getMessage("noperm", "warn")); + if (sender instanceof Player player && !getPermissionBasic(player)) { + sender.sendMessage(plugin.getLang().getMessage("nopermoption", "warn", "basic")); return true; } else { @@ -105,6 +109,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St player.sendMessage(RELOAD); player.sendMessage(GIVECUSTOMMODEL); player.sendMessage(GIVEPLAYERHEAD); + player.sendMessage(GETARMORSTATS); return true; } switch (args[0].toLowerCase()) { @@ -118,6 +123,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St case "give" -> commandGive(player); case "playerhead" -> commandGivePlayerHead(player, args); case "reload" -> commandReload(player); + case "stats" -> commandStats(player); default -> { sender.sendMessage(LISTMODE); sender.sendMessage(LISTAXIS); @@ -129,13 +135,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St sender.sendMessage(RELOAD); sender.sendMessage(GIVECUSTOMMODEL); sender.sendMessage(GIVEPLAYERHEAD); + sender.sendMessage(GETARMORSTATS); } } return true; } } - // Implemented to fix: // https://github.com/Wolfieheart/ArmorStandEditor-Issues/issues/35 & // https://github.com/Wolfieheart/ArmorStandEditor-Issues/issues/30 - See Remarks OTHER @@ -149,20 +155,20 @@ private void commandGive(Player player) { stack.setItemMeta(meta); player.getInventory().addItem(stack); player.sendMessage(plugin.getLang().getMessage("give", "info")); - } else{ + } else { player.sendMessage(plugin.getLang().getMessage("nogive", "warn")); } } - private void commandGivePlayerHead(Player player,String[] args) { - if(plugin.getAllowedToRetrievePlayerHead() && checkPermission(player, "head", true)){ + private void commandGivePlayerHead(Player player, String[] args) { + if (plugin.getAllowedToRetrievePlayerHead() && checkPermission(player, "head", true)) { - if(args.length == 2){ + if (args.length == 2) { //Get the Player head Texture String skinTexture = getPlayerHeadTexture(args[1]); - if(skinTexture == null){ + if (skinTexture == null) { player.sendMessage(plugin.getLang().getMessage("playerheaderror", "warn")); } @@ -198,16 +204,16 @@ private void commandGivePlayerHead(Player player,String[] args) { //Add the head to the Players Inventory + display PlayerHead Success Message player.getInventory().addItem(playerHead); - player.sendMessage(plugin.getLang().getMessage("playerhead","info")); + player.sendMessage(plugin.getLang().getMessage("playerhead", "info")); //Let Admins know this command has been ran - for(Player onlineList : Bukkit.getOnlinePlayers()){ - if(onlineList.hasPermission("asedit.permpack.admin") && plugin.getAdminOnlyNotifications()){ + for (Player onlineList : Bukkit.getOnlinePlayers()) { + if (onlineList.hasPermission("asedit.permpack.admin") && plugin.getAdminOnlyNotifications()) { onlineList.sendMessage(ChatColor.YELLOW + "[ArmorStandEditor] " + player.getName() + "has just used the /ase playerhead command to get the head for " + args[1]); } } } - } else{ + } else { player.sendMessage(plugin.getLang().getMessage("noplayerhead", "warn")); } } @@ -251,7 +257,7 @@ private void commandSlot(Player player, String[] args) { player.sendMessage(LISTSLOT); } - } catch ( NumberFormatException nfe) { + } catch (NumberFormatException nfe) { player.sendMessage(LISTSLOT); } } @@ -264,7 +270,7 @@ private void commandAdj(Player player, String[] args) { } if (args.length > 1) { - for ( AdjustmentMode adj : AdjustmentMode.values()) { + for (AdjustmentMode adj : AdjustmentMode.values()) { if (adj.toString().toLowerCase().contentEquals(args[1].toLowerCase())) { plugin.editorManager.getPlayerEditor(player.getUniqueId()).setAdjMode(adj); return; @@ -274,14 +280,14 @@ private void commandAdj(Player player, String[] args) { } } - private void commandAxis( Player player, String[] args) { + private void commandAxis(Player player, String[] args) { if (args.length <= 1) { player.sendMessage(plugin.getLang().getMessage("noaxiscom", "warn")); player.sendMessage(LISTAXIS); } if (args.length > 1) { - for ( Axis axis : Axis.values()) { + for (Axis axis : Axis.values()) { if (axis.toString().toLowerCase().contentEquals(args[1].toLowerCase())) { plugin.editorManager.getPlayerEditor(player.getUniqueId()).setAxis(axis); return; @@ -291,17 +297,17 @@ private void commandAxis( Player player, String[] args) { } } - private void commandMode( Player player, String[] args) { + private void commandMode(Player player, String[] args) { if (args.length <= 1) { player.sendMessage(plugin.getLang().getMessage("nomodecom", "warn")); player.sendMessage(LISTMODE); } if (args.length > 1) { - for ( EditMode mode : EditMode.values()) { + for (EditMode mode : EditMode.values()) { if (mode.toString().toLowerCase().contentEquals(args[1].toLowerCase())) { - if (args[1].equals("invisible") && !checkPermission(player, "togglearmorstandvisibility", true)) return; - if (args[1].equals("itemframe") && !checkPermission(player, "toggleitemframevisibility", true)) return; + if (args[1].equals("invisible") && !(checkPermission(player, "togglearmorstandvisibility", true) || plugin.getArmorStandVisibility())) return; + if (args[1].equals("itemframe") && !(checkPermission(player, "toggleitemframevisibility", true) || plugin.getItemFrameVisibility())) return; plugin.editorManager.getPlayerEditor(player.getUniqueId()).setMode(mode); return; } @@ -354,13 +360,13 @@ private void commandVersion(Player player) { player.sendMessage(ChatColor.YELLOW + "[ArmorStandEditor] Version: " + verString); } - private void commandVersionConsole(CommandSender sender){ + private void commandVersionConsole(CommandSender sender) { String verString = plugin.getArmorStandEditorVersion(); sender.sendMessage(ChatColor.YELLOW + "[ArmorStandEditor] Version: " + verString); } - private void commandReload(Player player){ - if(!(getPermissionReload(player))) return; + private void commandReload(Player player) { + if (!(getPermissionReload(player))) return; plugin.performReload(); player.sendMessage(plugin.getLang().getMessage("reloaded", "")); } @@ -370,7 +376,125 @@ private void commandReloadConsole(CommandSender sender) { sender.sendMessage(plugin.getLang().getMessage("reloaded", "info")); } - private boolean checkPermission(Player player, String permName, boolean sendMessageOnInvalidation) { + private void commandStats(Player player) { + if(!getPermissionStats(player)) return; + for(Entity e : player.getNearbyEntities(1,1,1)){ + if(e instanceof ArmorStand as){ + + //Calculation TIME - Might move this out later, but is OK here for now + double headX = as.getHeadPose().getX(); + headX = Math.toDegrees(headX); + headX = Math.rint(headX); + + double headY = as.getHeadPose().getY(); + headY = Math.toDegrees(headY); + headY = Math.rint(headY); + + double headZ = as.getHeadPose().getZ(); + headZ = Math.toDegrees(headZ); + headZ = Math.rint(headZ); + + //Body + double bodyX = as.getBodyPose().getX(); + bodyX = Math.toDegrees(bodyX); + bodyX = Math.rint(bodyX); + + double bodyY = as.getBodyPose().getY(); + bodyY = Math.toDegrees(bodyY); + bodyY = Math.rint(bodyY); + + double bodyZ = as.getBodyPose().getZ(); + bodyZ = Math.toDegrees(bodyZ); + bodyZ = Math.rint(bodyZ); + + + //Arms + double rightArmX = as.getRightArmPose().getX(); + rightArmX = Math.toDegrees(rightArmX); + rightArmX = Math.rint(rightArmX); + + double rightArmY = as.getRightArmPose().getY(); + rightArmY = Math.toDegrees(rightArmY); + rightArmY = Math.rint(rightArmY); + + double rightArmZ = as.getRightArmPose().getZ(); + rightArmZ = Math.toDegrees(rightArmZ); + rightArmZ = Math.rint(rightArmZ); + + + double leftArmX = as.getLeftArmPose().getX(); + leftArmX = Math.toDegrees(leftArmX); + leftArmX = Math.rint(leftArmX); + + double leftArmY = as.getLeftArmPose().getY(); + leftArmY = Math.toDegrees(leftArmY); + leftArmY = Math.rint(leftArmY); + + double leftArmZ = as.getLeftArmPose().getZ(); + leftArmZ = Math.toDegrees(leftArmZ); + leftArmZ = Math.rint(leftArmZ); + + //Legs + double rightLegX = as.getRightLegPose().getX(); + rightLegX = Math.toDegrees(rightLegX); + rightLegX = Math.rint(rightLegX); + + double rightLegY = as.getRightLegPose().getY(); + rightLegY = Math.toDegrees(rightLegY); + rightLegY = Math.rint(rightLegY); + + double rightLegZ = as.getRightLegPose().getZ(); + rightLegZ = Math.toDegrees(rightLegZ); + rightArmX = Math.rint(rightLegZ); + + double leftLegX = as.getLeftLegPose().getX(); + leftLegX = Math.toDegrees(leftLegX); + leftLegX = Math.rint(leftLegX); + + double leftLegY = as.getLeftLegPose().getY(); + leftLegY = Math.toDegrees(leftLegY); + leftLegY = Math.rint(leftLegY); + + double leftLegZ = as.getLeftLegPose().getZ(); + leftLegZ = Math.toDegrees(leftLegZ); + leftLegZ = Math.rint(leftLegZ); + + //Coordinates + float locationX = (float) as.getLocation().getX(); + float locationY = (float) as.getLocation().getY(); + float locationZ = (float) as.getLocation().getZ(); + + //Toggles + boolean isVisible = as.isVisible(); + boolean armsVisible = as.hasArms(); + boolean basePlateVisible = as.hasBasePlate(); + boolean isVulnerable = as.isInvulnerable(); + boolean hasGravity = as.hasGravity(); + boolean isSmall = as.isSmall(); + boolean isGlowing = as.isGlowing(); + boolean isLocked = plugin.scoreboard.getTeam(plugin.lockedTeam).hasEntry(as.getUniqueId().toString()); + + player.sendMessage(ChatColor.YELLOW + "----------- Armor Stand Statistics -----------"); + player.sendMessage(ChatColor.YELLOW + plugin.getLang().getMessage("stats")); + player.sendMessage(ChatColor.YELLOW + "Head: " + ChatColor.AQUA + headX + " / " + headY + " / " + headZ); + player.sendMessage(ChatColor.YELLOW + "Body: " + ChatColor.AQUA + bodyX + " / " + bodyY + " / " + bodyZ); + player.sendMessage(ChatColor.YELLOW + "Right Arm: " + ChatColor.AQUA + rightArmX + " / " + rightArmY + " / " + rightArmZ); + player.sendMessage(ChatColor.YELLOW + "Left Arm: " + ChatColor.AQUA + leftArmX + " / " + leftArmY + " / " + leftArmZ); + player.sendMessage(ChatColor.YELLOW + "Right Leg: " + ChatColor.AQUA + rightLegX + " / " + rightLegY + " / " + rightLegZ); + player.sendMessage(ChatColor.YELLOW + "Left Leg: " + ChatColor.AQUA + leftLegX + " / " + leftLegY + " / " + leftLegZ); + player.sendMessage(ChatColor.YELLOW + "Coordinates: " + ChatColor.AQUA + " x: " + locationX + " / y: " + locationY + " / z: " + locationZ); + player.sendMessage(ChatColor.YELLOW + "Is Visible: " + ChatColor.AQUA + isVisible + ". " + ChatColor.YELLOW + "Arms Visible: " + ChatColor.AQUA + armsVisible + ". " + ChatColor.YELLOW + "Base Plate Visible: "+ ChatColor.AQUA + basePlateVisible); + player.sendMessage(ChatColor.YELLOW + "Is Vulnerable: " + ChatColor.AQUA + isVulnerable + ". " + ChatColor.YELLOW + "Affected by Gravity: " + ChatColor.AQUA + hasGravity); + player.sendMessage(ChatColor.YELLOW + "Is Small: " + ChatColor.AQUA + isSmall + ". " + ChatColor.YELLOW + "Is Glowing: " + ChatColor.AQUA + isGlowing + ". " + ChatColor.YELLOW + "Is Locked: " + ChatColor.AQUA + isLocked); + player.sendMessage(ChatColor.YELLOW + "----------------------------------------------"); + } else{ + player.sendMessage(plugin.getLang().getMessage("norangeforstats", "warn")); + } + } + } + + + private boolean checkPermission(Player player, String permName, boolean sendMessageOnInvalidation) { if (permName.equalsIgnoreCase("paste")) { permName = "copy"; } @@ -387,18 +511,21 @@ private boolean checkPermission(Player player, String permName, boolean sendMes private boolean getPermissionBasic(Player player) { return checkPermission(player, "basic", false); } - - private boolean getPermissionGive(Player player) { return checkPermission(player, "give", false); } - - private boolean getPermissionUpdate(Player player){ + private boolean getPermissionGive(Player player) { + return checkPermission(player, "give", false); + } + private boolean getPermissionUpdate(Player player) { return checkPermission(player, "update", false); } - private boolean getPermissionReload(Player player) { return checkPermission(player, "reload", false); } - - private boolean getPermissionPlayerHead(Player player) { return checkPermission(player, "head", false); } + private boolean getPermissionPlayerHead(Player player) { + return checkPermission(player, "head", false); + } + private boolean getPermissionStats(Player player) { + return checkPermission(player, "stats", false); + } //REFACTOR COMPLETION @Override @@ -417,18 +544,22 @@ public List onTabComplete(CommandSender sender, Command command, String argList.add("?"); //Will Only work with permissions - if(getPermissionGive(player)){ + if (getPermissionGive(player)) { argList.add("give"); } - if(getPermissionUpdate(player)){ + if (getPermissionUpdate(player)) { argList.add("update"); } - if(getPermissionReload(player)){ + if (getPermissionReload(player)) { argList.add("reload"); } - if(getPermissionPlayerHead(player) && plugin.getAllowedToRetrievePlayerHead()){ + if (getPermissionPlayerHead(player) && plugin.getAllowedToRetrievePlayerHead()) { argList.add("playerhead"); } + + if (getPermissionStats(player)){ + argList.add("stats"); + } } if (args.length == 2 && args[0].equalsIgnoreCase("mode")) { @@ -455,17 +586,17 @@ public List onTabComplete(CommandSender sender, Command command, String private boolean isCommandValid(String commandName) { return commandName.equalsIgnoreCase("ase") || - commandName.equalsIgnoreCase("armorstandeditor") || - commandName.equalsIgnoreCase("asedit"); + commandName.equalsIgnoreCase("armorstandeditor") || + commandName.equalsIgnoreCase("asedit"); } private List getModeOptions() { return List.of( - "None", "Invisible", "ShowArms", "Gravity", "BasePlate", - "Size", "Copy", "Paste", "Head", "Body", "LeftArm", - "RightArm", "LeftLeg", "RightLeg", "Placement", - "DisableSlots", "Rotate", "Equipment", "Reset", - "ItemFrame", "ItemFrameGlow" + "None", "Invisible", "ShowArms", "Gravity", "BasePlate", + "Size", "Copy", "Paste", "Head", "Body", "LeftArm", + "RightArm", "LeftLeg", "RightLeg", "Placement", + "DisableSlots", "Rotate", "Equipment", "Reset", + "ItemFrame", "ItemFrameGlow", "Vulnerability", "ArmorStandGlow" ); } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditor.java b/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditor.java index 0e35a2a7..81c30121 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditor.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditor.java @@ -18,6 +18,9 @@ */ package io.github.rypofalem.armorstandeditor; +import net.md_5.bungee.api.ChatMessageType; +import net.md_5.bungee.api.chat.TextComponent; + import io.github.rypofalem.armorstandeditor.api.*; import io.github.rypofalem.armorstandeditor.menu.EquipmentMenu; import io.github.rypofalem.armorstandeditor.menu.Menu; @@ -27,12 +30,6 @@ import io.github.rypofalem.armorstandeditor.modes.CopySlots; import io.github.rypofalem.armorstandeditor.modes.EditMode; - -import java.util.ArrayList; -import java.util.UUID; - -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.*; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ItemFrame; @@ -43,6 +40,9 @@ import org.bukkit.scoreboard.Team; import org.bukkit.util.EulerAngle; +import java.util.ArrayList; +import java.util.UUID; + public class PlayerEditor { public ArmorStandEditorPlugin plugin; Team team; @@ -109,109 +109,105 @@ public void setCopySlot(byte slot) { } public void editArmorStand(ArmorStand armorStand) { - if (!getPlayer().hasPermission("asedit.basic")) return; - - armorStand = attemptTarget(armorStand); - switch (eMode) { - case LEFTARM: - armorStand.setLeftArmPose(subEulerAngle(armorStand.getLeftArmPose())); - break; - case RIGHTARM: - armorStand.setRightArmPose(subEulerAngle(armorStand.getRightArmPose())); - break; - case BODY: - armorStand.setBodyPose(subEulerAngle(armorStand.getBodyPose())); - break; - case HEAD: - armorStand.setHeadPose(subEulerAngle(armorStand.getHeadPose())); - break; - case LEFTLEG: - armorStand.setLeftLegPose(subEulerAngle(armorStand.getLeftLegPose())); - break; - case RIGHTLEG: - armorStand.setRightLegPose(subEulerAngle(armorStand.getRightLegPose())); - break; - case SHOWARMS: - toggleArms(armorStand); - break; - case SIZE: - toggleSize(armorStand); - break; - case INVISIBLE: - toggleVisible(armorStand); - break; - case BASEPLATE: - togglePlate(armorStand); - break; - case GRAVITY: - toggleGravity(armorStand); - break; - case COPY: - copy(armorStand); - break; - case PASTE: - paste(armorStand); - break; - case PLACEMENT: - move(armorStand); - break; - case ROTATE: - rotate(armorStand); - break; - case DISABLESLOTS: - toggleDisableSlots(armorStand); - break; - case VULNERABILITY: - toggleInvulnerability(armorStand); - break; - case EQUIPMENT: - openEquipment(armorStand); - break; - case RESET: - resetPosition(armorStand); - break; - case NONE: - default: - sendMessage("nomode", null); - break; + if (getPlayer().hasPermission("asedit.basic")) { + + armorStand = attemptTarget(armorStand); + switch (eMode) { + case LEFTARM: + armorStand.setLeftArmPose(subEulerAngle(armorStand.getLeftArmPose())); + break; + case RIGHTARM: + armorStand.setRightArmPose(subEulerAngle(armorStand.getRightArmPose())); + break; + case BODY: + armorStand.setBodyPose(subEulerAngle(armorStand.getBodyPose())); + break; + case HEAD: + armorStand.setHeadPose(subEulerAngle(armorStand.getHeadPose())); + break; + case LEFTLEG: + armorStand.setLeftLegPose(subEulerAngle(armorStand.getLeftLegPose())); + break; + case RIGHTLEG: + armorStand.setRightLegPose(subEulerAngle(armorStand.getRightLegPose())); + break; + case SHOWARMS: + toggleArms(armorStand); + break; + case SIZE: + toggleSize(armorStand); + break; + case INVISIBLE: + toggleVisible(armorStand); + break; + case BASEPLATE: + togglePlate(armorStand); + break; + case GRAVITY: + toggleGravity(armorStand); + break; + case COPY: + copy(armorStand); + break; + case PASTE: + paste(armorStand); + break; + case PLACEMENT: + move(armorStand); + break; + case ROTATE: + rotate(armorStand); + break; + case DISABLESLOTS: + toggleDisableSlots(armorStand); + break; + case VULNERABILITY: + toggleInvulnerability(armorStand); + break; + case EQUIPMENT: + openEquipment(armorStand); + break; + case RESET: + resetPosition(armorStand); + break; + case GLOWING: + toggleGlowing(armorStand); + break; + case NONE: + default: + sendMessage("nomode", null); + break; - } + } + }else return; } public void editItemFrame(ItemFrame itemFrame) { - if (!getPlayer().hasPermission("asedit.toggleitemframevisibility") || !plugin.invisibleItemFrames) return; //Option to use perms or Config - - //Generate a new ArmorStandManipulationEvent and call it out. - ItemFrameManipulatedEvent event = new ItemFrameManipulatedEvent(itemFrame, getPlayer()); - Bukkit.getPluginManager().callEvent(event); // Bukkit handles the call out - if (event.isCancelled()) return; //do nothing if cancelled - - switch (eMode) { - case ITEMFRAME: - toggleItemFrameVisible(itemFrame); - break; - case RESET: - itemFrame.setVisible(true); - break; - case NONE: - default: - sendMessage("nomodeif", null); - break; - } - } - - private void resetPosition(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.reset")) return; - armorStand.setHeadPose(new EulerAngle(0, 0, 0)); - armorStand.setBodyPose(new EulerAngle(0, 0, 0)); - armorStand.setLeftArmPose(new EulerAngle(0, 0, 0)); - armorStand.setRightArmPose(new EulerAngle(0, 0, 0)); - armorStand.setLeftLegPose(new EulerAngle(0, 0, 0)); - armorStand.setRightLegPose(new EulerAngle(0, 0, 0)); + if (getPlayer().hasPermission("asedit.toggleitemframevisibility") || plugin.invisibleItemFrames) { + + //Generate a new ArmorStandManipulationEvent and call it out. + ItemFrameManipulatedEvent event = new ItemFrameManipulatedEvent(itemFrame, getPlayer()); + Bukkit.getPluginManager().callEvent(event); // Bukkit handles the call out + if (event.isCancelled()) return; //do nothing if cancelled + + switch (eMode) { + case ITEMFRAME: + toggleItemFrameVisible(itemFrame); + break; + case RESET: + itemFrame.setVisible(true); + break; + case NONE: + default: + sendMessage("nomodeif", null); + break; + } + }else return; } private void openEquipment(ArmorStand armorStand) { if (!getPlayer().hasPermission("asedit.equipment")) return; + //if (team != null && team.hasEntry(armorStand.getName())) return; //Do not allow editing if the ArmorStand is Disabled equipMenu = new EquipmentMenu(this, armorStand); equipMenu.open(); } @@ -256,7 +252,7 @@ public void reverseEditArmorStand(ArmorStand armorStand) { } private void move(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.movement")) return; + if (!getPlayer().hasPermission("asedit.movement")) return; //Generate a new ArmorStandManipulationEvent and call it out. ArmorStandManipulatedEvent event = new ArmorStandManipulatedEvent(armorStand, getPlayer()); @@ -279,7 +275,7 @@ private void move(ArmorStand armorStand) { } private void reverseMove(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.movement")) return; + if (!getPlayer().hasPermission("asedit.movement")) return; Location loc = armorStand.getLocation(); switch (axis) { case X: @@ -296,7 +292,7 @@ private void reverseMove(ArmorStand armorStand) { } private void rotate(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.rotation")) return; + if (!getPlayer().hasPermission("asedit.rotation")) return; Location loc = armorStand.getLocation(); float yaw = loc.getYaw(); loc.setYaw((yaw + 180 + (float) degreeAngleChange) % 360 - 180); @@ -304,7 +300,7 @@ private void rotate(ArmorStand armorStand) { } private void reverseRotate(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.rotation")) return; + if (!getPlayer().hasPermission("asedit.rotation")) return; Location loc = armorStand.getLocation(); float yaw = loc.getYaw(); loc.setYaw((yaw + 180 - (float) degreeAngleChange) % 360 - 180); @@ -312,113 +308,170 @@ private void reverseRotate(ArmorStand armorStand) { } private void copy(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.copy")) return; - copySlots.copyDataToSlot(armorStand); - sendMessage("copied", "" + (copySlots.currentSlot + 1)); - setMode(EditMode.PASTE); + if (getPlayer().hasPermission("asedit.copy")) { + copySlots.copyDataToSlot(armorStand); + sendMessage("copied", "" + (copySlots.currentSlot + 1)); + setMode(EditMode.PASTE); + }else{ + sendMessage("nopermoption", "warn", "copy"); + } + } private void paste(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.paste")) return; - ArmorStandData data = copySlots.getDataToPaste(); - if (data == null) return; - armorStand.setHeadPose(data.headPos); - armorStand.setBodyPose(data.bodyPos); - armorStand.setLeftArmPose(data.leftArmPos); - armorStand.setRightArmPose(data.rightArmPos); - armorStand.setLeftLegPose(data.leftLegPos); - armorStand.setRightLegPose(data.rightLegPos); - armorStand.setSmall(data.size); - armorStand.setGravity(data.gravity); - armorStand.setBasePlate(data.basePlate); - armorStand.setArms(data.showArms); - armorStand.setVisible(data.visible); - - //Only Paste the Items on the stand if in Creative Mode - Do not run elsewhere for good fecking reason! - if (this.getPlayer().getGameMode() == GameMode.CREATIVE) { - armorStand.getEquipment().setHelmet(data.head); - armorStand.getEquipment().setChestplate(data.body); - armorStand.getEquipment().setLeggings(data.legs); - armorStand.getEquipment().setBoots(data.feetsies); - armorStand.getEquipment().setItemInMainHand(data.rightHand); - armorStand.getEquipment().setItemInOffHand(data.leftHand); + if (getPlayer().hasPermission("asedit.paste")) { + ArmorStandData data = copySlots.getDataToPaste(); + if (data == null) return; + armorStand.setHeadPose(data.headPos); + armorStand.setBodyPose(data.bodyPos); + armorStand.setLeftArmPose(data.leftArmPos); + armorStand.setRightArmPose(data.rightArmPos); + armorStand.setLeftLegPose(data.leftLegPos); + armorStand.setRightLegPose(data.rightLegPos); + armorStand.setSmall(data.size); + armorStand.setGravity(data.gravity); + armorStand.setBasePlate(data.basePlate); + armorStand.setArms(data.showArms); + armorStand.setVisible(data.visible); + + //Only Paste the Items on the stand if in Creative Mode + // - Do not run elsewhere for good fecking reason! + if (this.getPlayer().getGameMode() == GameMode.CREATIVE) { + armorStand.getEquipment().setHelmet(data.head); + armorStand.getEquipment().setChestplate(data.body); + armorStand.getEquipment().setLeggings(data.legs); + armorStand.getEquipment().setBoots(data.feetsies); + armorStand.getEquipment().setItemInMainHand(data.rightHand); + armorStand.getEquipment().setItemInOffHand(data.leftHand); + } + sendMessage("pasted", "" + (copySlots.currentSlot + 1)); + }else{ + sendMessage("nopermoption", "warn", "paste"); + } + } + + private void resetPosition(ArmorStand armorStand) { + if (getPlayer().hasPermission("asedit.reset")) { + armorStand.setHeadPose(new EulerAngle(0, 0, 0)); + armorStand.setBodyPose(new EulerAngle(0, 0, 0)); + armorStand.setLeftArmPose(new EulerAngle(0, 0, 0)); + armorStand.setRightArmPose(new EulerAngle(0, 0, 0)); + armorStand.setLeftLegPose(new EulerAngle(0, 0, 0)); + armorStand.setRightLegPose(new EulerAngle(0, 0, 0)); + } else{ + sendMessage("nopermoption", "warn", "reset"); } - sendMessage("pasted", "" + (copySlots.currentSlot + 1)); } private void toggleDisableSlots(ArmorStand armorStand) { - if (!getPlayer().hasPermission("asedit.disableSlots")) return; - if (armorStand.hasEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING)) { //Adds a lock to every slot or removes it - team = Scheduler.isFolia() ? null : plugin.scoreboard.getTeam(plugin.lockedTeam); - armorStandID = armorStand.getUniqueId(); - - for (final EquipmentSlot slot : EquipmentSlot.values()) { // UNLOCKED - armorStand.removeEquipmentLock(slot, ArmorStand.LockType.REMOVING_OR_CHANGING); - armorStand.removeEquipmentLock(slot, ArmorStand.LockType.ADDING); - } - getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, SoundCategory.PLAYERS, 1.0f, 1.0f); + if (!getPlayer().hasPermission("asedit.disableSlots")){ + sendMessage("nopermoption", "warn", "disableslots"); + } else { + if (armorStand.hasEquipmentLock(EquipmentSlot.HAND, ArmorStand.LockType.REMOVING_OR_CHANGING)) { //Adds a lock to every slot or removes it + team = Scheduler.isFolia() ? null : plugin.scoreboard.getTeam(plugin.lockedTeam); + armorStandID = armorStand.getUniqueId(); - if(team != null) { - team.removeEntry(armorStandID.toString()); - armorStand.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 50, 1, false, false)); //300 Ticks = 15 seconds - } + for (final EquipmentSlot slot : EquipmentSlot.values()) { // UNLOCKED + armorStand.removeEquipmentLock(slot, ArmorStand.LockType.REMOVING_OR_CHANGING); + armorStand.removeEquipmentLock(slot, ArmorStand.LockType.ADDING); + } + getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_ITEM_BREAK, SoundCategory.PLAYERS, 1.0f, 1.0f); + if (team != null) { + team.removeEntry(armorStandID.toString()); + armorStand.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 50, 1, false, false)); //300 Ticks = 15 seconds + } - } else { - for (final EquipmentSlot slot : EquipmentSlot.values()) { //LOCKED - armorStand.addEquipmentLock(slot, ArmorStand.LockType.REMOVING_OR_CHANGING); - armorStand.addEquipmentLock(slot, ArmorStand.LockType.ADDING); - } - getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_ARMOR_EQUIP_IRON, SoundCategory.PLAYERS, 1.0f, 1.0f); - if(team != null) { - team.addEntry(armorStandID.toString()); - armorStand.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 50, 1, false, false)); //300 Ticks = 15 seconds + + } else { + for (final EquipmentSlot slot : EquipmentSlot.values()) { //LOCKED + armorStand.addEquipmentLock(slot, ArmorStand.LockType.REMOVING_OR_CHANGING); + armorStand.addEquipmentLock(slot, ArmorStand.LockType.ADDING); + } + getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_ARMOR_EQUIP_IRON, SoundCategory.PLAYERS, 1.0f, 1.0f); + if (team != null) { + team.addEntry(armorStandID.toString()); + armorStand.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 50, 1, false, false)); //300 Ticks = 15 seconds + } } - } - sendMessage("disabledslots", null); + sendMessage("disabledslots", null); + } } private void toggleInvulnerability(ArmorStand armorStand) { //See NewFeature-Request #256 for more info - if(!getPlayer().hasPermission("asedit.toggleInvulnerability")) return; - armorStand.setInvulnerable(!armorStand.isInvulnerable()); - sendMessage("toggleinvulnerability", String.valueOf(armorStand.isInvulnerable())); + if (getPlayer().hasPermission("asedit.toggleInvulnerability")) { + armorStand.setInvulnerable(!armorStand.isInvulnerable()); + sendMessage("toggleinvulnerability", String.valueOf(armorStand.isInvulnerable())); + } else { + sendMessage("nopermoption","warn", "vulnerability"); + } } - private void toggleGravity(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.togglegravity")) return; + if (getPlayer().hasPermission("asedit.togglegravity")){ + armorStand.setGravity(!armorStand.hasGravity()); + sendMessage("setgravity", String.valueOf(armorStand.hasGravity()));//Fix for Wolfst0rm/ArmorStandEditor-Issues#6: Translation of On/Off Keys are broken + } else{ + sendMessage("nopermoption","warn", "gravity"); + } + + - //Fix for Wolfst0rm/ArmorStandEditor-Issues#6: Translation of On/Off Keys are broken - armorStand.setGravity(!armorStand.hasGravity()); - sendMessage("setgravity", String.valueOf(armorStand.hasGravity())); } void togglePlate(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.togglebaseplate")) return; - armorStand.setBasePlate(!armorStand.hasBasePlate()); + if(getPlayer().hasPermission("asedit.togglebaseplate")){ + armorStand.setBasePlate(!armorStand.hasBasePlate()); + } else{ + sendMessage("nopermoption", "warn", "baseplate"); + } + + } + + void toggleGlowing(ArmorStand armorStand){ + if(getPlayer().hasPermission("asedit.togglearmorstandglow")){ + //Will only make it glow white - Not something we can do like with Locking. Do not request this! + //Otherwise, this simple function becomes a mess to maintain. As you would need a Team generated with each + //Color and I ain't going to impose that on servers. + armorStand.setGlowing(!armorStand.isGlowing()); + } else{ + sendMessage("nopermoption", "warn", "armorstandglow"); + } } void toggleArms(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.togglearms")) return; - armorStand.setArms(!armorStand.hasArms()); + if(getPlayer().hasPermission("asedit.togglearms")){ + armorStand.setArms(!armorStand.hasArms()); + }else{ + sendMessage("nopermoption", "warn", "showarms"); + } } void toggleVisible(ArmorStand armorStand) { - if (!getPlayer().hasPermission("asedit.togglearmorstandvisibility") || !plugin.armorStandVisibility) return; //Option to use perms or Config - armorStand.setVisible(!armorStand.isVisible()); + if(getPlayer().hasPermission("asedit.togglearmorstandvisibility") || plugin.getArmorStandVisibility()){ + armorStand.setVisible(!armorStand.isVisible()); + } else{ //Throw No Permission Message + sendMessage("nopermoption", "warn", "armorstandvisibility"); + } } void toggleItemFrameVisible(ItemFrame itemFrame) { - if (!getPlayer().hasPermission("asedit.toggleitemframevisibility") || !plugin.invisibleItemFrames) return; //Option to use perms or Config - itemFrame.setVisible(!itemFrame.isVisible()); + if (getPlayer().hasPermission("asedit.toggleitemframevisibility") || plugin.invisibleItemFrames) { //Option to use perms or Config + itemFrame.setVisible(!itemFrame.isVisible()); + }else { + sendMessage("nopermoption", "warn", "itemframevisibility"); + } } void toggleSize(ArmorStand armorStand) { - if(!getPlayer().hasPermission("asedit.togglesize")) return; - armorStand.setSmall(!armorStand.isSmall()); + if (getPlayer().hasPermission("asedit.togglesize")) { + armorStand.setSmall(!armorStand.isSmall()); + } else { + sendMessage("nopermoption", "warn", "size"); + } } void cycleAxis(int i) { @@ -541,12 +594,11 @@ public void setFrameTarget(ArrayList itemFrames) { } - ArmorStand attemptTarget(ArmorStand armorStand) { if (target == null - || !target.isValid() - || target.getWorld() != getPlayer().getWorld() - || target.getLocation().distanceSquared(getPlayer().getLocation()) > 100) + || !target.isValid() + || target.getWorld() != getPlayer().getWorld() + || target.getLocation().distanceSquared(getPlayer().getLocation()) > 100) return armorStand; armorStand = target; return armorStand; @@ -559,7 +611,7 @@ void sendMessage(String path, String format, String option) { plugin.getServer().getPlayer(getUUID()).spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message)); } else { String rawText = plugin.getLang().getRawMessage(path, format, option); - String command = String.format("title %s actionbar %s", plugin.getServer().getPlayer(getUUID()).getName(), rawText); + String command = "title %s actionbar %s".formatted(plugin.getServer().getPlayer(getUUID()).getName(), rawText); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command); } } else { @@ -608,7 +660,6 @@ private class OpenMenuTask implements Runnable { public void run() { if (isMenuCancelled()) return; - //API: PlayerOpenMenuEvent PlayerOpenMenuEvent event = new PlayerOpenMenuEvent(getPlayer()); Bukkit.getPluginManager().callEvent(event); //TODO: Folia Refactor diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java b/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java index 23ca3ab6..2ae09182 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java @@ -20,6 +20,7 @@ package io.github.rypofalem.armorstandeditor; import com.google.common.collect.ImmutableList; + import io.github.rypofalem.armorstandeditor.api.ArmorStandRenameEvent; import io.github.rypofalem.armorstandeditor.api.ItemFrameGlowEvent; import io.github.rypofalem.armorstandeditor.menu.ASEHolder; @@ -37,6 +38,7 @@ import org.bukkit.event.player.*; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; import org.bukkit.persistence.PersistentDataType; import org.bukkit.util.Vector; @@ -64,16 +66,16 @@ public class PlayerEditorManager implements Listener { // Instantiate protections used to determine whether a player may edit an armor stand or item frame //NOTE: GriefPreventionProtection is Depreciated as of v1.19.3-40 private final List protections = ImmutableList.of( - new GriefDefenderProtection(), - new GriefPreventionProtection(), - new LandsProtection(), - new PlotSquaredProtection(), - new SkyblockProtection(), - new TownyProtection(), - new WorldGuardProtection(), - new BentoBoxProtection()); - - PlayerEditorManager( ArmorStandEditorPlugin plugin) { + new GriefDefenderProtection(), + new GriefPreventionProtection(), + new LandsProtection(), + new PlotSquaredProtection(), + new SkyblockProtection(), + new TownyProtection(), + new WorldGuardProtection(), + new BentoBoxProtection()); + + PlayerEditorManager(ArmorStandEditorPlugin plugin) { this.plugin = plugin; players = new HashMap<>(); coarseAdj = Util.FULL_CIRCLE / plugin.coarseRot; @@ -85,7 +87,7 @@ public class PlayerEditorManager implements Listener { } @EventHandler(priority = EventPriority.LOWEST) - void onArmorStandDamage( EntityDamageByEntityEvent event) { + void onArmorStandDamage(EntityDamageByEntityEvent event) { if (!(event.getDamager() instanceof Player)) return; Player player = (Player) event.getDamager(); if (!plugin.isEditTool(player.getInventory().getItemInMainHand())) return; @@ -109,7 +111,7 @@ void onArmorStandDamage( EntityDamageByEntityEvent event) { } @EventHandler(priority = EventPriority.LOWEST) - void onArmorStandInteract( PlayerInteractAtEntityEvent event) { + void onArmorStandInteract(PlayerInteractAtEntityEvent event) { if (ignoreNextInteract) return; if (event.getHand() != EquipmentSlot.HAND) return; Player player = event.getPlayer(); @@ -180,8 +182,8 @@ void onArmorStandInteract( PlayerInteractAtEntityEvent event) { } if (player.getInventory().getItemInMainHand().getType().equals(Material.GLOW_INK_SAC) //attempt glowing - && player.hasPermission("asedit.basic") - && plugin.glowItemFrames && player.isSneaking()) { + && player.hasPermission("asedit.basic") + && plugin.glowItemFrames && player.isSneaking()) { ItemFrameGlowEvent e = new ItemFrameGlowEvent(itemFrame, player); Bukkit.getPluginManager().callEvent(e); @@ -215,6 +217,32 @@ void onArmorStandInteract( PlayerInteractAtEntityEvent event) { } } + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + void onArmorStandBreak(EntityDamageByEntityEvent event) { // Fixes issue #309 + if (!(event.getDamager() instanceof Player)) return; // If the damager is not a player, ignore. + if (!(event.getEntity() instanceof ArmorStand)) return; // If the damaged entity is not an ArmorStand, ignore. + + if (event.getEntity() instanceof ArmorStand entityAS) { + // Check if the ArmorStand is invulnerable and if the damager is a player. + if (entityAS.isInvulnerable() && event.getDamager() instanceof Player p) { + // Check if the player is in Creative mode. + if (p.getGameMode() == GameMode.CREATIVE) { + // If the player is in Creative mode and the ArmorStand is invulnerable, + // cancel the event to prevent breaking the ArmorStand. + p.sendMessage(plugin.getLang().getMessage("unabledestroycreative")); + event.setCancelled(true); // Cancel the event to prevent ArmorStand destruction. + } + } + } + + if(event.getEntity() instanceof ArmorStand entityAS && entityAS.isDead()){ + //TODO: Find a more permanent fix for "Once you destroy that armor stand, the armor stand will keep it's name and colour given by the name tag." THIS IS A TEMP SOLUTION FOR NOW. + event.getEntity().setCustomName(null); + event.getEntity().setCustomNameVisible(false); + event.setCancelled(false); + } + } + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onSwitchHands(PlayerSwapHandItemsEvent event) { if (!plugin.isEditTool(event.getOffHandItem())) return; //event assumes they are already switched @@ -232,9 +260,8 @@ public void onSwitchHands(PlayerSwapHandItemsEvent event) { getPlayerEditor(player.getUniqueId()).setTarget(as); } else if (itemF != null && !itemF.isEmpty()) { getPlayerEditor(player.getUniqueId()).setFrameTarget(itemF); - } else { //TODO: Fix the sending of the message Twice in this Statement - getPlayerEditor(player.getUniqueId()).setTarget(null); - getPlayerEditor(player.getUniqueId()).setFrameTarget(null); + } else { + getPlayerEditor(player.getUniqueId()).sendMessage("nodoubletarget","warn"); } } @@ -254,9 +281,9 @@ private ArrayList getTargets(Player player) { List nearby = (List) player.getWorld().getNearbyEntities(eyeLaser, LASERRADIUS, LASERRADIUS, LASERRADIUS); if (!nearby.isEmpty()) { boolean endLaser = false; - for ( Entity e : nearby) { - if (e instanceof ArmorStand) { - armorStands.add((ArmorStand) e); + for (Entity e : nearby) { + if (e instanceof ArmorStand stand) { + armorStands.add(stand); endLaser = true; } } @@ -285,9 +312,9 @@ private ArrayList getFrameTargets(Player player) { List nearby = (List) player.getWorld().getNearbyEntities(eyeLaser, LASERRADIUS, LASERRADIUS, LASERRADIUS); if (!nearby.isEmpty()) { boolean endLaser = false; - for ( Entity e : nearby) { - if (e instanceof ItemFrame) { - itemFrames.add((ItemFrame) e); + for (Entity e : nearby) { + if (e instanceof ItemFrame frame) { + itemFrames.add(frame); endLaser = true; } } @@ -302,7 +329,7 @@ private ArrayList getFrameTargets(Player player) { } - boolean canEdit( Player player, Entity entity) { + boolean canEdit(Player player, Entity entity) { //Get the Entity being checked for editing Block block = entity.getLocation().getBlock(); @@ -310,43 +337,50 @@ boolean canEdit( Player player, Entity entity) { return protections.stream().allMatch(protection -> protection.checkPermission(block, player)); } - void applyLeftTool( Player player, ArmorStand as) { + void applyLeftTool(Player player, ArmorStand as) { getPlayerEditor(player.getUniqueId()).cancelOpenMenu(); getPlayerEditor(player.getUniqueId()).editArmorStand(as); } - void applyLeftTool( Player player, ItemFrame itemf) { + void applyLeftTool(Player player, ItemFrame itemf) { getPlayerEditor(player.getUniqueId()).cancelOpenMenu(); getPlayerEditor(player.getUniqueId()).editItemFrame(itemf); } - void applyRightTool( Player player, ItemFrame itemf) { + void applyRightTool(Player player, ItemFrame itemf) { getPlayerEditor(player.getUniqueId()).cancelOpenMenu(); getPlayerEditor(player.getUniqueId()).editItemFrame(itemf); } - void applyRightTool( Player player, ArmorStand as) { + void applyRightTool(Player player, ArmorStand as) { getPlayerEditor(player.getUniqueId()).cancelOpenMenu(); getPlayerEditor(player.getUniqueId()).reverseEditArmorStand(as); } //Unused? @EventHandler(priority = EventPriority.LOWEST) - void onRightClickTool( PlayerInteractEvent e) { + void onRightClickTool(PlayerInteractEvent e) { if (!(e.getAction() == Action.LEFT_CLICK_AIR - || e.getAction() == Action.RIGHT_CLICK_AIR - || e.getAction() == Action.LEFT_CLICK_BLOCK - || e.getAction() == Action.RIGHT_CLICK_BLOCK)) return; + || e.getAction() == Action.RIGHT_CLICK_AIR + || e.getAction() == Action.LEFT_CLICK_BLOCK + || e.getAction() == Action.RIGHT_CLICK_BLOCK)) return; Player player = e.getPlayer(); if (!plugin.isEditTool(player.getInventory().getItemInMainHand())) return; if (plugin.requireSneaking && !player.isSneaking()) return; - if(!player.hasPermission("asedit.basic")) return; + if (!player.hasPermission("asedit.basic")) return; + + if (!plugin.allowedWorldList.contains(player.getWorld().getName())) { //Implementation for Per World ASE + getPlayerEditor(player.getUniqueId()).sendMessage("notincorrectworld", "warn"); + e.setCancelled(true); + return; + } + e.setCancelled(true); getPlayerEditor(player.getUniqueId()).openMenu(); } @EventHandler(priority = EventPriority.NORMAL) - void onScrollNCrouch( PlayerItemHeldEvent e) { + void onScrollNCrouch(PlayerItemHeldEvent e) { Player player = e.getPlayer(); if (!player.isSneaking()) return; if (!plugin.isEditTool(player.getInventory().getItem(e.getPreviousSlot()))) return; @@ -360,7 +394,7 @@ void onScrollNCrouch( PlayerItemHeldEvent e) { } @EventHandler(priority = EventPriority.LOWEST) - void onPlayerMenuSelect( InventoryClickEvent e) { + void onPlayerMenuSelect(InventoryClickEvent e) { if (e.getInventory().getHolder() == null) return; if (!(e.getInventory().getHolder() instanceof ASEHolder)) return; if (e.getInventory().getHolder() == menuHolder) { @@ -386,7 +420,7 @@ void onPlayerMenuSelect( InventoryClickEvent e) { } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - void onPlayerMenuClose( InventoryCloseEvent e) { + void onPlayerMenuClose(InventoryCloseEvent e) { if (e.getInventory().getHolder() == null) return; if (!(e.getInventory().getHolder() instanceof ASEHolder)) return; if (e.getInventory().getHolder() == equipmentHolder) { @@ -396,21 +430,21 @@ void onPlayerMenuClose( InventoryCloseEvent e) { } @EventHandler(priority = EventPriority.MONITOR) - void onPlayerLogOut( PlayerQuitEvent e) { + void onPlayerLogOut(PlayerQuitEvent e) { removePlayerEditor(e.getPlayer().getUniqueId()); } - public PlayerEditor getPlayerEditor( UUID uuid) { + public PlayerEditor getPlayerEditor(UUID uuid) { return players.containsKey(uuid) ? players.get(uuid) : addPlayerEditor(uuid); } - PlayerEditor addPlayerEditor( UUID uuid) { + PlayerEditor addPlayerEditor(UUID uuid) { PlayerEditor pe = new PlayerEditor(uuid, plugin); players.put(uuid, pe); return pe; } - private void removePlayerEditor( UUID uuid) { + private void removePlayerEditor(UUID uuid) { players.remove(uuid); } @@ -422,14 +456,20 @@ public ASEHolder getEquipmentHolder() { return equipmentHolder; } - long getTime(){ + long getTime() { return counter.ticks; } - class TickCounter implements Runnable{ + class TickCounter implements Runnable { long ticks = 0; //I am optimistic + @Override - public void run() {ticks++;} - public long getTime() {return ticks;} + public void run() { + ticks++; + } + + public long getTime() { + return ticks; + } } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/Scheduler.java b/src/main/java/io/github/rypofalem/armorstandeditor/Scheduler.java index 1066726c..1dad84d8 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/Scheduler.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/Scheduler.java @@ -50,7 +50,8 @@ private static boolean methodExist(Class clazz, String methodName, Class.. try { clazz.getDeclaredMethod(methodName, parameterTypes); return true; - } catch (Throwable ignored) {} + } catch (Throwable ignored) { + } return false; } @@ -79,7 +80,7 @@ public static void runTaskTimer(Plugin plugin, Runnable runnable, long initialDe if (isFolia()) { Object globalRegionScheduler = getGlobalRegionScheduler(); callMethod(globalRegionScheduler, "runAtFixedRate", new Class[]{Plugin.class, Consumer.class, long.class, long.class}, - plugin, (Consumer) (task) -> runnable.run(), initialDelayTicks, periodTicks); + plugin, (Consumer) (task) -> runnable.run(), initialDelayTicks, periodTicks); return; } Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, initialDelayTicks, periodTicks); @@ -89,7 +90,7 @@ public static void runTaskLater(Plugin plugin, Runnable runnable, long delayedTi if (isFolia()) { Object globalRegionScheduler = getGlobalRegionScheduler(); callMethod(globalRegionScheduler, "runDelayed", new Class[]{Plugin.class, Consumer.class, long.class}, - plugin, (Consumer) (task) -> runnable.run(), delayedTicks); + plugin, (Consumer) (task) -> runnable.run(), delayedTicks); return; } Bukkit.getScheduler().runTaskLater(plugin, runnable, delayedTicks); diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/Util.java b/src/main/java/io/github/rypofalem/armorstandeditor/Util.java index 1b9a4550..3c77e847 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/Util.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/Util.java @@ -21,20 +21,20 @@ public abstract class Util { - public static final double FULL_CIRCLE = Math.PI*2; + public static final double FULL_CIRCLE = Math.PI * 2; - public static > String getEnumList(Class enumType){ + public static > String getEnumList(Class enumType) { return getEnumList(enumType, " | "); } - public static > String getEnumList(Class enumType, String delimiter){ + public static > String getEnumList(Class enumType, String delimiter) { StringBuilder list = new StringBuilder(); - boolean put =false; - for(Enum e : enumType.getEnumConstants()){ + boolean put = false; + for (Enum e : enumType.getEnumConstants()) { list.append(e.toString()).append(delimiter); put = true; } - if(put) list = new StringBuilder(list.substring(0, list.length() - delimiter.length())); + if (put) list = new StringBuilder(list.substring(0, list.length() - delimiter.length())); return list.toString(); } @@ -44,23 +44,23 @@ public static double addAngle(double current, double angleChange) { return current; } - public static double subAngle(double current, double angleChange){ + public static double subAngle(double current, double angleChange) { current -= angleChange; current = fixAngle(current, angleChange); return current; } //clamps angle to 0 if it exceeds 2PI rad (360 degrees), is closer to 0 than angleChange value, or is closer to 2PI rad than 2PI rad - angleChange value. - private static double fixAngle(double angle, double angleChange){ - if(angle > FULL_CIRCLE){ + private static double fixAngle(double angle, double angleChange) { + if (angle > FULL_CIRCLE) { return 0; } - if(angle > 0 && angle < angleChange && angle < angleChange/2){ + if (angle > 0 && angle < angleChange && angle < angleChange / 2) { return 0; } - if(angle > FULL_CIRCLE -angle && angle > FULL_CIRCLE - (angleChange/2)){ + if (angle > FULL_CIRCLE - angle && angle > FULL_CIRCLE - (angleChange / 2)) { return 0; } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandEvent.java index 4de03817..e82445c1 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandEvent.java @@ -20,16 +20,17 @@ package io.github.rypofalem.armorstandeditor.api; import lombok.Getter; + import org.bukkit.entity.ArmorStand; import org.bukkit.event.Event; -public abstract class ArmorStandEvent extends Event{ +public abstract class ArmorStandEvent extends Event { - @Getter - protected final ArmorStand armorStand; + @Getter + protected final ArmorStand armorStand; - public ArmorStandEvent(ArmorStand armorStand) { - this.armorStand = armorStand; - } + public ArmorStandEvent(ArmorStand armorStand) { + this.armorStand = armorStand; + } } \ No newline at end of file diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandManipulatedEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandManipulatedEvent.java index 8f7ae220..9df80d7a 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandManipulatedEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandManipulatedEvent.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -27,19 +28,27 @@ public class ArmorStandManipulatedEvent extends ArmorStandEvent implements Cancellable { - @Getter @Setter - private boolean cancelled = false; + @Getter + @Setter + private boolean cancelled = false; + + @Getter + protected final Player player; + + public ArmorStandManipulatedEvent(ArmorStand armorStand, Player player) { + super(armorStand); + this.player = player; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public ArmorStandManipulatedEvent(ArmorStand armorStand, Player player) { - super(armorStand); - this.player = player; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandRenameEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandRenameEvent.java index 07a62dbf..5b243872 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandRenameEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandRenameEvent.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -27,23 +28,32 @@ public class ArmorStandRenameEvent extends ArmorStandEvent implements Cancellable { - @Getter @Setter - private boolean cancelled = false; - @Getter @Setter - protected String name; + @Getter + @Setter + private boolean cancelled = false; + @Getter + @Setter + protected String name; + + @Getter + protected final Player player; + + public ArmorStandRenameEvent(ArmorStand armorStand, Player player, String name) { + super(armorStand); + this.player = player; + this.name = name; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public ArmorStandRenameEvent(ArmorStand armorStand, Player player, String name) { - super(armorStand); - this.player = player; - this.name = name; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandTargetedEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandTargetedEvent.java index 696b7ff9..196a039e 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandTargetedEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ArmorStandTargetedEvent.java @@ -21,25 +21,34 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; public class ArmorStandTargetedEvent extends ArmorStandEvent implements Cancellable { - @Getter @Setter - private boolean cancelled = false; + @Getter + @Setter + private boolean cancelled = false; + + @Getter + protected final Player player; + + public ArmorStandTargetedEvent(ArmorStand armorStand, Player player) { + super(armorStand); + this.player = player; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public ArmorStandTargetedEvent(ArmorStand armorStand, Player player) { - super(armorStand); - this.player = player; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } \ No newline at end of file diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameEvent.java index ec93be97..d6358613 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameEvent.java @@ -20,16 +20,17 @@ package io.github.rypofalem.armorstandeditor.api; import lombok.Getter; + import org.bukkit.entity.ItemFrame; import org.bukkit.event.Event; -public abstract class ItemFrameEvent extends Event{ +public abstract class ItemFrameEvent extends Event { - @Getter - protected final ItemFrame itemFrame; + @Getter + protected final ItemFrame itemFrame; - public ItemFrameEvent(ItemFrame itemFrame) { - this.itemFrame = itemFrame; - } + public ItemFrameEvent(ItemFrame itemFrame) { + this.itemFrame = itemFrame; + } } \ No newline at end of file diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameGlowEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameGlowEvent.java index 1d0b662e..7f5cdc97 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameGlowEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameGlowEvent.java @@ -2,25 +2,34 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; public class ItemFrameGlowEvent extends ItemFrameEvent implements Cancellable { - @Getter @Setter - private boolean cancelled = false; + @Getter + @Setter + private boolean cancelled = false; + + @Getter + protected final Player player; + + public ItemFrameGlowEvent(ItemFrame itemFrame, Player player) { + super(itemFrame); + this.player = player; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public ItemFrameGlowEvent(ItemFrame itemFrame, Player player) { - super(itemFrame); - this.player = player; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } \ No newline at end of file diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameManipulatedEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameManipulatedEvent.java index 6e190c92..9c80c077 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameManipulatedEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameManipulatedEvent.java @@ -20,6 +20,7 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -27,20 +28,28 @@ public class ItemFrameManipulatedEvent extends ItemFrameEvent implements Cancellable { - @Getter @Setter - private boolean cancelled = false; + @Getter + @Setter + private boolean cancelled = false; + + @Getter + protected final Player player; + + public ItemFrameManipulatedEvent(ItemFrame itemFrame, Player player) { + super(itemFrame); + this.player = player; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public ItemFrameManipulatedEvent(ItemFrame itemFrame, Player player) { - super(itemFrame); - this.player = player; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameTargetedEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameTargetedEvent.java index 9b1f8bfe..1c9c162c 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameTargetedEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/ItemFrameTargetedEvent.java @@ -21,25 +21,34 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; public class ItemFrameTargetedEvent extends ItemFrameEvent implements Cancellable { - @Getter @Setter - private boolean cancelled = false; + @Getter + @Setter + private boolean cancelled = false; + + @Getter + protected final Player player; + + public ItemFrameTargetedEvent(ItemFrame itemFrame, Player player) { + super(itemFrame); + this.player = player; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public ItemFrameTargetedEvent(ItemFrame itemFrame, Player player) { - super(itemFrame); - this.player = player; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/api/PlayerOpenMenuEvent.java b/src/main/java/io/github/rypofalem/armorstandeditor/api/PlayerOpenMenuEvent.java index 865233a2..908b6693 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/api/PlayerOpenMenuEvent.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/api/PlayerOpenMenuEvent.java @@ -20,25 +20,33 @@ import lombok.Getter; import lombok.Setter; + import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; public class PlayerOpenMenuEvent extends Event implements Cancellable { - @Getter - @Setter - private boolean cancelled = false; + @Getter + @Setter + private boolean cancelled = false; + + @Getter + protected final Player player; + + public PlayerOpenMenuEvent(Player player) { + this.player = player; + } - @Getter - protected final Player player; + /* Generated for Bukkit */ + private static final HandlerList handlers = new HandlerList(); - public PlayerOpenMenuEvent(Player player) { - this.player = player; - } + public static HandlerList getHandlerList() { + return (handlers); + } - /* Generated for Bukkit */ - private static final HandlerList handlers = new HandlerList(); - public static HandlerList getHandlerList() { return (handlers); } - @Override public HandlerList getHandlers() { return (handlers); } + @Override + public HandlerList getHandlers() { + return (handlers); + } } \ No newline at end of file diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/language/Language.java b/src/main/java/io/github/rypofalem/armorstandeditor/language/Language.java index ea579ca7..16b6e783 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/language/Language.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/language/Language.java @@ -21,15 +21,11 @@ package io.github.rypofalem.armorstandeditor.language; import io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin; + import org.bukkit.ChatColor; import org.bukkit.configuration.file.YamlConfiguration; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; +import java.io.*; import java.nio.charset.StandardCharsets; public class Language { @@ -93,14 +89,14 @@ public String getMessage(String path) { return getMessage(path, "info"); } - public String getRawMessage(String path, String format, String option){ + public String getRawMessage(String path, String format, String option) { String message = ChatColor.stripColor(getMessage(path, format, option)); format = getFormat(format); ChatColor color = ChatColor.WHITE; String bold = "" , italic = "" , underlined = "" , obfuscated = "" , strikethrough = ""; - for(int i = 0; i < format.length(); i++){ + for (int i = 0; i < format.length(); i++) { ChatColor code = ChatColor.getByChar(format.charAt(i)); - switch(code) { + switch (code) { case MAGIC: obfuscated = ", \"obfuscated\": true"; break; @@ -119,11 +115,11 @@ public String getRawMessage(String path, String format, String option){ default: color = !code.isColor() ? color : code; } } - return String.format("{\"text\":\"%s\", \"color\":\"%s\"%s%s%s%s%s}", message, color.name().toLowerCase(), + return "{\"text\":\"%s\", \"color\":\"%s\"%s%s%s%s%s}".formatted(message, color.name().toLowerCase(), obfuscated, bold, strikethrough, underlined, italic); } - private String getFormat(String format){ + private String getFormat(String format) { format = getString(format); return format == null ? "" : format; } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/menu/ASEHolder.java b/src/main/java/io/github/rypofalem/armorstandeditor/menu/ASEHolder.java index f3fe45f0..c5d341cd 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/menu/ASEHolder.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/menu/ASEHolder.java @@ -25,9 +25,9 @@ public class ASEHolder implements InventoryHolder { - @Override - public Inventory getInventory() { - return null; - } + @Override + public Inventory getInventory() { + return null; + } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/menu/EquipmentMenu.java b/src/main/java/io/github/rypofalem/armorstandeditor/menu/EquipmentMenu.java index d1eb2f6e..81aa44e7 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/menu/EquipmentMenu.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/menu/EquipmentMenu.java @@ -20,6 +20,7 @@ package io.github.rypofalem.armorstandeditor.menu; import io.github.rypofalem.armorstandeditor.PlayerEditor; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.ArmorStand; @@ -39,14 +40,14 @@ public class EquipmentMenu { static String name = "ArmorStand Equipment"; ItemStack helmet, chest, pants, feetsies, rightHand, leftHand; - public EquipmentMenu(PlayerEditor pe, ArmorStand as){ + public EquipmentMenu(PlayerEditor pe, ArmorStand as) { this.pe = pe; this.armorstand = as; name = pe.plugin.getLang().getMessage("equiptitle", "menutitle"); menuInv = Bukkit.createInventory(pe.getManager().getEquipmentHolder(), 18, name); } - private void fillInventory(){ + private void fillInventory() { menuInv.clear(); EntityEquipment equipment = armorstand.getEquipment(); assert equipment != null; @@ -71,13 +72,13 @@ private void fillInventory(){ ItemStack rightHandIcon = createIcon(Material.WOODEN_SWORD, "rhand"); ItemStack leftHandIcon = createIcon(Material.SHIELD, "lhand"); ItemStack[] items = - { helmetIcon, chestIcon, pantsIcon, feetsiesIcon, rightHandIcon, leftHandIcon, disabledIcon, disabledIcon, disabledIcon, - helmet, chest, pants, feetsies, rightHand, leftHand, disabledIcon, disabledIcon, disabledIcon - }; + {helmetIcon, chestIcon, pantsIcon, feetsiesIcon, rightHandIcon, leftHandIcon, disabledIcon, disabledIcon, disabledIcon, + helmet, chest, pants, feetsies, rightHand, leftHand, disabledIcon, disabledIcon, disabledIcon + }; menuInv.setContents(items); } - private ItemStack createIcon(Material mat, String slot){ + private ItemStack createIcon(Material mat, String slot) { ItemStack icon = new ItemStack(mat); ItemMeta meta = icon.getItemMeta(); meta.getPersistentDataContainer().set(pe.plugin.getIconKey(), PersistentDataType.STRING, "ase icon"); @@ -91,12 +92,12 @@ private ItemStack createIcon(Material mat, String slot){ return icon; } - public void open(){ + public void open() { fillInventory(); pe.getPlayer().openInventory(menuInv); } - public void equipArmorstand(){ + public void equipArmorstand() { helmet = menuInv.getItem(9); chest = menuInv.getItem(10); pants = menuInv.getItem(11); @@ -111,7 +112,7 @@ public void equipArmorstand(){ armorstand.getEquipment().setItemInOffHand(leftHand); } - public static String getName(){ + public static String getName() { return name; } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/menu/Menu.java b/src/main/java/io/github/rypofalem/armorstandeditor/menu/Menu.java index bd6edf94..38e2e4c1 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/menu/Menu.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/menu/Menu.java @@ -21,6 +21,7 @@ import io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin; import io.github.rypofalem.armorstandeditor.PlayerEditor; + import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.inventory.Inventory; @@ -65,6 +66,7 @@ private void fillInventory() { ItemStack visibility; ItemStack size = null; ItemStack rightLegPos; + ItemStack glowing; ItemStack leftLegPos; ItemStack plate = null; ItemStack copy = null; @@ -75,6 +77,7 @@ private void fillInventory() { ItemStack slot4 = null; ItemStack help; ItemStack itemFrameVisible; + ItemStack blankSlot; //Variables that need to be Initialized ItemStack place = null; @@ -84,53 +87,62 @@ private void fillInventory() { ItemStack playerHead = null; ItemStack toggleVulnerabilty = null; - xAxis = createIcon(new ItemStack(Material.RED_WOOL, 1), - "xaxis", "axis x"); + //Slots with No Value + blankSlot = createIcon(new ItemStack(Material.BLACK_STAINED_GLASS_PANE, 1), + "blankslot", ""); + + //Axis - X, Y, Z for Movement + xAxis = createIcon(new ItemStack(Material.RED_CONCRETE, 1), + "xaxis", "axis x"); - yAxis = createIcon(new ItemStack(Material.GREEN_WOOL, 1), - "yaxis", "axis y"); + yAxis = createIcon(new ItemStack(Material.GREEN_CONCRETE, 1), + "yaxis", "axis y"); - zAxis = createIcon(new ItemStack(Material.BLUE_WOOL, 1), - "zaxis", "axis z"); + zAxis = createIcon(new ItemStack(Material.BLUE_CONCRETE, 1), + "zaxis", "axis z"); - coarseAdj = createIcon(new ItemStack(Material.DIRT, 1), - "coarseadj", "adj coarse"); + //Movement Speed + coarseAdj = createIcon(new ItemStack(Material.COARSE_DIRT, 1), + "coarseadj", "adj coarse"); - fineAdj = createIcon(new ItemStack(Material.SANDSTONE), - "fineadj", "adj fine"); + fineAdj = createIcon(new ItemStack(Material.SMOOTH_SANDSTONE), + "fineadj", "adj fine"); - reset = createIcon(new ItemStack(Material.LEVER), - "reset", "mode reset"); + //Reset Changes + reset = createIcon(new ItemStack(Material.WATER_BUCKET), + "reset", "mode reset"); - headPos = createIcon(new ItemStack(Material.LEATHER_HELMET), - "head", "mode head"); + //Which Part to Move + headPos = createIcon(new ItemStack(Material.IRON_HELMET), + "head", "mode head"); - bodyPos = createIcon(new ItemStack(Material.LEATHER_CHESTPLATE), - "body", "mode body"); + bodyPos = createIcon(new ItemStack(Material.IRON_CHESTPLATE), + "body", "mode body"); - leftLegPos = createIcon(new ItemStack(Material.LEATHER_LEGGINGS), - "leftleg", "mode leftleg"); + leftLegPos = createIcon(new ItemStack(Material.IRON_LEGGINGS), + "leftleg", "mode leftleg"); - rightLegPos = createIcon(new ItemStack(Material.LEATHER_LEGGINGS), - "rightleg", "mode rightleg"); + rightLegPos = createIcon(new ItemStack(Material.IRON_LEGGINGS), + "rightleg", "mode rightleg"); leftArmPos = createIcon(new ItemStack(Material.STICK), - "leftarm", "mode leftarm"); + "leftarm", "mode leftarm"); rightArmPos = createIcon(new ItemStack(Material.STICK), - "rightarm", "mode rightarm"); + "rightarm", "mode rightarm"); showArms = createIcon(new ItemStack(Material.STICK), - "showarms", "mode showarms"); + "showarms", "mode showarms"); //Praise Start - Sikatsu and cowgod, Nicely spotted this being broken if (pe.getPlayer().hasPermission("asedit.togglearmorstandvisibility") || - pe.plugin.getArmorStandVisibility()) { + pe.plugin.getArmorStandVisibility()) { visibility = new ItemStack(Material.POTION, 1); PotionMeta potionMeta = (PotionMeta) visibility.getItemMeta(); - PotionEffect eff1 = new PotionEffect(PotionEffectType.INVISIBILITY, 1, 0); - assert potionMeta != null; - potionMeta.addCustomEffect(eff1, true); + PotionEffect effect = new PotionEffect(PotionEffectType.INVISIBILITY, 1, 0); + if (potionMeta != null) { + potionMeta.addCustomEffect(effect, true); + } visibility.setItemMeta(potionMeta); createIcon(visibility, "invisible", "mode invisible"); } else { @@ -138,7 +150,7 @@ private void fillInventory() { } if (pe.getPlayer().hasPermission("asedit.toggleitemframevisibility") || - pe.plugin.getItemFrameVisibility()) { + pe.plugin.getItemFrameVisibility()) { itemFrameVisible = new ItemStack(Material.ITEM_FRAME, 1); createIcon(itemFrameVisible, "itemframevisible", "mode itemframe"); } else { @@ -148,13 +160,13 @@ private void fillInventory() { //Praise end if (pe.getPlayer().hasPermission("asedit.toggleInvulnerability")) { - toggleVulnerabilty = createIcon(new ItemStack(Material.BEDROCK, 1), - "vulnerability", "mode vulnerability"); + toggleVulnerabilty = createIcon(new ItemStack(Material.TOTEM_OF_UNDYING, 1), + "vulnerability", "mode vulnerability"); } if (pe.getPlayer().hasPermission("asedit.togglesize")) { size = createIcon(new ItemStack(Material.PUFFERFISH, 1), - "size", "mode size"); + "size", "mode size"); } if (pe.getPlayer().hasPermission("asedit.disableslots")) { disableSlots = createIcon(new ItemStack(Material.BARRIER), "disableslots", "mode disableslots"); @@ -165,64 +177,75 @@ private void fillInventory() { } if (pe.getPlayer().hasPermission("asedit.togglebaseplate")) { - plate = createIcon(new ItemStack(Material.STONE_SLAB, 1), - "baseplate", "mode baseplate"); + plate = createIcon(new ItemStack(Material.SMOOTH_STONE_SLAB, 1), + "baseplate", "mode baseplate"); } if (pe.getPlayer().hasPermission("asedit.movement")) { - place = createIcon(new ItemStack(Material.MINECART, 1), - "placement", "mode placement"); + place = createIcon(new ItemStack(Material.RAIL, 1), + "placement", "mode placement"); } if (pe.getPlayer().hasPermission("asedit.rotation")) { rotate = createIcon(new ItemStack(Material.COMPASS, 1), - "rotate", "mode rotate"); + "rotate", "mode rotate"); } if (pe.getPlayer().hasPermission("asedit.equipment")) { equipment = createIcon(new ItemStack(Material.CHEST, 1), - "equipment", "mode equipment"); + "equipment", "mode equipment"); } if (pe.getPlayer().hasPermission("asedit.copy")) { - copy = createIcon(new ItemStack(Material.WRITABLE_BOOK), - "copy", "mode copy"); + copy = createIcon(new ItemStack(Material.FLOWER_BANNER_PATTERN), + "copy", "mode copy"); - slot1 = createIcon(new ItemStack(Material.DANDELION), - "copyslot", "slot 1", "1"); + slot1 = createIcon(new ItemStack(Material.BOOK), + "copyslot", "slot 1", "1"); - slot2 = createIcon(new ItemStack(Material.AZURE_BLUET, 2), - "copyslot", "slot 2", "2"); + slot2 = createIcon(new ItemStack(Material.BOOK, 2), + "copyslot", "slot 2", "2"); - slot3 = createIcon(new ItemStack(Material.BLUE_ORCHID, 3), - "copyslot", "slot 3", "3"); + slot3 = createIcon(new ItemStack(Material.BOOK, 3), + "copyslot", "slot 3", "3"); - slot4 = createIcon(new ItemStack(Material.PEONY, 4), - "copyslot", "slot 4", "4"); + slot4 = createIcon(new ItemStack(Material.BOOK, 4), + "copyslot", "slot 4", "4"); } - if (pe.getPlayer().hasPermission("asedit.paste")){ - paste = createIcon(new ItemStack(Material.ENCHANTED_BOOK), - "paste", "mode paste"); + if (pe.getPlayer().hasPermission("asedit.paste")) { + paste = createIcon(new ItemStack(Material.FEATHER), + "paste", "mode paste"); } - if(pe.getPlayer().hasPermission("asedit.head") && pe.plugin.getAllowedToRetrievePlayerHead()){ + if (pe.getPlayer().hasPermission("asedit.head") && pe.plugin.getAllowedToRetrievePlayerHead()) { playerHead = createIcon(new ItemStack(Material.PLAYER_HEAD, 1), - "playerheadmenu", - "playerhead"); + "playerheadmenu", + "playerhead"); + } else{ + playerHead = blankSlot; + } + + if (pe.getPlayer().hasPermission("asedit.togglearmorstandglow")){ + glowing = createIcon(new ItemStack(Material.GLOW_INK_SAC, 1), + "armorstandglow", + "mode armorstandglow"); + } else{ + glowing = blankSlot; } help = createIcon(new ItemStack(Material.NETHER_STAR), "helpgui", "help"); - ItemStack[] items = - { - xAxis, yAxis, zAxis, null, coarseAdj, fineAdj, null, rotate, place, - null, headPos, playerHead, null, null, null, null, null, null, - rightArmPos, bodyPos, leftArmPos, reset, null, null, showArms, visibility, size, - rightLegPos, equipment, leftLegPos, null, null, toggleVulnerabilty, disableSlots, gravity, plate, - null, copy, paste, null, null, null, null, itemFrameVisible, null, - slot1, slot2, slot3, slot4, null, null, null, null, help - }; + + ItemStack[] items = { + blankSlot, blankSlot, blankSlot, xAxis, yAxis, zAxis, blankSlot, blankSlot, help, + copy, paste, blankSlot, playerHead, headPos, reset, blankSlot, itemFrameVisible, blankSlot, + slot1, slot2, blankSlot, rightArmPos, bodyPos, leftArmPos, blankSlot, rotate, place, + slot3, slot4, blankSlot, rightLegPos, equipment, leftLegPos, blankSlot, coarseAdj, fineAdj, + blankSlot, glowing, blankSlot, blankSlot, blankSlot, blankSlot, blankSlot, blankSlot, blankSlot, + blankSlot, showArms, visibility, size, gravity, plate, toggleVulnerabilty, disableSlots, blankSlot + }; + menuInv.setContents(items); } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/modes/AdjustmentMode.java b/src/main/java/io/github/rypofalem/armorstandeditor/modes/AdjustmentMode.java index 631af300..0e0f1386 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/modes/AdjustmentMode.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/modes/AdjustmentMode.java @@ -24,11 +24,11 @@ public enum AdjustmentMode { private String name; - AdjustmentMode(String name){ + AdjustmentMode(String name) { this.name = name; } - public String toString(){ + public String toString() { return name; } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/modes/ArmorStandData.java b/src/main/java/io/github/rypofalem/armorstandeditor/modes/ArmorStandData.java index 70c190f0..7f906422 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/modes/ArmorStandData.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/modes/ArmorStandData.java @@ -28,7 +28,7 @@ public class ArmorStandData { public boolean visible, size, basePlate, gravity, showArms; public ItemStack head, body, legs, feetsies, rightHand, leftHand; - ArmorStandData(ArmorStand as){ + ArmorStandData(ArmorStand as) { this.headPos = as.getHeadPose(); this.leftArmPos = as.getLeftArmPose(); this.rightArmPos = as.getRightArmPose(); diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/modes/Axis.java b/src/main/java/io/github/rypofalem/armorstandeditor/modes/Axis.java index 178335ef..afa6c45c 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/modes/Axis.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/modes/Axis.java @@ -24,11 +24,11 @@ public enum Axis { String name; - Axis(String name){ + Axis(String name) { this.name = name; } - public String toString(){ + public String toString() { return name; } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/modes/CopySlots.java b/src/main/java/io/github/rypofalem/armorstandeditor/modes/CopySlots.java index ace6efd4..3e826ade 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/modes/CopySlots.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/modes/CopySlots.java @@ -23,24 +23,24 @@ public class CopySlots { ArmorStandData[] slots = new ArmorStandData[9]; - public byte currentSlot =0; + public byte currentSlot = 0; //returns true if parameters are acceptable, false otherwise. - public boolean changeSlots(byte slot){ - if(slot < slots.length && slot>=0){ + public boolean changeSlots(byte slot) { + if (slot < slots.length && slot >= 0) { currentSlot = slot; return true; - }else{ + } else { return false; } } - public void copyDataToSlot(ArmorStand armorStand){ + public void copyDataToSlot(ArmorStand armorStand) { slots[currentSlot] = new ArmorStandData(armorStand); } //returns null if there is not data in current slot - public ArmorStandData getDataToPaste(){ + public ArmorStandData getDataToPaste() { return slots[currentSlot]; } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/modes/EditMode.java b/src/main/java/io/github/rypofalem/armorstandeditor/modes/EditMode.java index eda5095c..00f3488c 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/modes/EditMode.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/modes/EditMode.java @@ -23,15 +23,15 @@ public enum EditMode { NONE("None"), INVISIBLE("Invisible"), SHOWARMS("ShowArms"), GRAVITY("Gravity"), BASEPLATE("BasePlate"), SIZE("Size"), COPY("Copy"), PASTE("Paste"), HEAD("Head"), BODY("Body"), LEFTARM("LeftArm"), RIGHTARM("RightArm"), LEFTLEG("LeftLeg"), RIGHTLEG("RightLeg"), PLACEMENT("Placement"), DISABLESLOTS("DisableSlots"), ROTATE("Rotate"), EQUIPMENT("Equipment"), RESET("Reset"), ITEMFRAME("ItemFrame"), ITEMFRAMEGLOW("ItemFrameGlow"), - VULNERABILITY("Vulnerability"), PLAYERHEAD("playerheadmenu"); + VULNERABILITY("Vulnerability"), PLAYERHEAD("playerheadmenu"), GLOWING("armorstandglow"); private String name; - EditMode(String name){ + EditMode(String name) { this.name = name; } - public String toString(){ + public String toString() { return name; } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/BentoBoxProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/BentoBoxProtection.java index 1a434f75..1c78b52b 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/BentoBoxProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/BentoBoxProtection.java @@ -19,9 +19,6 @@ package io.github.rypofalem.armorstandeditor.protections; -import org.bukkit.Bukkit; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; @@ -29,9 +26,13 @@ import world.bentobox.bentobox.managers.AddonsManager; import world.bentobox.bentobox.managers.IslandsManager; +import org.bukkit.Bukkit; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + import java.util.Optional; -public class BentoBoxProtection implements Protection { +public class BentoBoxProtection implements Protection { private final boolean bentoEnabled; @@ -42,29 +43,29 @@ public BentoBoxProtection() { @Override public boolean checkPermission(Block block, Player player) { - if(!bentoEnabled || player.isOp() || - player.hasPermission("asedit.ignoreProtection.bentobox") || - player.hasPermission("bentobox.admin")) return true; + if (!bentoEnabled || player.isOp() || + player.hasPermission("asedit.ignoreProtection.bentobox") || + player.hasPermission("bentobox.admin")) return true; //Get the Bento Instance BentoBox myBento = BentoBox.getInstance(); - if( myBento == null ) return true; + if (myBento == null) return true; //Get the Various Managers for Bentobox IslandsManager islandsManager = myBento.getIslandsManager(); AddonsManager addonsManager = myBento.getAddonsManager(); //Check first if BSkyblock is enabled or if the Player is Owner of that Island - if(!addonsManager.getAddonByName("BSkyblock").isPresent()) return true; + if (addonsManager.getAddonByName("BSkyblock").isEmpty()) return true; //Get the Location of the ArmorStand Optional islandOptional = islandsManager.getIslandAt(block.getLocation()); //If there are no Islands Present - if(!islandOptional.isPresent()) return true; + if (islandOptional.isEmpty()) return true; //Do not run this check if the player is the owner of the island - if(islandsManager.isOwner(player.getWorld(), player.getUniqueId())) return true; + if (islandsManager.isOwner(player.getWorld(), player.getUniqueId())) return true; //Get the Island from the Island Optional Island theIsland = islandOptional.get(); diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefDefenderProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefDefenderProtection.java index 0d7dc403..cfc2c179 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefDefenderProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefDefenderProtection.java @@ -30,7 +30,7 @@ import static com.griefdefender.api.claim.TrustTypes.BUILDER; -public class GriefDefenderProtection implements Protection { +public class GriefDefenderProtection implements Protection { private final boolean gdEnabled; diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefPreventionProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefPreventionProtection.java index 626a0e4e..d9153e00 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefPreventionProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/GriefPreventionProtection.java @@ -21,6 +21,7 @@ import me.ryanhamshire.GriefPrevention.Claim; import me.ryanhamshire.GriefPrevention.GriefPrevention; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; @@ -31,37 +32,37 @@ /** @Deprecated * Plugin has gone unsupported for a while - Might be cleaned up later. **/ -public class GriefPreventionProtection implements Protection { +public class GriefPreventionProtection implements Protection { private boolean gpEnabled; private GriefPrevention griefPrevention = null; /** @Deprecated **/ - public GriefPreventionProtection(){ + public GriefPreventionProtection() { gpEnabled = Bukkit.getPluginManager().isPluginEnabled("GriefPrevention"); - if(!gpEnabled) return; + if (!gpEnabled) return; griefPrevention = (GriefPrevention) Bukkit.getPluginManager().getPlugin("GriefPrevention"); } /** @Deprecated **/ - public boolean checkPermission(Block block, Player player){ - if(!gpEnabled) return true; - if(player.hasPermission("asedit.ignoreProtection.griefPrevention")) return true; + public boolean checkPermission(Block block, Player player) { + if (!gpEnabled) return true; + if (player.hasPermission("asedit.ignoreProtection.griefPrevention")) return true; Location blockLoc = block.getLocation(); - if(GriefPrevention.instance.claimsEnabledForWorld(blockLoc.getWorld())){ + if (GriefPrevention.instance.claimsEnabledForWorld(blockLoc.getWorld())) { Claim landClaim = griefPrevention.dataStore.getClaimAt(blockLoc, false, null); Material blockMat = block.getType(); - if(landClaim != null && landClaim.allowEdit(player) != null && landClaim.allowBuild(player,blockMat) != null){ + if (landClaim != null && landClaim.allowEdit(player) != null && landClaim.allowBuild(player, blockMat) != null) { player.sendMessage(ChatColor.RED + landClaim.allowEdit(player)); player.sendMessage(ChatColor.RED + landClaim.allowBuild(player, blockMat)); return false; } - } else{ + } else { return true; } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/LandsProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/LandsProtection.java index 56914a19..2d00f3e5 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/LandsProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/LandsProtection.java @@ -18,12 +18,14 @@ */ package io.github.rypofalem.armorstandeditor.protections; -import io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin; import me.angeschossen.lands.api.LandsIntegration; import me.angeschossen.lands.api.land.Area; import me.angeschossen.lands.api.land.LandWorld; import me.angeschossen.lands.api.player.LandPlayer; import me.angeschossen.lands.api.role.Role; + +import io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin; + import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -54,44 +56,37 @@ public boolean checkPermission(Block block, Player player) { //Get the world the play is in LandWorld landWorld = landsAPI.getWorld(player.getWorld()); - if(landWorld != null) { + if (landWorld != null) { //Prep to do check for ClaimedArea Area landAreaOfAS = landsAPI.getArea(block.getLocation()); Area landAreaOfPlayer = landsAPI.getArea(player.getLocation()); if (landAreaOfAS != null) { //Block is in a Claimed Area - if(landAreaOfPlayer == landAreaOfAS) { + if (landAreaOfPlayer == landAreaOfAS) { //Get Visitor Role for the Area of the AS Role visitorRole = landAreaOfAS.getVisitorRole(); //If Player is a Visitor - Dont allow Edits - if(landAreaOfAS.getRole(playerUUID) == visitorRole) return false; + if (landAreaOfAS.getRole(playerUUID) == visitorRole) return false; // If Player is Trusted OR Player is Owner of the Area/Claim, Allow Edits - if (landAreaOfAS.isTrusted(playerUUID) || landAreaOfAS.getOwnerUID() == landPlayer.getUID())return true; - - // If in the Claim a Player can: - // break Blocks, - // Place - // Interact with in Claimed Area - // add items to a container - // Allow Edits + if (landAreaOfAS.isTrusted(playerUUID) || landAreaOfAS.getOwnerUID() == landPlayer.getUID()) return true; else if (landAreaOfAS.hasRoleFlag(playerUUID, BLOCK_BREAK) || - landAreaOfAS.hasRoleFlag(playerUUID, BLOCK_PLACE) || - landAreaOfAS.hasRoleFlag(playerUUID, INTERACT_CONTAINER) || - landAreaOfAS.hasRoleFlag(playerUUID, INTERACT_GENERAL)) { + landAreaOfAS.hasRoleFlag(playerUUID, BLOCK_PLACE) || + landAreaOfAS.hasRoleFlag(playerUUID, INTERACT_CONTAINER) || + landAreaOfAS.hasRoleFlag(playerUUID, INTERACT_GENERAL)) { return true; - } else{ // Any other case, dont allow edits + } else { // Any other case, dont allow edits return false; } } else return false; //If the land areas are different } else { //If the AS is in the Wilderness return true; } - }else { //if the ArmorStand is in a world + } else { //if the ArmorStand is in a world return true; } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/PlotSquaredProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/PlotSquaredProtection.java index 3d25ecac..b1f78436 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/PlotSquaredProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/PlotSquaredProtection.java @@ -19,39 +19,63 @@ package io.github.rypofalem.armorstandeditor.protections; import com.plotsquared.bukkit.BukkitPlatform; +import com.plotsquared.core.PlotAPI; +import com.plotsquared.core.location.Location; +import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; -import com.plotsquared.core.location.Location; +import com.sk89q.worldedit.math.BlockVector3; import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; -public class PlotSquaredProtection implements Protection { +import java.util.UUID; + +public class PlotSquaredProtection implements Protection { private final boolean psEnabled; - private BukkitPlatform psPlatform = null; + private PlotAPI plotAPI; - public PlotSquaredProtection(){ + public PlotSquaredProtection() { psEnabled = Bukkit.getPluginManager().isPluginEnabled("PlotSquared"); if (!psEnabled) return; - psPlatform = (BukkitPlatform) Bukkit.getPluginManager().getPlugin("PlotSquared"); } - public boolean checkPermission(Block block, Player player){ - if(!psEnabled) return true; - if(player.isOp()) return true; - if(player.hasPermission("asedit.ignoreProtection.plotSquared")) return true; + public boolean checkPermission(Block block, Player player) { + if (!psEnabled) return true; + if (player.isOp()) return true; + if (player.hasPermission("asedit.ignoreProtection.plotSquared")) return true; + if (plotAPI == null) plotAPI = new PlotAPI(); + + //Get the Location of the Plot + Location plotLocation = Location.at(player.getWorld().getName(), BlockVector3.at(block.getX(), block.getY(), block.getZ())); + + //Get the Area of the PLot + PlotArea area = plotLocation.getPlotArea(); + + //If the Area is not a Plot, then we assume its a road, we return if a player can build on roads or not + if(area == null) + return player.hasPermission("plots.admin.build.road"); + + //Get the Plot + Plot plot = area.getPlot(plotLocation); + + //Rerun the Area check + if(plot == null) + return player.hasPermission("plots.admin.build.road"); + + //Get the Player + PlotPlayer plotPlayer = plotAPI.wrapPlayer(player.getUniqueId()); + + if(plotPlayer == null) return true; + + //Get the UUID of the PlotPlayer + UUID uuid = plotPlayer.getUUID(); - Location location = Location.at(block.getWorld().getName(), - block.getLocation().getBlockX(), - block.getLocation().getBlockY(), - block.getLocation().getBlockZ()); + //Return if they are added to the plot or if they are OP and have the Permission to build anywhere + return plot.isAdded(uuid) || plotPlayer.hasPermission("plots.admin.build.other"); - PlotArea area = psPlatform.plotAreaManager().getPlotArea(location); - if(area == null) return true; - Plot plot = area.getPlot(location); - return plot == null || plot.isAdded(player.getUniqueId()); } } diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/SkyblockProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/SkyblockProtection.java index 6d26ec14..30f52eca 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/SkyblockProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/SkyblockProtection.java @@ -21,19 +21,20 @@ import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI; import com.bgsoftware.superiorskyblock.api.island.Island; import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer; + import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; -public class SkyblockProtection implements Protection { +public class SkyblockProtection implements Protection { private final boolean skyblockEnabled; - public SkyblockProtection(){ + public SkyblockProtection() { //NOTE FROM AUTHOR: I know there are many plugins that have Skyblock. I am using SuperiorSkyBlock2 as an Example! //IF YOU WANT YOUR SKYBLOCK ADDED, PLEASE SUBMIT A FEATURE REQUEST! skyblockEnabled = Bukkit.getPluginManager().isPluginEnabled("SuperiorSkyblock2"); - if(!skyblockEnabled) return; + if (!skyblockEnabled) return; } public boolean checkPermission(Block block, Player player) { diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/TownyProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/TownyProtection.java index 6be3332f..0ad76435 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/TownyProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/TownyProtection.java @@ -28,18 +28,18 @@ import org.bukkit.entity.Player; //FIX for https://github.com/Wolfieheart/ArmorStandEditor-Issues/issues/15 -public class TownyProtection implements Protection { +public class TownyProtection implements Protection { private final boolean tEnabled; - public TownyProtection(){ + public TownyProtection() { tEnabled = Bukkit.getPluginManager().isPluginEnabled("Towny"); } - public boolean checkPermission(Block block, Player player){ - if(!tEnabled) return true; - if(player.isOp()) return true; - if(player.hasPermission("asedit.ignoreProtection.towny")) return true; //Add Additional Permission + public boolean checkPermission(Block block, Player player) { + if (!tEnabled) return true; + if (player.isOp()) return true; + if (player.hasPermission("asedit.ignoreProtection.towny")) return true; //Add Additional Permission Location playerLoc = player.getLocation(); diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/protections/WorldGuardProtection.java b/src/main/java/io/github/rypofalem/armorstandeditor/protections/WorldGuardProtection.java index 814939d2..f49b9de2 100644 --- a/src/main/java/io/github/rypofalem/armorstandeditor/protections/WorldGuardProtection.java +++ b/src/main/java/io/github/rypofalem/armorstandeditor/protections/WorldGuardProtection.java @@ -27,7 +27,6 @@ import com.sk89q.worldguard.protection.regions.RegionContainer; import com.sk89q.worldguard.protection.regions.RegionQuery; - import org.bukkit.Bukkit; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -36,17 +35,17 @@ public class WorldGuardProtection implements Protection { private final boolean wgEnabled; private RegionQuery regionQry; - public WorldGuardProtection(){ + public WorldGuardProtection() { wgEnabled = Bukkit.getPluginManager().isPluginEnabled("WorldGuard"); - if(!wgEnabled) return; + if (!wgEnabled) return; RegionContainer regionContainer = WorldGuard.getInstance().getPlatform().getRegionContainer(); regionQry = regionContainer.createQuery(); } - public boolean checkPermission(Block block, Player player){ + public boolean checkPermission(Block block, Player player) { if (!wgEnabled) return true; - if(player.isOp()) return true; + if (player.isOp()) return true; if (player.hasPermission("asedit.ignoreProtection.worldGuard")) return true; LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 2d51bd1e..601c6f23 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -3,7 +3,7 @@ #-----------------------------# #DO NOT CHANGE THIS - CHANGES AUTOMATICALLY PER UPDATE -version: "1.20.1-43.2" +version: "1.20.2-44" #----------- LANGUAGE #Name of the language file you wish to use @@ -13,15 +13,23 @@ version: "1.20.1-43.2" lang: en_US.yml #----------- UPDATE NOTIFICATIONS -#Enable or Disable the Update Checker +# Enable or Disable the Update Checker runTheUpdateChecker: true # When runTheUpdateChecker is true, we will also check every X hours check-interval: 24 -#Set this to allow your operators to get messages in game w.r.t Plugin updates +# Set this to allow your operators to get messages in game w.r.t Plugin updates opUpdateNotification: false +#----------- WORLD SETTINGS +# Add in a list of Worlds where ArmorStandEditing is allowed to happen +# Please add your own worlds to this list. All Default Worlds are supported. +allowed-worlds: + - world + - world_nether + - world_the_end + #----------- TOOL SETTINGS #Name of the edit tool's item Material. diff --git a/src/main/resources/lang/de_DE.yml b/src/main/resources/lang/de_DE.yml index d8a0f5ab..be6b04ee 100644 --- a/src/main/resources/lang/de_DE.yml +++ b/src/main/resources/lang/de_DE.yml @@ -76,6 +76,12 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. playerheaderror: msg: Unable to Retrieve Player Head. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +stats: + msg: Here are the statistics for your ArmorStand. help: msg: "1. Halte das Bearbeitungswerkzeug() in deiner Haupthand. @@ -106,8 +112,26 @@ cantedit: msg: Entschuldigung, du kannst hier keine Rüstungsständer bearbeiten! noperm: msg: Du hast keine Erlaubnis diesen Befehl zu nutzen! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow noslotnumcom: msg: Du musst eine Slotnummer angeben! +norangestats: + msg: Please get next to an ArmorStand before running this command. noadjcom: msg: Du musst Grob oder Fein auswählen! noaxiscom: @@ -228,6 +252,22 @@ helpgui: msg: Hilfe! description: msg: Klicke hier um Hilfe zu erhalten! +itemframevisible: + msg: Itemframe Visibility + description: + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/en_US.yml b/src/main/resources/lang/en_US.yml index 58f69c87..5a0e6153 100644 --- a/src/main/resources/lang/en_US.yml +++ b/src/main/resources/lang/en_US.yml @@ -86,6 +86,12 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file and/or check your permissions to confirm that you have asedit.head set to true. playerheaderror: msg: Unable to Retrieve Player Head. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +stats: + msg: Here are the statistics for your ArmorStand. playerheadhelp: msg: "Please use /ase playerhead to get a players head. Ex of the command - /ase playerhead Wolfieheart_" help: @@ -116,6 +122,24 @@ cantedit: msg: Sorry, you cannot edit armor stands here! noperm: msg: You don't have permission to use this! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: You must specify a slot number! noadjcom: @@ -250,6 +274,14 @@ playerheadmenu: msg: Player Head description: msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/es_ES.yml b/src/main/resources/lang/es_ES.yml index 6f4fc51c..4e66c87e 100644 --- a/src/main/resources/lang/es_ES.yml +++ b/src/main/resources/lang/es_ES.yml @@ -73,6 +73,10 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. playerheaderror: msg: Unable to Retrieve Player Head. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. help: msg: "1. Manten la herramienta de edición () en tu mano principal. @@ -97,12 +101,32 @@ helpdiscord: msg: "or join our Discord: https://discord.gg/3BbJKWpTCj" give: msg: Player given Item with CustomModelData +stats: + msg: Here are the statistics for your ArmorStand. #warn cantedit: msg: Lo siento, no puedes editar soportes aqui. -noperm: +noperm: msg: No tienes permiso para usar esto +norangestats: + msg: Please get next to an ArmorStand before running this command. +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow noslotnumcom: msg: Tienes que especificar un número de soot noadjcom: @@ -225,6 +249,22 @@ vulnerability: msg: Toggle Vulnerability description: msg: Toggles an item's vulnerability state +itemframevisible: + msg: Itemframe Visibility + description: + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/fr_FR.yml b/src/main/resources/lang/fr_FR.yml index 72907c83..f0f96185 100644 --- a/src/main/resources/lang/fr_FR.yml +++ b/src/main/resources/lang/fr_FR.yml @@ -71,6 +71,14 @@ doubletarget: msg: Regardez un armor stand ou un item frame, pas les deux! nodoubletarget: msg: Regardez un armor stand ou un item frame avant de changer de main! +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +stats: + msg: Here are the statistics for your ArmorStand. +playerheadhelp: + msg: "Please use /ase playerhead to get a players head. Ex of the command - /ase playerhead Wolfieheart_" help: msg: "1. Tenez l'outil d'édition () dans votre main principale. @@ -103,8 +111,26 @@ playerheaderror: #warn cantedit: msg: Désolé, vous ne pouvez pas modifier des armor stands ici ! -noperm: +noperm: msg: Vous n'avez pas la permission d'utiliser ceci ! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: Vous devez spécifier un numéro d'emplacement de copie ! noadjcom: @@ -233,6 +259,18 @@ itemframevisible: msg: Visibilité (Item Frame) description: msg: Rend visible ou invisible un Item Frame +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/ja_JP.yml b/src/main/resources/lang/ja_JP.yml index c0fb5a1d..fcdc6393 100644 --- a/src/main/resources/lang/ja_JP.yml +++ b/src/main/resources/lang/ja_JP.yml @@ -76,6 +76,14 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. playerheaderror: msg: Unable to Retrieve Player Head. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +stats: + msg: Here are the statistics for your ArmorStand. +playerheadhelp: + msg: "Please use /ase playerhead to get a players head. Ex of the command - /ase playerhead Wolfieheart_" help: msg: "1. 編集ツール()を手に持ちます。 @@ -104,6 +112,24 @@ cantedit: msg: 申し訳ありません、ここでアーマースタンドを編集することができません! noperm: msg: 使用する権限がありません! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: スロット番号を指定する必要があります! noadjcom: @@ -223,10 +249,22 @@ helpgui: msg: ヘルプ description: msg: ここをクリックするとヘルプが確認できます! -vulnerability: - msg: Toggle Vulnerability +itemframevisible: + msg: Itemframe Visibility description: - msg: Toggles an item's vulnerability state + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/nl_NL.yml b/src/main/resources/lang/nl_NL.yml index ec601cd4..183b66cf 100644 --- a/src/main/resources/lang/nl_NL.yml +++ b/src/main/resources/lang/nl_NL.yml @@ -70,7 +70,12 @@ nodoubletarget: msg: Kijk naar een ArmorStand of een ItemFrame voor je van hand verandert! give: msg: Speler heeft een item met CustomModelData ontvangen - +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +playerheadhelp: + msg: "Please use /ase playerhead to get a players head. Ex of the command - /ase playerhead Wolfieheart_" #Help help: msg: "1. Houd het wijzigingsgereedschap () in uw hoofdhand. @@ -98,11 +103,32 @@ playerhead: msg: Player Head opgehaald. playerheaderror: msg: Probleem om Player Head af te halen. +stats: + msg: Here are the statistics for your ArmorStand. + #warn cantedit: msg: Sorry, je kunt hier geen armorstands aanpassen! noperm: msg: Sorry, je hebt geen tostemming om dit command te gebruiken! +nopermoption: + msg: Sorry, je hebt geen tostemming om optie te gebruiken! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: Je moet een slot nummer opgeven! noadjcom: @@ -223,6 +249,23 @@ vulnerability: msg: Kwetsbaarheid description: msg: In en uit schakelen van Kwetsbaarheid. +itemframevisible: + msg: Itemframe Visibility + description: + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. + #icons (equipment menu) disabled: msg: Uitgeschakeld diff --git a/src/main/resources/lang/pl_PL.yml b/src/main/resources/lang/pl_PL.yml index bf1ad66f..e9ecfe83 100644 --- a/src/main/resources/lang/pl_PL.yml +++ b/src/main/resources/lang/pl_PL.yml @@ -77,11 +77,35 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. playerheaderror: msg: Unable to Retrieve Player Head. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +stats: + msg: Here are the statistics for your ArmorStand. #warn cantedit: msg: Nie możesz tego zrobić -noperm: +noperm: msg: Nie posiadasz wymaganych uprawnień +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: Musisz wybrać slot! noadjcom: @@ -204,6 +228,22 @@ helpgui: msg: Pomocy! description: msg: Kliknij tutaj, aby dostać pomoc! +itemframevisible: + msg: Itemframe Visibility + description: + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/pt_BR.yml b/src/main/resources/lang/pt_BR.yml index 1309bcc4..dbf67001 100644 --- a/src/main/resources/lang/pt_BR.yml +++ b/src/main/resources/lang/pt_BR.yml @@ -96,11 +96,32 @@ helpurl: msg: "More info: https://github.com/RypoFalem/ArmorStandEditor/wiki" helpdiscord: msg: "or join our Discord: https://discord.gg/3BbJKWpTCj" +stats: + msg: Here are the statistics for your ArmorStand. + #warn cantedit: msg: Sorry, you cannot edit armor stands here! noperm: msg: You don't have permission to use this! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: You must specify a slot number! noadjcom: @@ -119,6 +140,10 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. playerheaderror: msg: Unable to Retrieve Player Head. +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. #menutitle mainmenutitle: msg: Editor do suporte de armaduras @@ -230,10 +255,18 @@ itemframevisible: msg: Itemframe Visibility description: msg: Toggles an itemframes visibility -vulnerability: - msg: Toggle Vulnerability +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow description: - msg: Toggles an item's vulnerability state + msg: Turn ArmorStand Glowing on or off. #icons (equipment menu) disabled: diff --git a/src/main/resources/lang/ro_RO.yml b/src/main/resources/lang/ro_RO.yml index b68570c7..ae083396 100644 --- a/src/main/resources/lang/ro_RO.yml +++ b/src/main/resources/lang/ro_RO.yml @@ -70,12 +70,32 @@ playerhead: msg: Player Head retrieved. noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. +stats: + msg: Here are the statistics for your ArmorStand. #warn cantedit: msg: Nu poti edita armorstand-ul aici! -noperm: +noperm: msg: Nu ai permisiunea sa folosesti asta! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: Trebuie sa specifici numarul unui slot. noadjcom: @@ -88,7 +108,10 @@ nogive: msg: You have no permission to use the give command! playerheaderror: msg: Unable to Retrieve Player Head. - +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. #menutitle mainmenutitle: msg: Armor Stand Editor Menu @@ -197,6 +220,22 @@ vulnerability: msg: Toggle Vulnerability description: msg: Toggles an item's vulnerability state +itemframevisible: + msg: Itemframe Visibility + description: + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment) disabled: diff --git a/src/main/resources/lang/ru_RU.yml b/src/main/resources/lang/ru_RU.yml index b312c070..1bcfe6bc 100644 --- a/src/main/resources/lang/ru_RU.yml +++ b/src/main/resources/lang/ru_RU.yml @@ -1,4 +1,4 @@ -# Translated by KPidS +# Translated by KPidS+Hopak120 iconname: 2n icondescription: 5 @@ -20,7 +20,7 @@ setmode: invisible: переключения видимости size: переключения размера disableslots: переключения блокировки снаряжения - vulnerability: Toggle Vulnerability + vulnerability: переключения неуязвимости gravity: переключения гравитации baseplate: переключения плиты placement: изменения расположения @@ -59,15 +59,15 @@ target: notarget: msg: Цель стойки разблокирована toggleinvulnerability: - msg: ArmorStand vulnerability state has been toggled to . - true: invulnerable - false: vulnerable + msg: Стойка стала . + true: неуязвимой + false: уязвимой frametarget: msg: Цель рамки заблокирована doubletarget: msg: Наведитесь на стойку или на рамку, а не на то и другое одновременно. nodoubletarget: - msg: Please look at an ArmorStand or an ItemFrame before switching hands! + msg: Пожалуйста, смотрите на стойку или на рамку прежде чем менять руки! reloaded: msg: Конфиг перезагружен. help: @@ -90,9 +90,9 @@ helptips: helpurl: msg: "Больше информации: https://github.com/RypoFalem/ArmorStandEditor/wiki" helpdiscord: - msg: "or join our Discord: https://discord.gg/3BbJKWpTCj" + msg: "или присоединитесь к нашему Discord: https://discord.gg/3BbJKWpTCj" give: - msg: Player given Item with CustomModelData + msg: Игроку выдан предмет с CustomModelData. #warn cantedit: @@ -110,13 +110,13 @@ nomodecom: noreloadcom: msg: У вас нет прав, чтобы использовать эту команду nogive: - msg: You have no permission to use the give command! + msg: У вас нет прав на команду give playerhead: - msg: Player Head retrieved. + msg: Получена голова игрока. noplayerhead: - msg: Please turn on the ability to retrieve player heads in the config file. + msg: Пожалуйста включите возможность получения головы игрока в конфиге. playerheaderror: - msg: Unable to Retrieve Player Head. + msg: Невозможно получить голову игрока #menutitle mainmenutitle: @@ -230,9 +230,9 @@ itemframevisible: description: msg: Включить или выключить видимость рамки vulnerability: - msg: Toggle Vulnerability + msg: Неуязвимость description: - msg: Toggles an item's vulnerability state + msg: Включить или выключить неуязвимость #icons (equipment menu) disabled: @@ -245,7 +245,7 @@ equipslot: chest: нагрудник pants: штаны boots: ботинки - rhand: предмет для правой руки + rhand: предмет для правой руки lhand: предмет для левой руки helm: Шлем chest: Нагрудник diff --git a/src/main/resources/lang/test_NA.yml b/src/main/resources/lang/test_NA.yml index 2cb377b0..88916e28 100644 --- a/src/main/resources/lang/test_NA.yml +++ b/src/main/resources/lang/test_NA.yml @@ -55,8 +55,20 @@ pasted: #warn cantedit: msg: Sorry, you cannot edit armor stands here! -noperm: - msg: You don't have permission to use this! +noperm: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config noslotnumcom: msg: You must specify a slot number! noadjcom: @@ -75,7 +87,10 @@ toggleinvulnerability: msg: ArmorStand vulnerability state has been toggled to . true: invulnerable false: vulnerable - +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. #menutitle mainmenutitle: msg: Armor Stand Editor Menu @@ -179,7 +194,10 @@ copyslot: msg: Copy Slot description: msg: Select a slot to store settings - +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. #icons (equipment) disabled: msg: Disabled diff --git a/src/main/resources/lang/uk_UA.yml b/src/main/resources/lang/uk_UA.yml index 090abcb9..e728be8e 100644 --- a/src/main/resources/lang/uk_UA.yml +++ b/src/main/resources/lang/uk_UA.yml @@ -70,12 +70,35 @@ noplayerhead: msg: Please turn on the ability to retrieve player heads in the config file. playerheaderror: msg: Unable to Retrieve Player Head. - +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +stats: + msg: Here are the statistics for your ArmorStand. #warn cantedit: msg: Ти не можеш змінювати стенди тут! noperm: msg: У тебе нема прав! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: Уточніть слот! noadjcom: @@ -190,6 +213,22 @@ vulnerability: msg: Toggle Vulnerability description: msg: Toggles an item's vulnerability state +itemframevisible: + msg: Itemframe Visibility + description: + msg: Toggles an itemframes visibility +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. #icons (equipment) disabled: diff --git a/src/main/resources/lang/zh_CN.yml b/src/main/resources/lang/zh_CN.yml index 7a7bae7d..082f30ae 100644 --- a/src/main/resources/lang/zh_CN.yml +++ b/src/main/resources/lang/zh_CN.yml @@ -102,12 +102,36 @@ noplayerhead: msg: 请先在配置文件中开启获取玩家头颅功能 playerheaderror: msg: 无法获取玩家头颅 +notincorrectworld: + msg: Sorry but you are not in the correct world to use ArmorStandEditor. +unabledestroycreative: + msg: Unable to Destroy this Invulnerable ArmorStand in Creative Mode. +stats: + msg: Here are the statistics for your ArmorStand. #警告 cantedit: msg: 对不起, 你无法在这里编辑盔甲架! noperm: msg: 你没有权限这样做! +nopermoption: + msg: You don't have permission to use the Option! + basic: Normal ArmorStand + showarms: Show Arms + armorstandvisibility: Armor Stand Visibility + baseplate: Set Baseplate Visibility + gravity: Toggle Gravity + vulnerability: Toggle Vulnerability! + itemframevisibility: Item Frame Visibility + size: Toggle ArmorStand Size + disableslots: Toggle Equipment Lock + paste: Paste ArmorStand Config + copy: Copy ArmorStand Config + reset: Reset ArmorStand Config + stats: View ArmorStand Statistics + armorstandglow: Toggle ArmorStand Glow +norangestats: + msg: Please get next to an ArmorStand before running this command. noslotnumcom: msg: 你必须选择一个物品栏! noadjcom: @@ -232,7 +256,19 @@ itemframevisible: msg: 物品展示框显隐切换 description: msg: 显示/隐形物品展示框 - +blankslot: + msg: Nothing here + description: + msg: Just a placeholder item. Clicking me will not do anything. +playerheadmenu: + msg: Player Head + description: + msg: Please use /ase playerhead +armorstandglow: + msg: Toggle ArmorStand Glow + description: + msg: Turn ArmorStand Glowing on or off. + #图标 (装备) disabled: msg: 关闭 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f38b3dac..b8f90924 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,11 +1,11 @@ name: ArmorStandEditor main: io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin -version: 1.20.1-43.2 -api-version: "1.13" +version: 1.20.2-44 +api-version: "1.17" folia-supported: true website: https://www.spigotmc.org/resources/94503/ author: Wolfstorm -authors: [Wolfstorm, Pinnkk, Kugge, Marfjeh, miknes123, rypofalem, sekwah41, Sikatsu1997, Cool_boy, sumdream, Amaury Carrade, nicuch, kotarobo, prettydude, Jumpy91, Niasio, Patbox, Puremin0rez, Prof-Bloodstone, PlanetTeamSpeak] +authors: [Wolfstorm, DreiFxn, Pinnkk, Kugge, Marfjeh, miknes123, rypofalem, sekwah41, Sikatsu1997, Cool_boy, sumdream, Amaury Carrade, nicuch, kotarobo, prettydude, Jumpy91, Niasio, Patbox, Puremin0rez, Prof-Bloodstone, PlanetTeamSpeak] description: Allows players to edit data of armorstands without any commands. softdepend: [Towny, WorldGuard, GriefPrevention, PlotSquared, Lands, bentobox] @@ -24,19 +24,20 @@ permissions: children: asedit.permpack.admin: true asedit.ignoreProtection.*: true + asedit.head: true asedit.basic: description: Allow use armorstand edit functions. If set to false it will override all other functions. default: true asedit.rename: description: Rename armorstands - Now Supports Color - default: false + default: true asedit.equipment: description: Access armorstand equipment GUI - default: false + default: true asedit.disableSlots: description: Allows locking and unlocking the contents of an ArmorStand. When locked, armor and equipment can not be added or removed without unlocking it first. - default: false + default: true asedit.give: description: Gives player the EditTool with Proper CustomModelData default: false @@ -51,10 +52,10 @@ permissions: default: false asedit.movement: description: Changes whether the armor stand can be moved using the item for editing - default: false + default: true asedit.rotation: description: Allows player to rotate the ArmorStand - default: false + default: true asedit.copy: description: Allows the players to create copies of their ArmorStand Configurations. default: false @@ -63,28 +64,34 @@ permissions: default: false asedit.reset: description: Allows the reset of the ArmorStand back to Default values - default: false + default: true asedit.togglearmorstandvisibility: description: Toggles ArmorStand visibility. - default: false + default: true asedit.toggleitemframevisibility: description: Allows setting of ItemFrame Visibility - default: false + default: true asedit.toggleInvulnerability: description: Allows players to toggle the vulnerability state of an ArmorStand. - default: false + default: true asedit.togglebaseplate: description: Allows the toggling of the Baseplate of an ArmorStand. - default: false + default: true asedit.togglearms: description: Allows the toggling of the Arms of an ArmorStand. - default: false + default: true asedit.togglesize: description: Allows the toggling of the size of an ArmorStand. - default: false + default: true asedit.togglegravity: description: Changes whether the armor stand has gravity - default: false + default: true + asedit.togglearmorstandglow: + description: Allows toggling of the Glowing State of an ArmorStand. + default: true + asedit.stats: + description: Ability to view ArmorStand Stats. + default: true asedit.ignoreProtection.towny: description: Allows user to ignore Towny's Protection Limitations. @@ -158,6 +165,7 @@ permissions: asedit.togglesize: true asedit.togglearmorstandvisibility: true asedit.toggleitemframevisibility: true + asedit.togglearmorstandglow: true asedit.permpack.dontIgnoreProtections: true asedit.permpack.admin: