Skip to content

Commit

Permalink
Version: ArmorStandEditor 1.18.1-33 (#22)
Browse files Browse the repository at this point in the history
* [CORE] Version Bump to 1.18.1-33

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [CORE] Hotifx: Debug Output showing without Flag being there.

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Wolfst0rm/ArmorStandIssues#20: Going on An Adventure Part 1

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* Revert "[CORE] Hotifx: Debug Output showing without Flag being there."

This reverts commit 525e70f.

* [CORE] Wolfieheart/ArmorStandEditor-Issues#19: Debug Output to File

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [CORE] Fix Security Hotspot found by SonarCloud

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [CORE] Wolfieheart/ArmorStandEditor-Issues#19: Tidy Up with Code Smells from SonarCloud

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [ci-skip] Remove "- Coming Soon" from the 1.18.1 version link in Readme files

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [ci-skip] Update and Cleanup Readme file

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [CORE] Update Dependencies - Remove Adventure

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [CORE] Revert Maven to Master Version

Signed-off-by: Wolfstorm <[email protected]>
Signed-off-by: Github <[email protected]>

* [CORE] Fix itemFrameVisible not appearing in the Menu after Permission Move

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix itemFrameVisible and armorstandVisiblity not appearing in the Menu after Permission Move

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Bump Maven Version

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix for Invisibility Item Not Appearing in Menu Bug

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Return the right values when getting ArmorStand and ItemFrame Visibility Checks in Menu

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Remove conflicting Manifest File per Github Actions remarks

Signed-off-by: Wolfstorm <[email protected]>

* [ci-skip] Typos... Typos... Typos... Typos...

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Update BStats

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Alot of Compliation Issues on my end wrt UpdateChecker

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Left Debug Enabled Accidentally again on Dev Branch!

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Set MenuItem to not appear when visibility is not enabled.

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Finalise new Visibility Logic for ItemFrames and ArmorStands.

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Remarks from SonarCloud, Simplify return when getArmorStandVisibility and getItemFrameVisibility

Signed-off-by: Wolfstorm <[email protected]>

* [ci-skip] Fix Remark as to who noticed this being broken.

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Remarks from SonarCloud, Simplify return when getArmorStandVisibility and getItemFrameVisibility from config.yml

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Resolve Merge Conflicts

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Typos and Working Debug File Logic.

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Remarks from Sonar - 2 Hotspots and 1 Bug

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Remarks from Sonar Round 3 >.>

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Remarks from Sonar Round 3 >.>

Signed-off-by: Wolfstorm <[email protected]>

* [CORE] Fix Remarks from Sonar Round 3 >.>

Signed-off-by: Wolfstorm <[email protected]>
  • Loading branch information
Wolfieheart authored Jan 6, 2022
1 parent 4be4158 commit f93bfc8
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 69 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@


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.

</div>

## 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.

For versions older than 1.17, then please use [the original versions download page](https://www.spigotmc.org/resources/armor-stand-editor-dead.7688/).

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)
Expand All @@ -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).

Expand Down
54 changes: 30 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>io.github.rypofalem.armorstandeditor</groupId>
<artifactId>armorstandeditor</artifactId>
<packaging>jar</packaging>
<version>1.18.1-32</version>
<version>1.18.1-33</version>
<name>armorstandeditor</name>
<url>http://maven.apache.org</url>

Expand All @@ -16,6 +16,13 @@
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<pluginRepositories>
<pluginRepository>
<id>maven2</id>
<url>https://repo.maven.apache.org/maven2/</url>
</pluginRepository>
</pluginRepositories>

<repositories>
<repository>
<id>spigot-repo</id>
Expand All @@ -26,7 +33,7 @@
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!--- UpdateChecker -->
<!--- Update Checker -->
<repository>
<id>jeff-media-public</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
Expand Down Expand Up @@ -59,30 +66,10 @@
<!--Java 8-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<scmCommentPrefix>[ci skip]</scmCommentPrefix>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.2.1</version>
<configuration>
<relocations>
<!-- Using the maven-shade-plugin to shade and relocate the UpdateChecker -->
Expand All @@ -102,7 +89,26 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<scmCommentPrefix>[ci skip]</scmCommentPrefix>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>

</project>
2 changes: 0 additions & 2 deletions src/main/java/META-INF/MANIFEST.MF

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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{

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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!");
}
Expand All @@ -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(){
Expand All @@ -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");
Expand All @@ -327,7 +387,6 @@ public boolean getHasPaper(){
*/
public void print(String message){
if(debug){
this.getServer().broadcastMessage(message);
log(message);
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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", () -> {
Expand Down Expand Up @@ -429,7 +480,6 @@ private void getMetrics(){
} else{
map.put("Other", entry);
}

return map;
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit f93bfc8

Please sign in to comment.