diff --git a/build.gradle b/build.gradle index 61c885b7335..8aa7bfa5595 100644 --- a/build.gradle +++ b/build.gradle @@ -1,148 +1,108 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.apache.tools.ant.filters.ReplaceTokens -plugins { - id "com.github.hierynomus.license" version "0.14.0" - id "com.github.johnrengelman.shadow" version "5.2.0" -} - -apply plugin: 'java' -apply plugin: 'maven-publish' - -ext { - paperVersion = '1.16.4-R0.1-SNAPSHOT' // NOTICE: Edit this when updating to a new MC Version -} +import java.time.LocalTime -// Substitute dependencies' versions of Bukkit with latest Paper API -configurations.all { - resolutionStrategy.dependencySubstitution { - substitute module('org.bukkit:bukkit') with module("com.destroystokyo.paper:paper-api:${paperVersion}") - } +plugins { + id 'com.github.johnrengelman.shadow' version '6.1.0' + id 'com.github.hierynomus.license' version '0.14.0' + id 'java' } allprojects { repositories { jcenter() mavenCentral() - - maven { - url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' - } - - maven { - url 'http://maven.sk89q.com/repo' - } - - maven { - url 'https://papermc.io/repo/repository/maven-public/' - } - - maven { - url 'http://ci.emc.gs/nexus/content/groups/aikar/' - } - - maven { - url 'https://jitpack.io' - } - - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - - maven { - url 'https://repo.codemc.org/repository/maven-public' - } - } - - configurations { - ecj - shade - implementation.extendsFrom(shade) - } - - dependencies { - ecj 'org.eclipse.jdt:ecj:3.15.0' - } - - sourceCompatibility = 1.8 - compileJava { - options.fork = true - options.encoding = 'UTF-8' - options.compilerArgs = ['-properties', '.settings/org.eclipse.jdt.core.prefs', '-encoding', 'UTF-8', - '-warn:-tasks(TODO|FIXME|REMIND)'] - options.forkOptions.with { - executable = 'java' - jvmArgs = ['-classpath', project.configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main'] - } + maven { url 'https://jitpack.io' } + maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } + maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { url 'https://papermc.io/repo/repository/maven-public/' } + maven { url 'https://ci.emc.gs/nexus/content/groups/aikar/' } } } dependencies { - implementation "com.destroystokyo.paper:paper-api:${paperVersion}" - implementation 'org.eclipse.jdt:org.eclipse.jdt.annotation:1.1.0' - implementation 'com.google.code.findbugs:findbugs:3.0.1' - implementation 'com.sk89q.worldguard:worldguard-legacy:7.0.0-SNAPSHOT' - implementation 'com.github.marcelo-mason:PreciousStones:24e3d4bf67b7240ae36b32be10e99d4091938c5c' - implementation('net.milkbowl.vault:Vault:1.7.1') { + shadow group: 'io.papermc', name: 'paperlib', version: '1.0.6' + implementation group: 'com.destroystokyo.paper', name: 'paper-api', version: '1.16.4-R0.1-SNAPSHOT' + implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.annotation', version: '1.1.0' + implementation group: 'com.google.code.findbugs', name: 'findbugs', version: '3.0.1' + implementation group: 'com.sk89q.worldguard', name: 'worldguard-legacy', version: '7.0.0-SNAPSHOT' + implementation group: 'com.github.marcelo-mason', name: 'PreciousStones', version: '24e3d4bf67' + implementation group: 'net.milkbowl.vault', name: 'Vault', version: '1.7.1', { exclude group: 'org.bstats', module: 'bstats-bukkit' } - shade 'io.papermc:paperlib:1.0.5' - - testImplementation 'junit:junit:4.12' - testImplementation 'org.easymock:easymock:3.6' - implementation fileTree(dir: 'lib', include: '*.jar') + + testImplementation group: 'junit', name: 'junit', version: '4.13.2' + testImplementation group: 'org.easymock', name: 'easymock', version: '4.2' } -processResources { - filter ReplaceTokens, tokens: [ - "version": System.getenv("SKRIPT_VERSION") == null ? project.property("version") : System.getenv("SKRIPT_VERSION"), - 'today': "unknown", // Don't leak information about system this was built on - "release-flavor": "selfbuilt-unknown", // Note: 'selfbuilt' prefix makes updater report a custom build - "release-channel": "none", // No updates, so anything else wouldn't make sense - "release-updater": "ch.njol.skript.update.NoUpdateChecker", // Disable update checking - "release-source": "", - "release-download": "null" - ] +compileJava.options.encoding = 'UTF-8' +compileTestJava.options.encoding = 'UTF-8' + +task checkAliases { + description 'Checks for the existence of the aliases.' + doLast { + def aliasFolder = new File('skript-aliases') + if (!aliasFolder.exists() || aliasFolder.listFiles().length == 0) { + throw new InvalidUserDataException('Aliases are missing from \'skript-aliases\' folder. Consider fetching submodules with \'git submodule update --init\'.') + } + } } task jar(overwrite: true, type: ShadowJar) { - archiveName System.getenv('SKRIPT_JAR_NAME') == null ? 'Skript.jar' : System.getenv("SKRIPT_JAR_NAME") + dependsOn checkAliases + archiveName jarName ? 'Skript.jar' : jarName from sourceSets.main.output } task build(overwrite: true, type: ShadowJar) { - archiveName System.getenv('SKRIPT_JAR_NAME') == null ? 'Skript.jar' : System.getenv("SKRIPT_JAR_NAME") + archiveName jarName ? 'Skript.jar' : jarName from sourceSets.main.output } -//jar.dependsOn shadowJar +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar +} + +task sourceJar(type: Jar) { + from sourceSets.main.allJava +} + tasks.withType(ShadowJar) { - configurations = [project.configurations.shade] + dependsOn relocateShadowJar + configurations = [ + project.configurations.shadow, + project.configurations.compile + ] dependencies { - include (dependency('io.papermc:paperlib')) + include(dependency('io.papermc:paperlib')) } relocate 'io.papermc.lib', 'ch.njol.skript.paperlib' - manifest { - attributes("Name": "ch/njol/skript", - "Sealed": "true") + attributes( + 'Name': 'ch/njol/skript', + 'Sealed': 'true' + ) } - - from('skript-aliases') { - into('aliases-english') // Change this if we get aliases in other languages + from 'skript-aliases', { + into 'aliases-english' // Change this if we get aliases in other languages } - - // Include all modules of Skript from 'skript-worldguard6/build/classes/java/main' - from 'skript-worldguard7fawe/build/classes/java/main' } -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation -task relocateShadowJar(type: ConfigureShadowRelocation) { - target = tasks.shadowJar +processResources { + filter ReplaceTokens, tokens: [ + 'version' : project.property('version'), + 'today' : 'unknown', // Don't leak information about system this was built on + 'release-flavor' : 'selfbuilt-unknown', // Note: 'selfbuilt' prefix makes updater report a custom build + 'release-channel' : 'none', // No updates, so anything else wouldn't make sense + 'release-updater' : 'ch.njol.skript.update.NoUpdateChecker', // Disable update checking + 'release-source' : '', + 'release-download': 'null' + ] } -tasks.shadowJar.dependsOn tasks.relocateShadowJar license { header file('licenseheader.txt') @@ -153,60 +113,17 @@ license { exclude('**/*.json') // JSON files do not have headers } -task checkAliases { - description 'Checks for the existence of the aliases.' - - doLast { - def aliasFolder = new File('skript-aliases') - if (!aliasFolder.exists() || aliasFolder.listFiles().length == 0) { - throw new InvalidUserDataException("Aliases are missing from 'skript-aliases' folder. Consider fetching submodules with 'git submodule update --init'.") - } - } -} - -jar.dependsOn checkAliases - -task sourceJar(type: Jar) { - from sourceSets.main.allJava -} - -publishing { - publications { - mavenJava(MavenPublication) { - groupId "ch.njol" - artifactId "skript" - version project.property("version") - - from components.java - - artifact sourceJar { - classifier "sources" - } - } - } - - repositories { - maven { - url "file:///itemapi_repo/" - } - } -} - -// Set compile encoding to UTF-8 (#850) -compileJava.options.encoding = 'UTF-8' -compileTestJava.options.encoding = 'UTF-8' - // Task to check that test scripts are named correctly tasks.create('testNaming') { doLast { // Regression tests for (def file : project.file('src/test/skript/tests/regressions').listFiles()) { def name = file.getName() - if (!name.toLowerCase().equals(name)) { + if (name.toLowerCase() != name) { throw new InvalidUserDataException('invalid test name: ' + name) } } - + // Syntax tests for (def dir : project.file('src/test/skript/tests/syntaxes').listFiles()) { for (def file : dir.listFiles()) { @@ -221,17 +138,30 @@ tasks.create('testNaming') { // Create a test task with given name, environments dir/file and is it development mode task void createTestTask(String name, String environments, boolean devMode) { - tasks.create(name, Exec) { + tasks.create(name) { // Execute JUnit tests, compile Skript and check test naming - dependsOn(test, jar, testNaming) - if (devMode) { - standardInput = System.in + dependsOn test, jar, testNaming + doFirst { + if (devMode) { + standardInput = System.in + } + javaexec { + group = 'execution' + classpath = files([ + 'build' + File.separator + 'libs' + File.separator + 'Skript.jar', + project.configurations.runtimeClasspath.find { it.name.startsWith('gson') }, + sourceSets.main.runtimeClasspath + ]) + main = 'ch.njol.skript.tests.platform.PlatformMain' + args = [ + 'test_runners', + 'src/test/skript/tests', + 'src/test/resources/runner_data', + environments, + devMode + ] + } } - commandLine 'java', '-cp', - "build${File.separator}libs${File.separator}Skript.jar${File.pathSeparator}" + - project.configurations.runtimeClasspath.find {it.name.startsWith('gson')}, - 'ch.njol.skript.tests.platform.PlatformMain', - 'test_runners', 'src/test/skript/tests', 'src/test/resources/runner_data', environments, "" + devMode } } @@ -239,28 +169,27 @@ void createTestTask(String name, String environments, boolean devMode) { createTestTask('quickTest', 'src/test/skript/environments/main/paper-1.16.3.json', false) createTestTask('skriptTest', 'src/test/skript/environments/main', false) createTestTask('skriptTestFull', 'src/test/skript/environments/', false) -createTestTask('skriptTestDev', 'src/test/skript/environments/main/' + (System.getProperty('skript.testEnv') == null - ? 'paper-1.16.3.json' : System.getProperty('skript.testEnv') + '.json'), true) +createTestTask('skriptTestDev', 'src/test/skript/environments/main/' + (project.property('testEnv') == null + ? 'paper-1.16.3.json' : project.property('testEnv') + '.json'), true) // Build flavor configurations task githubResources(type: ProcessResources) { - from ('src/main/resources') { + from 'src/main/resources', { include '**' - version = System.getenv("SKRIPT_VERSION") == null ? project.property("version") : System.getenv("SKRIPT_VERSION") - def channel = "stable" - if (version.contains("alpha")) { - channel = "alpha" - } else if (version.contains("beta")) { - channel = "beta" - } + version = project.property('version') + def channel = 'stable' + if (version.contains('alpha')) + channel = 'alpha' + else if (version.contains('beta')) + channel = 'beta' filter ReplaceTokens, tokens: [ - "version": version, - "today": "" + LocalDate.now(), - "release-flavor": "skriptlang-github", // SkriptLang build, distributed on Github - "release-channel": channel, // Release channel, see above - "release-updater": "ch.njol.skript.update.GithubChecker", // Github API client - "release-source": "https://api.github.com/repos/SkriptLang/Skript/releases", // Github API URL - "release-download": "null" // Update checker will figure it out + 'version' : version, + 'today' : '' + LocalTime.now(), + 'release-flavor' : 'skriptlang-github', // SkriptLang build, distributed on Github + 'release-channel' : channel, // Release channel, see above + 'release-updater' : 'ch.njol.skript.update.GithubChecker', // Github API client + 'release-source' : 'https://api.github.com/repos/SkriptLang/Skript/releases', // Github API URL + 'release-download': 'null' // Update checker will figure it out ] } into 'build/resources/main' @@ -270,39 +199,32 @@ task githubRelease(type: ShadowJar) { from sourceSets.main.output dependsOn githubResources archiveName = 'Skript-github.jar' - manifest { - attributes("Name": "ch/njol/skript", - "Sealed": "true") - } - - from('skript-aliases') { - into('aliases-english') + attributes( + 'Name': 'ch/njol/skript', + 'Sealed': 'true' + ) } - - // Include all modules of Skript from 'skript-worldguard6/build/classes/java/main' - from 'skript-worldguard7fawe/build/classes/java/main' } task spigotResources(type: ProcessResources) { - from ('src/main/resources') { + from 'src/main/resources', { include '**' - version = System.getenv("SKRIPT_VERSION") == null ? project.property("version") : System.getenv("SKRIPT_VERSION") - def channel = "stable" - if (version.contains("alpha")) { - channel = "alpha" - } else if (version.contains("beta")) { - channel = "beta" - } + version = project.property('version') + def channel = 'stable' + if (version.contains('alpha')) + channel = 'alpha' + else if (version.contains('beta')) + channel = 'beta' filter ReplaceTokens, tokens: [ - "version": version, - "today": "" + LocalDate.now(), - "release-flavor": "skriptlang-spigot", // SkriptLang build, distributed on Spigot resources - "release-channel": channel, // Release channel, see above - "release-updater": "ch.njol.skript.update.GithubChecker", // Github API client - "release-source": "https://api.github.com/repos/SkriptLang/Skript/releases", // Github API URL - "release-download": "\"http://example.com\"" // TODO insert Spigot URL + 'version' : version, + 'today' : '' + LocalTime.now(), + 'release-flavor' : 'skriptlang-spigot', // SkriptLang build, distributed on Spigot resources + 'release-channel' : channel, // Release channel, see above + 'release-updater' : 'ch.njol.skript.update.GithubChecker', // Github API client + 'release-source' : 'https://api.github.com/repos/SkriptLang/Skript/releases', // Github API URL + 'release-download': '\'http://example.com\'' // TODO insert Spigot URL ] } into 'build/resources/main' @@ -312,34 +234,28 @@ task spigotRelease(type: ShadowJar) { from sourceSets.main.output dependsOn spigotResources archiveName = 'Skript-spigot.jar' - manifest { - attributes("Name": "ch/njol/skript", - "Sealed": "true") + attributes( + 'Name': 'ch/njol/skript', + 'Sealed': 'true' + ) } - - from('skript-aliases') { - into('aliases-english') - } - - // Include all modules of Skript from 'skript-worldguard6/build/classes/java/main' - from 'skript-worldguard7fawe/build/classes/java/main' } task nightlyResources(type: ProcessResources) { - from ('src/main/resources') { + from 'src/main/resources', { include '**' - def hash = "git rev-parse --short HEAD".execute().text.trim() - version = project.property("version") + "-nightly-" + hash + def hash = 'git rev-parse --short HEAD'.execute().text.trim() + version = project.property('version') + '-nightly-' + hash filter ReplaceTokens, tokens: [ - "version": version, - "today": "" + LocalDate.now(), - "release-flavor": "skriptlang-nightly", // SkriptLang build, automatically done by CI - "release-channel": "alpha", // No update checking, but these are VERY unstable - "release-updater": "ch.njol.skript.update.NoUpdateChecker", // No autoupdates for now - "release-source": "", - "release-download": "null" + 'version' : version, + 'today' : '' + LocalTime.now(), + 'release-flavor' : 'skriptlang-nightly', // SkriptLang build, automatically done by CI + 'release-channel' : 'alpha', // No update checking, but these are VERY unstable + 'release-updater' : 'ch.njol.skript.update.NoUpdateChecker', // No autoupdates for now + 'release-source' : '', + 'release-download': 'null' ] } into 'build/resources/main' @@ -347,20 +263,13 @@ task nightlyResources(type: ProcessResources) { task nightlyRelease(type: ShadowJar) { from sourceSets.main.output - dependsOn nightlyResources - dependsOn licenseMain + dependsOn nightlyResources, licenseMain archiveName = 'Skript-nightly.jar' - manifest { - attributes("Name": "ch/njol/skript", - "Sealed": "true") - } - - from('skript-aliases') { - into('aliases-english') + attributes( + 'Name': 'ch/njol/skript', + 'Sealed': 'true' + ) } - - // Include all modules of Skript from 'skript-worldguard6/build/classes/java/main' - from 'skript-worldguard7fawe/build/classes/java/main' } diff --git a/gradle.properties b/gradle.properties index d04d146b364..ffed00d0f54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,5 @@ groupid=ch.njol name=skript version=2.5.3 +jarName=Skript.jar +testEnv=paper-1.16.3 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 457aad0d981..e708b1c023e 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 75b8c7c8c67..442d9132ea3 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-5.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708ff229..4f906e0c811 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" 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"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -66,6 +82,7 @@ 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 @@ -109,10 +126,11 @@ if $darwin; then 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 +# 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 @@ -138,19 +156,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + 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" ;; + 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 @@ -159,14 +177,9 @@ 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 6d57edc706c..107acd32c4e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@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 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, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ 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" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @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 +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ 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% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle index c054a9b7ee8..7966204f946 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ rootProject.name = 'Skript' -include 'skript-worldguard6' \ No newline at end of file +include 'skript-worldguard6' diff --git a/skript-worldguard6/build.gradle b/skript-worldguard6/build.gradle index 46df352fd2d..ed0d430e88b 100644 --- a/skript-worldguard6/build.gradle +++ b/skript-worldguard6/build.gradle @@ -7,7 +7,6 @@ dependencies { implementation 'com.sk89q:worldguard:6.1.1-SNAPSHOT' } -sourceCompatibility = 1.8 jar { archiveName 'Skript-worldguard6.jar' -} \ No newline at end of file +} diff --git a/src/main/java/ch/njol/skript/variables/Variables.java b/src/main/java/ch/njol/skript/variables/Variables.java index f6a5a4d71eb..a3256fa173a 100644 --- a/src/main/java/ch/njol/skript/variables/Variables.java +++ b/src/main/java/ch/njol/skript/variables/Variables.java @@ -82,9 +82,9 @@ private Variables() {} } @SuppressWarnings("unchecked") - private final void init() { + private void init() { // used by asserts - info = (ClassInfo) Classes.getExactClassInfo(Object.class); + info = (ClassInfo) (ClassInfo) Classes.getExactClassInfo(Object.class); } @SuppressWarnings({"unchecked"}) @@ -291,7 +291,7 @@ static Lock getReadLock() { * Returns the internal value of the requested variable. *

* Do not modify the returned value! - * + * * @param name * @return an Object for a normal Variable or a Map for a list variable, or null if the variable is not set. */ @@ -315,7 +315,7 @@ public static Object getVariable(final String name, final @Nullable Event e, fin return change.value; } } - + try { variablesLock.readLock().lock(); return variables.getVariable(n); @@ -327,7 +327,7 @@ public static Object getVariable(final String name, final @Nullable Event e, fin /** * Sets a variable. - * + * * @param name The variable's name. Can be a "list variable::*" (value must be null in this case) * @param value The variable's value. Use null to delete the variable. */ @@ -433,7 +433,7 @@ static void processChangeQueue() { * Must be called on Bukkit's main thread. *

* This method directly invokes {@link VariablesStorage#save(String, String, byte[])}, i.e. you should not be holding any database locks or such when calling this! - * + * * @param name * @param value * @param source @@ -484,7 +484,7 @@ else if (loadConflicts == MAX_CONFLICT_WARNINGS + 1) /** * Stores loaded variables into the variables map and the appropriate databases. - * + * * @return How many variables were not stored anywhere */ @SuppressWarnings("null") diff --git a/src/main/java/ch/njol/util/coll/BidiHashMap.java b/src/main/java/ch/njol/util/coll/BidiHashMap.java index 5b46018d367..4ab8fbed6cf 100644 --- a/src/main/java/ch/njol/util/coll/BidiHashMap.java +++ b/src/main/java/ch/njol/util/coll/BidiHashMap.java @@ -148,7 +148,7 @@ public Set valueSet() { @Override public BidiHashMap clone() { - return new BidiHashMap<>(this); + return new BidiHashMap(this); } } diff --git a/src/main/java/ch/njol/yggdrasil/PseudoEnum.java b/src/main/java/ch/njol/yggdrasil/PseudoEnum.java index 2f9de6aed60..259f58adc73 100644 --- a/src/main/java/ch/njol/yggdrasil/PseudoEnum.java +++ b/src/main/java/ch/njol/yggdrasil/PseudoEnum.java @@ -38,7 +38,7 @@ * furthermore a constant can be assigned to any number of fields. *

* This class defines methods similar to those in {@link Enum} with minor differences, e.g. {@link #values()} returns a {@link List} instead of an array. - * + * * @author Peter Güttinger */ @ThreadSafe @@ -56,7 +56,7 @@ public abstract class PseudoEnum> { @SuppressWarnings("unchecked") protected PseudoEnum(final String name) throws IllegalArgumentException { this.name = name; - info = getInfo(getClass()); + info = (Info) getInfo(getClass()); info.writeLock.lock(); try { if (info.map.containsKey(name)) @@ -71,7 +71,7 @@ protected PseudoEnum(final String name) throws IllegalArgumentException { /** * Returns the unique name of this constant. - * + * * @return The unique name of this constant. * @see Enum#name() */ @@ -81,7 +81,7 @@ public final String name() { /** * Returns {@link #name()}. - * + * * @return {@link #name()} * @see Enum#toString() */ @@ -93,7 +93,7 @@ public String toString() { /** * Returns the unique ID of this constant. This will not be used by Yggdrasil and can thus change freely across version, in particular reordering and inserting constants is * permitted. - * + * * @return The unique ID of this constant. * @see Enum#ordinal() */ @@ -119,7 +119,7 @@ public final boolean equals(@Nullable final Object obj) { /** * Prevents cloning of pseudo-enums. If you want to make your enums cloneable, create a (name, constantToClone) constructor. - * + * * @return newer returns normally * @throws CloneNotSupportedException always */ @@ -131,18 +131,18 @@ protected final Object clone() throws CloneNotSupportedException { /** * Returns this constant's pseudo-enum class, i.e. the first non-anonymous superclass of this constant. This class is the same for all constants inheriting from a common class * independently from whether they define an anonymous subclass. - * + * * @return This constant's pseudo-enum class. * @see Enum#getDeclaringClass() */ @SuppressWarnings("unchecked") public final Class getDeclaringClass() { - return getDeclaringClass(getClass()); + return (Class) getDeclaringClass(getClass()); } /** * Returns the common base class for constants of the given type, i.e. the first non-anonymous superclass of type. - * + * * @return The pseudo-enum class of the given class. * @see Enum#getDeclaringClass() */ @@ -159,7 +159,7 @@ public static > Class getDeclaringClass(final * The returned list is a copy of the internal list at the time this method was called. *

* Please note that you - * + * * @return All constants registered so far. * @see Enum#valueOf(Class, String) */ @@ -172,7 +172,7 @@ public final List values() { * c). *

* The returned list is a copy of the internal list at the time this method was called. - * + * * @return All constants registered so far. * @throws IllegalArgumentException If {@link #getDeclaringClass(Class) getDeclaringClass}(c) != c (i.e. if the given class is anonymous). * @see Enum#valueOf(Class, String) @@ -194,7 +194,7 @@ private static > List values(final Class c, final /** * Returns the constant with the given ID. - * + * * @param id The constant's ID * @return The constant with the given ID. * @throws IndexOutOfBoundsException if ID is < 0 or >= {@link #numConstants()}