├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── assets │ │ └── modid │ │ │ └── icon.png │ ├── modid.mixins.json │ └── fabric.mod.json │ └── java │ └── carpet_extension │ ├── mixins │ ├── CrashReport_noopMixin.java │ └── MobEntity_makarenaMixin.java │ ├── ExampleOwnSettings.java │ ├── ExampleCommand.java │ ├── ExampleSimpleSettings.java │ └── ExampleExtension.java ├── settings.gradle ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat ├── gradlew └── LICENSE /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnembon/fabric-carpet-extension-example-mod/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/assets/modid/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gnembon/fabric-carpet-extension-example-mod/HEAD/src/main/resources/assets/modid/icon.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | jcenter() 4 | maven { 5 | name = 'Fabric' 6 | url = 'https://maven.fabricmc.net/' 7 | } 8 | gradlePluginPortal() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | .gradle/ 4 | build/ 5 | out/ 6 | classes/ 7 | 8 | # idea 9 | 10 | .idea/ 11 | *.iml 12 | *.ipr 13 | *.iws 14 | 15 | # vscode 16 | 17 | .settings/ 18 | .vscode/ 19 | bin/ 20 | .classpath 21 | .project 22 | 23 | # fabric 24 | 25 | run/ -------------------------------------------------------------------------------- /src/main/resources/modid.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "carpet_extension.mixins", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "CrashReport_noopMixin", 7 | "MobEntity_makarenaMixin" 8 | ], 9 | "client": [ 10 | ], 11 | "injectors": { 12 | "defaultRequire": 1 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fabric Example Mod 2 | 3 | ## Setup 4 | 5 | 1. Edit build.gradle and mod.json to suit your needs. 6 | * The "mixins" object can be removed from mod.json if you do not need to use mixins. 7 | * Please replace all occurences of "modid" with your own mod ID - sometimes, a different string may also suffice. 8 | 2. Run the following command: 9 | 10 | ``` 11 | ./gradlew idea 12 | ``` 13 | 14 | ## License 15 | 16 | This template is available under the CC0 license. Feel free to learn from it and incorporate it in your own projects. 17 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/use or https://modmuss50.me/fabric.html 6 | minecraft_version=1.16.2-pre2 7 | yarn_mappings=1.16.2-pre2+build.1 8 | loader_version=0.9.0+build.204 9 | # check available versions on maven for the given minecraft version you are using 10 | carpet_core_version=1.4.6+v200805 11 | 12 | # Mod Properties 13 | mod_version = 1.4.6 14 | maven_group = carpet-extension 15 | archives_base_name = carpet-extension 16 | 17 | # Dependencies 18 | # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric 19 | # fabric_version=0.3.0+build.187 20 | -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "carpet-extension", 4 | "version": "1.4.6", 5 | 6 | "name": "Example Carpet Extension Mod", 7 | "description": "This is an example description! Tell everyone what your mod is about!", 8 | "authors": [ 9 | "Me!" 10 | ], 11 | "contact": { 12 | "homepage": "https://web.me/", 13 | "sources": "https://github.com/gnembon/fabric-carpet-extension-example-mod" 14 | }, 15 | 16 | "license": "CC0-1.0", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "main": [ 22 | ] 23 | }, 24 | "mixins": [ 25 | "modid.mixins.json" 26 | ], 27 | 28 | "depends": { 29 | "minecraft": "1.16.x", 30 | "fabricloader": ">=0.4.0", 31 | "carpet": "*" 32 | }, 33 | "suggests": { 34 | "flamingo": "*" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/carpet_extension/mixins/CrashReport_noopMixin.java: -------------------------------------------------------------------------------- 1 | package carpet_extension.mixins; 2 | 3 | import carpet_extension.ExampleExtension; 4 | import net.minecraft.util.crash.CrashReport; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.injection.At; 7 | import org.spongepowered.asm.mixin.injection.Inject; 8 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 9 | 10 | @Mixin(CrashReport.class) 11 | public class CrashReport_noopMixin 12 | { 13 | /* 14 | This mixins sole purpose is to get the extension classes loaded in the appropriate moment 15 | After carpet has loaded its settings class, and before anything else loads in the game 16 | */ 17 | @Inject(method = "initCrashReport", at = @At("HEAD")) 18 | private static void gameStarted(CallbackInfo ci) 19 | { 20 | ExampleExtension.noop(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/carpet_extension/ExampleOwnSettings.java: -------------------------------------------------------------------------------- 1 | package carpet_extension; 2 | 3 | import carpet.settings.Rule; 4 | 5 | public class ExampleOwnSettings 6 | { 7 | public enum Option 8 | { 9 | OPTION_A, OPTION_B, OPTION_C 10 | } 11 | 12 | @Rule(desc = "Example integer setting", category = "misc") 13 | public static int intSetting = 10; 14 | 15 | @Rule( 16 | desc = "Example string type setting", 17 | options = {"foo", "bar", "baz"}, 18 | extra = { 19 | "This can take multiple values", 20 | "that you can tab-complete in chat", 21 | "but it can take any value you want" 22 | }, 23 | category = "misc", 24 | strict = false 25 | ) 26 | public static String stringSetting = "foo"; 27 | 28 | @Rule( 29 | desc = "Example enum setting", 30 | extra = {"This is another string-type option","that conveniently parses and validates for you"}, 31 | category = "misc") 32 | public static Option optionSetting = Option.OPTION_A; 33 | 34 | @Rule(desc = "Example bool setting", category = "misc") 35 | public static boolean boolSetting; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/carpet_extension/mixins/MobEntity_makarenaMixin.java: -------------------------------------------------------------------------------- 1 | package carpet_extension.mixins; 2 | 3 | import carpet_extension.ExampleSimpleSettings; 4 | import net.minecraft.entity.EntityType; 5 | import net.minecraft.entity.LivingEntity; 6 | import net.minecraft.entity.ai.control.LookControl; 7 | import net.minecraft.entity.mob.MobEntity; 8 | import net.minecraft.world.World; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.Shadow; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | @Mixin(MobEntity.class) 16 | public abstract class MobEntity_makarenaMixin extends LivingEntity 17 | { 18 | @Shadow public abstract LookControl getLookControl(); 19 | 20 | protected MobEntity_makarenaMixin(EntityType entityType_1, World world_1) 21 | { 22 | super(entityType_1, world_1); 23 | } 24 | 25 | @Inject(method = "tick", at = @At("HEAD")) 26 | private void makarena(CallbackInfo ci) 27 | { 28 | if (ExampleSimpleSettings.makarena && onGround) 29 | { 30 | int stage = age % 200; 31 | if (stage > 155 && world.getClosestPlayer(this, 32.0) != null) 32 | { 33 | headYaw += 2; 34 | prevHeadYaw += 2; 35 | if (stage == 199) 36 | { 37 | addVelocity(0.0, 0.4, 0.0); 38 | } 39 | } 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/carpet_extension/ExampleCommand.java: -------------------------------------------------------------------------------- 1 | package carpet_extension; 2 | 3 | import carpet.utils.Messenger; 4 | import com.mojang.brigadier.CommandDispatcher; 5 | import net.minecraft.server.command.ServerCommandSource; 6 | 7 | import static net.minecraft.server.command.CommandManager.literal; 8 | 9 | public class ExampleCommand 10 | { 11 | public static void register(CommandDispatcher dispatcher) 12 | { 13 | dispatcher.register(literal("testcommand"). 14 | then(literal("first"). 15 | executes( (c)-> { 16 | Messenger.m(c.getSource(), "gi Shhhh....."); 17 | return 1; 18 | })). 19 | then(literal("second"). 20 | executes( (c)-> listSettings(c.getSource())))); 21 | 22 | } 23 | 24 | private static int listSettings(ServerCommandSource source) 25 | { 26 | Messenger.m(source, "w Here is all the settings we manage:"); 27 | Messenger.m(source, "w Own stuff:"); 28 | Messenger.m(source, "w - boolean: "+ExampleOwnSettings.boolSetting); 29 | Messenger.m(source, "w - string: "+ExampleOwnSettings.stringSetting); 30 | Messenger.m(source, "w - int: "+ExampleOwnSettings.intSetting); 31 | Messenger.m(source, "w - enum: "+ExampleOwnSettings.optionSetting); 32 | Messenger.m(source, "w Carpet Managed:"); 33 | Messenger.m(source, "w - makarena: "+ExampleSimpleSettings.makarena); 34 | Messenger.m(source, "w - useless numerical setting: "+ExampleSimpleSettings.uselessNumericalSetting); 35 | return 1; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/carpet_extension/ExampleSimpleSettings.java: -------------------------------------------------------------------------------- 1 | package carpet_extension; 2 | 3 | import carpet.settings.ParsedRule; 4 | import carpet.settings.Rule; 5 | import carpet.settings.Validator; 6 | import carpet.utils.Messenger; 7 | import net.minecraft.server.command.ServerCommandSource; 8 | 9 | import static carpet.settings.RuleCategory.CREATIVE; 10 | 11 | /** 12 | * Here is your example Settings class you can plug to use carpetmod /carpet settings command 13 | */ 14 | public class ExampleSimpleSettings 15 | { 16 | /** 17 | * Custom validator class for your setting. If validate returns null - settings is not changed. 18 | */ 19 | private static class CheckValue extends Validator 20 | { 21 | @Override 22 | public Integer validate(ServerCommandSource source, ParsedRule currentRule, Integer newValue, String typedString) 23 | { 24 | Messenger.m(source, "rb Congrats, you just changed a setting to "+newValue); 25 | return newValue < 20000000 ? newValue : null; 26 | } 27 | } 28 | 29 | /** 30 | * Simple numeric setting, no use otherwise 31 | */ 32 | @Rule( 33 | desc = "Example numerical setting", 34 | options = {"32768", "250000", "1000000"}, 35 | validate = {Validator.NONNEGATIVE_NUMBER.class, CheckValue.class}, 36 | category = {CREATIVE, "examplemod"} 37 | ) 38 | public static int uselessNumericalSetting = 32768; 39 | 40 | 41 | /** 42 | * You can define your own catergories. It makes sense to create new category for all settings in your mod. 43 | */ 44 | @Rule(desc="makes mobs dance Makarena", category = {"fun", "examplemod"}) 45 | public static boolean makarena = false; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /src/main/java/carpet_extension/ExampleExtension.java: -------------------------------------------------------------------------------- 1 | package carpet_extension; 2 | 3 | import carpet.CarpetExtension; 4 | import carpet.CarpetServer; 5 | import carpet.settings.SettingsManager; 6 | import carpet.utils.Messenger; 7 | import com.mojang.brigadier.CommandDispatcher; 8 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 9 | import net.minecraft.server.MinecraftServer; 10 | import net.minecraft.server.command.ServerCommandSource; 11 | import net.minecraft.server.network.ServerPlayerEntity; 12 | 13 | public class ExampleExtension implements CarpetExtension 14 | { 15 | public static void noop() { } 16 | private static SettingsManager mySettingManager; 17 | static 18 | { 19 | mySettingManager = new SettingsManager("1.0","examplemod","Example Mod"); 20 | CarpetServer.manageExtension(new ExampleExtension()); 21 | } 22 | 23 | @Override 24 | public void onGameStarted() 25 | { 26 | // let's /carpet handle our few simple settings 27 | CarpetServer.settingsManager.parseSettingsClass(ExampleSimpleSettings.class); 28 | // Lets have our own settings class independent from carpet.conf 29 | mySettingManager.parseSettingsClass(ExampleOwnSettings.class); 30 | 31 | // set-up a snooper to observe how rules are changing in carpet 32 | CarpetServer.settingsManager.addRuleObserver( (serverCommandSource, currentRuleState, originalUserTest) -> 33 | { 34 | if (currentRuleState.categories.contains("examplemod")) 35 | { 36 | Messenger.m( 37 | serverCommandSource, 38 | "gi Psssst... make sure not to change not to touch original carpet rules" 39 | ); 40 | // obviously you can change original carpet rules 41 | } 42 | else 43 | { 44 | try 45 | { 46 | Messenger.print_server_message( 47 | serverCommandSource.getMinecraftServer(), 48 | "Ehlo everybody, "+serverCommandSource.getPlayer().getName().getString()+" is cheating..." 49 | ); 50 | } 51 | catch (CommandSyntaxException ignored) { } 52 | } 53 | }); 54 | } 55 | 56 | @Override 57 | public void onServerLoaded(MinecraftServer server) 58 | { 59 | // reloading of /carpet settings is handled by carpet 60 | // reloading of own settings is handled as an extension, since we claim own settings manager 61 | } 62 | 63 | @Override 64 | public void onTick(MinecraftServer server) 65 | { 66 | // no need to add this. 67 | } 68 | 69 | @Override 70 | public void registerCommands(CommandDispatcher dispatcher) 71 | { 72 | ExampleCommand.register(dispatcher); 73 | } 74 | 75 | @Override 76 | public SettingsManager customSettingsManager() 77 | { 78 | // this will ensure that our settings are loaded properly when world loads 79 | return mySettingManager; 80 | } 81 | 82 | @Override 83 | public void onPlayerLoggedIn(ServerPlayerEntity player) 84 | { 85 | // 86 | } 87 | 88 | @Override 89 | public void onPlayerLoggedOut(ServerPlayerEntity player) 90 | { 91 | // 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | --------------------------------------------------------------------------------