diff --git a/README.md b/README.md
index 892d8ca5..e9f3c5fe 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,15 @@
ArmorStandEditor is a plugin for [Spigot and related forks](https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/) to allow players in survival to easily edit armor stand pose and attributes.
-
+
+## Credits
+
+* RypoFalem for the original version of this plugin. Thank you for all your hard work (Archived in branch [Original-Version](https://github.com/Wolfst0rm/ArmorStandEditor/tree/Original-Version) )
+* Anyone who has contributed to this project with tests, issues, code reviews etc. Thank you!
+* Shamblecraft for allowing me to test on the server as required before publishing to production.
+
## Downloads
Downloads for Version 1.17 and higher can be obtained from the [download page](https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/) or our [release tracker](https://github.com/Wolfst0rm/ArmorStandEditor/releases) here on Github.
@@ -23,7 +29,7 @@ For versions older than 1.17, then please use [the original versions download pa
The Latest Downloads Shortcut Links:
* [Unstable 1.1x-DEV Versions](https://github.com/Wolfst0rm/ArmorStandEditor/actions) - **Use these at your own risk. Limited Support is provided for testing purposes**
-* [1.18.1 - Coming SOON!](https://www.spigotmc.org/threads/armorstandeditor-reborn.517132)
+* [1.18.1](https://www.spigotmc.org/threads/armorstandeditor-reborn.517132)
* [1.18](https://github.com/Wolfst0rm/ArmorStandEditor/releases/tag/1.18-31)
* [1.17.1](https://github.com/Wolfst0rm/ArmorStandEditor/releases/tag/1.17.1-30)
* [1.17](https://github.com/Wolfst0rm/ArmorStandEditor/releases/tag/1.17.1-27)
@@ -47,17 +53,16 @@ subject to change in the future. The minimum enforced API Version is 1.13.
* Editing ArmorStands with no commands required
* Rotation of all ArmorStand Parts along each axis
* Rotation of entire ArmorStand after Placement. Supported by Crouching and Scrolling, so you never have to open the menu
-* Finer Adjustment to allow for Fine Tuning of Positions.
-* Coarser Adustments to allow you to quikly to get to the intended position
-* Toggles for: Disabling Slots, Invisiblity, Gravity, Base Plates, Size (Normal and Small)
+* Finer Adjustment to allow for Fine-Tuning of Positions.
+* Coarser Adjustments to allow you to quickly to get to the intended position
+* Toggles for: Disabling Slots, Invisibility, Gravity, Base Plates, Size (Normal and Small)
* Copying and Pasting ArmorStand Settings between ArmorStandEditor in a Survival Friendly way
* Storage of Copied Settings in one of 9 available slots.
* Naming of ArmorStands through the use of Vanilla Name tags, with colored name support
* Multiple Language Support through the use of community translations
-* Respects multiple protection plugins: WorldGaurd, Towny, GriefPrevention, Residence etc.
+* Respects multiple protection plugins: WorldGuard, Towny, GriefPrevention, Residence etc.
* Targeting of an ArmorStand by pressing F with the tool in your hand
-* Glowing ArmorStand to signify Targetting and Slot Disables through the use of Scoreboards.
-*
+* Glowing ArmorStand to signify Targeting and Slot Disables through the use of Scoreboards.
You can also follow our [Feature Roadmap](https://github.com/Wolfst0rm/ArmorStandEditor-Issues/issues/11) to see what we have planned (Updated as required).
diff --git a/pom.xml b/pom.xml
index 0e0333f9..54bfcb0b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
io.github.rypofalem.armorstandeditorarmorstandeditorjar
- 1.18.1-32
+ 1.18.1-33armorstandeditorhttp://maven.apache.org
@@ -16,6 +16,13 @@
https://sonarcloud.io
+
+
+ maven2
+ https://repo.maven.apache.org/maven2/
+
+
+
spigot-repo
@@ -26,7 +33,7 @@
jitpack.iohttps://jitpack.io
-
+
jeff-media-publichttps://hub.jeff-media.com/nexus/repository/jeff-media-public/
@@ -59,30 +66,10 @@
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
-
- 11
-
- -parameters
-
-
-
-
- maven-release-plugin
- ${maven-release-plugin.version}
-
- [ci skip]
- @{project.version}
-
- org.apache.maven.pluginsmaven-shade-plugin
- 3.2.4
+ 3.2.1
@@ -102,7 +89,26 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 11
+
+ -parameters
+
+
+
+
+ maven-release-plugin
+ ${maven-release-plugin.version}
+
+ [ci skip]
+ @{project.version}
+
+
-
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100644
index 59499bce..00000000
--- a/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-
diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java b/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java
index fd309698..ff34bcb3 100644
--- a/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java
+++ b/src/main/java/io/github/rypofalem/armorstandeditor/ArmorStandEditorPlugin.java
@@ -19,11 +19,9 @@
package io.github.rypofalem.armorstandeditor;
-import de.jeff_media.updatechecker.UpdateChecker;
-import de.jeff_media.updatechecker.UserAgentBuilder;
+import de.jeff_media.updatechecker.*;
import io.github.rypofalem.armorstandeditor.language.Language;
-import io.github.rypofalem.armorstandeditor.Metrics.DrilldownPie;
-import io.github.rypofalem.armorstandeditor.Metrics.SimplePie;
+import io.github.rypofalem.armorstandeditor.Metrics.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -37,12 +35,14 @@
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
+import java.io.*;
+import java.time.*;
+import java.nio.file.Files;
+import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
+import java.time.format.FormatStyle;
+import java.util.*;
import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
public class ArmorStandEditorPlugin extends JavaPlugin{
@@ -82,6 +82,17 @@ public class ArmorStandEditorPlugin extends JavaPlugin{
public Team team;
String lockedTeam = "ASLocked";
+ //Better Debug Output
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ Date date = Calendar.getInstance().getTime();
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime( FormatStyle.SHORT ).withLocale( Locale.UK ).withZone( ZoneId.systemDefault() );
+ String dateAsString = dateFormat.format(date);
+ String timeAsString = formatter.format(instant);
+ final String debugOutputFileName = getDataFolder() + File.separator + "DEBUG-" + dateAsString + ".log";
+ FileOutputStream fos = null;
+ File f = new File(debugOutputFileName);
+
private static ArmorStandEditorPlugin plugin;
private static final int PLUGIN_ID = 12668;
@@ -149,6 +160,14 @@ public void onEnable(){
registerScoreboards(scoreboard);
getLogger().info(SEPARATOR_FIELD);
+ //Is Debug Enabled
+ debug = getConfig().getBoolean("debug", true);
+ print("Debug Mode Enabled? Well if you can read this its true");
+
+ if(debug){
+ createDebugFile();
+ }
+
//saveResource doesn't accept File.separator on Windows, need to hardcode unix separator "/" instead
updateConfig("", "config.yml");
updateConfig("lang/", "test_NA.yml");
@@ -181,7 +200,7 @@ public void onEnable(){
return;
}
- //ArmorStandVisility Node
+ //ArmorStandVisibility Node
armorStandVisibility = getConfig().getBoolean("armorStandVisibility", true);
print("ArmorStands allowed to be made visible/invisible?: " + armorStandVisibility);
@@ -206,9 +225,9 @@ public void onEnable(){
requireSneaking = getConfig().getBoolean("requireSneaking",false);
print("Sneaking required to activate the UI: " + requireSneaking);
- //Optional Information
- debug = getConfig().getBoolean("debug", true);
+ //Send Messages to Action Bar - NEW SINCE 1.16 at least (?)
+ //TODO: Fix above comment with correct version - FUTURE CHORE!
sendToActionBar = getConfig().getBoolean("sendMessagesToActionBar", true);
print("Messages being sent to action bar?: " + sendToActionBar);
@@ -264,7 +283,7 @@ private void unregisterScoreboards(Scoreboard scoreboard) {
team = scoreboard.getTeam(lockedTeam);
if(team != null) { //Basic Sanity Check to ensure that the team is there
team.unregister();
- print("Team '" + lockedTeam + "sucessfully removed.");
+ print("Team '" + lockedTeam + "' successfully removed.");
} else{
getLogger().severe("Team Already Appears to be removed. Please do not do this manually!");
}
@@ -286,8 +305,41 @@ public void onDisable(){
unregisterScoreboards(scoreboard);
}
+ public void createDebugFile(){
+ try {
+ if (!f.exists() && f.createNewFile()) {
+ Files.setAttribute(f.toPath(), "dos:hidden", false);
+ }
+ } catch (IOException e) {
+ this.getServer().getLogger().warning(e.getMessage());
+ }
+ }
+
public void log(String message){
+ //Output to Server Console - Safer than doing a Broadcast to everyone on the Server
+ String timeMsgSep = ": ";
this.getServer().getLogger().info("ArmorStandEditor: " + message);
+
+ try{
+ fos = new FileOutputStream(f, true);
+
+ //Write the Content as Bytes
+ fos.write(timeAsString.getBytes());
+ fos.write(timeMsgSep.getBytes());
+ fos.write(message.getBytes());
+ fos.write(10);
+ fos.flush();
+ }catch(IOException e){
+ this.getServer().getLogger().warning(e.getMessage());
+ }finally{
+ if(fos != null){
+ try {
+ fos.close();
+ } catch (IOException e) {
+ this.getServer().getLogger().warning(e.getMessage());
+ }
+ }
+ }
}
public String getNmsVersion(){
@@ -306,6 +358,14 @@ public boolean getHasSpigot(){
}
}
+ public boolean getArmorStandVisibility(){
+ return getConfig().getBoolean("armorStandVisibility");
+ }
+
+ public boolean getItemFrameVisibility(){
+ return getConfig().getBoolean("invisibleItemFrames");
+ }
+
public boolean getHasPaper(){
try {
Class.forName("com.destroystokyo.paper.PaperConfig");
@@ -327,7 +387,6 @@ public boolean getHasPaper(){
*/
public void print(String message){
if(debug){
- this.getServer().broadcastMessage(message);
log(message);
}
}
@@ -355,7 +414,7 @@ public boolean isEditTool(ItemStack itemStk){
if(requireToolLore && editToolLore != null){
- //If the ItemStack does not have Meta Data then we return false
+ //If the ItemStack does not have Metadata then we return false
if(!itemStk.hasItemMeta()) { return false; }
//Get the lore of the Item and if it is null - Return False
@@ -380,24 +439,16 @@ private void getMetrics(){
Metrics metrics = new Metrics(this, PLUGIN_ID);
//RequireToolLore Metric
- metrics.addCustomChart(new SimplePie("tool_lore_enabled", () -> {
- return getConfig().getString("requireToolLore");
- }));
+ metrics.addCustomChart(new SimplePie("tool_lore_enabled", () -> getConfig().getString("requireToolLore")));
//RequireToolData
- metrics.addCustomChart(new SimplePie("tool_data_enabled", () ->{
- return getConfig().getString("requireToolData");
- }));
+ metrics.addCustomChart(new SimplePie("tool_data_enabled", () -> getConfig().getString("requireToolData")));
//Send Messages to ActionBar
- metrics.addCustomChart(new SimplePie("action_bar_messages", () -> {
- return getConfig().getString("sendMessagesToActionBar");
- }));
+ metrics.addCustomChart(new SimplePie("action_bar_messages", () -> getConfig().getString("sendMessagesToActionBar")));
//Debug Mode Enabled?
- metrics.addCustomChart(new SimplePie("uses_debug_mode", () -> {
- return getConfig().getString("debug");
- }));
+ metrics.addCustomChart(new SimplePie("uses_debug_mode", () -> getConfig().getString("debug")));
//Language is used
metrics.addCustomChart(new DrilldownPie("language_used", () -> {
@@ -429,7 +480,6 @@ private void getMetrics(){
} else{
map.put("Other", entry);
}
-
return map;
}));
diff --git a/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java b/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java
index 0017a037..b6462140 100644
--- a/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java
+++ b/src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java
@@ -111,7 +111,7 @@ void onArmorStandInteract( PlayerInteractAtEntityEvent event) {
//Attempt rename
if (player.getInventory().getItemInMainHand().getType() == Material.NAME_TAG && player.hasPermission("asedit.rename")) {
ItemStack nameTag = player.getInventory().getItemInMainHand();
- String name;
+ String name;
if (nameTag.getItemMeta() != null && nameTag.getItemMeta().hasDisplayName()) {
name = nameTag.getItemMeta().getDisplayName().replace('&', ChatColor.COLOR_CHAR);
} else {
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 0ceb427a..e8dcd8f1 100644
--- a/src/main/java/io/github/rypofalem/armorstandeditor/menu/Menu.java
+++ b/src/main/java/io/github/rypofalem/armorstandeditor/menu/Menu.java
@@ -39,6 +39,7 @@ public class Menu {
private PlayerEditor pe;
private static String name = "Armor Stand Editor Menu";
+
public Menu(PlayerEditor pe) {
this.pe = pe;
name = pe.plugin.getLang().getMessage("mainmenutitle", "menutitle");
@@ -121,20 +122,29 @@ private void fillInventory() {
showArms = createIcon(new ItemStack(Material.STICK),
"showarms", "mode showarms");
- if (pe.getPlayer().hasPermission("asedit.invisible")) {
+ //Praise Start - Sikatsu and cowgod, Nicely spotted this being broken
+ if (pe.getPlayer().hasPermission("asedit.armorstand.invisible") ||
+ pe.plugin.getArmorStandVisibility() ) {
visibility = new ItemStack(Material.POTION, 1);
PotionMeta potionMeta = (PotionMeta) visibility.getItemMeta();
PotionEffect eff1 = new PotionEffect(PotionEffectType.INVISIBILITY, 1, 0);
potionMeta.addCustomEffect(eff1, true);
visibility.setItemMeta(potionMeta);
visibility = createIcon(visibility, "invisible", "mode invisible");
+ } else {
+ visibility = null;
}
- if (pe.getPlayer().hasPermission("asedit.invisible")) {
+ if (pe.getPlayer().hasPermission("asedit.itemframe.invisible") ||
+ pe.plugin.getItemFrameVisibility() ) {
itemFrameVisible = new ItemStack(Material.ITEM_FRAME, 1);
itemFrameVisible = createIcon(itemFrameVisible, "itemframevisible", "mode itemframe");
+ } else {
+ itemFrameVisible = null;
}
+ //Praise end
+
size = createIcon(new ItemStack(Material.PUFFERFISH, 1),
"size", "mode size");
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 93dee387..9b3d4987 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -10,7 +10,7 @@ tool: FLINT
#If true, the GUI will only open if the player is sneaking
requireSneaking: false
-#Allow the option to toggle invisiblity for ItemFrames and ArmorStand
+#Allow the option to toggle invisibility for ItemFrames and ArmorStand
ivisibleItemFrames: true
armorStandVisibility: true
@@ -32,5 +32,6 @@ sendMessagesToActionBar: true
#If true, players can make itemFrames glow by right clicking with a Glow Ink Sac
glowingItemFrame: true
-#DO NOT REMOVE THIS - Internal Testing Usage. Enable => Unintended Side Effects
+#DO NOT ENABLE - For Testing Purposes. Can lead to unwanted sideaffects
+#Enable if you are submitting a bug report PLEASE!
debug: false
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 533adb52..8b5998fe 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
name: ArmorStandEditor
main: io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin
-version: 1.18.1-32
+version: 1.18.1-33
api-version: "1.13"
website: https://www.spigotmc.org/resources/94503/
author: Wolfstorm
@@ -25,7 +25,7 @@ permissions:
description: Allows setting of ItemFrame Visibility
default: true
asedit.rename:
- description: Rename armorstands
+ description: Rename armorstands - Now Supports Color
default: true
asedit.equipment:
description: Access armorstand equipment GUI