From 2008cdfba7162e57ab8e9dab45b1527265b4c554 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Thu, 11 Feb 2016 20:56:09 +1100 Subject: [PATCH 01/19] Added build script for Gradle. Seems to work. --- .gitignore | 16 +- build.gradle | 193 +++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53638 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 160 +++++++++++++++++++ gradlew.bat | 90 +++++++++++ settings.gradle | 17 ++ 7 files changed, 474 insertions(+), 8 deletions(-) create mode 100644 build.gradle create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index fb448c0..b3645b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project -IslandCraft-NMS-v1_8_R1/bin/ +**/build/ +/.checkstyle/ +/.classpath/ +/.gradle/ +/.settings/ *.class -*.yml -/bin/ +*.jar +!/gradle/wrapper/gradle-wrapper.jar +*.project diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..57dce26 --- /dev/null +++ b/build.gradle @@ -0,0 +1,193 @@ +// To build the Bukkit plugin run 'gradle bukkit' + +plugins { + id 'com.github.johnrengelman.shadow' version '1.2.3' +} + +group = 'com.github.hoqhuuep' +version = '1.0.3-SNAPSHOT' + +allprojects { + repositories { + jcenter() + maven { + name = 'bukkit-repo' + url 'http://repo.bukkit.org/content/groups/public/' + } + maven { + name = 'spigot-repo' + url 'https://hub.spigotmc.org/nexus/content/groups/public/' + } + maven { + name = 'mcstats-repo' + url 'http://repo.mcstats.org/content/repositories/public' + } + mavenLocal() + } +} + +subprojects { + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = '1.6' + targetCompatibility = '1.6' +} + +project(':IslandCraft-API') { +} + +project(':IslandCraft-Core') { + dependencies { + compile project(':IslandCraft-API') + compile project(':IslandCraft-NMS') + compile project(':IslandCraft-NMS-v1_4_R1') + compile project(':IslandCraft-NMS-v1_5_R1') + compile project(':IslandCraft-NMS-v1_5_R2') + compile project(':IslandCraft-NMS-v1_5_R3') + compile project(':IslandCraft-NMS-v1_6_R1') + compile project(':IslandCraft-NMS-v1_6_R2') + compile project(':IslandCraft-NMS-v1_6_R3') + compile project(':IslandCraft-NMS-v1_7_R1') + compile project(':IslandCraft-NMS-v1_7_R2') + compile project(':IslandCraft-NMS-v1_7_R3') + compile project(':IslandCraft-NMS-v1_7_R4') + compile project(':IslandCraft-NMS-v1_8_R1') + compile project(':IslandCraft-NMS-v1_8_R2') + compile project(':IslandCraft-NMS-v1_8_R3') + compile group: 'com.google.guava', name: 'guava', version: '10.0.1' + compile group: 'commons-lang', name: 'commons-lang', version: '2.3' + compile group: 'org.bukkit', name: 'bukkit', version: '1.7.9-R0.2' + compile group: 'org.mcstats.bukkit', name: 'metrics', version: 'R7' + } +} + +project(':IslandCraft-NMS') { + dependencies { + compile project(':IslandCraft-API') + compile group: 'org.bukkit', name: 'bukkit', version: '1.7.9-R0.2' + } +} + +project(':IslandCraft-NMS-v1_4_R1') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.4.7-R1.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_5_R1') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.5-R0.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_5_R2') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.5.1-R0.3-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_5_R3') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.5.2-R1.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_6_R1') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.6.1-R0.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_6_R2') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.6.2-R1.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_6_R3') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.6.4-R2.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_7_R1') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.7.2-R0.4-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_7_R2') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.7.5-R0.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_7_R3') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.7.9-R0.3-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_7_R4') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.7.10-R0.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_8_R1') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.8-R1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_8_R2') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.8.3-R0.1-SNAPSHOT' + } +} + +project(':IslandCraft-NMS-v1_8_R3') { + dependencies { + compile project(':IslandCraft-NMS') + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.8.7-R0.1-SNAPSHOT' + } +} + +configurations { + bukkitPlugin +} + +dependencies { + bukkitPlugin (project(':IslandCraft-Core')) { + exclude group: 'org.bukkit' + exclude group: 'commons-lang' + } +} + +task bukkit(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { + description = 'Create the IslandCraft Bukkit plugin JAR' + group = project.group + baseName = project.name + appendix = 'Bukkit' + version = project.version + configurations = [ project.configurations.bukkitPlugin ] + from { + project.configurations.bukkitPlugin + } + relocate 'com.google', 'com.github.hoqhuuep.islandcraft.google' + relocate 'org.mcstats', 'com.github.hoqhuuep.islandcraft.mcstats' +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..5ccda13e9cb94678ba179b32452cf3d60dc36353 GIT binary patch literal 53638 zcmafaW0a=B^559DjdyI@wr$%scWm3Xy<^+Pj_sKpY&N+!|K#4>Bz;ajPk*RBjZ;RV75EK*;j-;d{(BB5~-#>pF^k0$_Qx&35mhPeng zP5V`%P1S)(UiPcRczm!G=Nud7!TH`9_!bdReTmO0lO(Zfn zfMqP~+s2VTE#?sl=$9e(CuBOAH2n}=c4idsipAKKQIO=pSsMiScd0TvKs^d1xMCym`IZxg&Xd3ii(^3$M#K)myV2qM z{o5&z?1rtP{gnX6zegV2 z$03xe*g2pGA^BqfBE}XDD-CN?H&?w?kE0wG3~``ie?T+IRmsT;*cpLZ)OnaXBtFzX zMcc97L%tQqGz+E@0i)gy&0g_7PV@3~zaE{g-2zQ|T9d>EL&JiD+E8t?H^#-Hv8!mV z-r%F^bl8v}j19B}`M^zJ>hD+Tg?Fg%no2GYmKkbR`2=|`@o`~1&VbKUJ@ZSojd|ihP|{9&8F<6 zcAvtwl6yo{Js7UQ{l~MjA7Rz8(sYEcRXX(n*(Mp75OBEijo(25zwC)pc=#%f_xV93 z`&d+DI*TAtd3KBd(^964h=X;uks5gf3MU}cR#X_wnk6_crcAVLsTV2SzsGM$h~aq~ z6oX|v?jSq%txd-SHwHy`7x4*jJqH^;0*1`Sztp*aYi4tRMBD|Ryyl%F{IC{(=Y{Y5 zhSQPvqZ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an{u4Q<;uqv!JJTP~zu!=QUWn&gmp`dotN)4Wf6S%NckF(` zF4X)J?2iHCANKE_7vQ;F|0ffE<1b9l-yi-`cmJb6&uz^=X+AgoLh~2c9|ij3_77v< zbED%=eDT(Qf&br4kk9MuxgF&v(F(vY@W-1uU_tnMtI8{BaKKyOcXb&iAS6KOxwoC) GfBiq \(.*\)$'` + 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`" +cd "$SAVED" >/dev/null + +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 + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + 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. + +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" ] ; 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 +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\"" +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\"" + 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 +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..5f19212 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@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 + +@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= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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 +if "%@eval[2+2]" == "4" goto 4NT_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=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +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 diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..6a068f7 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,17 @@ +include 'IslandCraft-API' +include 'IslandCraft-Core' +include 'IslandCraft-NMS' +include 'IslandCraft-NMS-v1_4_R1' +include 'IslandCraft-NMS-v1_5_R1' +include 'IslandCraft-NMS-v1_5_R2' +include 'IslandCraft-NMS-v1_5_R3' +include 'IslandCraft-NMS-v1_6_R1' +include 'IslandCraft-NMS-v1_6_R2' +include 'IslandCraft-NMS-v1_6_R3' +include 'IslandCraft-NMS-v1_7_R1' +include 'IslandCraft-NMS-v1_7_R2' +include 'IslandCraft-NMS-v1_7_R3' +include 'IslandCraft-NMS-v1_7_R4' +include 'IslandCraft-NMS-v1_8_R1' +include 'IslandCraft-NMS-v1_8_R2' +include 'IslandCraft-NMS-v1_8_R3' From 59ba7ca5c5385626b538d8a826392cfc424c6a9f Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Thu, 11 Feb 2016 21:00:47 +1100 Subject: [PATCH 02/19] Removed Maven pom.xml files. Use Gradle instead. --- .gitignore | 4 +- IslandCraft-Api/.gitignore | 5 - IslandCraft-Api/pom.xml | 9 -- IslandCraft-Core/.gitignore | 5 - IslandCraft-Core/dependency-reduced-pom.xml | 68 --------- IslandCraft-Core/logs/latest.log | 0 IslandCraft-Core/pom.xml | 145 -------------------- IslandCraft-NMS-v1_4_R1/.gitignore | 5 - IslandCraft-NMS-v1_4_R1/pom.xml | 24 ---- IslandCraft-NMS-v1_5_R1/.gitignore | 5 - IslandCraft-NMS-v1_5_R1/pom.xml | 24 ---- IslandCraft-NMS-v1_5_R2/.gitignore | 5 - IslandCraft-NMS-v1_5_R2/pom.xml | 24 ---- IslandCraft-NMS-v1_5_R3/.gitignore | 5 - IslandCraft-NMS-v1_5_R3/pom.xml | 24 ---- IslandCraft-NMS-v1_6_R1/.gitignore | 5 - IslandCraft-NMS-v1_6_R1/pom.xml | 24 ---- IslandCraft-NMS-v1_6_R2/.gitignore | 5 - IslandCraft-NMS-v1_6_R2/pom.xml | 24 ---- IslandCraft-NMS-v1_6_R3/.gitignore | 5 - IslandCraft-NMS-v1_6_R3/pom.xml | 24 ---- IslandCraft-NMS-v1_7_R1/.gitignore | 5 - IslandCraft-NMS-v1_7_R1/pom.xml | 24 ---- IslandCraft-NMS-v1_7_R2/.gitignore | 5 - IslandCraft-NMS-v1_7_R2/pom.xml | 24 ---- IslandCraft-NMS-v1_7_R3/.gitignore | 5 - IslandCraft-NMS-v1_7_R3/pom.xml | 24 ---- IslandCraft-NMS-v1_7_R4/.gitignore | 5 - IslandCraft-NMS-v1_7_R4/pom.xml | 24 ---- IslandCraft-NMS-v1_8_R1/.gitignore | 5 - IslandCraft-NMS-v1_8_R1/pom.xml | 25 ---- IslandCraft-NMS-v1_8_R2/.gitignore | 5 - IslandCraft-NMS-v1_8_R2/pom.xml | 25 ---- IslandCraft-NMS-v1_8_R3/.gitignore | 5 - IslandCraft-NMS-v1_8_R3/pom.xml | 25 ---- IslandCraft-NMS/.gitignore | 5 - IslandCraft-NMS/pom.xml | 18 --- pom.xml | 107 --------------- 38 files changed, 2 insertions(+), 773 deletions(-) delete mode 100644 IslandCraft-Api/.gitignore delete mode 100644 IslandCraft-Api/pom.xml delete mode 100644 IslandCraft-Core/.gitignore delete mode 100644 IslandCraft-Core/dependency-reduced-pom.xml delete mode 100644 IslandCraft-Core/logs/latest.log delete mode 100644 IslandCraft-Core/pom.xml delete mode 100644 IslandCraft-NMS-v1_4_R1/.gitignore delete mode 100644 IslandCraft-NMS-v1_4_R1/pom.xml delete mode 100644 IslandCraft-NMS-v1_5_R1/.gitignore delete mode 100644 IslandCraft-NMS-v1_5_R1/pom.xml delete mode 100644 IslandCraft-NMS-v1_5_R2/.gitignore delete mode 100644 IslandCraft-NMS-v1_5_R2/pom.xml delete mode 100644 IslandCraft-NMS-v1_5_R3/.gitignore delete mode 100644 IslandCraft-NMS-v1_5_R3/pom.xml delete mode 100644 IslandCraft-NMS-v1_6_R1/.gitignore delete mode 100644 IslandCraft-NMS-v1_6_R1/pom.xml delete mode 100644 IslandCraft-NMS-v1_6_R2/.gitignore delete mode 100644 IslandCraft-NMS-v1_6_R2/pom.xml delete mode 100644 IslandCraft-NMS-v1_6_R3/.gitignore delete mode 100644 IslandCraft-NMS-v1_6_R3/pom.xml delete mode 100644 IslandCraft-NMS-v1_7_R1/.gitignore delete mode 100644 IslandCraft-NMS-v1_7_R1/pom.xml delete mode 100644 IslandCraft-NMS-v1_7_R2/.gitignore delete mode 100644 IslandCraft-NMS-v1_7_R2/pom.xml delete mode 100644 IslandCraft-NMS-v1_7_R3/.gitignore delete mode 100644 IslandCraft-NMS-v1_7_R3/pom.xml delete mode 100644 IslandCraft-NMS-v1_7_R4/.gitignore delete mode 100644 IslandCraft-NMS-v1_7_R4/pom.xml delete mode 100644 IslandCraft-NMS-v1_8_R1/.gitignore delete mode 100644 IslandCraft-NMS-v1_8_R1/pom.xml delete mode 100644 IslandCraft-NMS-v1_8_R2/.gitignore delete mode 100644 IslandCraft-NMS-v1_8_R2/pom.xml delete mode 100644 IslandCraft-NMS-v1_8_R3/.gitignore delete mode 100644 IslandCraft-NMS-v1_8_R3/pom.xml delete mode 100644 IslandCraft-NMS/.gitignore delete mode 100644 IslandCraft-NMS/pom.xml delete mode 100644 pom.xml diff --git a/.gitignore b/.gitignore index b3645b2..5602176 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ **/build/ +**/.settings/ /.checkstyle/ -/.classpath/ /.gradle/ -/.settings/ *.class +*.classpath *.jar !/gradle/wrapper/gradle-wrapper.jar *.project diff --git a/IslandCraft-Api/.gitignore b/IslandCraft-Api/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-Api/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-Api/pom.xml b/IslandCraft-Api/pom.xml deleted file mode 100644 index 1f363ef..0000000 --- a/IslandCraft-Api/pom.xml +++ /dev/null @@ -1,9 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-Api - \ No newline at end of file diff --git a/IslandCraft-Core/.gitignore b/IslandCraft-Core/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-Core/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-Core/dependency-reduced-pom.xml b/IslandCraft-Core/dependency-reduced-pom.xml deleted file mode 100644 index 547fa17..0000000 --- a/IslandCraft-Core/dependency-reduced-pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - IslandCraft - com.github.hoqhuuep - 1.0.2 - - 4.0.0 - IslandCraft-Core - - - - maven-shade-plugin - 2.3 - - - package - - shade - - - - - - - org.mcstats.*:* - com.github.hoqhuuep:IslandCraft-Api - com.github.hoqhuuep:IslandCraft-NMS* - com.google*:* - - - - - org.mcstats - com.github.hoqhuuep.islandcraft.mcstats - - - com.google - com.github.hoqhuuep.islandcraft.google - - - - - - maven-jar-plugin - 2.3.2 - - IslandCraft-1.0.2 - - - - - - - commons-lang - commons-lang - 2.3 - provided - - - org.bukkit - bukkit - 1.7.9-R0.2 - provided - - - - diff --git a/IslandCraft-Core/logs/latest.log b/IslandCraft-Core/logs/latest.log deleted file mode 100644 index e69de29..0000000 diff --git a/IslandCraft-Core/pom.xml b/IslandCraft-Core/pom.xml deleted file mode 100644 index f046e6d..0000000 --- a/IslandCraft-Core/pom.xml +++ /dev/null @@ -1,145 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-Core - - - - com.google.guava - guava - 10.0.1 - compile - - - com.github.hoqhuuep - IslandCraft-Api - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_8_R3 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_8_R2 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_8_R1 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_7_R4 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_7_R3 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_7_R2 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_7_R1 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_6_R3 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_6_R2 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_6_R1 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_5_R3 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_5_R2 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_5_R1 - 1.0.2 - - - com.github.hoqhuuep - IslandCraft-NMS-v1_4_R1 - 1.0.2 - - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - - - org.mcstats.*:* - com.github.hoqhuuep:IslandCraft-Api - com.github.hoqhuuep:IslandCraft-NMS* - com.google*:* - - - - - org.mcstats - com.github.hoqhuuep.islandcraft.mcstats - - - com.google - com.github.hoqhuuep.islandcraft.google - - - - - - package - - shade - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.2 - - IslandCraft-1.0.2 - - - - - diff --git a/IslandCraft-NMS-v1_4_R1/.gitignore b/IslandCraft-NMS-v1_4_R1/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_4_R1/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_4_R1/pom.xml b/IslandCraft-NMS-v1_4_R1/pom.xml deleted file mode 100644 index 0bfd8ff..0000000 --- a/IslandCraft-NMS-v1_4_R1/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_4_R1 - - - - org.bukkit - craftbukkit - 1.4.7-R1.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_5_R1/.gitignore b/IslandCraft-NMS-v1_5_R1/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_5_R1/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_5_R1/pom.xml b/IslandCraft-NMS-v1_5_R1/pom.xml deleted file mode 100644 index 789e35d..0000000 --- a/IslandCraft-NMS-v1_5_R1/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_5_R1 - - - - org.bukkit - craftbukkit - 1.5-R0.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_5_R2/.gitignore b/IslandCraft-NMS-v1_5_R2/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_5_R2/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_5_R2/pom.xml b/IslandCraft-NMS-v1_5_R2/pom.xml deleted file mode 100644 index 0520e70..0000000 --- a/IslandCraft-NMS-v1_5_R2/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_5_R2 - - - - org.bukkit - craftbukkit - 1.5.1-R0.3-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_5_R3/.gitignore b/IslandCraft-NMS-v1_5_R3/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_5_R3/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_5_R3/pom.xml b/IslandCraft-NMS-v1_5_R3/pom.xml deleted file mode 100644 index f97f0c1..0000000 --- a/IslandCraft-NMS-v1_5_R3/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_5_R3 - - - - org.bukkit - craftbukkit - 1.5.2-R1.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_6_R1/.gitignore b/IslandCraft-NMS-v1_6_R1/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_6_R1/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_6_R1/pom.xml b/IslandCraft-NMS-v1_6_R1/pom.xml deleted file mode 100644 index dccb5b5..0000000 --- a/IslandCraft-NMS-v1_6_R1/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_6_R1 - - - - org.bukkit - craftbukkit - 1.6.1-R0.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_6_R2/.gitignore b/IslandCraft-NMS-v1_6_R2/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_6_R2/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_6_R2/pom.xml b/IslandCraft-NMS-v1_6_R2/pom.xml deleted file mode 100644 index a3a239d..0000000 --- a/IslandCraft-NMS-v1_6_R2/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_6_R2 - - - - org.bukkit - craftbukkit - 1.6.2-R1.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_6_R3/.gitignore b/IslandCraft-NMS-v1_6_R3/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_6_R3/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_6_R3/pom.xml b/IslandCraft-NMS-v1_6_R3/pom.xml deleted file mode 100644 index 9994644..0000000 --- a/IslandCraft-NMS-v1_6_R3/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_6_R3 - - - - org.bukkit - craftbukkit - 1.6.4-R2.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_7_R1/.gitignore b/IslandCraft-NMS-v1_7_R1/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_7_R1/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_7_R1/pom.xml b/IslandCraft-NMS-v1_7_R1/pom.xml deleted file mode 100644 index 304cb87..0000000 --- a/IslandCraft-NMS-v1_7_R1/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_7_R1 - - - - org.bukkit - craftbukkit - 1.7.2-R0.4-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_7_R2/.gitignore b/IslandCraft-NMS-v1_7_R2/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_7_R2/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_7_R2/pom.xml b/IslandCraft-NMS-v1_7_R2/pom.xml deleted file mode 100644 index 018dc66..0000000 --- a/IslandCraft-NMS-v1_7_R2/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_7_R2 - - - - org.bukkit - craftbukkit - 1.7.5-R0.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_7_R3/.gitignore b/IslandCraft-NMS-v1_7_R3/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_7_R3/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_7_R3/pom.xml b/IslandCraft-NMS-v1_7_R3/pom.xml deleted file mode 100644 index 267201b..0000000 --- a/IslandCraft-NMS-v1_7_R3/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_7_R3 - - - - org.bukkit - craftbukkit - 1.7.9-R0.3-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_7_R4/.gitignore b/IslandCraft-NMS-v1_7_R4/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_7_R4/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_7_R4/pom.xml b/IslandCraft-NMS-v1_7_R4/pom.xml deleted file mode 100644 index 895f898..0000000 --- a/IslandCraft-NMS-v1_7_R4/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_7_R4 - - - - org.bukkit - craftbukkit - 1.7.10-R0.1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_8_R1/.gitignore b/IslandCraft-NMS-v1_8_R1/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_8_R1/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_8_R1/pom.xml b/IslandCraft-NMS-v1_8_R1/pom.xml deleted file mode 100644 index 85d9199..0000000 --- a/IslandCraft-NMS-v1_8_R1/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_8_R1 - - - - org.bukkit - craftbukkit - 1.8-R1-SNAPSHOT - system - C:\Users\Daniel\Dropbox\Projects\IslandCraft\Spigot\craftbukkit-1.8.jar - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_8_R2/.gitignore b/IslandCraft-NMS-v1_8_R2/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_8_R2/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_8_R2/pom.xml b/IslandCraft-NMS-v1_8_R2/pom.xml deleted file mode 100644 index 29c706a..0000000 --- a/IslandCraft-NMS-v1_8_R2/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_8_R2 - - - - org.bukkit - craftbukkit - 1.8.3-R0.1-SNAPSHOT - system - C:\Users\Daniel\Dropbox\Projects\IslandCraft\Spigot-1.8.3\craftbukkit-1.8.3.jar - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_8_R3/.gitignore b/IslandCraft-NMS-v1_8_R3/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_8_R3/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_8_R3/pom.xml b/IslandCraft-NMS-v1_8_R3/pom.xml deleted file mode 100644 index 518d480..0000000 --- a/IslandCraft-NMS-v1_8_R3/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_8_R3 - - - - org.bukkit - craftbukkit - 1.8.7-R0.1-SNAPSHOT - system - C:\Users\Daniel\Dropbox\Projects\IslandCraft\Spigot-1.8.7\craftbukkit-1.8.7.jar - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS/.gitignore b/IslandCraft-NMS/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS/pom.xml b/IslandCraft-NMS/pom.xml deleted file mode 100644 index c31bcdd..0000000 --- a/IslandCraft-NMS/pom.xml +++ /dev/null @@ -1,18 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS - - - - com.github.hoqhuuep - IslandCraft-Api - 1.0.2 - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 5b8cfce..0000000 --- a/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - 4.0.0 - com.github.hoqhuuep - IslandCraft - 1.0.2 - pom - - - IslandCraft - 2013 - http://dev.bukkit.org/bukkit-plugins/islandcraft/ - Modifies the terrain generation of Minecraft to create an ocean with many islands. - - - - UTF-8 - - - - IslandCraft-Core - IslandCraft-NMS - IslandCraft-NMS-v1_8_R3 - IslandCraft-NMS-v1_8_R2 - IslandCraft-NMS-v1_8_R1 - IslandCraft-NMS-v1_7_R4 - IslandCraft-NMS-v1_7_R3 - IslandCraft-NMS-v1_7_R2 - IslandCraft-NMS-v1_7_R1 - IslandCraft-NMS-v1_6_R3 - IslandCraft-NMS-v1_6_R2 - IslandCraft-NMS-v1_6_R1 - IslandCraft-NMS-v1_5_R3 - IslandCraft-NMS-v1_5_R2 - IslandCraft-NMS-v1_5_R1 - IslandCraft-NMS-v1_4_R1 - IslandCraft-Api - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-eclipse-plugin - - true - true - - 2.9 - - - - - - - bukkit-repo - http://repo.bukkit.org/content/groups/public/ - - - spigot-repo - https://hub.spigotmc.org/nexus/content/groups/public/ - - - Plugin Metrics - http://repo.mcstats.org/content/repositories/public - - - - - - - com.google.guava - guava - 10.0.1 - compile - - - - commons-lang - commons-lang - 2.3 - provided - - - org.bukkit - bukkit - 1.7.9-R0.2 - provided - - - org.mcstats.bukkit - metrics - R7 - compile - - - From 4e73b282abf353d8e6ebb95ccf351534687b2ef4 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Thu, 11 Feb 2016 21:22:59 +1100 Subject: [PATCH 03/19] Oops. These shouldn't be here! --- IslandCraft-NMS-v1_8_R1/bin/.classpath.old | 46 ------------------ IslandCraft-NMS-v1_8_R1/bin/.gitignore | 5 -- IslandCraft-NMS-v1_8_R1/bin/pom.xml | 24 --------- .../nms/v1_8_R1/CustomWorldChunkManager.class | Bin 6234 -> 0 bytes .../islandcraft/nms/v1_8_R1/NmsHandler.class | Bin 1837 -> 0 bytes 5 files changed, 75 deletions(-) delete mode 100644 IslandCraft-NMS-v1_8_R1/bin/.classpath.old delete mode 100644 IslandCraft-NMS-v1_8_R1/bin/.gitignore delete mode 100644 IslandCraft-NMS-v1_8_R1/bin/pom.xml delete mode 100644 IslandCraft-NMS-v1_8_R1/bin/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R1/CustomWorldChunkManager.class delete mode 100644 IslandCraft-NMS-v1_8_R1/bin/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R1/NmsHandler.class diff --git a/IslandCraft-NMS-v1_8_R1/bin/.classpath.old b/IslandCraft-NMS-v1_8_R1/bin/.classpath.old deleted file mode 100644 index 7092a1c..0000000 --- a/IslandCraft-NMS-v1_8_R1/bin/.classpath.old +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/IslandCraft-NMS-v1_8_R1/bin/.gitignore b/IslandCraft-NMS-v1_8_R1/bin/.gitignore deleted file mode 100644 index c449f83..0000000 --- a/IslandCraft-NMS-v1_8_R1/bin/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.settings -/.checkstyle -/.classpath -/.project diff --git a/IslandCraft-NMS-v1_8_R1/bin/pom.xml b/IslandCraft-NMS-v1_8_R1/bin/pom.xml deleted file mode 100644 index 0773f0c..0000000 --- a/IslandCraft-NMS-v1_8_R1/bin/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - - com.github.hoqhuuep - IslandCraft - 1.0.2 - - IslandCraft-NMS-v1_8_R1 - - - - org.bukkit - craftbukkit - 1.7.8-R1-SNAPSHOT - provided - - - com.github.hoqhuuep - IslandCraft-NMS - 1.0.2 - - - diff --git a/IslandCraft-NMS-v1_8_R1/bin/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R1/CustomWorldChunkManager.class b/IslandCraft-NMS-v1_8_R1/bin/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R1/CustomWorldChunkManager.class deleted file mode 100644 index e2e6ae48eb466651d24f75947101e341c3070cf9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6234 zcmeHM-BQ~|6g~?9fkP5vk~A%8BAEWz{gF$5)0n0WE+n22O$rpI;Ucq^7kh)W>#SC8 zx$i6Vst?kccBZ-S6ZAFu0-YX7#x_B+aECBS2hVuq-TltD=bSyel0N_W&u@PKz=v?p zfDr=U`pPMJl#9}1+NLE(dZh-}&7f9l$|ubrV677OT`KC1qC2`IJipXlcy#m8+Cr%k z_*!~fQn~d?GZ4G0RL}-f2Am-<9kHQZqjbOam^qrjM2$<2tyG$@ewNyBHJl^d=jN!MK z!>LQ)YN3z1*!P>jnTo7411=J{&~txTDXAu4hQQo+LNQ;uZB{oiPc80J&809~O4eNF z-7<4In1;(!a0Ol=FuuqI*S85=F4#S`b*;E)l#816q%+LcXTn?+^Qr|ZnDumQ#jhXu)S!Pw6 z+&8(XbA=1$?%~i5Q%pD*?~allwx0wzRyQptBH7_C^AjhD!#ws`>I^3i9cWQ!7i-O& z$91scdbRfJ)#|HP3+vVD)a$%im&`ZAusy1srl~PG>_@B%-Oq^o!3y_-6{Tz#{x}od zYe}W!ga?|t2}yWSfP(2P?@kPYiO%vR4RYuNN+2?|G-|Nl zd;hoHeY!7RoPCjX7dqLj|!eFE$Dv1>=D)DVhNQK4wt+}GHgT?>Tf z9;=Er_c_WUcf!pW2`}hE&c5GfO7S{FXx?5AS}oKw{4J^k$}B#1jwR9JpTC?vsmRNM8qmbNk>WS30`{ZX7ar zSnQ`jB@11t#-SD;5_sd;U>{ILJ*JsD5cPb|%3echPI~2{9Z7Hxq|ZZ5D$HYzz-S>9 znsVzhP!3x`wT8g86xA-0J5a2u3P%bbbI*jn$5ByJPIJ$IPcaqU8ZqD|vPR8FgEQb3 zs&G-et5O-ThzU91lmV!Q8J)^D;43VoaFGpILQnD0!ho+)Hj4u?0F!_5(3?GGY?b>y zuI&cC()ln4Xo_m)D7*$^Fpez)TO%+5d6xC-asJR&Y&>m9Tpc+LF| z)8FUwzrv-b*cw3$L@WR^@M_cph`WO9vE9dLH`2A6O|T=8-BipDufugjVRglvPos3o$!32&vag}F$NshP<3HWX6W#s{*=M7AR4HaXJ4Y(FKkz55^8eokb& z0q>>w7FJDq-hN48dq0J3Y#`gy6t+?d+u*$YmB{u1ETpgvuD8Dv*hcZcf^ctqg!LMJ Z?&9|n?ygVZGx!|J@CAGccc22x{{o;YNqhhR diff --git a/IslandCraft-NMS-v1_8_R1/bin/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R1/NmsHandler.class b/IslandCraft-NMS-v1_8_R1/bin/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R1/NmsHandler.class deleted file mode 100644 index f01e8d26f0e6d9ef5afc4b1d883a5637adf82d85..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1837 zcmb_d-A@xi5TE7iO09q>et;hfyuiy{Fg_S-Ob|s#Dj28`eIeVsX}fs0d+cr-`O8c+ z(RcqS&fIT)``ekh-+#XU1c0Zo>cJR;H`atfBBTmVMOy@+PJ)JX z%~maF>a%96g=rvdEL0R4QFnn#Y|!2~d46)R5$q*)hYT?q4<;DQIhpEcP=yqsZgfKHvliJR z?uW6kme*yBwi6{n+R99+2)~F1@)hFbceL@l+W42W@kty1LYoyHX|y~eln56#xg*~A zH6<385lMSL)85Zda~1p!N13GBIIc}&!11r@qRC3S&4CX636!DQTGFxA4PPnGD47MxR(E-Xt zM=I+?9QUivU~#RIAFy2Mx0KgEGgvxkDJK)$Rc&b{k=x9wIInx+R;+ZhpmfV_{udC}Jg5Kw From 2293be1bf20d6514e6785658fd3aac61fc381d3d Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Fri, 12 Feb 2016 21:51:27 +1100 Subject: [PATCH 04/19] Apply eclipse plugin to Gradle config. Execute "gradle eclipse" to create eclipse projects. --- .gitignore | 1 + build.gradle | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5602176..172f9ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +**/bin/ **/build/ **/.settings/ /.checkstyle/ diff --git a/build.gradle b/build.gradle index 57dce26..dcd4bb6 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,8 @@ allprojects { } mavenLocal() } + + apply plugin: 'eclipse' } subprojects { From cf76a2d039b34a7e4661ad8cbcc2b610e23b7f43 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sat, 13 Feb 2016 10:11:58 +1100 Subject: [PATCH 05/19] Separating out common logic to prepare for Sponge version. Removed dependencies on guava and commons-lang. Updated to Java 1.7 (less than 0.5% of servers are running 1.6 now). --- .../bukkit/BiomeGeneratorListener.java | 6 +- .../islandcraft/bukkit/BukkitNoise.java | 19 ++ .../bukkit/BukkitNoiseBuilder.java | 11 + .../islandcraft/bukkit/BukkitWorldConfig.java | 49 ++++ .../bukkit}/EbeanServerIslandDatabase.java | 4 +- .../islandcraft/bukkit}/EbeanServerUtil.java | 3 +- .../bukkit/IslandCraftBiomeGenerator.java | 2 +- .../islandcraft/bukkit/IslandCraftPlugin.java | 237 ++++++++++++++++++ .../hoqhuuep/islandcraft/bukkit/Metrics.java | 0 .../src/main/resources/config.yml | 0 .../src/main/resources/plugin.yml | 0 .../core/ConstantBiomeDistribution.java | 23 ++ .../core/ConstantIslandGenerator.java | 3 +- .../islandcraft/core/DefaultIsland.java | 0 .../islandcraft/core/DefaultIslandCraft.java | 0 .../islandcraft/core/DefaultWorld.java | 47 ++-- .../core/EmptyIslandDistribution.java | 3 +- .../core/EmptyIslandGenerator.java | 3 +- .../core/HexagonalIslandDistribution.java | 3 +- .../islandcraft/core/ICClassLoader.java | 20 +- .../hoqhuuep/islandcraft/core/ICLogger.java | 0 .../hoqhuuep/islandcraft/core/ICNoise.java | 5 + .../islandcraft/core/ICWorldConfig.java | 9 + .../islandcraft/core/IslandCache.java | 22 +- .../islandcraft/core/IslandDatabase.java | 0 .../core/IslandGeneratorAlpha.java | 193 ++++++++++++++ .../hoqhuuep/islandcraft/core/Noise.java | 6 + .../islandcraft/core/NoiseBuilder.java | 5 + .../core/SquareIslandDistribution.java | 3 +- .../core/mosaic/AngleComparator.java | 0 .../islandcraft/core/mosaic/Grid.java | 0 .../islandcraft/core/mosaic/Poisson.java | 0 .../islandcraft/core/mosaic/RangeEntry.java | 0 .../islandcraft/core/mosaic/RangeList.java | 0 .../islandcraft/core/mosaic/Site.java | 0 .../hoqhuuep/islandcraft/util/Cache.java | 5 + .../islandcraft/util/CacheLoader.java | 5 + .../islandcraft/util/EternalLoadingCache.java | 28 +++ .../util/ExpiringLoadingCache.java | 77 ++++++ .../islandcraft/util/StringUtils.java | 20 ++ .../islandcraft/bukkit/IslandCraftPlugin.java | 208 --------------- .../core/ConstantBiomeDistribution.java | 24 -- .../core/IslandGeneratorAlpha.java | 193 -------------- .../nms/v1_8_R2/CustomWorldChunkManager.java | 2 +- .../nms/v1_8_R3/CustomWorldChunkManager.java | 2 +- build.gradle | 30 ++- settings.gradle | 4 +- 47 files changed, 764 insertions(+), 510 deletions(-) rename {IslandCraft-Core => IslandCraft-Bukkit}/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java (95%) create mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java create mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java create mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitWorldConfig.java rename {IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core => IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit}/EbeanServerIslandDatabase.java (97%) rename {IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core => IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit}/EbeanServerUtil.java (97%) rename {IslandCraft-Core => IslandCraft-Bukkit}/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java (98%) create mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java rename {IslandCraft-Core => IslandCraft-Bukkit}/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java (100%) rename {IslandCraft-Core => IslandCraft-Bukkit}/src/main/resources/config.yml (100%) rename {IslandCraft-Core => IslandCraft-Bukkit}/src/main/resources/plugin.yml (100%) create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java (95%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIsland.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIslandCraft.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java (73%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java (95%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java (94%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java (99%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java (75%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java (100%) create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICWorldConfig.java rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java (72%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandDatabase.java (100%) create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java (99%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/AngleComparator.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Grid.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Poisson.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeEntry.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeList.java (100%) rename {IslandCraft-Core => IslandCraft-Common}/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Site.java (100%) create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/Cache.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/CacheLoader.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/EternalLoadingCache.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/ExpiringLoadingCache.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/StringUtils.java delete mode 100644 IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java delete mode 100644 IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java delete mode 100644 IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java similarity index 95% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java rename to IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java index ca7f06c..e57da73 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BiomeGeneratorListener.java @@ -12,10 +12,8 @@ import org.bukkit.event.world.WorldInitEvent; import com.github.hoqhuuep.islandcraft.api.ICWorld; -import com.github.hoqhuuep.islandcraft.api.IslandCraft; import com.github.hoqhuuep.islandcraft.core.ICLogger; import com.github.hoqhuuep.islandcraft.core.IslandCache; -import com.github.hoqhuuep.islandcraft.core.DefaultIslandCraft; import com.github.hoqhuuep.islandcraft.core.DefaultWorld; import com.github.hoqhuuep.islandcraft.core.ICClassLoader; import com.github.hoqhuuep.islandcraft.core.IslandDatabase; @@ -60,7 +58,7 @@ public void onWorldInit(final WorldInitEvent event) { return; } ICLogger.logger.info("Installing biome generator in WorldInitEvent for world with name: " + worldName); - final ICWorld icWorld = new DefaultWorld(worldName, world.getSeed(), database, config, cache, classLoader); + final ICWorld icWorld = new DefaultWorld(worldName, world.getSeed(), database, new BukkitWorldConfig(worldName, config), cache, classLoader); final BiomeGenerator biomeGenerator = new IslandCraftBiomeGenerator(icWorld); nms.installBiomeGenerator(world, biomeGenerator); worldsDone.add(worldName); @@ -87,7 +85,7 @@ public void onChunkLoad(final ChunkLoadEvent event) { return; } ICLogger.logger.info("Installing biome generator in ChunkLoadEvent for world with name: " + worldName); - final ICWorld icWorld = new DefaultWorld(worldName, world.getSeed(), database, config, cache, classLoader); + final ICWorld icWorld = new DefaultWorld(worldName, world.getSeed(), database, new BukkitWorldConfig(worldName, config), cache, classLoader); final BiomeGenerator biomeGenerator = new IslandCraftBiomeGenerator(icWorld); if (nms.installBiomeGenerator(world, biomeGenerator)) { // If this is the very first time, regenerate the chunk diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java new file mode 100644 index 0000000..c027ff5 --- /dev/null +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java @@ -0,0 +1,19 @@ +package com.github.hoqhuuep.islandcraft.bukkit; + +import org.bukkit.util.noise.OctaveGenerator; +import org.bukkit.util.noise.SimplexOctaveGenerator; + +import com.github.hoqhuuep.islandcraft.core.Noise; + +public class BukkitNoise implements Noise { + private final OctaveGenerator octaveGenerator; + + public BukkitNoise(long seed) { + octaveGenerator = new SimplexOctaveGenerator(seed, 2); + } + + @Override + public double noise(double x, double z) { + return octaveGenerator.noise(x, z, 2.0, 0.5, true) / 2.0 + 0.5; + } +} diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java new file mode 100644 index 0000000..719d8f3 --- /dev/null +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java @@ -0,0 +1,11 @@ +package com.github.hoqhuuep.islandcraft.bukkit; + +import com.github.hoqhuuep.islandcraft.core.Noise; +import com.github.hoqhuuep.islandcraft.core.NoiseBuilder; + +public class BukkitNoiseBuilder implements NoiseBuilder { + @Override + public Noise build(long seed) { + return new BukkitNoise(seed); + } +} diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitWorldConfig.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitWorldConfig.java new file mode 100644 index 0000000..02212fd --- /dev/null +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitWorldConfig.java @@ -0,0 +1,49 @@ +package com.github.hoqhuuep.islandcraft.bukkit; + +import java.util.List; + +import org.bukkit.configuration.ConfigurationSection; + +import com.github.hoqhuuep.islandcraft.core.ICWorldConfig; +import com.github.hoqhuuep.islandcraft.core.ICLogger; + +public class BukkitWorldConfig implements ICWorldConfig { + private final String worldName; + private final ConfigurationSection config; + + public BukkitWorldConfig(String worldName, ConfigurationSection config) { + this.worldName = worldName; + this.config = config; + } + + @Override + public String getOcean() { + if (!config.contains("ocean") || !config.isString("ocean")) { + ICLogger.logger.warning("No string-value for 'worlds." + worldName + ".ocean' found in config.yml"); + ICLogger.logger.warning("Default value 'com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN' will be used"); + } + return config.getString("ocean", "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"); + } + + @Override + public String getIslandDistribution() { + if (!config.contains("island-distribution") || !config.isString("island-distribution")) { + ICLogger.logger.warning("No string-value for 'worlds." + worldName + ".island-distribution' found in config.yml"); + ICLogger.logger.warning("Default value 'com.github.hoqhuuep.islandcraft.core.EmptyIslandDistribution' will be used"); + } + return config.getString("island-distribution", "com.github.hoqhuuep.islandcraft.core.EmptyIslandDistribution"); + } + + @Override + public String[] getIslandGenerstors() { + if (!config.contains("island-generators") || !config.isList("island-generators")) { + ICLogger.logger.warning("No list-value for 'worlds." + worldName + ".island-generators' found in config.yml"); + ICLogger.logger.warning("Default value '[com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator]' will be used"); + } + List islandGenerators = config.getStringList("island-generators"); + if (islandGenerators.isEmpty()) { + islandGenerators.add("com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator"); + } + return islandGenerators.toArray(new String[islandGenerators.size()]); + } +} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EbeanServerIslandDatabase.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/EbeanServerIslandDatabase.java similarity index 97% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EbeanServerIslandDatabase.java rename to IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/EbeanServerIslandDatabase.java index 98df535..1ebbb7f 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EbeanServerIslandDatabase.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/EbeanServerIslandDatabase.java @@ -1,4 +1,4 @@ -package com.github.hoqhuuep.islandcraft.core; +package com.github.hoqhuuep.islandcraft.bukkit; import java.io.Serializable; @@ -9,6 +9,8 @@ import javax.persistence.Table; import com.avaje.ebean.EbeanServer; +import com.github.hoqhuuep.islandcraft.core.ICLogger; +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; public class EbeanServerIslandDatabase implements IslandDatabase { private final EbeanServer ebeanServer; diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EbeanServerUtil.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/EbeanServerUtil.java similarity index 97% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EbeanServerUtil.java rename to IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/EbeanServerUtil.java index b1ce02e..670dc73 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EbeanServerUtil.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/EbeanServerUtil.java @@ -1,4 +1,4 @@ -package com.github.hoqhuuep.islandcraft.core; +package com.github.hoqhuuep.islandcraft.bukkit; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -17,6 +17,7 @@ import com.avaje.ebeaninternal.api.SpiEbeanServer; import com.avaje.ebeaninternal.server.ddl.DdlGenerator; import com.avaje.ebeaninternal.server.lib.sql.TransactionIsolation; +import com.github.hoqhuuep.islandcraft.core.ICLogger; public class EbeanServerUtil { public static EbeanServer build(final JavaPlugin javaPlugin) { diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java similarity index 98% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java rename to IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java index 4ed3d31..9d843df 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftBiomeGenerator.java @@ -42,6 +42,6 @@ public ICBiome[] generateChunkBiomes(final int x, final int z) { @Override public void cleanupCache() { - // NOP + // Nothing to do } } diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java new file mode 100644 index 0000000..22023fd --- /dev/null +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java @@ -0,0 +1,237 @@ +package com.github.hoqhuuep.islandcraft.bukkit; + +import java.util.Arrays; +import java.util.List; +import java.util.logging.Level; + +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; + +import com.avaje.ebean.EbeanServer; +import com.github.hoqhuuep.islandcraft.api.ICLocation; +import com.github.hoqhuuep.islandcraft.api.ICRegion; +import com.github.hoqhuuep.islandcraft.api.IslandCraft; +import com.github.hoqhuuep.islandcraft.core.DefaultIslandCraft; +import com.github.hoqhuuep.islandcraft.core.ICLogger; +import com.github.hoqhuuep.islandcraft.core.ICNoise; +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; +import com.github.hoqhuuep.islandcraft.nms.NmsWrapper; + +public class IslandCraftPlugin extends JavaPlugin { + + private DefaultIslandCraft islandCraft = null; + + @Override + public void onEnable() { + ICLogger.logger = getLogger(); + ICNoise.builder = new BukkitNoiseBuilder(); + + // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage + try { + final Metrics metrics = new Metrics(this); + metrics.start(); + } catch (final Exception e) { + ICLogger.logger.warning("Failed to start MCStats"); + } + + saveDefaultConfig(); + FileConfiguration config = getConfig(); + if (!config.contains("config-version") || !config.isString("config-version")) { + ICLogger.logger.severe("No string-value for 'config-version' found in config.yml"); + ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + setEnabled(false); + return; + } + final String configVersion = config.getString("config-version"); + if (!configVersion.equals("1.0.0")) { + ICLogger.logger.severe("Incompatible config-version found in config.yml"); + ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + setEnabled(false); + return; + } + + if (!config.contains("verbose-logging") || !config.isBoolean("verbose-logging")) { + ICLogger.logger.warning("No boolean-value for 'verbose-logging' found in config.yml"); + ICLogger.logger.warning("Default value 'false' will be used"); + } + final boolean verboseLogging = config.getBoolean("verbose-logging", false); + ICLogger.logger.setLevel(verboseLogging ? Level.ALL : Level.WARNING); + + final NmsWrapper nms = NmsWrapper.getInstance(getServer()); + if (nms == null) { + ICLogger.logger.severe("IslandCraft does not currently support this CraftBukkit version"); + ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + setEnabled(false); + return; + } + + IslandDatabase database; + try { + final EbeanServer ebeanServer = EbeanServerUtil.build(this); + database = new EbeanServerIslandDatabase(ebeanServer); + } catch (final Exception e) { + ICLogger.logger.severe("Error creating EbeanServer database"); + ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.severe("Exception message: " + e.getMessage()); + setEnabled(false); + return; + } + + try { + islandCraft = new DefaultIslandCraft(); + final Listener listener = new BiomeGeneratorListener(this, database, nms); + getServer().getPluginManager().registerEvents(listener, this); + } catch (final Exception e) { + ICLogger.logger.severe("Error creating or registering BiomeGeneratorListener"); + ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.severe("Exception message: " + e.getMessage()); + setEnabled(false); + return; + } + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (sender instanceof Player) { + sender.sendMessage("This command can only be executed by console!"); + return false; + } + if (args.length == 0) { + sender.sendMessage("/ic "); + return false; + } + if ("reload".equals(args[0])) { + sender.sendMessage("Reloaded IslandCraft configuration"); + reloadConfig(); + } else if ("create".equals(args[0])) { + // ic create 2 1 ConstantBiomeDistribution IslandGeneratorAlpha + if (args.length < 4) { + sender.sendMessage("/ic create "); + sender.sendMessage("OR"); + sender.sendMessage("/ic create [distribution] [generator]"); + sender.sendMessage("Note: An island size of 1 = 4 chunks"); + return false; + } + String world = args[1]; + int island; + int ocean; + try { + island = Integer.parseInt(args[2]) * 32; + ocean = Integer.parseInt(args[3]) * 32; + } catch (Exception e) { + sender.sendMessage("Invalid size for:"); + sender.sendMessage("/ic create [distribution] [generator]"); + return false; + } + String distribution = "SquareIslandDistribution"; + String generator = "IslandGeneratorAlpha"; + if (args.length > 4) { + distribution = args[4]; + } + if (args.length > 5) { + distribution = args[5]; + } + FileConfiguration config = getConfig(); + String path = "worlds." + world; + config.set(path + "." + "ocean", + "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"); + config.set(path + "." + "island-distribution", + "com.github.hoqhuuep.islandcraft.core." + distribution + " " + island + " " + ocean); + String[] gen_types = { + "com.github.hoqhuuep.islandcraft.core." + generator + + " BIRCH_FOREST BIRCH_FOREST_M BIRCH_FOREST_HILLS BIRCH_FOREST_HILLS_M ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " COLD_TAIGA COLD_TAIGA_M COLD_TAIGA_HILLS ~ ~ ~ OCEAN COLD_BEACH FROZEN_RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " DESERT DESERT_M DESERT_HILLS ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " EXTREME_HILLS EXTREME_HILLS_M EXTREME_HILLS_PLUS EXTREME_HILLS_PLUS_M EXTREME_HILLS_EDGE ~ OCEAN STONE_BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " FOREST ~ FOREST_HILLS ~ FLOWER_FOREST ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " ICE_PLAINS ~ ICE_MOUNTAINS ~ ICE_PLAINS_SPIKES ~ OCEAN FROZEN_OCEAN FROZEN_RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " JUNGLE JUNGLE_M JUNGLE_HILLS ~ JUNGLE_EDGE JUNGLE_EDGE_M OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " MEGA_TAIGA MEGA_SPRUCE_TAIGA MEGA_TAIGA_HILLS MEGA_SPRUCE_TAIGA_HILLS ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " MESA MESA_BRYCE MESA_PLATEAU MESA_PLATEAU_M MESA_PLATEAU_F MESA_PLATEAU_F_M OCEAN MESA RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " MUSHROOM_ISLAND ~ ~ ~ ~ ~ OCEAN MUSHROOM_ISLAND_SHORE RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " PLAINS ~ SUNFLOWER_PLAINS ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " ROOFED_FOREST ROOFED_FOREST_M ~ ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " SAVANNA SAVANNA_M SAVANNA_PLATEAU SAVANNA_PLATEAU_M ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " SWAMPLAND SWAMPLAND_M ~ ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core." + generator + + " TAIGA TAIGA_M TAIGA_HILLS ~ ~ ~ OCEAN BEACH RIVER" }; + + config.set(path + "." + "island-generators", gen_types); + + sender.sendMessage("Saving configuration!"); + saveConfig(); + reloadConfig(); + sender.sendMessage("Generating world; please wait..."); + if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) + && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), + "mv create " + world + " normal"); + } else { + if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) + && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) { + Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world); + } else { + Bukkit.createWorld(new WorldCreator(world).environment(World.Environment.NORMAL)); + } + } + sender.sendMessage("Done!"); + } else { + sender.sendMessage("/ic "); + } + return true; + } + + @Override + public void onDisable() { + ICLogger.logger = null; + } + + @Override + public List> getDatabaseClasses() { + final Class[] classes = { EbeanServerIslandDatabase.IslandBean.class, + EbeanServerIslandDatabase.IslandPK.class }; + return Arrays.asList(classes); + } + + public IslandCraft getIslandCraft() { + return islandCraft; + } + + private static final int BLOCKS_PER_CHUNK = 16; + + public void regenerate(final World world, final ICRegion region) { + final ICLocation min = region.getMin(); + final ICLocation max = region.getMax(); + final int minX = min.getX() / BLOCKS_PER_CHUNK; + final int minZ = min.getZ() / BLOCKS_PER_CHUNK; + final int maxX = max.getX() / BLOCKS_PER_CHUNK; + final int maxZ = max.getZ() / BLOCKS_PER_CHUNK; + // Must loop from high to low for trees to generate correctly + for (int x = maxX - 1; x >= minX; --x) { + for (int z = maxZ - 1; z >= minZ; --z) { + // TODO queue these? + world.regenerateChunk(x, z); + } + } + } +} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java rename to IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java diff --git a/IslandCraft-Core/src/main/resources/config.yml b/IslandCraft-Bukkit/src/main/resources/config.yml similarity index 100% rename from IslandCraft-Core/src/main/resources/config.yml rename to IslandCraft-Bukkit/src/main/resources/config.yml diff --git a/IslandCraft-Core/src/main/resources/plugin.yml b/IslandCraft-Bukkit/src/main/resources/plugin.yml similarity index 100% rename from IslandCraft-Core/src/main/resources/plugin.yml rename to IslandCraft-Bukkit/src/main/resources/plugin.yml diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java new file mode 100644 index 0000000..6291838 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java @@ -0,0 +1,23 @@ +package com.github.hoqhuuep.islandcraft.core; + +import com.github.hoqhuuep.islandcraft.api.BiomeDistribution; +import com.github.hoqhuuep.islandcraft.api.ICBiome; +import com.github.hoqhuuep.islandcraft.util.StringUtils; + +public class ConstantBiomeDistribution implements BiomeDistribution { + private final ICBiome biome; + + public ConstantBiomeDistribution(final String[] args) { + ICLogger.logger.info("Creating ConstantBiomeDistribution with args: " + StringUtils.join(args, " ")); + if (args.length != 1) { + ICLogger.logger.severe("ConstantBiomeDistribution requrires 1 parameter, " + args.length + " given"); + throw new IllegalArgumentException("ConstantBiomeDistribution requrires 1 parameter"); + } + biome = ICBiome.valueOf(args[0]); + } + + @Override + public ICBiome biomeAt(final int x, final int z, final long worldSeed) { + return biome; + } +} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java similarity index 95% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java index 0d13c2d..c20520d 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java @@ -2,10 +2,9 @@ import java.util.Arrays; -import org.apache.commons.lang.StringUtils; - import com.github.hoqhuuep.islandcraft.api.ICBiome; import com.github.hoqhuuep.islandcraft.api.IslandGenerator; +import com.github.hoqhuuep.islandcraft.util.StringUtils; public class ConstantIslandGenerator implements IslandGenerator { private final ICBiome biome; diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIsland.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIsland.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIsland.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIsland.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIslandCraft.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIslandCraft.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIslandCraft.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultIslandCraft.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java similarity index 73% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java index e563e9e..1b66e4d 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/DefaultWorld.java @@ -1,13 +1,11 @@ package com.github.hoqhuuep.islandcraft.core; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Random; import java.util.Set; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.configuration.ConfigurationSection; import com.github.hoqhuuep.islandcraft.api.BiomeDistribution; import com.github.hoqhuuep.islandcraft.api.ICBiome; @@ -16,9 +14,10 @@ import com.github.hoqhuuep.islandcraft.api.ICRegion; import com.github.hoqhuuep.islandcraft.api.ICWorld; import com.github.hoqhuuep.islandcraft.api.IslandDistribution; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; +import com.github.hoqhuuep.islandcraft.util.Cache; +import com.github.hoqhuuep.islandcraft.util.CacheLoader; +import com.github.hoqhuuep.islandcraft.util.ExpiringLoadingCache; +import com.github.hoqhuuep.islandcraft.util.StringUtils; public class DefaultWorld implements ICWorld { private final String worldName; @@ -31,38 +30,22 @@ public class DefaultWorld implements ICWorld { private final ICClassLoader classLoader; private final Cache databaseCache; - public DefaultWorld(final String name, final long seed, final IslandDatabase database, final ConfigurationSection config, final IslandCache cache, final ICClassLoader classLoader) { + public DefaultWorld(final String name, final long seed, final IslandDatabase database, final ICWorldConfig config, final IslandCache cache, final ICClassLoader classLoader) { this.worldName = name; this.worldSeed = seed; this.database = database; this.cache = cache; this.classLoader = classLoader; - if (!config.contains("ocean") || !config.isString("ocean")) { - ICLogger.logger.warning("No string-value for 'worlds." + name + ".ocean' found in config.yml"); - ICLogger.logger.warning("Default value 'com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN' will be used"); - } - ocean = classLoader.getBiomeDistribution(config.getString("ocean", "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN")); - - if (!config.contains("island-distribution") || !config.isString("island-distribution")) { - ICLogger.logger.warning("No string-value for 'worlds." + name + ".island-distribution' found in config.yml"); - ICLogger.logger.warning("Default value 'com.github.hoqhuuep.islandcraft.core.EmptyIslandDistribution' will be used"); - } - islandDistribution = classLoader.getIslandDistribution(config.getString("island-distribution", "com.github.hoqhuuep.islandcraft.core.EmptyIslandDistribution")); - - if (!config.contains("island-generators") || !config.isList("island-generators")) { - ICLogger.logger.warning("No list-value for 'worlds." + name + ".island-generators' found in config.yml"); - ICLogger.logger.warning("Default value '[com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator]' will be used"); - } - islandGenerators = config.getStringList("island-generators"); - if (islandGenerators.isEmpty()) { - islandGenerators.add("com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator"); - } + ocean = classLoader.getBiomeDistribution(config.getOcean()); + islandDistribution = classLoader.getIslandDistribution(config.getIslandDistribution()); + islandGenerators = new ArrayList(Arrays.asList(config.getIslandGenerstors())); // Load islandGenerators just to make sure there are no errors for (final String islandGenerator : islandGenerators) { classLoader.getIslandGenerator(islandGenerator); } - databaseCache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.SECONDS).build(new DatabaseCacheLoader()); + + databaseCache = new ExpiringLoadingCache(30, new DatabaseCacheLoader()); } @Override @@ -137,7 +120,7 @@ public ICIsland getIslandAt(final int x, final int z) { if (center == null) { return null; } - return databaseCache.getUnchecked(center); + return databaseCache.get(center); } @Override @@ -150,12 +133,12 @@ public Set getIslandsAt(final int x, final int z) { final Set centers = islandDistribution.getCentersAt(x, z, worldSeed); final Set islands = new HashSet(centers.size()); for (final ICLocation center : centers) { - islands.add(databaseCache.getUnchecked(center)); + islands.add(databaseCache.get(center)); } return islands; } - private class DatabaseCacheLoader extends CacheLoader { + private class DatabaseCacheLoader implements CacheLoader { @Override public ICIsland load(final ICLocation center) { final ICRegion innerRegion = islandDistribution.getInnerRegion(center, worldSeed); diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java similarity index 95% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java index 38ef6e2..4b13f41 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java @@ -3,11 +3,10 @@ import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.StringUtils; - import com.github.hoqhuuep.islandcraft.api.ICLocation; import com.github.hoqhuuep.islandcraft.api.ICRegion; import com.github.hoqhuuep.islandcraft.api.IslandDistribution; +import com.github.hoqhuuep.islandcraft.util.StringUtils; public class EmptyIslandDistribution implements IslandDistribution { public EmptyIslandDistribution(final String[] args) { diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java similarity index 94% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java index 3520632..2c8bb55 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java @@ -1,9 +1,8 @@ package com.github.hoqhuuep.islandcraft.core; -import org.apache.commons.lang.StringUtils; - import com.github.hoqhuuep.islandcraft.api.ICBiome; import com.github.hoqhuuep.islandcraft.api.IslandGenerator; +import com.github.hoqhuuep.islandcraft.util.StringUtils; public class EmptyIslandGenerator implements IslandGenerator { public EmptyIslandGenerator(final String[] args) { diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java similarity index 99% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java index 37b32f0..9142d43 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java @@ -3,11 +3,10 @@ import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.StringUtils; - import com.github.hoqhuuep.islandcraft.api.ICLocation; import com.github.hoqhuuep.islandcraft.api.ICRegion; import com.github.hoqhuuep.islandcraft.api.IslandDistribution; +import com.github.hoqhuuep.islandcraft.util.StringUtils; public class HexagonalIslandDistribution implements IslandDistribution { private final int islandSize; diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java similarity index 75% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java index 9b2e548..c949aa5 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICClassLoader.java @@ -6,9 +6,9 @@ import com.github.hoqhuuep.islandcraft.api.BiomeDistribution; import com.github.hoqhuuep.islandcraft.api.IslandDistribution; import com.github.hoqhuuep.islandcraft.api.IslandGenerator; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; +import com.github.hoqhuuep.islandcraft.util.Cache; +import com.github.hoqhuuep.islandcraft.util.CacheLoader; +import com.github.hoqhuuep.islandcraft.util.EternalLoadingCache; public class ICClassLoader { private final Cache islandDistributionCache; @@ -16,14 +16,14 @@ public class ICClassLoader { private final Cache biomeDistributionCache; public ICClassLoader() { - islandDistributionCache = CacheBuilder.newBuilder().build(new StringConstructorCacheLoader()); - islandGeneratorCache = CacheBuilder.newBuilder().build(new StringConstructorCacheLoader()); - biomeDistributionCache = CacheBuilder.newBuilder().build(new StringConstructorCacheLoader()); + islandDistributionCache = new EternalLoadingCache(new StringConstructorCacheLoader()); + islandGeneratorCache = new EternalLoadingCache(new StringConstructorCacheLoader()); + biomeDistributionCache = new EternalLoadingCache(new StringConstructorCacheLoader()); } public IslandDistribution getIslandDistribution(final String string) { try { - return islandDistributionCache.getUnchecked(string); + return islandDistributionCache.get(string); } catch (final Exception e) { ICLogger.logger.warning("Error creating IslandDistribution from string: " + string); ICLogger.logger.warning("Using 'com.github.hoqhuuep.islandcraft.core.EmptyIslandDistribution' instead"); @@ -33,7 +33,7 @@ public IslandDistribution getIslandDistribution(final String string) { public IslandGenerator getIslandGenerator(final String string) { try { - return islandGeneratorCache.getUnchecked(string); + return islandGeneratorCache.get(string); } catch (final Exception e) { ICLogger.logger.warning("Error creating IslandGenerator from string: " + string); ICLogger.logger.warning("Using 'com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator' instead"); @@ -43,7 +43,7 @@ public IslandGenerator getIslandGenerator(final String string) { public BiomeDistribution getBiomeDistribution(final String string) { try { - return biomeDistributionCache.getUnchecked(string); + return biomeDistributionCache.get(string); } catch (final Exception e) { ICLogger.logger.warning("Error creating BiomeDistribution from string: " + string); ICLogger.logger.warning("Using 'com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN' instead"); @@ -51,7 +51,7 @@ public BiomeDistribution getBiomeDistribution(final String string) { } } - private static class StringConstructorCacheLoader extends CacheLoader { + private static class StringConstructorCacheLoader implements CacheLoader { @Override @SuppressWarnings("unchecked") public T load(final String string) { diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java new file mode 100644 index 0000000..16b5dc1 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java @@ -0,0 +1,5 @@ +package com.github.hoqhuuep.islandcraft.core; + +public class ICNoise { + public static NoiseBuilder builder = null; +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICWorldConfig.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICWorldConfig.java new file mode 100644 index 0000000..8e21da3 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICWorldConfig.java @@ -0,0 +1,9 @@ +package com.github.hoqhuuep.islandcraft.core; + +public interface ICWorldConfig { + String getOcean(); + + String getIslandDistribution(); + + String[] getIslandGenerstors(); +} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java similarity index 72% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java index e0d3243..ec9943c 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandCache.java @@ -1,22 +1,20 @@ package com.github.hoqhuuep.islandcraft.core; -import java.util.concurrent.TimeUnit; - import com.github.hoqhuuep.islandcraft.api.ICBiome; import com.github.hoqhuuep.islandcraft.api.ICIsland; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; +import com.github.hoqhuuep.islandcraft.util.Cache; +import com.github.hoqhuuep.islandcraft.util.CacheLoader; +import com.github.hoqhuuep.islandcraft.util.ExpiringLoadingCache; public class IslandCache { private final Cache cache; public IslandCache() { - cache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.SECONDS).build(new IslandCacheLoader()); + cache = new ExpiringLoadingCache(30, new IslandCacheLoader()); } public ICBiome biomeAt(final ICIsland island, final int relativeX, final int relativeZ) { - final ICBiome[] biomes = cache.getUnchecked(island); + final ICBiome[] biomes = cache.get(island); final int xSize = island.getInnerRegion().getMax().getZ() - island.getInnerRegion().getMin().getZ(); return biomes[relativeZ * xSize + relativeX]; } @@ -26,7 +24,7 @@ public ICBiome biomeAt(final ICIsland island, final int relativeX, final int rel public ICBiome[] biomeChunk(final ICIsland island, final int relativeX, final int relativeZ) { final int xSize = island.getInnerRegion().getMax().getZ() - island.getInnerRegion().getMin().getZ(); final ICBiome[] result = new ICBiome[BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK]; - final ICBiome[] biomes = cache.getUnchecked(island); + final ICBiome[] biomes = cache.get(island); for (int z = 0; z < BLOCKS_PER_CHUNK; ++z) { System.arraycopy(biomes, xSize * (relativeZ + z) + relativeX, result, z * BLOCKS_PER_CHUNK, BLOCKS_PER_CHUNK); } @@ -34,14 +32,10 @@ public ICBiome[] biomeChunk(final ICIsland island, final int relativeX, final in } public ICBiome[] biomeAll(final ICIsland island) { - return cache.getUnchecked(island).clone(); - } - - public void cleanUp() { - cache.cleanUp(); + return cache.get(island).clone(); } - private static class IslandCacheLoader extends CacheLoader { + private static class IslandCacheLoader implements CacheLoader { @Override public ICBiome[] load(final ICIsland island) { final int xSize = island.getInnerRegion().getMax().getX() - island.getInnerRegion().getMin().getX(); diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandDatabase.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandDatabase.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandDatabase.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandDatabase.java diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java new file mode 100644 index 0000000..e58dd82 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java @@ -0,0 +1,193 @@ +package com.github.hoqhuuep.islandcraft.core; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import java.util.Random; + +import com.github.hoqhuuep.islandcraft.api.ICBiome; +import com.github.hoqhuuep.islandcraft.api.IslandGenerator; +import com.github.hoqhuuep.islandcraft.core.mosaic.Poisson; +import com.github.hoqhuuep.islandcraft.core.mosaic.Site; +import com.github.hoqhuuep.islandcraft.util.StringUtils; + +public class IslandGeneratorAlpha implements IslandGenerator { + private static final double MIN_DISTANCE = 8; + private static final double NOISE = 2.7; + private static final double CIRCLE = 2; + private static final double SQUARE = 0; + private static final double THRESHOLD = 2; + private final Color ocean; + private final Color normal; + private final Color mountains; + private final Color hills; + private final Color hillsMountains; + private final Color forest; + private final Color forestMountains; + private final Color outerCoast; + private final Color innerCoast; + + // private final Color river; // unused for now + + public IslandGeneratorAlpha(final String[] args) { + ICLogger.logger.info("Creating IslandGeneratorAlpha with args: " + StringUtils.join(args, " ")); + if (args.length != 9) { + ICLogger.logger.severe("IslandGeneratorAlpha requrires 9 parameters, " + args.length + " given"); + throw new IllegalArgumentException("IslandGeneratorAlpha requrires 9 parameters"); + } + ocean = new Color(ICBiome.values().length, true); + normal = biomeColor(args[0], ocean); + mountains = biomeColor(args[1], normal); + hills = biomeColor(args[2], normal); + hillsMountains = biomeColor(args[3], hills); + forest = biomeColor(args[4], normal); + forestMountains = biomeColor(args[5], forest); + outerCoast = biomeColor(args[6], normal); + innerCoast = biomeColor(args[7], normal); + // river = biomeColor(args[8], normal); // unused for now + } + + @Override + public ICBiome[] generate(final int xSize, final int zSize, final long islandSeed) { + ICLogger.logger.info(String.format( + "Generating island from IslandGeneratorAlpha with xSize: %d, zSize: %d, islandSeed: %d, biome: %s", + xSize, zSize, islandSeed, ICBiome.values()[normal.getRGB()])); + final Poisson poisson = new Poisson(xSize, zSize, MIN_DISTANCE); + final List sites = poisson.generate(new Random(islandSeed)); + final Noise shapeNoise = ICNoise.builder.build(islandSeed); + final Noise hillsNoise = ICNoise.builder.build(islandSeed + 1); + final Noise forestNoise = ICNoise.builder.build(islandSeed + 2); + final Noise mountainsNoise = ICNoise.builder.build(islandSeed + 3); + // Find borders + final Queue oceanSites = new LinkedList(); + for (final Site site : sites) { + if (site.polygon == null) { + site.isOcean = true; + oceanSites.add(site); + } + } + final List suspectCoast = new ArrayList(); + final List coast = new ArrayList(); + // Find oceans and coasts + while (!oceanSites.isEmpty()) { + final Site site = oceanSites.remove(); + for (final Site neighbor : site.neighbors) { + if (site.polygon == null) { + if (!neighbor.isOcean) { + neighbor.isOcean = true; + oceanSites.add(neighbor); + } + } else { + final double dx = (double) (neighbor.x - (xSize / 2)) / (double) (xSize / 2); + final double dz = (double) (neighbor.z - (zSize / 2)) / (double) (zSize / 2); + if (NOISE * noise(dx, dz, shapeNoise) + CIRCLE * circle(dx, dz) + + SQUARE * square(dx, dz) > THRESHOLD) { + if (!neighbor.isOcean) { + neighbor.isOcean = true; + oceanSites.add(neighbor); + } + } else { + neighbor.isInnerCoast = true; + suspectCoast.add(neighbor); + } + } + } + } + // Create coast + SITE: for (final Site site : suspectCoast) { + for (final Site neighbor : site.neighbors) { + if (!neighbor.isOcean && !neighbor.isInnerCoast) { + coast.add(site); + continue SITE; + } + } + site.isInnerCoast = false; + site.isOcean = true; + } + // Create shallow ocean + for (final Site site : coast) { + for (final Site neighbor : site.neighbors) { + if (neighbor.isOcean) { + neighbor.isOcean = false; + neighbor.isOuterCoast = true; + } + } + } + // Create blank image + final BufferedImage image = new BufferedImage(xSize, zSize, BufferedImage.TYPE_INT_ARGB); + final Graphics2D graphics = image.createGraphics(); + graphics.setComposite(AlphaComposite.Src); + graphics.setBackground(ocean); + graphics.clearRect(0, 0, xSize, zSize); + // Render island + for (final Site site : sites) { + if (site.isOcean) { + continue; + } else if (site.isOuterCoast) { + graphics.setColor(outerCoast); + } else if (site.isInnerCoast) { + graphics.setColor(innerCoast); + } else if (noise(site, 0.375, 160.0, mountainsNoise)) { + if (noise(site, 0.375, 80.0, hillsNoise)) { + graphics.setColor(hillsMountains); + } else if (noise(site, 0.375, 160.0, forestNoise)) { + graphics.setColor(forestMountains); + } else { + graphics.setColor(mountains); + } + } else { + if (noise(site, 0.375, 80.0, hillsNoise)) { + graphics.setColor(hills); + } else if (noise(site, 0.375, 160.0, forestNoise)) { + graphics.setColor(forest); + } else { + graphics.setColor(normal); + } + } + graphics.fillPolygon(site.polygon); + graphics.drawPolygon(site.polygon); + } + // Save result + graphics.dispose(); + final ICBiome[] result = new ICBiome[xSize * zSize]; + final ICBiome[] values = ICBiome.values(); + final int maxOrdinal = values.length; + for (int i = 0; i < result.length; ++i) { + final int x = i % xSize; + final int z = i / xSize; + final int ordinal = image.getRGB(x, z); + if (ordinal < maxOrdinal) { + result[i] = values[ordinal]; + } + } + return result; + } + + private static Color biomeColor(final String name, final Color backup) { + if (name.equals("~")) { + return backup; + } + return new Color(ICBiome.valueOf(name).ordinal(), true); + } + + private static boolean noise(final Site site, final double threshold, final double period, final Noise noise) { + return noise.noise(site.x / period, site.z / period) < threshold; + } + + private static double noise(final double dx, final double dz, final Noise noise) { + return noise.noise(dx, dz); + } + + private static double circle(final double dx, final double dz) { + return (dx * dx + dz * dz) / 2; + } + + private static double square(final double dx, final double dz) { + return Math.max(Math.abs(dx), Math.abs(dz)); + } +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java new file mode 100644 index 0000000..3ba0d3c --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java @@ -0,0 +1,6 @@ +package com.github.hoqhuuep.islandcraft.core; + +public interface Noise { + /** Returns noise value in range [0, 1] **/ + double noise(double x, double z); +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java new file mode 100644 index 0000000..0a25b2f --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java @@ -0,0 +1,5 @@ +package com.github.hoqhuuep.islandcraft.core; + +public interface NoiseBuilder { + Noise build(long seed); +} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java similarity index 99% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java index a1e30ad..94da126 100644 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java @@ -3,11 +3,10 @@ import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang.StringUtils; - import com.github.hoqhuuep.islandcraft.api.ICLocation; import com.github.hoqhuuep.islandcraft.api.ICRegion; import com.github.hoqhuuep.islandcraft.api.IslandDistribution; +import com.github.hoqhuuep.islandcraft.util.StringUtils; public class SquareIslandDistribution implements IslandDistribution { private final int islandSize; diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/AngleComparator.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/AngleComparator.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/AngleComparator.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/AngleComparator.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Grid.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Grid.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Grid.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Grid.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Poisson.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Poisson.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Poisson.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Poisson.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeEntry.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeEntry.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeEntry.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeEntry.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeList.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeList.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeList.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/RangeList.java diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Site.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Site.java similarity index 100% rename from IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Site.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/mosaic/Site.java diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/Cache.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/Cache.java new file mode 100644 index 0000000..f0745c0 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/Cache.java @@ -0,0 +1,5 @@ +package com.github.hoqhuuep.islandcraft.util; + +public interface Cache { + V get(K key); +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/CacheLoader.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/CacheLoader.java new file mode 100644 index 0000000..484dc02 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/CacheLoader.java @@ -0,0 +1,5 @@ +package com.github.hoqhuuep.islandcraft.util; + +public interface CacheLoader { + V load(K key); +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/EternalLoadingCache.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/EternalLoadingCache.java new file mode 100644 index 0000000..dd00b1e --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/EternalLoadingCache.java @@ -0,0 +1,28 @@ +package com.github.hoqhuuep.islandcraft.util; + +import java.util.HashMap; +import java.util.Map; + +public class EternalLoadingCache implements Cache { + private final CacheLoader loader; + private final Map cache = new HashMap(); + + public EternalLoadingCache(CacheLoader loader) { + this.loader = loader; + } + + @Override + public V get(K key) { + // Try to get value from cache + V value = cache.get(key); + if (value != null) { + return value; + } + // Otherwise generate new value using loader + value = loader.load(key); + if (value != null) { + cache.put(key, value); + } + return value; + } +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/ExpiringLoadingCache.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/ExpiringLoadingCache.java new file mode 100644 index 0000000..2a1c744 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/ExpiringLoadingCache.java @@ -0,0 +1,77 @@ +package com.github.hoqhuuep.islandcraft.util; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; +import java.util.Timer; +import java.util.TimerTask; + +public class ExpiringLoadingCache implements Cache { + private final int millis; + private final CacheLoader loader; + private final Map> cache = new HashMap>(); + private final Random random = new Random(); + + public ExpiringLoadingCache(int seconds, CacheLoader loader) { + this.millis = seconds * 1000; + this.loader = loader; + startTimer(); + } + + private void startTimer() { + Timer timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + removeExpired(); + startTimer(); + } + }, millis + random.nextInt(millis)); + } + + private void removeExpired() { + long nanos = System.nanoTime(); + Iterator>> iterator = cache.entrySet().iterator(); + while (iterator.hasNext()) { + Entry> value = iterator.next(); + if (value.getValue().expired(nanos)) { + iterator.remove(); + } + } + } + + @Override + public V get(K key) { + // Try to get value from cache + Expiring value = cache.get(key); + if (value == null) { + // Otherwise generate new value using loader + value = new Expiring(millis, loader.load(key)); + cache.put(key, value); + } + return value.access(); + } + + private static class Expiring { + private long lifeNanos; + private long expiryNanos; + private final V value; + + public Expiring(long millis, V value) { + this.lifeNanos = millis * 1000 * 1000; + this.expiryNanos = System.nanoTime() + lifeNanos; + this.value = value; + } + + public V access() { + this.expiryNanos = System.nanoTime() + lifeNanos; + return this.value; + } + + public boolean expired(long nanos) { + return nanos > expiryNanos; + } + } +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/StringUtils.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/StringUtils.java new file mode 100644 index 0000000..d44d25d --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/util/StringUtils.java @@ -0,0 +1,20 @@ +package com.github.hoqhuuep.islandcraft.util; + +public class StringUtils { + public static String join(String[] array, String sepeator) { + if (array.length == 0) { + return ""; + } + StringBuilder result = new StringBuilder(); + result.append(array[0]); + for (int i = 1; i < array.length; ++i) { + result.append(sepeator); + result.append(array[i]); + } + return result.toString(); + } + + public static boolean equals(String a, String b) { + return (a == null && b == null) || (a != null && a.equals(b)); + } +} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java b/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java deleted file mode 100644 index fe3a99f..0000000 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.github.hoqhuuep.islandcraft.bukkit; - -import java.util.Arrays; -import java.util.List; -import java.util.logging.Level; - -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; - -import com.avaje.ebean.EbeanServer; -import com.github.hoqhuuep.islandcraft.api.ICLocation; -import com.github.hoqhuuep.islandcraft.api.ICRegion; -import com.github.hoqhuuep.islandcraft.api.IslandCraft; -import com.github.hoqhuuep.islandcraft.core.DefaultIslandCraft; -import com.github.hoqhuuep.islandcraft.core.EbeanServerIslandDatabase; -import com.github.hoqhuuep.islandcraft.core.EbeanServerUtil; -import com.github.hoqhuuep.islandcraft.core.ICLogger; -import com.github.hoqhuuep.islandcraft.core.IslandDatabase; -import com.github.hoqhuuep.islandcraft.nms.NmsWrapper; - -public class IslandCraftPlugin extends JavaPlugin { - - private DefaultIslandCraft islandCraft = null; - - @Override - public void onEnable() { - ICLogger.logger = getLogger(); - - // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage - try { - final Metrics metrics = new Metrics(this); - metrics.start(); - } catch (final Exception e) { - ICLogger.logger.warning("Failed to start MCStats"); - } - - saveDefaultConfig(); - FileConfiguration config = getConfig(); - if (!config.contains("config-version") || !config.isString("config-version")) { - ICLogger.logger.severe("No string-value for 'config-version' found in config.yml"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - setEnabled(false); - return; - } - final String configVersion = config.getString("config-version"); - if (!configVersion.equals("1.0.0")) { - ICLogger.logger.severe("Incompatible config-version found in config.yml"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - setEnabled(false); - return; - } - - if (!config.contains("verbose-logging") || !config.isBoolean("verbose-logging")) { - ICLogger.logger.warning("No boolean-value for 'verbose-logging' found in config.yml"); - ICLogger.logger.warning("Default value 'false' will be used"); - } - final boolean verboseLogging = config.getBoolean("verbose-logging", false); - ICLogger.logger.setLevel(verboseLogging ? Level.ALL : Level.WARNING); - - final NmsWrapper nms = NmsWrapper.getInstance(getServer()); - if (nms == null) { - ICLogger.logger.severe("IslandCraft does not currently support this CraftBukkit version"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - setEnabled(false); - return; - } - - IslandDatabase database; - try { - final EbeanServer ebeanServer = EbeanServerUtil.build(this); - database = new EbeanServerIslandDatabase(ebeanServer); - } catch (final Exception e) { - ICLogger.logger.severe("Error creating EbeanServer database"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - ICLogger.logger.severe("Exception message: " + e.getMessage()); - setEnabled(false); - return; - } - - try { - islandCraft = new DefaultIslandCraft(); - final Listener listener = new BiomeGeneratorListener(this, database, nms); - getServer().getPluginManager().registerEvents(listener, this); - } catch (final Exception e) { - ICLogger.logger.severe("Error creating or registering BiomeGeneratorListener"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - ICLogger.logger.severe("Exception message: " + e.getMessage()); - setEnabled(false); - return; - } - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (sender instanceof Player) { - sender.sendMessage("This command can only be executed by console!"); - return false; - } - if (args.length == 0) { - sender.sendMessage("/ic "); - return false; - } - if ("reload".equals(args[0])) { - sender.sendMessage("Reloaded IslandCraft configuration"); - reloadConfig(); - } else if ("create".equals(args[0])) { - // ic create 2 1 ConstantBiomeDistribution IslandGeneratorAlpha - if (args.length < 4) { - sender.sendMessage("/ic create "); - sender.sendMessage("OR"); - sender.sendMessage("/ic create [distribution] [generator]"); - sender.sendMessage("Note: An island size of 1 = 4 chunks"); - return false; - } - String world = args[1]; - int island; - int ocean; - try { - island = Integer.parseInt(args[2]) * 32; - ocean = Integer.parseInt(args[3]) * 32; - } catch (Exception e) { - sender.sendMessage("Invalid size for:"); - sender.sendMessage("/ic create [distribution] [generator]"); - return false; - } - String distribution = "SquareIslandDistribution"; - String generator = "IslandGeneratorAlpha"; - if (args.length > 4) { - distribution = args[4]; - } - if (args.length > 5) { - distribution = args[5]; - } - FileConfiguration config = getConfig(); - String path = "worlds." + world; - config.set(path + "." + "ocean", "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"); - config.set(path + "." + "island-distribution", "com.github.hoqhuuep.islandcraft.core." + distribution + " " + island + " " + ocean); - String[] gen_types = { "com.github.hoqhuuep.islandcraft.core." + generator + " BIRCH_FOREST BIRCH_FOREST_M BIRCH_FOREST_HILLS BIRCH_FOREST_HILLS_M ~ ~ OCEAN BEACH RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " COLD_TAIGA COLD_TAIGA_M COLD_TAIGA_HILLS ~ ~ ~ OCEAN COLD_BEACH FROZEN_RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " DESERT DESERT_M DESERT_HILLS ~ ~ ~ OCEAN BEACH RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " EXTREME_HILLS EXTREME_HILLS_M EXTREME_HILLS_PLUS EXTREME_HILLS_PLUS_M EXTREME_HILLS_EDGE ~ OCEAN STONE_BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " FOREST ~ FOREST_HILLS ~ FLOWER_FOREST ~ OCEAN BEACH RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " ICE_PLAINS ~ ICE_MOUNTAINS ~ ICE_PLAINS_SPIKES ~ OCEAN FROZEN_OCEAN FROZEN_RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " JUNGLE JUNGLE_M JUNGLE_HILLS ~ JUNGLE_EDGE JUNGLE_EDGE_M OCEAN BEACH RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " MEGA_TAIGA MEGA_SPRUCE_TAIGA MEGA_TAIGA_HILLS MEGA_SPRUCE_TAIGA_HILLS ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " MESA MESA_BRYCE MESA_PLATEAU MESA_PLATEAU_M MESA_PLATEAU_F MESA_PLATEAU_F_M OCEAN MESA RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " MUSHROOM_ISLAND ~ ~ ~ ~ ~ OCEAN MUSHROOM_ISLAND_SHORE RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " PLAINS ~ SUNFLOWER_PLAINS ~ ~ ~ OCEAN BEACH RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " ROOFED_FOREST ROOFED_FOREST_M ~ ~ ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " SAVANNA SAVANNA_M SAVANNA_PLATEAU SAVANNA_PLATEAU_M ~ ~ OCEAN BEACH RIVER", "com.github.hoqhuuep.islandcraft.core." + generator + " SWAMPLAND SWAMPLAND_M ~ ~ ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core." + generator + " TAIGA TAIGA_M TAIGA_HILLS ~ ~ ~ OCEAN BEACH RIVER" }; - - config.set(path + "." + "island-generators", gen_types); - - sender.sendMessage("Saving configuration!"); - saveConfig(); - reloadConfig(); - sender.sendMessage("Generating world; please wait..."); - if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) { - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv create " + world + " normal"); - } else { - if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) { - Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw create " + world); - } else { - Bukkit.createWorld(new WorldCreator(world).environment(World.Environment.NORMAL)); - } - } - sender.sendMessage("Done!"); - } else { - sender.sendMessage("/ic "); - } - return true; - } - - @Override - public void onDisable() { - ICLogger.logger = null; - } - - @Override - public List> getDatabaseClasses() { - final Class[] classes = { EbeanServerIslandDatabase.IslandBean.class, EbeanServerIslandDatabase.IslandPK.class }; - return Arrays.asList(classes); - } - - public IslandCraft getIslandCraft() { - return islandCraft; - } - - private static final int BLOCKS_PER_CHUNK = 16; - - public void regenerate(final World world, final ICRegion region) { - final ICLocation min = region.getMin(); - final ICLocation max = region.getMax(); - final int minX = min.getX() / BLOCKS_PER_CHUNK; - final int minZ = min.getZ() / BLOCKS_PER_CHUNK; - final int maxX = max.getX() / BLOCKS_PER_CHUNK; - final int maxZ = max.getZ() / BLOCKS_PER_CHUNK; - // Must loop from high to low for trees to generate correctly - for (int x = maxX - 1; x >= minX; --x) { - for (int z = maxZ - 1; z >= minZ; --z) { - // TODO queue these? - world.regenerateChunk(x, z); - } - } - } -} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java b/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java deleted file mode 100644 index 883bb4b..0000000 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.github.hoqhuuep.islandcraft.core; - -import org.apache.commons.lang.StringUtils; - -import com.github.hoqhuuep.islandcraft.api.BiomeDistribution; -import com.github.hoqhuuep.islandcraft.api.ICBiome; - -public class ConstantBiomeDistribution implements BiomeDistribution { - private final ICBiome biome; - - public ConstantBiomeDistribution(final String[] args) { - ICLogger.logger.info("Creating ConstantBiomeDistribution with args: " + StringUtils.join(args, " ")); - if (args.length != 1) { - ICLogger.logger.severe("ConstantBiomeDistribution requrires 1 parameter, " + args.length + " given"); - throw new IllegalArgumentException("ConstantBiomeDistribution requrires 1 parameter"); - } - biome = ICBiome.valueOf(args[0]); - } - - @Override - public ICBiome biomeAt(final int x, final int z, final long worldSeed) { - return biome; - } -} diff --git a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java b/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java deleted file mode 100644 index 77ff29e..0000000 --- a/IslandCraft-Core/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.github.hoqhuuep.islandcraft.core; - -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Random; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.util.noise.OctaveGenerator; -import org.bukkit.util.noise.SimplexOctaveGenerator; - -import com.github.hoqhuuep.islandcraft.api.ICBiome; -import com.github.hoqhuuep.islandcraft.api.IslandGenerator; -import com.github.hoqhuuep.islandcraft.core.mosaic.Poisson; -import com.github.hoqhuuep.islandcraft.core.mosaic.Site; - -public class IslandGeneratorAlpha implements IslandGenerator { - private static final double MIN_DISTANCE = 8; - private static final double NOISE = 2.7; - private static final double CIRCLE = 2; - private static final double SQUARE = 0; - private static final double THRESHOLD = 2; - private final Color ocean; - private final Color normal; - private final Color mountains; - private final Color hills; - private final Color hillsMountains; - private final Color forest; - private final Color forestMountains; - private final Color outerCoast; - private final Color innerCoast; - - // private final Color river; // unused for now - - public IslandGeneratorAlpha(final String[] args) { - ICLogger.logger.info("Creating IslandGeneratorAlpha with args: " + StringUtils.join(args, " ")); - if (args.length != 9) { - ICLogger.logger.severe("IslandGeneratorAlpha requrires 9 parameters, " + args.length + " given"); - throw new IllegalArgumentException("IslandGeneratorAlpha requrires 9 parameters"); - } - ocean = new Color(ICBiome.values().length, true); - normal = biomeColor(args[0], ocean); - mountains = biomeColor(args[1], normal); - hills = biomeColor(args[2], normal); - hillsMountains = biomeColor(args[3], hills); - forest = biomeColor(args[4], normal); - forestMountains = biomeColor(args[5], forest); - outerCoast = biomeColor(args[6], normal); - innerCoast = biomeColor(args[7], normal); - // river = biomeColor(args[8], normal); // unused for now - } - - @Override - public ICBiome[] generate(final int xSize, final int zSize, final long islandSeed) { - ICLogger.logger.info(String.format("Generating island from IslandGeneratorAlpha with xSize: %d, zSize: %d, islandSeed: %d, biome: %s", xSize, zSize, islandSeed, ICBiome.values()[normal.getRGB()])); - final Poisson poisson = new Poisson(xSize, zSize, MIN_DISTANCE); - final List sites = poisson.generate(new Random(islandSeed)); - final SimplexOctaveGenerator shapeNoise = new SimplexOctaveGenerator(islandSeed, 2); - final SimplexOctaveGenerator hillsNoise = new SimplexOctaveGenerator(islandSeed + 1, 2); - final SimplexOctaveGenerator forestNoise = new SimplexOctaveGenerator(islandSeed + 2, 2); - final SimplexOctaveGenerator mountainsNoise = new SimplexOctaveGenerator(islandSeed + 3, 2); - // Find borders - final Queue oceanSites = new LinkedList(); - for (final Site site : sites) { - if (site.polygon == null) { - site.isOcean = true; - oceanSites.add(site); - } - } - final List suspectCoast = new ArrayList(); - final List coast = new ArrayList(); - // Find oceans and coasts - while (!oceanSites.isEmpty()) { - final Site site = oceanSites.remove(); - for (final Site neighbor : site.neighbors) { - if (site.polygon == null) { - if (!neighbor.isOcean) { - neighbor.isOcean = true; - oceanSites.add(neighbor); - } - } else { - final double dx = (double) (neighbor.x - (xSize / 2)) / (double) (xSize / 2); - final double dz = (double) (neighbor.z - (zSize / 2)) / (double) (zSize / 2); - if (NOISE * noise(dx, dz, shapeNoise) + CIRCLE * circle(dx, dz) + SQUARE * square(dx, dz) > THRESHOLD) { - if (!neighbor.isOcean) { - neighbor.isOcean = true; - oceanSites.add(neighbor); - } - } else { - neighbor.isInnerCoast = true; - suspectCoast.add(neighbor); - } - } - } - } - // Create coast - SITE: for (final Site site : suspectCoast) { - for (final Site neighbor : site.neighbors) { - if (!neighbor.isOcean && !neighbor.isInnerCoast) { - coast.add(site); - continue SITE; - } - } - site.isInnerCoast = false; - site.isOcean = true; - } - // Create shallow ocean - for (final Site site : coast) { - for (final Site neighbor : site.neighbors) { - if (neighbor.isOcean) { - neighbor.isOcean = false; - neighbor.isOuterCoast = true; - } - } - } - // Create blank image - final BufferedImage image = new BufferedImage(xSize, zSize, BufferedImage.TYPE_INT_ARGB); - final Graphics2D graphics = image.createGraphics(); - graphics.setComposite(AlphaComposite.Src); - graphics.setBackground(ocean); - graphics.clearRect(0, 0, xSize, zSize); - // Render island - for (final Site site : sites) { - if (site.isOcean) { - continue; - } else if (site.isOuterCoast) { - graphics.setColor(outerCoast); - } else if (site.isInnerCoast) { - graphics.setColor(innerCoast); - } else if (noise(site, 0.375, 160.0, mountainsNoise)) { - if (noise(site, 0.375, 80.0, hillsNoise)) { - graphics.setColor(hillsMountains); - } else if (noise(site, 0.375, 160.0, forestNoise)) { - graphics.setColor(forestMountains); - } else { - graphics.setColor(mountains); - } - } else { - if (noise(site, 0.375, 80.0, hillsNoise)) { - graphics.setColor(hills); - } else if (noise(site, 0.375, 160.0, forestNoise)) { - graphics.setColor(forest); - } else { - graphics.setColor(normal); - } - } - graphics.fillPolygon(site.polygon); - graphics.drawPolygon(site.polygon); - } - // Save result - graphics.dispose(); - final ICBiome[] result = new ICBiome[xSize * zSize]; - final ICBiome[] values = ICBiome.values(); - final int maxOrdinal = values.length; - for (int i = 0; i < result.length; ++i) { - final int x = i % xSize; - final int z = i / xSize; - final int ordinal = image.getRGB(x, z); - if (ordinal < maxOrdinal) { - result[i] = values[ordinal]; - } - } - return result; - } - - private static Color biomeColor(final String name, final Color backup) { - if (name.equals("~")) { - return backup; - } - return new Color(ICBiome.valueOf(name).ordinal(), true); - } - - private static boolean noise(final Site site, final double threshold, final double period, final OctaveGenerator octaveGenerator) { - return octaveGenerator.noise(site.x / period, site.z / period, 2.0, 0.5, true) / 2.0 + 0.5 < threshold; - } - - private static double noise(final double dx, final double dz, final OctaveGenerator octaveGenerator) { - return octaveGenerator.noise(dx, dz, 2.0, 0.5, true) / 2.0 + 0.5; - } - - private static double circle(final double dx, final double dz) { - return (dx * dx + dz * dz) / 2; - } - - private static double square(final double dx, final double dz) { - return Math.max(Math.abs(dx), Math.abs(dz)); - } -} diff --git a/IslandCraft-NMS-v1_8_R2/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R2/CustomWorldChunkManager.java b/IslandCraft-NMS-v1_8_R2/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R2/CustomWorldChunkManager.java index 5ef6166..3d84966 100644 --- a/IslandCraft-NMS-v1_8_R2/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R2/CustomWorldChunkManager.java +++ b/IslandCraft-NMS-v1_8_R2/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R2/CustomWorldChunkManager.java @@ -94,7 +94,7 @@ public CustomWorldChunkManager(final BiomeGenerator biomeGenerator) { /** Returns a list of biome's which are valid for spawn */ @Override - @SuppressWarnings("rawtypes") + @SuppressWarnings({ "rawtypes", "unchecked" }) public List a() { return super.a(); } diff --git a/IslandCraft-NMS-v1_8_R3/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R3/CustomWorldChunkManager.java b/IslandCraft-NMS-v1_8_R3/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R3/CustomWorldChunkManager.java index 863bd8e..cc7897b 100644 --- a/IslandCraft-NMS-v1_8_R3/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R3/CustomWorldChunkManager.java +++ b/IslandCraft-NMS-v1_8_R3/src/main/java/com/github/hoqhuuep/islandcraft/nms/v1_8_R3/CustomWorldChunkManager.java @@ -94,7 +94,7 @@ public CustomWorldChunkManager(final BiomeGenerator biomeGenerator) { /** Returns a list of biome's which are valid for spawn */ @Override - @SuppressWarnings("rawtypes") + @SuppressWarnings({ "rawtypes", "unchecked" }) public List a() { return super.a(); } diff --git a/build.gradle b/build.gradle index dcd4bb6..d082f40 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,10 @@ version = '1.0.3-SNAPSHOT' allprojects { repositories { jcenter() + maven { + name = 'sponge-repo' + url = 'http://repo.spongepowered.org/maven' + } maven { name = 'bukkit-repo' url 'http://repo.bukkit.org/content/groups/public/' @@ -32,17 +36,29 @@ subprojects { apply plugin: 'java' apply plugin: 'maven' - sourceCompatibility = '1.6' - targetCompatibility = '1.6' + sourceCompatibility = '1.7' + targetCompatibility = '1.7' } project(':IslandCraft-API') { } -project(':IslandCraft-Core') { +project(':IslandCraft-Common') { dependencies { compile project(':IslandCraft-API') - compile project(':IslandCraft-NMS') + } +} + +project(':IslandCraft-Sponge') { + dependencies { + compile project(':IslandCraft-Common') + compile group: 'org.spongepowered', name:'spongeapi', version: '3.0.0' + } +} + +project(':IslandCraft-Bukkit') { + dependencies { + compile project(':IslandCraft-Common') compile project(':IslandCraft-NMS-v1_4_R1') compile project(':IslandCraft-NMS-v1_5_R1') compile project(':IslandCraft-NMS-v1_5_R2') @@ -57,8 +73,6 @@ project(':IslandCraft-Core') { compile project(':IslandCraft-NMS-v1_8_R1') compile project(':IslandCraft-NMS-v1_8_R2') compile project(':IslandCraft-NMS-v1_8_R3') - compile group: 'com.google.guava', name: 'guava', version: '10.0.1' - compile group: 'commons-lang', name: 'commons-lang', version: '2.3' compile group: 'org.bukkit', name: 'bukkit', version: '1.7.9-R0.2' compile group: 'org.mcstats.bukkit', name: 'metrics', version: 'R7' } @@ -174,9 +188,8 @@ configurations { } dependencies { - bukkitPlugin (project(':IslandCraft-Core')) { + bukkitPlugin (project(':IslandCraft-Bukkit')) { exclude group: 'org.bukkit' - exclude group: 'commons-lang' } } @@ -190,6 +203,5 @@ task bukkit(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { from { project.configurations.bukkitPlugin } - relocate 'com.google', 'com.github.hoqhuuep.islandcraft.google' relocate 'org.mcstats', 'com.github.hoqhuuep.islandcraft.mcstats' } diff --git a/settings.gradle b/settings.gradle index 6a068f7..c487b3a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,7 @@ include 'IslandCraft-API' -include 'IslandCraft-Core' +include 'IslandCraft-Common' +include 'IslandCraft-Bukkit' +include 'IslandCraft-Sponge' include 'IslandCraft-NMS' include 'IslandCraft-NMS-v1_4_R1' include 'IslandCraft-NMS-v1_5_R1' From 28905c291b437c4b5c7f133dcfaacdfc5493cd1b Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sat, 13 Feb 2016 11:04:47 +1100 Subject: [PATCH 06/19] IslandCraft for Sponge! Runs but needs a lot of work. Need to implement configuration. Need to implement database. Need to implement commands. Need to tweak noise generator (islands are very square). --- .../islandcraft/bukkit/IslandCraftPlugin.java | 28 ++--- .../islandcraft/bukkit/JavaUtilLogger.java | 28 +++++ .../core/ConstantBiomeDistribution.java | 2 +- .../core/ConstantIslandGenerator.java | 2 +- .../core/EmptyIslandDistribution.java | 2 +- .../core/EmptyIslandGenerator.java | 2 +- .../core/HexagonalIslandDistribution.java | 6 +- .../hoqhuuep/islandcraft/core/ICLogger.java | 10 +- .../core/IslandGeneratorAlpha.java | 2 +- .../core/SquareIslandDistribution.java | 6 +- .../hoqhuuep/islandcraft/FlowNoise.java | 17 +++ .../islandcraft/FlowNoiseBuilder.java | 11 ++ .../IslandCraftBiomeGenerator.java | 115 ++++++++++++++++++ .../IslandCraftGenerationModifier.java | 24 ++++ .../islandcraft/IslandCraftPlugin.java | 26 ++++ .../hoqhuuep/islandcraft/Slf4jLogger.java | 28 +++++ .../hoqhuuep/islandcraft/TempFakeConfig.java | 36 ++++++ .../islandcraft/TempFakeDatabase.java | 19 +++ build.gradle | 22 ++++ 19 files changed, 357 insertions(+), 29 deletions(-) create mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/JavaUtilLogger.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Slf4jLogger.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java index 22023fd..628d731 100644 --- a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java @@ -30,7 +30,7 @@ public class IslandCraftPlugin extends JavaPlugin { @Override public void onEnable() { - ICLogger.logger = getLogger(); + ICLogger.logger = new JavaUtilLogger(getLogger()); ICNoise.builder = new BukkitNoiseBuilder(); // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage @@ -44,15 +44,15 @@ public void onEnable() { saveDefaultConfig(); FileConfiguration config = getConfig(); if (!config.contains("config-version") || !config.isString("config-version")) { - ICLogger.logger.severe("No string-value for 'config-version' found in config.yml"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.error("No string-value for 'config-version' found in config.yml"); + ICLogger.logger.error("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); setEnabled(false); return; } final String configVersion = config.getString("config-version"); if (!configVersion.equals("1.0.0")) { - ICLogger.logger.severe("Incompatible config-version found in config.yml"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.error("Incompatible config-version found in config.yml"); + ICLogger.logger.error("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); setEnabled(false); return; } @@ -62,12 +62,12 @@ public void onEnable() { ICLogger.logger.warning("Default value 'false' will be used"); } final boolean verboseLogging = config.getBoolean("verbose-logging", false); - ICLogger.logger.setLevel(verboseLogging ? Level.ALL : Level.WARNING); + getLogger().setLevel(verboseLogging ? Level.ALL : Level.WARNING); final NmsWrapper nms = NmsWrapper.getInstance(getServer()); if (nms == null) { - ICLogger.logger.severe("IslandCraft does not currently support this CraftBukkit version"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.error("IslandCraft does not currently support this CraftBukkit version"); + ICLogger.logger.error("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); setEnabled(false); return; } @@ -77,9 +77,9 @@ public void onEnable() { final EbeanServer ebeanServer = EbeanServerUtil.build(this); database = new EbeanServerIslandDatabase(ebeanServer); } catch (final Exception e) { - ICLogger.logger.severe("Error creating EbeanServer database"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - ICLogger.logger.severe("Exception message: " + e.getMessage()); + ICLogger.logger.error("Error creating EbeanServer database"); + ICLogger.logger.error("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.error("Exception message: " + e.getMessage()); setEnabled(false); return; } @@ -89,9 +89,9 @@ public void onEnable() { final Listener listener = new BiomeGeneratorListener(this, database, nms); getServer().getPluginManager().registerEvents(listener, this); } catch (final Exception e) { - ICLogger.logger.severe("Error creating or registering BiomeGeneratorListener"); - ICLogger.logger.severe("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); - ICLogger.logger.severe("Exception message: " + e.getMessage()); + ICLogger.logger.error("Error creating or registering BiomeGeneratorListener"); + ICLogger.logger.error("Check for updates at http://dev.bukkit.org/bukkit-plugins/islandcraft/"); + ICLogger.logger.error("Exception message: " + e.getMessage()); setEnabled(false); return; } diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/JavaUtilLogger.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/JavaUtilLogger.java new file mode 100644 index 0000000..4c8f7d0 --- /dev/null +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/JavaUtilLogger.java @@ -0,0 +1,28 @@ +package com.github.hoqhuuep.islandcraft.bukkit; + +import java.util.logging.Logger; + +import com.github.hoqhuuep.islandcraft.core.ICLogger; + +public class JavaUtilLogger extends ICLogger { + private final Logger logger; + + public JavaUtilLogger(Logger logger) { + this.logger = logger; + } + + @Override + public void info(String message) { + logger.info(message); + } + + @Override + public void warning(String message) { + logger.warning(message); + } + + @Override + public void error(String message) { + logger.severe(message); + } +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java index 6291838..2f0dea3 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantBiomeDistribution.java @@ -10,7 +10,7 @@ public class ConstantBiomeDistribution implements BiomeDistribution { public ConstantBiomeDistribution(final String[] args) { ICLogger.logger.info("Creating ConstantBiomeDistribution with args: " + StringUtils.join(args, " ")); if (args.length != 1) { - ICLogger.logger.severe("ConstantBiomeDistribution requrires 1 parameter, " + args.length + " given"); + ICLogger.logger.error("ConstantBiomeDistribution requrires 1 parameter, " + args.length + " given"); throw new IllegalArgumentException("ConstantBiomeDistribution requrires 1 parameter"); } biome = ICBiome.valueOf(args[0]); diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java index c20520d..76765ed 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ConstantIslandGenerator.java @@ -12,7 +12,7 @@ public class ConstantIslandGenerator implements IslandGenerator { public ConstantIslandGenerator(final String[] args) { ICLogger.logger.info("Creating ConstantIslandGenerator with args: " + StringUtils.join(args, " ")); if (args.length != 1) { - ICLogger.logger.severe("ConstantIslandGenerator requrires 1 parameter, " + args.length + " given"); + ICLogger.logger.error("ConstantIslandGenerator requrires 1 parameter, " + args.length + " given"); throw new IllegalArgumentException("ConstantIslandGenerator requrires 1 parameter, " + args.length + " given"); } biome = ICBiome.valueOf(args[0]); diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java index 4b13f41..56737dd 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandDistribution.java @@ -12,7 +12,7 @@ public class EmptyIslandDistribution implements IslandDistribution { public EmptyIslandDistribution(final String[] args) { ICLogger.logger.info("Creating EmptyIslandDistribution with args: " + StringUtils.join(args, " ")); if (args.length != 0) { - ICLogger.logger.severe("EmptyIslandDistribution requrires 0 parameters, " + args.length + " given"); + ICLogger.logger.error("EmptyIslandDistribution requrires 0 parameters, " + args.length + " given"); throw new IllegalArgumentException("EmptyIslandDistribution requrires 0 parameters, " + args.length + " given"); } } diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java index 2c8bb55..4b4f6b3 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/EmptyIslandGenerator.java @@ -8,7 +8,7 @@ public class EmptyIslandGenerator implements IslandGenerator { public EmptyIslandGenerator(final String[] args) { ICLogger.logger.info("Creating EmptyIslandGenerator with args: " + StringUtils.join(args, " ")); if (args.length != 0) { - ICLogger.logger.severe("EmptyIslandGenerator requrires 0 parameters, " + args.length + " given"); + ICLogger.logger.error("EmptyIslandGenerator requrires 0 parameters, " + args.length + " given"); throw new IllegalArgumentException("EmptyIslandGenerator requrires 0 parameters, " + args.length + " given"); } } diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java index 9142d43..f3ae581 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/HexagonalIslandDistribution.java @@ -22,18 +22,18 @@ public class HexagonalIslandDistribution implements IslandDistribution { public HexagonalIslandDistribution(final String[] args) { ICLogger.logger.info("Creating HexagonalIslandDistribution with args: " + StringUtils.join(args, " ")); if (args.length != 2) { - ICLogger.logger.severe("HexagonalIslandDistribution requrires 2 parameters, " + args.length + " given"); + ICLogger.logger.error("HexagonalIslandDistribution requrires 2 parameters, " + args.length + " given"); throw new IllegalArgumentException("HexagonalIslandDistribution requrires 2 parameters"); } islandSize = Integer.parseInt(args[0]); oceanSize = Integer.parseInt(args[1]); // Validate configuration values if (islandSize <= 0 || islandSize % 32 != 0) { - ICLogger.logger.severe("HexagonalIslandDistribution.island-size must be a positive multiple of 32"); + ICLogger.logger.error("HexagonalIslandDistribution.island-size must be a positive multiple of 32"); throw new IllegalArgumentException("HexagonalIslandDistribution.island-size must be a positive multiple of 32"); } if (oceanSize <= 0 || oceanSize % 32 != 0) { - ICLogger.logger.severe("HexagonalIslandDistribution.ocean-size must be a positive multiple of 32"); + ICLogger.logger.error("HexagonalIslandDistribution.ocean-size must be a positive multiple of 32"); throw new IllegalArgumentException("HexagonalIslandDistribution.ocean-size must be a positive multiple of 32"); } islandSeparation = islandSize + oceanSize; diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java index 7174b46..3e11f96 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICLogger.java @@ -1,7 +1,9 @@ package com.github.hoqhuuep.islandcraft.core; -import java.util.logging.Logger; - -public class ICLogger { - public static Logger logger = null; +public abstract class ICLogger { + public static ICLogger logger = null; + + public abstract void info(String message); + public abstract void warning(String message); + public abstract void error(String message); } diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java index e58dd82..9440980 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java @@ -37,7 +37,7 @@ public class IslandGeneratorAlpha implements IslandGenerator { public IslandGeneratorAlpha(final String[] args) { ICLogger.logger.info("Creating IslandGeneratorAlpha with args: " + StringUtils.join(args, " ")); if (args.length != 9) { - ICLogger.logger.severe("IslandGeneratorAlpha requrires 9 parameters, " + args.length + " given"); + ICLogger.logger.error("IslandGeneratorAlpha requrires 9 parameters, " + args.length + " given"); throw new IllegalArgumentException("IslandGeneratorAlpha requrires 9 parameters"); } ocean = new Color(ICBiome.values().length, true); diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java index 94da126..8d9f6bc 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/SquareIslandDistribution.java @@ -18,18 +18,18 @@ public class SquareIslandDistribution implements IslandDistribution { public SquareIslandDistribution(final String[] args) { ICLogger.logger.info("Creating SquareIslandDistribution with args: " + StringUtils.join(args, " ")); if (args.length != 2) { - ICLogger.logger.severe("SquareIslandDistribution requrires 2 parameters, " + args.length + " given"); + ICLogger.logger.error("SquareIslandDistribution requrires 2 parameters, " + args.length + " given"); throw new IllegalArgumentException("SquareIslandDistribution requrires 2 parameters"); } islandSize = Integer.parseInt(args[0]); oceanSize = Integer.parseInt(args[1]); // Validate configuration values if (islandSize <= 0 || islandSize % 32 != 0) { - ICLogger.logger.severe("SquareIslandDistribution.island-size must be a positive multiple of 32"); + ICLogger.logger.error("SquareIslandDistribution.island-size must be a positive multiple of 32"); throw new IllegalArgumentException("SquareIslandDistribution.island-size must be a positive multiple of 32"); } if (oceanSize <= 0 || oceanSize % 32 != 0) { - ICLogger.logger.severe("SquareIslandDistribution.ocean-size must be a positive multiple of 32"); + ICLogger.logger.error("SquareIslandDistribution.ocean-size must be a positive multiple of 32"); throw new IllegalArgumentException("SquareIslandDistribution.ocean-size must be a positive multiple of 32"); } islandSeparation = islandSize + oceanSize; diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java new file mode 100644 index 0000000..59d606c --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java @@ -0,0 +1,17 @@ +package com.github.hoqhuuep.islandcraft; + +import com.flowpowered.noise.NoiseQuality; +import com.github.hoqhuuep.islandcraft.core.Noise; + +public class FlowNoise implements Noise { + private final int seed; + + public FlowNoise(long seed) { + this.seed = (int) seed; + } + + @Override + public double noise(double x, double z) { + return com.flowpowered.noise.Noise.valueCoherentNoise3D(x, 0.0, z, seed, NoiseQuality.STANDARD); + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java new file mode 100644 index 0000000..988a6c3 --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java @@ -0,0 +1,11 @@ +package com.github.hoqhuuep.islandcraft; + +import com.github.hoqhuuep.islandcraft.core.Noise; +import com.github.hoqhuuep.islandcraft.core.NoiseBuilder; + +public class FlowNoiseBuilder implements NoiseBuilder { + @Override + public Noise build(long seed) { + return new FlowNoise(seed); + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java new file mode 100644 index 0000000..481946b --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java @@ -0,0 +1,115 @@ +package com.github.hoqhuuep.islandcraft; + +import java.util.EnumMap; +import java.util.Map; + +import org.spongepowered.api.world.biome.BiomeType; +import org.spongepowered.api.world.biome.BiomeTypes; +import org.spongepowered.api.world.extent.MutableBiomeArea; +import org.spongepowered.api.world.gen.BiomeGenerator; + +import com.flowpowered.math.vector.Vector2i; +import com.github.hoqhuuep.islandcraft.api.ICBiome; +import com.github.hoqhuuep.islandcraft.api.ICWorld; +import com.github.hoqhuuep.islandcraft.core.DefaultWorld; +import com.github.hoqhuuep.islandcraft.core.ICClassLoader; +import com.github.hoqhuuep.islandcraft.core.IslandCache; + +public class IslandCraftBiomeGenerator implements BiomeGenerator { + private final ICWorld icWorld; + + public IslandCraftBiomeGenerator(String worldName, long worldSeed) { + icWorld = new DefaultWorld(worldName, worldSeed, new TempFakeDatabase(), new TempFakeConfig(), + new IslandCache(), new ICClassLoader()); + } + + @Override + public void generateBiomes(MutableBiomeArea buffer) { + Vector2i min = buffer.getBiomeMin(); + Vector2i max = buffer.getBiomeMax(); + int xMin = min.getX(); + int xMax = max.getX(); + int zMin = min.getY(); + int zMax = max.getY(); + for (int z = zMin; z <= zMax; ++z) { + for (int x = xMin; x <= xMax; ++x) { + ICBiome icBiome = icWorld.getBiomeAt(x, z); + buffer.setBiome(x, z, convertBiome(icBiome)); + } + } + } + + private BiomeType convertBiome(ICBiome icBiome) { + BiomeType spongeBiome = spongeBiomeFromICBiome.get(icBiome); + if (spongeBiome == null) { + return BiomeTypes.DEEP_OCEAN; + } + return spongeBiome; + } + + private final Map spongeBiomeFromICBiome = new EnumMap(ICBiome.class); + + { + spongeBiomeFromICBiome.put(ICBiome.BEACH, BiomeTypes.BEACH); + spongeBiomeFromICBiome.put(ICBiome.BIRCH_FOREST, BiomeTypes.BIRCH_FOREST); + spongeBiomeFromICBiome.put(ICBiome.BIRCH_FOREST_HILLS, BiomeTypes.BIRCH_FOREST_HILLS); + spongeBiomeFromICBiome.put(ICBiome.BIRCH_FOREST_HILLS_M, BiomeTypes.BIRCH_FOREST_HILLS_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.BIRCH_FOREST_M, BiomeTypes.BIRCH_FOREST_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.COLD_BEACH, BiomeTypes.COLD_BEACH); + spongeBiomeFromICBiome.put(ICBiome.COLD_TAIGA, BiomeTypes.COLD_TAIGA); + spongeBiomeFromICBiome.put(ICBiome.COLD_TAIGA_HILLS, BiomeTypes.COLD_TAIGA_HILLS); + spongeBiomeFromICBiome.put(ICBiome.COLD_TAIGA_M, BiomeTypes.COLD_TAIGA_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.DEEP_OCEAN, BiomeTypes.DEEP_OCEAN); + spongeBiomeFromICBiome.put(ICBiome.DESERT, BiomeTypes.DESERT); + spongeBiomeFromICBiome.put(ICBiome.DESERT_HILLS, BiomeTypes.DESERT_HILLS); + spongeBiomeFromICBiome.put(ICBiome.DESERT_M, BiomeTypes.DESERT_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.END, BiomeTypes.SKY); + spongeBiomeFromICBiome.put(ICBiome.EXTREME_HILLS, BiomeTypes.EXTREME_HILLS); + spongeBiomeFromICBiome.put(ICBiome.EXTREME_HILLS_EDGE, BiomeTypes.EXTREME_HILLS_EDGE); + spongeBiomeFromICBiome.put(ICBiome.EXTREME_HILLS_M, BiomeTypes.EXTREME_HILLS_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.EXTREME_HILLS_PLUS, BiomeTypes.EXTREME_HILLS_PLUS); + spongeBiomeFromICBiome.put(ICBiome.EXTREME_HILLS_PLUS_M, BiomeTypes.EXTREME_HILLS_PLUS_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.FLOWER_FOREST, BiomeTypes.FLOWER_FOREST); + spongeBiomeFromICBiome.put(ICBiome.FOREST, BiomeTypes.FOREST); + spongeBiomeFromICBiome.put(ICBiome.FOREST_HILLS, BiomeTypes.FOREST_HILLS); + spongeBiomeFromICBiome.put(ICBiome.FROZEN_OCEAN, BiomeTypes.FROZEN_OCEAN); + spongeBiomeFromICBiome.put(ICBiome.FROZEN_RIVER, BiomeTypes.FROZEN_RIVER); + spongeBiomeFromICBiome.put(ICBiome.ICE_MOUNTAINS, BiomeTypes.ICE_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.ICE_PLAINS, BiomeTypes.ICE_PLAINS); + spongeBiomeFromICBiome.put(ICBiome.ICE_PLAINS_SPIKES, BiomeTypes.ICE_PLAINS_SPIKES); + spongeBiomeFromICBiome.put(ICBiome.JUNGLE, BiomeTypes.JUNGLE); + spongeBiomeFromICBiome.put(ICBiome.JUNGLE_EDGE, BiomeTypes.JUNGLE_EDGE); + spongeBiomeFromICBiome.put(ICBiome.JUNGLE_HILLS, BiomeTypes.JUNGLE_HILLS); + spongeBiomeFromICBiome.put(ICBiome.JUNGLE_M, BiomeTypes.JUNGLE_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.JUNGLE_EDGE_M, BiomeTypes.JUNGLE_EDGE_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.MEGA_SPRUCE_TAIGA, BiomeTypes.MEGA_SPRUCE_TAIGA); + spongeBiomeFromICBiome.put(ICBiome.MEGA_SPRUCE_TAIGA_HILLS, BiomeTypes.MEGA_SPRUCE_TAIGA_HILLS); + spongeBiomeFromICBiome.put(ICBiome.MEGA_TAIGA, BiomeTypes.MEGA_TAIGA); + spongeBiomeFromICBiome.put(ICBiome.MEGA_TAIGA_HILLS, BiomeTypes.MEGA_TAIGA_HILLS); + spongeBiomeFromICBiome.put(ICBiome.MESA, BiomeTypes.MESA); + spongeBiomeFromICBiome.put(ICBiome.MESA_BRYCE, BiomeTypes.MESA_BRYCE); + spongeBiomeFromICBiome.put(ICBiome.MESA_PLATEAU, BiomeTypes.MESA_PLATEAU); + spongeBiomeFromICBiome.put(ICBiome.MESA_PLATEAU_F, BiomeTypes.MESA_PLATEAU_FOREST); + spongeBiomeFromICBiome.put(ICBiome.MESA_PLATEAU_F_M, BiomeTypes.MESA_PLATEAU_FOREST_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.MESA_PLATEAU_M, BiomeTypes.MESA_PLATEAU_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.MUSHROOM_ISLAND, BiomeTypes.MUSHROOM_ISLAND); + spongeBiomeFromICBiome.put(ICBiome.MUSHROOM_ISLAND_SHORE, BiomeTypes.MUSHROOM_ISLAND_SHORE); + spongeBiomeFromICBiome.put(ICBiome.NETHER, BiomeTypes.HELL); + spongeBiomeFromICBiome.put(ICBiome.OCEAN, BiomeTypes.OCEAN); + spongeBiomeFromICBiome.put(ICBiome.PLAINS, BiomeTypes.PLAINS); + spongeBiomeFromICBiome.put(ICBiome.RIVER, BiomeTypes.RIVER); + spongeBiomeFromICBiome.put(ICBiome.ROOFED_FOREST, BiomeTypes.ROOFED_FOREST); + spongeBiomeFromICBiome.put(ICBiome.ROOFED_FOREST_M, BiomeTypes.ROOFED_FOREST_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.SAVANNA, BiomeTypes.SAVANNA); + spongeBiomeFromICBiome.put(ICBiome.SAVANNA_M, BiomeTypes.SAVANNA_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.SAVANNA_PLATEAU, BiomeTypes.SAVANNA_PLATEAU); + spongeBiomeFromICBiome.put(ICBiome.SAVANNA_PLATEAU_M, BiomeTypes.SAVANNA_PLATEAU_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.STONE_BEACH, BiomeTypes.STONE_BEACH); + spongeBiomeFromICBiome.put(ICBiome.SUNFLOWER_PLAINS, BiomeTypes.SUNFLOWER_PLAINS); + spongeBiomeFromICBiome.put(ICBiome.SWAMPLAND, BiomeTypes.SWAMPLAND); + spongeBiomeFromICBiome.put(ICBiome.SWAMPLAND_M, BiomeTypes.SWAMPLAND_MOUNTAINS); + spongeBiomeFromICBiome.put(ICBiome.TAIGA, BiomeTypes.TAIGA); + spongeBiomeFromICBiome.put(ICBiome.TAIGA_HILLS, BiomeTypes.TAIGA_HILLS); + spongeBiomeFromICBiome.put(ICBiome.TAIGA_M, BiomeTypes.TAIGA_MOUNTAINS); + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java new file mode 100644 index 0000000..d2c7fb0 --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java @@ -0,0 +1,24 @@ +package com.github.hoqhuuep.islandcraft; + +import org.spongepowered.api.data.DataContainer; +import org.spongepowered.api.world.WorldCreationSettings; +import org.spongepowered.api.world.gen.WorldGenerator; +import org.spongepowered.api.world.gen.WorldGeneratorModifier; + +public class IslandCraftGenerationModifier implements WorldGeneratorModifier { + @Override + public String getId() { + return "islandcraft:biomes"; + } + + @Override + public String getName() { + return "IslandCraft Biomes"; + } + + @Override + public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, + WorldGenerator worldGenerator) { + worldGenerator.setBiomeGenerator(new IslandCraftBiomeGenerator(world.getWorldName(), world.getSeed())); + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java new file mode 100644 index 0000000..7725d0b --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java @@ -0,0 +1,26 @@ +package com.github.hoqhuuep.islandcraft; + +import org.slf4j.Logger; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.event.Listener; +import org.spongepowered.api.event.game.state.GameInitializationEvent; +import org.spongepowered.api.plugin.Plugin; +import org.spongepowered.api.world.gen.WorldGeneratorModifier; + +import com.github.hoqhuuep.islandcraft.core.ICLogger; +import com.github.hoqhuuep.islandcraft.core.ICNoise; +import com.google.inject.Inject; + +@Plugin(id = "islandcraft", name = "IslandCraft", version = "1.0.3-SNAPSHOT") +public class IslandCraftPlugin { + @Inject + private Logger logger; + + @Listener + public void onGameInitialization(GameInitializationEvent event) { + ICLogger.logger = new Slf4jLogger(logger); + ICNoise.builder = new FlowNoiseBuilder(); + + Sponge.getRegistry().register(WorldGeneratorModifier.class, new IslandCraftGenerationModifier()); + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Slf4jLogger.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Slf4jLogger.java new file mode 100644 index 0000000..d477c1b --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Slf4jLogger.java @@ -0,0 +1,28 @@ +package com.github.hoqhuuep.islandcraft; + +import org.slf4j.Logger; + +import com.github.hoqhuuep.islandcraft.core.ICLogger; + +public class Slf4jLogger extends ICLogger { + private final Logger logger; + + public Slf4jLogger(Logger logger) { + this.logger = logger; + } + + @Override + public void info(String message) { + logger.info(message); + } + + @Override + public void warning(String message) { + logger.warn(message); + } + + @Override + public void error(String message) { + logger.error(message); + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java new file mode 100644 index 0000000..3f97e31 --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java @@ -0,0 +1,36 @@ +package com.github.hoqhuuep.islandcraft; + +import com.github.hoqhuuep.islandcraft.core.ICWorldConfig; + +public class TempFakeConfig implements ICWorldConfig { + @Override + public String getOcean() { + return "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"; + } + + @Override + public String getIslandDistribution() { + return "com.github.hoqhuuep.islandcraft.core.HexagonalIslandDistribution 288 32"; + } + + @Override + public String[] getIslandGenerstors() { + return new String[] { + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha BIRCH_FOREST BIRCH_FOREST_M BIRCH_FOREST_HILLS BIRCH_FOREST_HILLS_M ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha COLD_TAIGA COLD_TAIGA_M COLD_TAIGA_HILLS ~ ~ ~ OCEAN COLD_BEACH FROZEN_RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha DESERT DESERT_M DESERT_HILLS ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha EXTREME_HILLS EXTREME_HILLS_M EXTREME_HILLS_PLUS EXTREME_HILLS_PLUS_M EXTREME_HILLS_EDGE ~ OCEAN STONE_BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha FOREST ~ FOREST_HILLS ~ FLOWER_FOREST ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha ICE_PLAINS ~ ICE_MOUNTAINS ~ ICE_PLAINS_SPIKES ~ OCEAN FROZEN_OCEAN FROZEN_RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha JUNGLE JUNGLE_M JUNGLE_HILLS ~ JUNGLE_EDGE JUNGLE_EDGE_M OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MEGA_TAIGA MEGA_SPRUCE_TAIGA MEGA_TAIGA_HILLS MEGA_SPRUCE_TAIGA_HILLS ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MESA MESA_BRYCE MESA_PLATEAU MESA_PLATEAU_M MESA_PLATEAU_F MESA_PLATEAU_F_M OCEAN MESA RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MUSHROOM_ISLAND ~ ~ ~ ~ ~ OCEAN MUSHROOM_ISLAND_SHORE RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha PLAINS ~ SUNFLOWER_PLAINS ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha ROOFED_FOREST ROOFED_FOREST_M ~ ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha SAVANNA SAVANNA_M SAVANNA_PLATEAU SAVANNA_PLATEAU_M ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha SWAMPLAND SWAMPLAND_M ~ ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha TAIGA TAIGA_M TAIGA_HILLS ~ ~ ~ OCEAN BEACH RIVER" + }; + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java new file mode 100644 index 0000000..1040b93 --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java @@ -0,0 +1,19 @@ +package com.github.hoqhuuep.islandcraft; + +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; + +public class TempFakeDatabase implements IslandDatabase { + @Override + public void save(String worldName, int centerX, int centerZ, long islandSeed, String generator) { + } + + @Override + public Result load(String worldName, int centerX, int centerZ) { + return null; + } + + @Override + public boolean isEmpty(String worldName) { + return false; + } +} diff --git a/build.gradle b/build.gradle index d082f40..f167d5d 100644 --- a/build.gradle +++ b/build.gradle @@ -205,3 +205,25 @@ task bukkit(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { } relocate 'org.mcstats', 'com.github.hoqhuuep.islandcraft.mcstats' } + +configurations { + spongePlugin +} + +dependencies { + spongePlugin (project(':IslandCraft-Sponge')) { + exclude group: 'org.spongepowered' + } +} + +task sponge(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { + description = 'Create the IslandCraft Sponge plugin JAR' + group = project.group + baseName = project.name + appendix = 'Sponge' + version = project.version + configurations = [ project.configurations.spongePlugin ] + from { + project.configurations.spongePlugin + } +} From b57d1184fd5945da7899b26a9a0b0423537da91a Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sun, 14 Feb 2016 20:16:25 +1100 Subject: [PATCH 07/19] Added license file. --- LICENSE | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a352714 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2016 Daniel Simmons +Copyright (c) contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 015158e4e523eb32fe7ae220e864f90a01f43ea3 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Mon, 15 Feb 2016 22:17:02 +1100 Subject: [PATCH 08/19] Load configuration from file. (Still need to provide default configuration file in plugin JAR). --- .../IslandCraftBiomeGenerator.java | 6 ++- .../IslandCraftGenerationModifier.java | 10 +++- .../islandcraft/IslandCraftPlugin.java | 25 +++++++++- .../islandcraft/SpongeWorldConfig.java | 48 +++++++++++++++++++ .../hoqhuuep/islandcraft/TempFakeConfig.java | 36 -------------- 5 files changed, 84 insertions(+), 41 deletions(-) create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java delete mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java index 481946b..8f7993f 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java @@ -15,11 +15,13 @@ import com.github.hoqhuuep.islandcraft.core.ICClassLoader; import com.github.hoqhuuep.islandcraft.core.IslandCache; +import ninja.leaping.configurate.commented.CommentedConfigurationNode; + public class IslandCraftBiomeGenerator implements BiomeGenerator { private final ICWorld icWorld; - public IslandCraftBiomeGenerator(String worldName, long worldSeed) { - icWorld = new DefaultWorld(worldName, worldSeed, new TempFakeDatabase(), new TempFakeConfig(), + public IslandCraftBiomeGenerator(String worldName, long worldSeed, CommentedConfigurationNode config) { + icWorld = new DefaultWorld(worldName, worldSeed, new TempFakeDatabase(), new SpongeWorldConfig(config.getNode(worldName)), new IslandCache(), new ICClassLoader()); } diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java index d2c7fb0..d7f9405 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java @@ -5,7 +5,15 @@ import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGeneratorModifier; +import ninja.leaping.configurate.commented.CommentedConfigurationNode; + public class IslandCraftGenerationModifier implements WorldGeneratorModifier { + private final CommentedConfigurationNode config; + + public IslandCraftGenerationModifier(CommentedConfigurationNode config) { + this.config = config; + } + @Override public String getId() { return "islandcraft:biomes"; @@ -19,6 +27,6 @@ public String getName() { @Override public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, WorldGenerator worldGenerator) { - worldGenerator.setBiomeGenerator(new IslandCraftBiomeGenerator(world.getWorldName(), world.getSeed())); + worldGenerator.setBiomeGenerator(new IslandCraftBiomeGenerator(world.getWorldName(), world.getSeed(), config.getNode("worlds"))); } } diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java index 7725d0b..1c7eb0c 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java @@ -1,9 +1,13 @@ package com.github.hoqhuuep.islandcraft; +import java.io.IOException; + import org.slf4j.Logger; import org.spongepowered.api.Sponge; +import org.spongepowered.api.config.DefaultConfig; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.game.state.GameInitializationEvent; +import org.spongepowered.api.event.game.state.GameStoppedEvent; import org.spongepowered.api.plugin.Plugin; import org.spongepowered.api.world.gen.WorldGeneratorModifier; @@ -11,16 +15,33 @@ import com.github.hoqhuuep.islandcraft.core.ICNoise; import com.google.inject.Inject; +import ninja.leaping.configurate.ConfigurationOptions; +import ninja.leaping.configurate.commented.CommentedConfigurationNode; +import ninja.leaping.configurate.loader.ConfigurationLoader; + @Plugin(id = "islandcraft", name = "IslandCraft", version = "1.0.3-SNAPSHOT") public class IslandCraftPlugin { @Inject private Logger logger; + @Inject + @DefaultConfig(sharedRoot = false) + private ConfigurationLoader configLoader; + + private CommentedConfigurationNode config; + @Listener - public void onGameInitialization(GameInitializationEvent event) { + public void onGameInitialization(GameInitializationEvent event) throws IOException { ICLogger.logger = new Slf4jLogger(logger); ICNoise.builder = new FlowNoiseBuilder(); - Sponge.getRegistry().register(WorldGeneratorModifier.class, new IslandCraftGenerationModifier()); + config = configLoader.load(ConfigurationOptions.defaults().setShouldCopyDefaults(true)); + + Sponge.getRegistry().register(WorldGeneratorModifier.class, new IslandCraftGenerationModifier(config)); + } + + @Listener + public void onGameStopped(GameStoppedEvent event) throws IOException { + configLoader.save(config); } } diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java new file mode 100644 index 0000000..ff193bb --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java @@ -0,0 +1,48 @@ +package com.github.hoqhuuep.islandcraft; + +import java.util.Arrays; +import java.util.List; + +import com.github.hoqhuuep.islandcraft.core.ICWorldConfig; +import com.google.common.reflect.TypeToken; + +import ninja.leaping.configurate.commented.CommentedConfigurationNode; +import ninja.leaping.configurate.objectmapping.ObjectMappingException; + +public class SpongeWorldConfig implements ICWorldConfig { + private final CommentedConfigurationNode config; + private static final String DEFAULT_OCEAN = "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"; + private static final String DEFAULT_ISLAND_DISTRIBUTION = "com.github.hoqhuuep.islandcraft.core.HexagonalIslandDistribution 288 32"; + private static final String[] DEFAULT_ISLAND_GENERATORS = new String[] { + "com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator" }; + + public SpongeWorldConfig(CommentedConfigurationNode config) { + this.config = config; + } + + @Override + public String getOcean() { + return config.getNode("ocean").getString(DEFAULT_OCEAN); + } + + @Override + public String getIslandDistribution() { + return config.getNode("island-distribution").getString(DEFAULT_ISLAND_DISTRIBUTION); + } + + @Override + public String[] getIslandGenerstors() { + try { + List list = config.getNode("island-generators").getList(TypeToken.of(String.class), + Arrays.asList(DEFAULT_ISLAND_GENERATORS)); + if (list.isEmpty()) { + config.getNode("island-generators").setValue(Arrays.asList(DEFAULT_ISLAND_GENERATORS)); + return DEFAULT_ISLAND_GENERATORS; + } + return list.toArray(new String[list.size()]); + } catch (ObjectMappingException e) { + e.printStackTrace(); + return DEFAULT_ISLAND_GENERATORS; + } + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java deleted file mode 100644 index 3f97e31..0000000 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.github.hoqhuuep.islandcraft; - -import com.github.hoqhuuep.islandcraft.core.ICWorldConfig; - -public class TempFakeConfig implements ICWorldConfig { - @Override - public String getOcean() { - return "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"; - } - - @Override - public String getIslandDistribution() { - return "com.github.hoqhuuep.islandcraft.core.HexagonalIslandDistribution 288 32"; - } - - @Override - public String[] getIslandGenerstors() { - return new String[] { - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha BIRCH_FOREST BIRCH_FOREST_M BIRCH_FOREST_HILLS BIRCH_FOREST_HILLS_M ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha COLD_TAIGA COLD_TAIGA_M COLD_TAIGA_HILLS ~ ~ ~ OCEAN COLD_BEACH FROZEN_RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha DESERT DESERT_M DESERT_HILLS ~ ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha EXTREME_HILLS EXTREME_HILLS_M EXTREME_HILLS_PLUS EXTREME_HILLS_PLUS_M EXTREME_HILLS_EDGE ~ OCEAN STONE_BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha FOREST ~ FOREST_HILLS ~ FLOWER_FOREST ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha ICE_PLAINS ~ ICE_MOUNTAINS ~ ICE_PLAINS_SPIKES ~ OCEAN FROZEN_OCEAN FROZEN_RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha JUNGLE JUNGLE_M JUNGLE_HILLS ~ JUNGLE_EDGE JUNGLE_EDGE_M OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MEGA_TAIGA MEGA_SPRUCE_TAIGA MEGA_TAIGA_HILLS MEGA_SPRUCE_TAIGA_HILLS ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MESA MESA_BRYCE MESA_PLATEAU MESA_PLATEAU_M MESA_PLATEAU_F MESA_PLATEAU_F_M OCEAN MESA RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MUSHROOM_ISLAND ~ ~ ~ ~ ~ OCEAN MUSHROOM_ISLAND_SHORE RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha PLAINS ~ SUNFLOWER_PLAINS ~ ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha ROOFED_FOREST ROOFED_FOREST_M ~ ~ ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha SAVANNA SAVANNA_M SAVANNA_PLATEAU SAVANNA_PLATEAU_M ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha SWAMPLAND SWAMPLAND_M ~ ~ ~ ~ OCEAN BEACH RIVER", - "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha TAIGA TAIGA_M TAIGA_HILLS ~ ~ ~ OCEAN BEACH RIVER" - }; - } -} From 44870b77c57da73362a9f27a5cf39e8710051782 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Tue, 16 Feb 2016 20:48:58 +1100 Subject: [PATCH 09/19] New gradle configuration for building Bukkit plugin with support for only latest version of CraftBukkit. --- build.gradle | 105 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index f167d5d..34e8b1a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,6 @@ -// To build the Bukkit plugin run 'gradle bukkit' +// To build the Sponge plugin, run 'gradle sponge' +// To build the Bukkit plugin with support for all versions of CraftBukkit since 1.4.7, run 'gradle bukkit' +// To build the Bukkit plugin with support for only the latest version of CraftBukkit, run 'gradle bukkitLatest' plugins { id 'com.github.johnrengelman.shadow' version '1.2.3' @@ -58,21 +60,8 @@ project(':IslandCraft-Sponge') { project(':IslandCraft-Bukkit') { dependencies { + compile project(':IslandCraft-NMS') compile project(':IslandCraft-Common') - compile project(':IslandCraft-NMS-v1_4_R1') - compile project(':IslandCraft-NMS-v1_5_R1') - compile project(':IslandCraft-NMS-v1_5_R2') - compile project(':IslandCraft-NMS-v1_5_R3') - compile project(':IslandCraft-NMS-v1_6_R1') - compile project(':IslandCraft-NMS-v1_6_R2') - compile project(':IslandCraft-NMS-v1_6_R3') - compile project(':IslandCraft-NMS-v1_7_R1') - compile project(':IslandCraft-NMS-v1_7_R2') - compile project(':IslandCraft-NMS-v1_7_R3') - compile project(':IslandCraft-NMS-v1_7_R4') - compile project(':IslandCraft-NMS-v1_8_R1') - compile project(':IslandCraft-NMS-v1_8_R2') - compile project(':IslandCraft-NMS-v1_8_R3') compile group: 'org.bukkit', name: 'bukkit', version: '1.7.9-R0.2' compile group: 'org.mcstats.bukkit', name: 'metrics', version: 'R7' } @@ -184,11 +173,73 @@ project(':IslandCraft-NMS-v1_8_R3') { } configurations { + spongePlugin bukkitPlugin + bukkitLatest +} + +dependencies { + spongePlugin (project(':IslandCraft-Sponge')) { + exclude group: 'org.spongepowered' + } +} + +task sponge(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { + description = 'Create the IslandCraft Sponge plugin JAR' + group = project.group + baseName = project.name + appendix = 'Sponge' + version = project.version + configurations = [ project.configurations.spongePlugin ] + from { + project.configurations.spongePlugin + } } dependencies { - bukkitPlugin (project(':IslandCraft-Bukkit')) { + bukkitPlugin(project(':IslandCraft-Bukkit')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_4_R1')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_5_R1')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_5_R2')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_5_R3')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_6_R1')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_6_R2')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_6_R3')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_7_R1')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_7_R2')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_7_R3')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_7_R4')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_8_R1')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_8_R2')) { + exclude group: 'org.bukkit' + } + bukkitPlugin(project(':IslandCraft-NMS-v1_8_R3')) { exclude group: 'org.bukkit' } } @@ -206,24 +257,24 @@ task bukkit(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { relocate 'org.mcstats', 'com.github.hoqhuuep.islandcraft.mcstats' } -configurations { - spongePlugin -} - dependencies { - spongePlugin (project(':IslandCraft-Sponge')) { - exclude group: 'org.spongepowered' + bukkitLatest (project(':IslandCraft-Bukkit')) { + exclude group: 'org.bukkit' + } + bukkitLatest(project(':IslandCraft-NMS-v1_8_R3')) { + exclude group: 'org.bukkit' } } -task sponge(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { - description = 'Create the IslandCraft Sponge plugin JAR' +task bukkitLatest(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { + description = 'Create the IslandCraft Bukkit plugin JAR' group = project.group baseName = project.name - appendix = 'Sponge' + appendix = 'BukkitLatest' version = project.version - configurations = [ project.configurations.spongePlugin ] + configurations = [ project.configurations.bukkitLatest ] from { - project.configurations.spongePlugin + project.configurations.bukkitLatest } + relocate 'org.mcstats', 'com.github.hoqhuuep.islandcraft.mcstats' } From 9d59d12c9a2e8998690ab1c75041d626f8d96ca6 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Thu, 18 Feb 2016 22:42:21 +1100 Subject: [PATCH 10/19] Remove metrics class for Bukkit (included in shaded jar with Gradle dependency anyway). Add metrics class for Sponge (with slight modifications, current published version does not work with SpongeAPI 3.0.0). --- .../islandcraft/bukkit/IslandCraftPlugin.java | 1 + .../islandcraft/IslandCraftPlugin.java | 8 + .../github/hoqhuuep/islandcraft}/Metrics.java | 188 ++++++++---------- build.gradle | 5 + 4 files changed, 99 insertions(+), 103 deletions(-) rename {IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit => IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft}/Metrics.java (82%) diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java index 628d731..81f053f 100644 --- a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java @@ -13,6 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; +import org.mcstats.Metrics; import com.avaje.ebean.EbeanServer; import com.github.hoqhuuep.islandcraft.api.ICLocation; diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java index 1c7eb0c..6b0b8fd 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java @@ -35,6 +35,14 @@ public void onGameInitialization(GameInitializationEvent event) throws IOExcepti ICLogger.logger = new Slf4jLogger(logger); ICNoise.builder = new FlowNoiseBuilder(); + // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage + try { + Metrics metrics = new Metrics(Sponge.getGame(), Sponge.getPluginManager().fromInstance(this).get()); + metrics.start(); + } catch (final Exception e) { + ICLogger.logger.warning("Failed to start MCStats"); + } + config = configLoader.load(ConfigurationOptions.defaults().setShouldCopyDefaults(true)); Sponge.getRegistry().register(WorldGeneratorModifier.class, new IslandCraftGenerationModifier(config)); diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Metrics.java similarity index 82% rename from IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java rename to IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Metrics.java index 3f4525a..c1db281 100644 --- a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/Metrics.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/Metrics.java @@ -1,5 +1,3 @@ -package com.github.hoqhuuep.islandcraft.bukkit; - /* * Copyright 2011-2013 Tyler Blair. All rights reserved. * @@ -27,15 +25,16 @@ * authors and contributors and should not be interpreted as representing official policies, * either expressed or implied, of anybody else. */ -import org.bukkit.Bukkit; -import org.bukkit.Server; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.PluginDescriptionFile; -import org.bukkit.scheduler.BukkitTask; +package com.github.hoqhuuep.islandcraft; + +import ninja.leaping.configurate.commented.CommentedConfigurationNode; +import ninja.leaping.configurate.hocon.HoconConfigurationLoader; +import ninja.leaping.configurate.loader.ConfigurationLoader; +import org.spongepowered.api.Game; +import org.spongepowered.api.plugin.PluginContainer; +import org.spongepowered.api.scheduler.Task; +import javax.inject.Inject; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -43,19 +42,17 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; -import java.lang.reflect.Method; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; -import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; import java.util.UUID; -import java.util.logging.Level; +import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; public class Metrics { @@ -80,10 +77,15 @@ public class Metrics { */ private static final int PING_INTERVAL = 15; + /** + * The game data is being sent for + */ + private final Game game; + /** * The plugin this metrics submits for */ - private final Plugin plugin; + private final PluginContainer plugin; /** * All of the custom graphs to submit to metrics @@ -93,22 +95,27 @@ public class Metrics { /** * The plugin configuration file */ - private final YamlConfiguration configuration; + private CommentedConfigurationNode config; /** * The plugin configuration file */ - private final File configurationFile; + private File configurationFile; + + /** + * The configuration loader + */ + private ConfigurationLoader configurationLoader; /** * Unique server id */ - private final String guid; + private String guid; /** * Debug mode */ - private final boolean debug; + private boolean debug; /** * Lock for synchronization @@ -118,33 +125,47 @@ public class Metrics { /** * The scheduled task */ - private volatile int task = -1; + private volatile Task task = null; - public Metrics(final Plugin plugin) throws IOException { + @Inject + public Metrics(final Game game, final PluginContainer plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } + this.game = game; this.plugin = plugin; - // load the config + loadConfiguration(); + } + + /** + * Loads the configuration + */ + private void loadConfiguration() { configurationFile = getConfigFile(); - configuration = YamlConfiguration.loadConfiguration(configurationFile); + configurationLoader = HoconConfigurationLoader.builder().setFile(configurationFile).build(); - // add some defaults - configuration.addDefault("opt-out", false); - configuration.addDefault("guid", UUID.randomUUID().toString()); - configuration.addDefault("debug", false); + try { + if (!configurationFile.exists()) { + configurationFile.createNewFile(); + config = configurationLoader.load(); - // Do we need to create the file? - if (configuration.get("guid", null) == null) { - configuration.options().header("http://mcstats.org").copyDefaults(true); - configuration.save(configurationFile); - } + config.setComment("This contains settings for MCStats: http://mcstats.org"); + config.getNode("mcstats.guid").setValue(UUID.randomUUID().toString()); + config.getNode("mcstats.opt-out").setValue(false); + config.getNode("mcstats.debug").setValue(false); - // Load the guid then - guid = configuration.getString("guid"); - debug = configuration.getBoolean("debug", false); + configurationLoader.save(config); + } else { + config = configurationLoader.load(); + } + + guid = config.getNode("mcstats.guid").getString(); + debug = config.getNode("mcstats.debug").getBoolean(); + } catch (IOException e) { + e.printStackTrace(); + } } /** @@ -197,13 +218,12 @@ public boolean start() { } // Is metrics already running? - if (task != -1) { + if (task != null) { return true; } // Begin hitting the server with glorious data - task = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() { - + game.getScheduler().createTaskBuilder().async().interval(PING_INTERVAL, TimeUnit.MINUTES).execute(new Runnable() { private boolean firstPost = true; public void run() { @@ -211,9 +231,9 @@ public void run() { // This has to be synchronized or it can collide with the disable method. synchronized (optOutLock) { // Disable Task, if it is running and the server owner decided to opt-out - if (isOptOut() && task != -1) { - plugin.getServer().getScheduler().cancelTask(task); - task = -1; + if (isOptOut() && task != null) { + task.cancel(); + task = null; // Tell all plotters to stop gathering information. for (Graph graph : graphs) { graph.onOptOut(); @@ -231,11 +251,11 @@ public void run() { firstPost = false; } catch (IOException e) { if (debug) { - Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); + System.out.println("[Metrics] " + e.getMessage()); } } } - }, 0l, PING_INTERVAL * 1200l); + }).submit(plugin); return true; } @@ -248,21 +268,9 @@ public void run() { */ public boolean isOptOut() { synchronized (optOutLock) { - try { - // Reload the metrics file - configuration.load(getConfigFile()); - } catch (IOException ex) { - if (debug) { - Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); - } - return true; - } catch (InvalidConfigurationException ex) { - if (debug) { - Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); - } - return true; - } - return configuration.getBoolean("opt-out", false); + loadConfiguration(); + + return config.getNode("mcstats.opt-out").getBoolean(); } } @@ -276,12 +284,12 @@ public void enable() throws IOException { synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { - configuration.set("opt-out", false); - configuration.save(configurationFile); + config.getNode("mcstats.opt-out").setValue(false); + configurationLoader.save(config); } // Enable Task, if it is not running - if (task == -1) { + if (task == null) { start(); } } @@ -297,14 +305,14 @@ public void disable() throws IOException { synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { - configuration.set("opt-out", true); - configuration.save(configurationFile); + config.getNode("mcstats.opt-out").setValue(true); + configurationLoader.save(config); } // Disable Task, if it is running - if (task != -1) { - Bukkit.getScheduler().cancelTask(task); - task = -1; + if (task != null) { + task.cancel(); + task = null; } } } @@ -315,37 +323,10 @@ public void disable() throws IOException { * @return the File object for the config file */ public File getConfigFile() { - // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use - // is to abuse the plugin object we already have - // plugin.getDataFolder() => base/plugins/PluginA/ - // pluginsFolder => base/plugins/ - // The base is not necessarily relative to the startup directory. - File pluginsFolder = plugin.getDataFolder().getParentFile(); - - // return => base/plugins/PluginMetrics/config.yml - return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); - } - - /** - * Gets the online player (backwards compatibility) - * - * @return online player amount - */ - private int getOnlinePlayers() { - try { - Method onlinePlayerMethod = Server.class.getMethod("getOnlinePlayers"); - if(onlinePlayerMethod.getReturnType().equals(Collection.class)) { - return ((Collection)onlinePlayerMethod.invoke(Bukkit.getServer())).size(); - } else { - return ((Player[])onlinePlayerMethod.invoke(Bukkit.getServer())).length; - } - } catch (Exception ex) { - if (debug) { - Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); - } - } - - return 0; + // TODO configDir + File configFolder = new File("config"); + + return new File(configFolder, "PluginMetrics.conf"); } /** @@ -353,12 +334,13 @@ private int getOnlinePlayers() { */ private void postPlugin(final boolean isPing) throws IOException { // Server software specific section - PluginDescriptionFile description = plugin.getDescription(); - String pluginName = description.getName(); - boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled - String pluginVersion = description.getVersion(); - String serverVersion = Bukkit.getVersion(); - int playersOnline = this.getOnlinePlayers(); + String pluginName = plugin.getName(); + boolean onlineMode = game.getServer().getOnlineMode(); // TRUE if online mode is enabled + String pluginVersion = plugin.getVersion(); + // TODO no visible way to get MC version at the moment + // TODO added by game.getPlatform().getMinecraftVersion() -- impl in 2.1 + String serverVersion = String.format("%s %s", "Sponge", game.getPlatform().getMinecraftVersion()); + int playersOnline = game.getServer().getOnlinePlayers().size(); // END server software specific section -- all code below does not use any code outside of this class / Java @@ -555,7 +537,7 @@ private boolean isMineshafterPresent() { * @param json * @param key * @param value - * @throws UnsupportedEncodingException + * @throws java.io.UnsupportedEncodingException */ private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; diff --git a/build.gradle b/build.gradle index 34e8b1a..94ecc03 100644 --- a/build.gradle +++ b/build.gradle @@ -52,9 +52,13 @@ project(':IslandCraft-Common') { } project(':IslandCraft-Sponge') { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' + dependencies { compile project(':IslandCraft-Common') compile group: 'org.spongepowered', name:'spongeapi', version: '3.0.0' + compile group: 'org.mcstats.sponge', name: 'metrics', version: 'R8-SNAPSHOT' } } @@ -194,6 +198,7 @@ task sponge(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) { from { project.configurations.spongePlugin } + relocate 'org.mcstats', 'com.github.hoqhuuep.islandcraft.mcstats' } dependencies { From c1d96c5c456c00494b2cf9cb00342c00b83897d4 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sat, 20 Feb 2016 15:06:50 +1100 Subject: [PATCH 11/19] Renaming Api -> API... commit 1 of 2. --- .../com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java | 0 .../java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java | 0 .../com/github/hoqhuuep/islandcraft/api/IslandDistribution.java | 0 .../java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java (100%) rename {IslandCraft-Api => IslandCraft-API-Temp}/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java (100%) diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java diff --git a/IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java b/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java similarity index 100% rename from IslandCraft-Api/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java rename to IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java From faaeb65fd9b9eff0bd05f3f0ded9e40298e38e57 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sat, 20 Feb 2016 15:07:29 +1100 Subject: [PATCH 12/19] Renaming Api -> API... commit 2 of 2. --- .../com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java | 0 .../main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java | 0 .../java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java | 0 .../com/github/hoqhuuep/islandcraft/api/IslandDistribution.java | 0 .../java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java (100%) rename {IslandCraft-API-Temp => IslandCraft-API}/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java (100%) diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/BiomeDistribution.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICBiome.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICIsland.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICLocation.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICRegion.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/ICWorld.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandCraft.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandDistribution.java diff --git a/IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java b/IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java similarity index 100% rename from IslandCraft-API-Temp/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java rename to IslandCraft-API/src/main/java/com/github/hoqhuuep/islandcraft/api/IslandGenerator.java From 72017e6d779160c3ee1114295e647f460d8efded Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sat, 20 Feb 2016 15:42:00 +1100 Subject: [PATCH 13/19] Tweaked Flow noise generation to produce more similar result to Bukkit noise. --- .../main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java index 59d606c..b8a9cd5 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java @@ -12,6 +12,9 @@ public FlowNoise(long seed) { @Override public double noise(double x, double z) { - return com.flowpowered.noise.Noise.valueCoherentNoise3D(x, 0.0, z, seed, NoiseQuality.STANDARD); + double n1 = com.flowpowered.noise.Noise.gradientCoherentNoise3D(x * 1.5, 0.0, z * 1.5, seed+0, NoiseQuality.STANDARD) * 3.0 - 1.0; + double n2 = com.flowpowered.noise.Noise.gradientCoherentNoise3D(x * 3, 0.0, z * 3, seed+1, NoiseQuality.STANDARD) * 3.0 - 1.0; + double res = (n1 * 2 + n2 * 1) / 3 - 0.07; + return res <= 0.0 ? 0.0 : res >= 1.0 ? 1.0 : res; } } From 9dacc2c407d792af7bb7853811ff719c2fbe20bf Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sat, 20 Feb 2016 19:06:00 +1100 Subject: [PATCH 14/19] So... Bukkit's noise generator was based on a paper... I've grabbed the public domain code from that paper... Now our noise generator creates noise which is identical to Bukkit's noise... So now there is no difference between current Bukkit plugin generation and Sponge plugin generation! :D --- .../islandcraft/bukkit/BukkitNoise.java | 19 - .../bukkit/BukkitNoiseBuilder.java | 11 - .../islandcraft/bukkit/IslandCraftPlugin.java | 2 - .../hoqhuuep/islandcraft/core/ICNoise.java | 5 - .../core/IslandGeneratorAlpha.java | 10 +- .../islandcraft/core/NoiseBuilder.java | 5 - .../islandcraft/core/{ => noise}/Noise.java | 2 +- .../islandcraft/core/noise/OctaveNoise.java | 21 + .../islandcraft/core/noise/SimplexNoise.java | 500 ++++++++++++++++++ .../hoqhuuep/islandcraft/FlowNoise.java | 20 - .../islandcraft/FlowNoiseBuilder.java | 11 - .../islandcraft/IslandCraftPlugin.java | 2 - 12 files changed, 528 insertions(+), 80 deletions(-) delete mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java delete mode 100644 IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java delete mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java delete mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java rename IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/{ => noise}/Noise.java (67%) create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/OctaveNoise.java create mode 100644 IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/SimplexNoise.java delete mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java delete mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java deleted file mode 100644 index c027ff5..0000000 --- a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoise.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.github.hoqhuuep.islandcraft.bukkit; - -import org.bukkit.util.noise.OctaveGenerator; -import org.bukkit.util.noise.SimplexOctaveGenerator; - -import com.github.hoqhuuep.islandcraft.core.Noise; - -public class BukkitNoise implements Noise { - private final OctaveGenerator octaveGenerator; - - public BukkitNoise(long seed) { - octaveGenerator = new SimplexOctaveGenerator(seed, 2); - } - - @Override - public double noise(double x, double z) { - return octaveGenerator.noise(x, z, 2.0, 0.5, true) / 2.0 + 0.5; - } -} diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java deleted file mode 100644 index 719d8f3..0000000 --- a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/BukkitNoiseBuilder.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.hoqhuuep.islandcraft.bukkit; - -import com.github.hoqhuuep.islandcraft.core.Noise; -import com.github.hoqhuuep.islandcraft.core.NoiseBuilder; - -public class BukkitNoiseBuilder implements NoiseBuilder { - @Override - public Noise build(long seed) { - return new BukkitNoise(seed); - } -} diff --git a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java index 81f053f..c4dab39 100644 --- a/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java +++ b/IslandCraft-Bukkit/src/main/java/com/github/hoqhuuep/islandcraft/bukkit/IslandCraftPlugin.java @@ -21,7 +21,6 @@ import com.github.hoqhuuep.islandcraft.api.IslandCraft; import com.github.hoqhuuep.islandcraft.core.DefaultIslandCraft; import com.github.hoqhuuep.islandcraft.core.ICLogger; -import com.github.hoqhuuep.islandcraft.core.ICNoise; import com.github.hoqhuuep.islandcraft.core.IslandDatabase; import com.github.hoqhuuep.islandcraft.nms.NmsWrapper; @@ -32,7 +31,6 @@ public class IslandCraftPlugin extends JavaPlugin { @Override public void onEnable() { ICLogger.logger = new JavaUtilLogger(getLogger()); - ICNoise.builder = new BukkitNoiseBuilder(); // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage try { diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java deleted file mode 100644 index 16b5dc1..0000000 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/ICNoise.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.hoqhuuep.islandcraft.core; - -public class ICNoise { - public static NoiseBuilder builder = null; -} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java index 9440980..868aa1a 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/IslandGeneratorAlpha.java @@ -14,6 +14,8 @@ import com.github.hoqhuuep.islandcraft.api.IslandGenerator; import com.github.hoqhuuep.islandcraft.core.mosaic.Poisson; import com.github.hoqhuuep.islandcraft.core.mosaic.Site; +import com.github.hoqhuuep.islandcraft.core.noise.Noise; +import com.github.hoqhuuep.islandcraft.core.noise.OctaveNoise; import com.github.hoqhuuep.islandcraft.util.StringUtils; public class IslandGeneratorAlpha implements IslandGenerator { @@ -59,10 +61,10 @@ public ICBiome[] generate(final int xSize, final int zSize, final long islandSee xSize, zSize, islandSeed, ICBiome.values()[normal.getRGB()])); final Poisson poisson = new Poisson(xSize, zSize, MIN_DISTANCE); final List sites = poisson.generate(new Random(islandSeed)); - final Noise shapeNoise = ICNoise.builder.build(islandSeed); - final Noise hillsNoise = ICNoise.builder.build(islandSeed + 1); - final Noise forestNoise = ICNoise.builder.build(islandSeed + 2); - final Noise mountainsNoise = ICNoise.builder.build(islandSeed + 3); + final Noise shapeNoise = new OctaveNoise(islandSeed); + final Noise hillsNoise = new OctaveNoise(islandSeed + 1); + final Noise forestNoise = new OctaveNoise(islandSeed + 2); + final Noise mountainsNoise = new OctaveNoise(islandSeed + 3); // Find borders final Queue oceanSites = new LinkedList(); for (final Site site : sites) { diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java deleted file mode 100644 index 0a25b2f..0000000 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/NoiseBuilder.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.hoqhuuep.islandcraft.core; - -public interface NoiseBuilder { - Noise build(long seed); -} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/Noise.java similarity index 67% rename from IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java rename to IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/Noise.java index 3ba0d3c..9f7bc2d 100644 --- a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/Noise.java +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/Noise.java @@ -1,4 +1,4 @@ -package com.github.hoqhuuep.islandcraft.core; +package com.github.hoqhuuep.islandcraft.core.noise; public interface Noise { /** Returns noise value in range [0, 1] **/ diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/OctaveNoise.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/OctaveNoise.java new file mode 100644 index 0000000..f9d1167 --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/OctaveNoise.java @@ -0,0 +1,21 @@ +package com.github.hoqhuuep.islandcraft.core.noise; + +import java.util.Random; + +public class OctaveNoise implements Noise { + private SimplexNoise octave1; + private SimplexNoise octave2; + + public OctaveNoise(long seed) { + Random random = new Random(seed); + octave1 = new SimplexNoise(random); + octave2 = new SimplexNoise(random); + } + + @Override + public double noise(double x, double y) { + double noise1 = octave1.noise(x, y, 0.0); + double noise2 = octave2.noise(x * 2.0, y * 2.0, 0.0) * 0.5; + return (noise1 + noise2) / 3.0 + 0.5; + } +} diff --git a/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/SimplexNoise.java b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/SimplexNoise.java new file mode 100644 index 0000000..b9bb80e --- /dev/null +++ b/IslandCraft-Common/src/main/java/com/github/hoqhuuep/islandcraft/core/noise/SimplexNoise.java @@ -0,0 +1,500 @@ +package com.github.hoqhuuep.islandcraft.core.noise; + +import java.util.Random; + +/** + * Simplex noise in 2D, 3D and 4D + * + * This is a modified version of public domain code available from: + * http://webstaff.itn.liu.se/~stegu/simplexnoise/SimplexNoise.java + * + * It is based on the paper: + * http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf + * + * A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. + * + * Based on example code by Stefan Gustavson (stegu@itn.liu.se). Optimisations + * by Peter Eastman (peastman@drizzle.stanford.edu). Better rank ordering method + * by Stefan Gustavson in 2012. Modifications to mimic how Bukkit's noise + * generator handles seeding by Daniel Simmons in 2016. + * + * This could be speeded up even further, but it's useful as it is. + * + * Version 2016-02-20 + * + * This code was placed in the public domain by its original author, Stefan + * Gustavson. You may use it as you see fit, but attribution is appreciated. + */ +public class SimplexNoise { + private static Grad grad3[] = { + new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0), + new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1), + new Grad(0, 1, 1), new Grad(0, -1, 1), new Grad(0, 1, -1), new Grad(0, -1, -1), + }; + + private static Grad grad4[] = { + new Grad(0, 1, 1, 1), new Grad(0, 1, 1, -1), new Grad(0, 1, -1, 1), new Grad(0, 1, -1, -1), + new Grad(0, -1, 1, 1), new Grad(0, -1, 1, -1), new Grad(0, -1, -1, 1), new Grad(0, -1, -1, -1), + new Grad(1, 0, 1, 1), new Grad(1, 0, 1, -1), new Grad(1, 0, -1, 1), new Grad(1, 0, -1, -1), + new Grad(-1, 0, 1, 1), new Grad(-1, 0, 1, -1), new Grad(-1, 0, -1, 1), new Grad(-1, 0, -1, -1), + new Grad(1, 1, 0, 1), new Grad(1, 1, 0, -1), new Grad(1, -1, 0, 1), new Grad(1, -1, 0, -1), + new Grad(-1, 1, 0, 1), new Grad(-1, 1, 0, -1), new Grad(-1, -1, 0, 1), new Grad(-1, -1, 0, -1), + new Grad(1, 1, 1, 0), new Grad(1, 1, -1, 0), new Grad(1, -1, 1, 0), new Grad(1, -1, -1, 0), + new Grad(-1, 1, 1, 0), new Grad(-1, 1, -1, 0), new Grad(-1, -1, 1, 0), new Grad(-1, -1, -1, 0), + }; + + // To remove the need for index wrapping, double the permutation table length + private int perm[] = new int[512]; + private int permMod12[] = new int[512]; + + // Skewing and unskewing factors for 2, 3, and 4 dimensions + private static final double F2 = 0.5 * (Math.sqrt(3.0) - 1.0); + private static final double G2 = (3.0 - Math.sqrt(3.0)) / 6.0; + private static final double F3 = 1.0 / 3.0; + private static final double G3 = 1.0 / 6.0; + private static final double F4 = (Math.sqrt(5.0) - 1.0) / 4.0; + private static final double G4 = (5.0 - Math.sqrt(5.0)) / 20.0; + + private double offsetX; + private double offsetY; + private double offsetZ; + private double offsetW; + + public SimplexNoise(Random random) { + offsetX = random.nextDouble() * 256; + offsetY = random.nextDouble() * 256; + offsetZ = random.nextDouble() * 256; + + for (int i = 0; i < 256; ++i) { + perm[i] = random.nextInt(256); + } + + // Create a random permutation of "p" + for (int i = 0; i < 256; ++i) { + int pos = random.nextInt(256 - i) + i; + int temp = perm[i]; + perm[i] = perm[pos]; + perm[pos] = temp; + perm[i + 256] = perm[i]; + } + + for (int i = 0; i < 512; i++) { + permMod12[i] = (perm[i] % 12); + } + offsetW = random.nextDouble() * 256; + } + + // This method is a *lot* faster than using (int) Math.floor(x) + private static int fastfloor(double x) { + int xi = (int) x; + return x < xi ? xi - 1 : xi; + } + + private static double dot(Grad g, double x, double y) { + return g.x * x + g.y * y; + } + + private static double dot(Grad g, double x, double y, double z) { + return g.x * x + g.y * y + g.z * z; + } + + private static double dot(Grad g, double x, double y, double z, double w) { + return g.x * x + g.y * y + g.z * z + g.w * w; + } + + // 2D simplex noise + public double noise(double x, double y) { + x += offsetX; + y += offsetY; + + // Noise contributions from the three corners + double n0, n1, n2; + + // Skew the input space to determine which simplex cell we're in + double s = (x + y) * F2; // Hairy factor for 2D + int i = fastfloor(x + s); + int j = fastfloor(y + s); + double t = (i + j) * G2; + double X0 = i - t; // Unskew the cell origin back to (x,y) space + double Y0 = j - t; + double x0 = x - X0; // The x,y distances from the cell origin + double y0 = y - Y0; + + // For the 2D case, the simplex shape is an equilateral triangle. + + // Determine which simplex we are in. + int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords + if (x0 > y0) { + i1 = 1; + j1 = 0; + } // lower triangle, XY order: (0,0)->(1,0)->(1,1) + else { + i1 = 0; + j1 = 1; + } // upper triangle, YX order: (0,0)->(0,1)->(1,1) + + // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and + // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where + // c = (3-sqrt(3))/6 + + double x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords + double y1 = y0 - j1 + G2; + double x2 = x0 - 1.0 + 2.0 * G2; // Offsets for last corner in (x,y) unskewed coords + double y2 = y0 - 1.0 + 2.0 * G2; + + // Work out the hashed gradient indices of the three simplex corners + int ii = i & 255; + int jj = j & 255; + int gi0 = permMod12[ii + perm[jj]]; + int gi1 = permMod12[ii + i1 + perm[jj + j1]]; + int gi2 = permMod12[ii + 1 + perm[jj + 1]]; + + // Calculate the contribution from the three corners + double t0 = 0.5 - x0 * x0 - y0 * y0; + if (t0 < 0) { + n0 = 0.0; + } else { + t0 *= t0; + n0 = t0 * t0 * dot(grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient + } + + double t1 = 0.5 - x1 * x1 - y1 * y1; + if (t1 < 0) { + n1 = 0.0; + } else { + t1 *= t1; + n1 = t1 * t1 * dot(grad3[gi1], x1, y1); + } + + double t2 = 0.5 - x2 * x2 - y2 * y2; + if (t2 < 0) { + n2 = 0.0; + } else { + t2 *= t2; + n2 = t2 * t2 * dot(grad3[gi2], x2, y2); + } + + // Add contributions from each corner to get the final noise value. + // The result is scaled to return values in the interval [-1,1]. + return 70.0 * (n0 + n1 + n2); + } + + // 3D simplex noise + public double noise(double x, double y, double z) { + x += offsetX; + y += offsetY; + z += offsetZ; + + double n0, n1, n2, n3; // Noise contributions from the four corners + + // Skew the input space to determine which simplex cell we're in + double s = (x + y + z) * F3; // Very nice and simple skew factor for 3D + int i = fastfloor(x + s); + int j = fastfloor(y + s); + int k = fastfloor(z + s); + double t = (i + j + k) * G3; + double X0 = i - t; // Unskew the cell origin back to (x,y,z) space + double Y0 = j - t; + double Z0 = k - t; + double x0 = x - X0; // The x,y,z distances from the cell origin + double y0 = y - Y0; + double z0 = z - Z0; + + // For the 3D case, the simplex shape is a slightly irregular tetrahedron. + + // Determine which simplex we are in. + int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords + int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords + if (x0 >= y0) { + if (y0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 1; + k2 = 0; + } // X Y Z order + else if (x0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 0; + k2 = 1; + } // X Z Y order + else { + i1 = 0; + j1 = 0; + k1 = 1; + i2 = 1; + j2 = 0; + k2 = 1; + } // Z X Y order + } else { // x0 y0) { + rankx++; + } else { + ranky++; + } + if (x0 > z0) { + rankx++; + } else { + rankz++; + } + if (x0 > w0) { + rankx++; + } else { + rankw++; + } + if (y0 > z0) { + ranky++; + } else { + rankz++; + } + if (y0 > w0) { + ranky++; + } else { + rankw++; + } + if (z0 > w0) { + rankz++; + } else { + rankw++; + } + + int i1, j1, k1, l1; // The integer offsets for the second simplex corner + int i2, j2, k2, l2; // The integer offsets for the third simplex corner + int i3, j3, k3, l3; // The integer offsets for the fourth simplex corner + + // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order. + // Many values of c will never occur, since e.g. x>y>z>w makes x= 3 ? 1 : 0; + j1 = ranky >= 3 ? 1 : 0; + k1 = rankz >= 3 ? 1 : 0; + l1 = rankw >= 3 ? 1 : 0; + + // Rank 2 denotes the second largest coordinate. + i2 = rankx >= 2 ? 1 : 0; + j2 = ranky >= 2 ? 1 : 0; + k2 = rankz >= 2 ? 1 : 0; + l2 = rankw >= 2 ? 1 : 0; + + // Rank 1 denotes the second smallest coordinate. + i3 = rankx >= 1 ? 1 : 0; + j3 = ranky >= 1 ? 1 : 0; + k3 = rankz >= 1 ? 1 : 0; + l3 = rankw >= 1 ? 1 : 0; + + // The fifth corner has all coordinate offsets = 1, so no need to compute that. + double x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords + double y1 = y0 - j1 + G4; + double z1 = z0 - k1 + G4; + double w1 = w0 - l1 + G4; + double x2 = x0 - i2 + 2.0 * G4; // Offsets for third corner in (x,y,z,w) coords + double y2 = y0 - j2 + 2.0 * G4; + double z2 = z0 - k2 + 2.0 * G4; + double w2 = w0 - l2 + 2.0 * G4; + double x3 = x0 - i3 + 3.0 * G4; // Offsets for fourth corner in (x,y,z,w) coords + double y3 = y0 - j3 + 3.0 * G4; + double z3 = z0 - k3 + 3.0 * G4; + double w3 = w0 - l3 + 3.0 * G4; + double x4 = x0 - 1.0 + 4.0 * G4; // Offsets for last corner in (x,y,z,w) coords + double y4 = y0 - 1.0 + 4.0 * G4; + double z4 = z0 - 1.0 + 4.0 * G4; + double w4 = w0 - 1.0 + 4.0 * G4; + + // Work out the hashed gradient indices of the five simplex corners + int ii = i & 255; + int jj = j & 255; + int kk = k & 255; + int ll = l & 255; + int gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32; + int gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32; + int gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32; + int gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32; + int gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32; + + // Calculate the contribution from the five corners + double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; + if (t0 < 0) { + n0 = 0.0; + } else { + t0 *= t0; + n0 = t0 * t0 * dot(grad4[gi0], x0, y0, z0, w0); + } + double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1; + if (t1 < 0) { + n1 = 0.0; + } else { + t1 *= t1; + n1 = t1 * t1 * dot(grad4[gi1], x1, y1, z1, w1); + } + double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2; + if (t2 < 0) { + n2 = 0.0; + } else { + t2 *= t2; + n2 = t2 * t2 * dot(grad4[gi2], x2, y2, z2, w2); + } + double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3; + if (t3 < 0) { + n3 = 0.0; + } else { + t3 *= t3; + n3 = t3 * t3 * dot(grad4[gi3], x3, y3, z3, w3); + } + double t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4; + if (t4 < 0) { + n4 = 0.0; + } else { + t4 *= t4; + n4 = t4 * t4 * dot(grad4[gi4], x4, y4, z4, w4); + } + + // Sum up and scale the result to cover the range [-1,1] + return 27.0 * (n0 + n1 + n2 + n3 + n4); + } + + // Inner class to speed up gradient computations + // (array access is a lot slower than member access) + private static class Grad { + double x, y, z, w; + + Grad(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + Grad(double x, double y, double z, double w) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + } + } +} \ No newline at end of file diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java deleted file mode 100644 index b8a9cd5..0000000 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoise.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.github.hoqhuuep.islandcraft; - -import com.flowpowered.noise.NoiseQuality; -import com.github.hoqhuuep.islandcraft.core.Noise; - -public class FlowNoise implements Noise { - private final int seed; - - public FlowNoise(long seed) { - this.seed = (int) seed; - } - - @Override - public double noise(double x, double z) { - double n1 = com.flowpowered.noise.Noise.gradientCoherentNoise3D(x * 1.5, 0.0, z * 1.5, seed+0, NoiseQuality.STANDARD) * 3.0 - 1.0; - double n2 = com.flowpowered.noise.Noise.gradientCoherentNoise3D(x * 3, 0.0, z * 3, seed+1, NoiseQuality.STANDARD) * 3.0 - 1.0; - double res = (n1 * 2 + n2 * 1) / 3 - 0.07; - return res <= 0.0 ? 0.0 : res >= 1.0 ? 1.0 : res; - } -} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java deleted file mode 100644 index 988a6c3..0000000 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/FlowNoiseBuilder.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.github.hoqhuuep.islandcraft; - -import com.github.hoqhuuep.islandcraft.core.Noise; -import com.github.hoqhuuep.islandcraft.core.NoiseBuilder; - -public class FlowNoiseBuilder implements NoiseBuilder { - @Override - public Noise build(long seed) { - return new FlowNoise(seed); - } -} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java index 6b0b8fd..7545065 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java @@ -12,7 +12,6 @@ import org.spongepowered.api.world.gen.WorldGeneratorModifier; import com.github.hoqhuuep.islandcraft.core.ICLogger; -import com.github.hoqhuuep.islandcraft.core.ICNoise; import com.google.inject.Inject; import ninja.leaping.configurate.ConfigurationOptions; @@ -33,7 +32,6 @@ public class IslandCraftPlugin { @Listener public void onGameInitialization(GameInitializationEvent event) throws IOException { ICLogger.logger = new Slf4jLogger(logger); - ICNoise.builder = new FlowNoiseBuilder(); // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage try { From 07482a2a7adc04195a9cd4733da33f59b604aafe Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Sun, 21 Feb 2016 19:17:10 +1100 Subject: [PATCH 15/19] Implemented database. Seems to work fine with H2. --- .../IslandCraftBiomeGenerator.java | 8 +- ...java => IslandCraftGeneratorModifier.java} | 13 +- .../islandcraft/IslandCraftPlugin.java | 20 +++- .../islandcraft/JdbcIslandDatabase.java | 113 ++++++++++++++++++ .../islandcraft/TempFakeDatabase.java | 19 --- 5 files changed, 146 insertions(+), 27 deletions(-) rename IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/{IslandCraftGenerationModifier.java => IslandCraftGeneratorModifier.java} (53%) create mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/JdbcIslandDatabase.java delete mode 100644 IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java index 8f7993f..282fd42 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java @@ -14,15 +14,17 @@ import com.github.hoqhuuep.islandcraft.core.DefaultWorld; import com.github.hoqhuuep.islandcraft.core.ICClassLoader; import com.github.hoqhuuep.islandcraft.core.IslandCache; +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; import ninja.leaping.configurate.commented.CommentedConfigurationNode; public class IslandCraftBiomeGenerator implements BiomeGenerator { private final ICWorld icWorld; - public IslandCraftBiomeGenerator(String worldName, long worldSeed, CommentedConfigurationNode config) { - icWorld = new DefaultWorld(worldName, worldSeed, new TempFakeDatabase(), new SpongeWorldConfig(config.getNode(worldName)), - new IslandCache(), new ICClassLoader()); + public IslandCraftBiomeGenerator(String worldName, long worldSeed, CommentedConfigurationNode config, + IslandDatabase database) { + icWorld = new DefaultWorld(worldName, worldSeed, database, new SpongeWorldConfig(config), new IslandCache(), + new ICClassLoader()); } @Override diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java similarity index 53% rename from IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java rename to IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java index d7f9405..c63e38b 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGenerationModifier.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java @@ -2,16 +2,21 @@ import org.spongepowered.api.data.DataContainer; import org.spongepowered.api.world.WorldCreationSettings; +import org.spongepowered.api.world.gen.BiomeGenerator; import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGeneratorModifier; +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; + import ninja.leaping.configurate.commented.CommentedConfigurationNode; -public class IslandCraftGenerationModifier implements WorldGeneratorModifier { +public class IslandCraftGeneratorModifier implements WorldGeneratorModifier { private final CommentedConfigurationNode config; + private final IslandDatabase database; - public IslandCraftGenerationModifier(CommentedConfigurationNode config) { + public IslandCraftGeneratorModifier(CommentedConfigurationNode config, IslandDatabase database) { this.config = config; + this.database = database; } @Override @@ -27,6 +32,8 @@ public String getName() { @Override public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, WorldGenerator worldGenerator) { - worldGenerator.setBiomeGenerator(new IslandCraftBiomeGenerator(world.getWorldName(), world.getSeed(), config.getNode("worlds"))); + String worldName = world.getWorldName(); + BiomeGenerator islandCraftBiomeGenerator = new IslandCraftBiomeGenerator(worldName, world.getSeed(), config.getNode(worldName), database); + worldGenerator.setBiomeGenerator(islandCraftBiomeGenerator); } } diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java index 7545065..f33f57b 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java @@ -1,6 +1,7 @@ package com.github.hoqhuuep.islandcraft; import java.io.IOException; +import java.sql.SQLException; import org.slf4j.Logger; import org.spongepowered.api.Sponge; @@ -9,9 +10,11 @@ import org.spongepowered.api.event.game.state.GameInitializationEvent; import org.spongepowered.api.event.game.state.GameStoppedEvent; import org.spongepowered.api.plugin.Plugin; +import org.spongepowered.api.service.sql.SqlService; import org.spongepowered.api.world.gen.WorldGeneratorModifier; import com.github.hoqhuuep.islandcraft.core.ICLogger; +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; import com.google.inject.Inject; import ninja.leaping.configurate.ConfigurationOptions; @@ -30,9 +33,11 @@ public class IslandCraftPlugin { private CommentedConfigurationNode config; @Listener - public void onGameInitialization(GameInitializationEvent event) throws IOException { + public void onGameInitialization(GameInitializationEvent event) throws IOException, SQLException { + // Logging ICLogger.logger = new Slf4jLogger(logger); + // Metrics // https://github.com/Hidendra/Plugin-Metrics/wiki/Usage try { Metrics metrics = new Metrics(Sponge.getGame(), Sponge.getPluginManager().fromInstance(this).get()); @@ -41,9 +46,20 @@ public void onGameInitialization(GameInitializationEvent event) throws IOExcepti ICLogger.logger.warning("Failed to start MCStats"); } + // Configuration config = configLoader.load(ConfigurationOptions.defaults().setShouldCopyDefaults(true)); + if (!"1.0.0".equals(config.getNode("config-version").setComment("Do not modify config-version").getString("1.0.0"))) { + logger.error("Invalid config-version found in './config/islandcraft/islandcraft.config'. Must be '1.0.0'."); + return; + } + + // Database + SqlService sqlService = Sponge.getServiceManager().provide(SqlService.class).get(); + IslandDatabase database = new JdbcIslandDatabase(sqlService, config.getNode("database")); - Sponge.getRegistry().register(WorldGeneratorModifier.class, new IslandCraftGenerationModifier(config)); + // Modify world generator + WorldGeneratorModifier islandCraftGeneratorModifier = new IslandCraftGeneratorModifier(config.getNode("worlds"), database); + Sponge.getRegistry().register(WorldGeneratorModifier.class, islandCraftGeneratorModifier); } @Listener diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/JdbcIslandDatabase.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/JdbcIslandDatabase.java new file mode 100644 index 0000000..b174eb9 --- /dev/null +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/JdbcIslandDatabase.java @@ -0,0 +1,113 @@ +package com.github.hoqhuuep.islandcraft; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import javax.sql.DataSource; + +import org.spongepowered.api.service.sql.SqlService; + +import com.github.hoqhuuep.islandcraft.core.IslandDatabase; + +import ninja.leaping.configurate.commented.CommentedConfigurationNode; + +public class JdbcIslandDatabase implements IslandDatabase { + private final DataSource dataSource; + private final String username; + private final String password; + + public JdbcIslandDatabase(SqlService sqlService, CommentedConfigurationNode config) throws SQLException { + String url = config.getNode("url").getString("jdbc:h2:./islandcraft"); + username = config.getNode("username").getString(null); + password = config.getNode("password").getString(null); + dataSource = sqlService.getDataSource(url); + createTablesIfTheyDoNotExist(); + } + + Connection getConnection() throws SQLException { + if (username != null && password != null) { + return dataSource.getConnection(username, password); + } + return dataSource.getConnection(); + } + + private void createTablesIfTheyDoNotExist() throws SQLException { + try (Connection connection = getConnection(); + PreparedStatement statement = connection.prepareStatement("CREATE TABLE IF NOT EXISTS islandcraft_core (world_name VARCHAR(255) NOT NULL, center_x INTEGER NOT NULL, center_z INTEGER NOT NULL, island_seed BIGINT, generator VARCHAR(65535))")) { + statement.executeUpdate(); + } + } + + @Override + public void save(String worldName, int centerX, int centerZ, long islandSeed, String generator) { + if (load(worldName, centerX, centerZ) != null) { + // Already exists => UPDATE + try (Connection connection = getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE islandcraft_core SET island_seed=?, generator=? WHERE world_name=? AND center_x=? AND center_z=?")) { + statement.setLong(1, islandSeed); + statement.setString(2, generator); + statement.setString(3, worldName); + statement.setInt(4, centerX); + statement.setInt(5, centerZ); + statement.executeUpdate(); + } catch (SQLException e) { + // Nothing we can do about this... + e.printStackTrace(); + } + } else { + // Does not already exist => INSERT + try (Connection connection = getConnection(); + PreparedStatement statement = connection.prepareStatement("INSERT INTO islandcraft_core (world_name, center_x, center_z, island_seed, generator) VALUES (?, ?, ?, ?, ?)")) { + statement.setString(1, worldName); + statement.setInt(2, centerX); + statement.setInt(3, centerZ); + statement.setLong(4, islandSeed); + statement.setString(5, generator); + statement.executeUpdate(); + } catch (SQLException e) { + // Nothing we can do about this... + e.printStackTrace(); + } + } + } + + @Override + public Result load(String worldName, int centerX, int centerZ) { + try (Connection connection = getConnection(); + PreparedStatement statement = connection.prepareStatement("SELECT island_seed, generator FROM islandcraft_core WHERE world_name=? AND center_x=? AND center_z=?")) { + statement.setString(1, worldName); + statement.setInt(2, centerX); + statement.setInt(3, centerZ); + try (ResultSet result = statement.executeQuery()) { + if (result.next()) { + long islandSeed = result.getLong(1); + String generator = result.getString(2); + return new Result(islandSeed, generator); + } + } + } catch (SQLException e) { + // Nothing we can do about this... + e.printStackTrace(); + } + return null; + } + + @Override + public boolean isEmpty(String worldName) { + try (Connection connection = getConnection(); + PreparedStatement statement = connection.prepareStatement("SELECT COUNT(*) FROM islandcraft_core WHERE world_name=?")) { + statement.setString(1, worldName); + try (ResultSet result = statement.executeQuery()) { + if (result.next()) { + return result.getInt(1) == 0; + } + } + } catch (SQLException e) { + // Nothing we can do about this... + e.printStackTrace(); + } + return false; + } +} diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java deleted file mode 100644 index 1040b93..0000000 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/TempFakeDatabase.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.github.hoqhuuep.islandcraft; - -import com.github.hoqhuuep.islandcraft.core.IslandDatabase; - -public class TempFakeDatabase implements IslandDatabase { - @Override - public void save(String worldName, int centerX, int centerZ, long islandSeed, String generator) { - } - - @Override - public Result load(String worldName, int centerX, int centerZ) { - return null; - } - - @Override - public boolean isEmpty(String worldName) { - return false; - } -} From 13fdd164c236a9cf3c23239ba33042f602069260 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Mon, 22 Feb 2016 10:44:49 +1100 Subject: [PATCH 16/19] Fix NPE when plugin fails to load. --- .../com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java index f33f57b..f979ae6 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftPlugin.java @@ -64,6 +64,8 @@ public void onGameInitialization(GameInitializationEvent event) throws IOExcepti @Listener public void onGameStopped(GameStoppedEvent event) throws IOException { - configLoader.save(config); + if (config != null) { + configLoader.save(config); + } } } From 95381cceb0b6ff13a4f2792dfb36454281430b7c Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Mon, 22 Feb 2016 18:15:08 +1100 Subject: [PATCH 17/19] Add islands to default configuration. Formatting. --- .../IslandCraftBiomeGenerator.java | 6 ++--- .../IslandCraftGeneratorModifier.java | 3 +-- .../islandcraft/SpongeWorldConfig.java | 23 +++++++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java index 282fd42..adf0141 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftBiomeGenerator.java @@ -21,10 +21,8 @@ public class IslandCraftBiomeGenerator implements BiomeGenerator { private final ICWorld icWorld; - public IslandCraftBiomeGenerator(String worldName, long worldSeed, CommentedConfigurationNode config, - IslandDatabase database) { - icWorld = new DefaultWorld(worldName, worldSeed, database, new SpongeWorldConfig(config), new IslandCache(), - new ICClassLoader()); + public IslandCraftBiomeGenerator(String worldName, long worldSeed, CommentedConfigurationNode config, IslandDatabase database) { + icWorld = new DefaultWorld(worldName, worldSeed, database, new SpongeWorldConfig(config), new IslandCache(), new ICClassLoader()); } @Override diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java index c63e38b..3ac9daf 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/IslandCraftGeneratorModifier.java @@ -30,8 +30,7 @@ public String getName() { } @Override - public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, - WorldGenerator worldGenerator) { + public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, WorldGenerator worldGenerator) { String worldName = world.getWorldName(); BiomeGenerator islandCraftBiomeGenerator = new IslandCraftBiomeGenerator(worldName, world.getSeed(), config.getNode(worldName), database); worldGenerator.setBiomeGenerator(islandCraftBiomeGenerator); diff --git a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java index ff193bb..ca1642f 100644 --- a/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java +++ b/IslandCraft-Sponge/src/main/java/com/github/hoqhuuep/islandcraft/SpongeWorldConfig.java @@ -14,7 +14,22 @@ public class SpongeWorldConfig implements ICWorldConfig { private static final String DEFAULT_OCEAN = "com.github.hoqhuuep.islandcraft.core.ConstantBiomeDistribution DEEP_OCEAN"; private static final String DEFAULT_ISLAND_DISTRIBUTION = "com.github.hoqhuuep.islandcraft.core.HexagonalIslandDistribution 288 32"; private static final String[] DEFAULT_ISLAND_GENERATORS = new String[] { - "com.github.hoqhuuep.islandcraft.core.EmptyIslandGenerator" }; + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha BIRCH_FOREST BIRCH_FOREST_M BIRCH_FOREST_HILLS BIRCH_FOREST_HILLS_M ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha COLD_TAIGA COLD_TAIGA_M COLD_TAIGA_HILLS ~ ~ ~ OCEAN COLD_BEACH FROZEN_RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha DESERT DESERT_M DESERT_HILLS ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha EXTREME_HILLS EXTREME_HILLS_M EXTREME_HILLS_PLUS EXTREME_HILLS_PLUS_M EXTREME_HILLS_EDGE ~ OCEAN STONE_BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha FOREST ~ FOREST_HILLS ~ FLOWER_FOREST ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha ICE_PLAINS ~ ICE_MOUNTAINS ~ ICE_PLAINS_SPIKES ~ OCEAN FROZEN_OCEAN FROZEN_RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha JUNGLE JUNGLE_M JUNGLE_HILLS ~ JUNGLE_EDGE JUNGLE_EDGE_M OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MEGA_TAIGA MEGA_SPRUCE_TAIGA MEGA_TAIGA_HILLS MEGA_SPRUCE_TAIGA_HILLS ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MESA MESA_BRYCE MESA_PLATEAU MESA_PLATEAU_M MESA_PLATEAU_F MESA_PLATEAU_F_M OCEAN MESA RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha MUSHROOM_ISLAND ~ ~ ~ ~ ~ OCEAN MUSHROOM_ISLAND_SHORE RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha PLAINS ~ SUNFLOWER_PLAINS ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha ROOFED_FOREST ROOFED_FOREST_M ~ ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha SAVANNA SAVANNA_M SAVANNA_PLATEAU SAVANNA_PLATEAU_M ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha SWAMPLAND SWAMPLAND_M ~ ~ ~ ~ OCEAN BEACH RIVER", + "com.github.hoqhuuep.islandcraft.core.IslandGeneratorAlpha TAIGA TAIGA_M TAIGA_HILLS ~ ~ ~ OCEAN BEACH RIVER" + }; public SpongeWorldConfig(CommentedConfigurationNode config) { this.config = config; @@ -33,10 +48,10 @@ public String getIslandDistribution() { @Override public String[] getIslandGenerstors() { try { - List list = config.getNode("island-generators").getList(TypeToken.of(String.class), - Arrays.asList(DEFAULT_ISLAND_GENERATORS)); + List defaultGenerators = Arrays.asList(DEFAULT_ISLAND_GENERATORS); + List list = config.getNode("island-generators").getList(TypeToken.of(String.class), defaultGenerators); if (list.isEmpty()) { - config.getNode("island-generators").setValue(Arrays.asList(DEFAULT_ISLAND_GENERATORS)); + config.getNode("island-generators").setValue(defaultGenerators); return DEFAULT_ISLAND_GENERATORS; } return list.toArray(new String[list.size()]); From b56a4386c26fa9d8ce2af5ec559a923282dd015c Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Mon, 22 Feb 2016 20:02:12 +1100 Subject: [PATCH 18/19] Update CraftBukkit dependency version. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 94ecc03..075e0ce 100644 --- a/build.gradle +++ b/build.gradle @@ -172,7 +172,7 @@ project(':IslandCraft-NMS-v1_8_R2') { project(':IslandCraft-NMS-v1_8_R3') { dependencies { compile project(':IslandCraft-NMS') - compile group: 'org.bukkit', name: 'craftbukkit', version: '1.8.7-R0.1-SNAPSHOT' + compile group: 'org.bukkit', name: 'craftbukkit', version: '1.8.8-R0.1-SNAPSHOT' } } From b1b560374eb209026494cac5d7310addffd557c4 Mon Sep 17 00:00:00 2001 From: Daniel Simmons Date: Tue, 23 Feb 2016 21:23:33 +1100 Subject: [PATCH 19/19] Updated version to 1.0.3-BETA. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 075e0ce..b3139b8 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } group = 'com.github.hoqhuuep' -version = '1.0.3-SNAPSHOT' +version = '1.0.3-BETA' allprojects { repositories {