diff --git a/Bungee/src/main/java/net/notfab/hubbasics/bungee/HubBasics.java b/Bungee/src/main/java/net/notfab/hubbasics/bungee/HubBasics.java index 98f82658..a48d397e 100644 --- a/Bungee/src/main/java/net/notfab/hubbasics/bungee/HubBasics.java +++ b/Bungee/src/main/java/net/notfab/hubbasics/bungee/HubBasics.java @@ -3,6 +3,7 @@ import lombok.Getter; import net.md_5.bungee.api.plugin.Plugin; import net.notfab.hubbasics.bungee.commands.LobbyCommand; +import net.notfab.hubbasics.bungee.listeners.JoinListener; import net.notfab.hubbasics.bungee.managers.ConfigHandler; import net.notfab.hubbasics.bungee.managers.HBLogger; import net.notfab.spigot.simpleconfig.SimpleConfigManager; @@ -35,13 +36,21 @@ public void onEnable() { } else { loggerManager.info("Running in Development mode, Metrics disabled."); } - getProxy().getPluginManager().registerCommand(this, new LobbyCommand()); + JoinListener listener = new JoinListener(this); + listener.setup(this); + if (listener.isEnabled()) { + this.getProxy().getPluginManager().registerListener(this, new JoinListener(this)); + } + LobbyCommand command = new LobbyCommand(this); + command.setup(this); + getProxy().getPluginManager().registerCommand(this, command); } @Override public void onDisable() { this.loggerManager.onDisable(); + getProxy().getPluginManager().unregisterListeners(this); getProxy().getPluginManager().unregisterCommands(this); } -} \ No newline at end of file +} diff --git a/Bungee/src/main/java/net/notfab/hubbasics/bungee/Module.java b/Bungee/src/main/java/net/notfab/hubbasics/bungee/Module.java new file mode 100644 index 00000000..7d018844 --- /dev/null +++ b/Bungee/src/main/java/net/notfab/hubbasics/bungee/Module.java @@ -0,0 +1,7 @@ +package net.notfab.hubbasics.bungee; + +public interface Module { + + void setup(HubBasics hubBasics); + +} diff --git a/Bungee/src/main/java/net/notfab/hubbasics/bungee/commands/LobbyCommand.java b/Bungee/src/main/java/net/notfab/hubbasics/bungee/commands/LobbyCommand.java index 7784ca5c..7c4964ee 100644 --- a/Bungee/src/main/java/net/notfab/hubbasics/bungee/commands/LobbyCommand.java +++ b/Bungee/src/main/java/net/notfab/hubbasics/bungee/commands/LobbyCommand.java @@ -7,23 +7,53 @@ import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Command; +import net.notfab.hubbasics.bungee.HubBasics; +import net.notfab.hubbasics.bungee.Module; +import net.notfab.hubbasics.bungee.managers.HBLogger; import net.notfab.hubbasics.bungee.utils.Messages; import net.notfab.spigot.simpleconfig.SimpleConfig; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; -public class LobbyCommand extends Command { +public class LobbyCommand extends Command implements Module { - private net.notfab.hubbasics.bungee.HubBasics HubBasics = net.notfab.hubbasics.bungee.HubBasics.getInstance(); + private static final HBLogger logger = HBLogger.getLogger("HubBasics"); + private HubBasics hubBasics; - public LobbyCommand() { + private List servers = new ArrayList<>(); + + public LobbyCommand(HubBasics hubBasics) { super("lobby", null, "hub"); + this.hubBasics = hubBasics; + } + + @Override + public void setup(HubBasics hubBasics) { + SimpleConfig config = hubBasics.getConfigManager().getNewConfig("config.yml"); + boolean isList = config.get("Lobby") instanceof List; + if (isList) { + for (String server : config.getStringList("Lobby")) { + if (hubBasics.getProxy().getServerInfo(server) == null) { + logger.warn("Unknown Server: " + server); + continue; + } + this.servers.add(server); + } + } else { + String server = config.getString("Lobby"); + if (hubBasics.getProxy().getServerInfo(server) == null) { + logger.warn("Unknown Server: " + server); + return; + } + this.servers.add(server); + } } @Override public void execute(CommandSender commandSender, String[] strings) { - ServerInfo serverInfo = getLobby(); + ServerInfo serverInfo = this.getLobby(); if (serverInfo != null && commandSender instanceof ProxiedPlayer) { ProxiedPlayer player = (ProxiedPlayer) commandSender; if (!player.getServer().getInfo().getName().equals(serverInfo.getName())) { @@ -34,7 +64,7 @@ public void execute(CommandSender commandSender, String[] strings) { out.writeUTF("Lobby"); player.sendData("BungeeCord", out.toByteArray()); } - } else if (commandSender instanceof ProxiedPlayer) { + } else if (serverInfo == null) { commandSender.sendMessage(new TextComponent(Messages.get(commandSender, "LOBBY_NOT_DEFINED"))); } else { commandSender.sendMessage(new TextComponent(Messages.get(commandSender, "COMMAND_PLAYER"))); @@ -42,23 +72,18 @@ public void execute(CommandSender commandSender, String[] strings) { } private ServerInfo getLobby() { - SimpleConfig config = HubBasics.getConfigManager().getNewConfig("config.yml"); - boolean isList = config.get("Lobby") instanceof List; - if (isList) { - int lowest = Integer.MAX_VALUE - 1; - AtomicReference serverInfo = new AtomicReference<>(); - List lobbies = config.getStringList("Lobby"); - lobbies.forEach(lobby -> { - ServerInfo info = HubBasics.getProxy().getServerInfo(lobby); - if (info.getPlayers().size() < lowest) { - serverInfo.set(info); - } - }); - return serverInfo.get(); - } else { - String name = config.getString("Lobby"); - return HubBasics.getProxy().getServerInfo(name); + if (this.servers.size() == 1) { + return hubBasics.getProxy().getServerInfo(this.servers.get(0)); } + int lowest = Integer.MAX_VALUE - 1; + AtomicReference serverInfo = new AtomicReference<>(); + this.servers.forEach(lobby -> { + ServerInfo info = hubBasics.getProxy().getServerInfo(lobby); + if (info.getPlayers().size() < lowest) { + serverInfo.set(info); + } + }); + return serverInfo.get(); } -} \ No newline at end of file +} diff --git a/Bungee/src/main/java/net/notfab/hubbasics/bungee/listeners/JoinListener.java b/Bungee/src/main/java/net/notfab/hubbasics/bungee/listeners/JoinListener.java new file mode 100644 index 00000000..1eef4fdb --- /dev/null +++ b/Bungee/src/main/java/net/notfab/hubbasics/bungee/listeners/JoinListener.java @@ -0,0 +1,81 @@ +package net.notfab.hubbasics.bungee.listeners; + +import lombok.Getter; +import net.md_5.bungee.api.config.ServerInfo; +import net.md_5.bungee.api.event.ServerConnectEvent; +import net.md_5.bungee.api.plugin.Listener; +import net.md_5.bungee.event.EventHandler; +import net.notfab.hubbasics.bungee.HubBasics; +import net.notfab.hubbasics.bungee.Module; +import net.notfab.spigot.simpleconfig.SimpleConfig; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; +import java.util.logging.Logger; + +public class JoinListener implements Listener, Module { + + private static final Logger logger = Logger.getLogger("HubBasics"); + private HubBasics hubBasics; + + @Getter + private boolean enabled = false; + private List servers = new ArrayList<>(); + + public JoinListener(HubBasics hubBasics) { + this.hubBasics = hubBasics; + } + + @Override + public void setup(HubBasics hubBasics) { + SimpleConfig config = hubBasics.getConfigManager().getNewConfig("config.yml"); + this.enabled = config.getBoolean("LobbyOnJoin"); + // List of servers + boolean isList = config.get("Lobby") instanceof List; + if (isList) { + for (String server : config.getStringList("Lobby")) { + if (hubBasics.getProxy().getServerInfo(server) == null) { + logger.warning("Unknown Server: " + server); + continue; + } + this.servers.add(server); + } + } else { + String server = config.getString("Lobby"); + if (hubBasics.getProxy().getServerInfo(server) == null) { + logger.warning("Unknown Server: " + server); + return; + } + this.servers.add(server); + } + } + + @EventHandler + public void onJoin(ServerConnectEvent event) { + if (event.getReason() == ServerConnectEvent.Reason.JOIN_PROXY + || event.getReason() == ServerConnectEvent.Reason.LOBBY_FALLBACK) { + ServerInfo serverInfo = this.getLobby(); + if (serverInfo != null) { + event.setTarget(serverInfo); + } else { + logger.warning("No available lobby servers!"); + } + } + } + + private ServerInfo getLobby() { + if (this.servers.size() == 1) { + return hubBasics.getProxy().getServerInfo(this.servers.get(0)); + } + int lowest = Integer.MAX_VALUE - 1; + AtomicReference serverInfo = new AtomicReference<>(); + this.servers.forEach(lobby -> { + ServerInfo info = hubBasics.getProxy().getServerInfo(lobby); + if (info.getPlayers().size() < lowest) { + serverInfo.set(info); + } + }); + return serverInfo.get(); + } +} diff --git a/Bungee/src/main/resources/config.yml b/Bungee/src/main/resources/config.yml index 9342166e..5bad00a2 100644 --- a/Bungee/src/main/resources/config.yml +++ b/Bungee/src/main/resources/config.yml @@ -6,4 +6,12 @@ # Lobby Server # Either a string with the name of a server (that is configured on BungeeCord) # or a list of strings for HubBasics to balance between. -Lobby: Lobby \ No newline at end of file +# +# Example: +# +#Lobby: +# - hub1 +# - hub2 +Lobby: Lobby +# Sends players to the lobby when they join (or fallback). +LobbyOnJoin: false diff --git a/Spigot/build.gradle b/Spigot/build.gradle index 364350d2..88e32b01 100644 --- a/Spigot/build.gradle +++ b/Spigot/build.gradle @@ -75,4 +75,4 @@ task runSpigot(type: JavaExec, dependsOn: copyFiles) { jarFile.getAbsolutePath() ] debug = true -} \ No newline at end of file +} diff --git a/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinTP.java b/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinTP.java index f576f89e..b2dd5e3e 100644 --- a/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinTP.java +++ b/Spigot/src/main/java/net/notfab/hubbasics/spigot/modules/v1_7/JoinTP.java @@ -8,7 +8,7 @@ import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerChangedWorldEvent; -import org.bukkit.event.player.PlayerJoinEvent; +import org.spigotmc.event.player.PlayerSpawnLocationEvent; import java.util.ArrayList; import java.util.HashMap; @@ -55,16 +55,16 @@ public void onDisable() { } @EventHandler - public void onJoin(PlayerJoinEvent event) { + public void onJoin(PlayerSpawnLocationEvent event) { if (globalTP) { HLocation location = HubBasics.getLocationManager().get(globalTarget); - location.teleport(event.getPlayer()); + event.setSpawnLocation(location.toBukkitLocation()); } else { if (!worlds.contains(event.getPlayer().getWorld().getName())) { return; } HLocation location = HubBasics.getLocationManager().get(worldLocations.get(event.getPlayer().getWorld().getName())); - location.teleport(event.getPlayer()); + event.setSpawnLocation(location.toBukkitLocation()); } } @@ -85,4 +85,4 @@ public void onWorld(PlayerChangedWorldEvent event) { } } -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index f3e3597a..1d8fae0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ allprojects { group 'net.notfab.hubbasics' - version = '6.11.3' + version = '6.11.4' wrapper { - gradleVersion = '6.0.1' + gradleVersion = '6.3' } ext.getGitHash = { -> def stdout = new ByteArrayOutputStream() @@ -12,4 +12,4 @@ allprojects { } return stdout.toString().trim() } -} \ No newline at end of file +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..490fda85 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 94920145..a4b44297 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 8998e10c..2fe81a7d 100644 --- a/gradlew +++ b/gradlew @@ -7,7 +7,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -26,22 +26,22 @@ # Resolve links: $0 may be a link PRG="$0" # Need this for relative symlinks. -while [ -h "$PRG" ]; do - ls=$(ls -ld "$PRG") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' >/dev/null; then - PRG="$link" - else - PRG=$(dirname "$PRG")"/$link" - fi +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi done -SAVED="$(pwd)" -cd "$(dirname \"$PRG\")/" >/dev/null -APP_HOME="$(pwd -P)" +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" cd "$SAVED" >/dev/null APP_NAME="Gradle" -APP_BASE_NAME=$(basename "$0") +APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -49,15 +49,15 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn() { - echo "$*" +warn () { + echo "$*" } -die() { - echo - echo "$*" - echo - exit 1 +die () { + echo + echo "$*" + echo + exit 1 } # OS specific support (must be 'true' or 'false'). @@ -65,124 +65,119 @@ cygwin=false msys=false darwin=false nonstop=false -case "$(uname)" in -CYGWIN*) - cygwin=true - ;; -Darwin*) - darwin=true - ;; -MINGW*) - msys=true - ;; -NONSTOP*) - nonstop=true - ;; +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ]; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi + fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then - MAX_FD_LIMIT=$(ulimit -H -n) - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi fi # For Darwin, add options to specify how the application appears in the dock if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - APP_HOME=$(cygpath --path --mixed "$APP_HOME") - CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") - JAVACMD=$(cygpath --unix "$JAVACMD") - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) - SEP="" - for dir in $ROOTDIRSRAW; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ]; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@"; do - CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) - CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition - eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") - else - eval $(echo args$i)="\"$arg\"" +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" fi - i=$((i + 1)) - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac fi # Escape application args -save() { - for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done - echo " " +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9991c503..62bd9b9c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -5,7 +5,7 @@ @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem -@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS, @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @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="-Xmx64m" "-Xms64m"