From 0fcf7cc0c923e6edf7d57687d78a0a333d0d4013 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 14 Sep 2020 18:44:16 +0200 Subject: [PATCH] Consistency fixes (#12) * Consistency fixes * Windows users need a batch file --- .gitignore | 1 - README.md | 2 +- gradlew.bat | 84 +++++++++++++++++++ .../commands/AdvancedFlyCommand.java | 4 +- .../commands/NightVisionCommand.java | 4 +- .../commands/NoClipCommand.java | 4 +- .../commands/system/CommandForwarder.java | 2 - .../buildersutilities/utils/BannerUtil.java | 1 - 8 files changed, 91 insertions(+), 11 deletions(-) create mode 100644 gradlew.bat diff --git a/.gitignore b/.gitignore index df1cd48..719df9b 100644 --- a/.gitignore +++ b/.gitignore @@ -131,6 +131,5 @@ local.properties /target/ checkstyle.xml classes/ -*.bat docs/ build/ \ No newline at end of file diff --git a/README.md b/README.md index 47e97b6..3645b0a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This plugin is a collection of a lot of tiny features that help with building. * [Issues](https://github.com/Brennian/Builders-Utilities/issues) # Building -Gradle is the recommended way to build the project. Use `./gradlew build shadowJar` in the main project directory to build the project. +Gradle is the recommended way to build the project. Use `./gradlew build` in the main project directory to build the project. # Contributing See [here](https://github.com/Brennian/Builders-Utilities/blob/master/CONTRIBUTING.md) diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..dee787c --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega \ No newline at end of file diff --git a/src/main/java/net/arcaniax/buildersutilities/commands/AdvancedFlyCommand.java b/src/main/java/net/arcaniax/buildersutilities/commands/AdvancedFlyCommand.java index 03f43c4..e1fd3cf 100644 --- a/src/main/java/net/arcaniax/buildersutilities/commands/AdvancedFlyCommand.java +++ b/src/main/java/net/arcaniax/buildersutilities/commands/AdvancedFlyCommand.java @@ -43,9 +43,9 @@ public class AdvancedFlyCommand implements ICommand { } if (PlayerMoveListener.togglePlayer(player)) { - player.sendMessage(Main.MSG_PREFIX + "Advanced Fly " + ChatColor.GREEN + ChatColor.ITALIC + "Enabled"); + player.sendMessage(Main.MSG_PREFIX + "Advanced Fly " + ChatColor.GREEN + "enabled"); } else { - player.sendMessage(Main.MSG_PREFIX + "Advanced Fly " + ChatColor.RED + ChatColor.ITALIC + "Disabled"); + player.sendMessage(Main.MSG_PREFIX + "Advanced Fly " + ChatColor.RED + "disabled"); } } } diff --git a/src/main/java/net/arcaniax/buildersutilities/commands/NightVisionCommand.java b/src/main/java/net/arcaniax/buildersutilities/commands/NightVisionCommand.java index e5ae6c1..96dc5f4 100644 --- a/src/main/java/net/arcaniax/buildersutilities/commands/NightVisionCommand.java +++ b/src/main/java/net/arcaniax/buildersutilities/commands/NightVisionCommand.java @@ -45,10 +45,10 @@ public class NightVisionCommand implements ICommand { if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) { player.removePotionEffect(PotionEffectType.NIGHT_VISION); - player.sendMessage(Main.MSG_PREFIX + "Night Vision " + ChatColor.RED + ChatColor.ITALIC + "Disabled"); + player.sendMessage(Main.MSG_PREFIX + "Night Vision " + ChatColor.RED + "disabled"); } else { player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, true, false)); - player.sendMessage(Main.MSG_PREFIX + "Night Vision " + ChatColor.GREEN + ChatColor.ITALIC + "Enabled"); + player.sendMessage(Main.MSG_PREFIX + "Night Vision " + ChatColor.GREEN + "enabled"); } } } diff --git a/src/main/java/net/arcaniax/buildersutilities/commands/NoClipCommand.java b/src/main/java/net/arcaniax/buildersutilities/commands/NoClipCommand.java index ab81645..b432e4f 100644 --- a/src/main/java/net/arcaniax/buildersutilities/commands/NoClipCommand.java +++ b/src/main/java/net/arcaniax/buildersutilities/commands/NoClipCommand.java @@ -45,13 +45,13 @@ public class NoClipCommand implements ICommand { if (NoClipManager.noClipPlayerIds.contains(player.getUniqueId())) { NoClipManager.noClipPlayerIds.remove(player.getUniqueId()); - player.sendMessage(Main.MSG_PREFIX + "NoClip " + ChatColor.RED + ChatColor.ITALIC + "Disabled"); + player.sendMessage(Main.MSG_PREFIX + "NoClip " + ChatColor.RED + "disabled"); if (player.getGameMode() == GameMode.SPECTATOR) { player.setGameMode(GameMode.CREATIVE); } } else { NoClipManager.noClipPlayerIds.add(player.getUniqueId()); - player.sendMessage(Main.MSG_PREFIX + "NoClip " + ChatColor.GREEN + ChatColor.ITALIC + "Enabled"); + player.sendMessage(Main.MSG_PREFIX + "NoClip " + ChatColor.GREEN + "enabled"); } } } diff --git a/src/main/java/net/arcaniax/buildersutilities/commands/system/CommandForwarder.java b/src/main/java/net/arcaniax/buildersutilities/commands/system/CommandForwarder.java index 520d73b..3f0e9f5 100644 --- a/src/main/java/net/arcaniax/buildersutilities/commands/system/CommandForwarder.java +++ b/src/main/java/net/arcaniax/buildersutilities/commands/system/CommandForwarder.java @@ -29,7 +29,6 @@ import net.arcaniax.buildersutilities.Main; import net.arcaniax.buildersutilities.commands.AdvancedFlyCommand; import net.arcaniax.buildersutilities.commands.BannerCommand; import net.arcaniax.buildersutilities.commands.ColorCommand; -import net.arcaniax.buildersutilities.commands.HelpCommand; import net.arcaniax.buildersutilities.commands.SecretBlockCommand; import net.arcaniax.buildersutilities.commands.NoClipCommand; import net.arcaniax.buildersutilities.commands.NightVisionCommand; @@ -48,7 +47,6 @@ import net.arcaniax.buildersutilities.commands.aliases.TwistAliasCommand; import net.arcaniax.buildersutilities.commands.aliases.ScaleAliasCommand; import net.arcaniax.buildersutilities.commands.aliases.WalkSpeedAliasCommand; import net.arcaniax.buildersutilities.commands.aliases.FlySpeedAliasCommand; -import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/net/arcaniax/buildersutilities/utils/BannerUtil.java b/src/main/java/net/arcaniax/buildersutilities/utils/BannerUtil.java index dba8946..2e5cb22 100644 --- a/src/main/java/net/arcaniax/buildersutilities/utils/BannerUtil.java +++ b/src/main/java/net/arcaniax/buildersutilities/utils/BannerUtil.java @@ -25,7 +25,6 @@ package net.arcaniax.buildersutilities.utils; -import net.arcaniax.buildersutilities.Main; import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.block.banner.Pattern;