diff --git a/LICENSE b/LICENSE index 723ef115..7a4a3ea2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -175,7 +176,18 @@ END OF TERMS AND CONDITIONS - Copyright © 2021 William278 + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -187,4 +199,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..ea73d728 --- /dev/null +++ b/build.gradle @@ -0,0 +1,61 @@ +plugins { + id 'com.github.johnrengelman.shadow' version '7.1.2' + id 'org.ajoberstar.grgit' version '5.0.0' + id 'java' +} + +group 'net.william278' +version "$ext.plugin_version+${versionMetadata()}" + +ext { + set 'version', version.toString() +} + +import org.apache.tools.ant.filters.ReplaceTokens + +allprojects { + apply plugin: 'com.github.johnrengelman.shadow' + apply plugin: 'java' + + compileJava.options.encoding = 'UTF-8' + javadoc.options.encoding = 'UTF-8' + + compileJava.options.release.set 16 + + repositories { + mavenLocal() + mavenCentral() + maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' } + maven { url 'https://repo.minebench.de/' } + maven { url 'https://jitpack.io' } + } + + processResources { + filter ReplaceTokens as Class, beginToken: '${', endToken: '}', + tokens: rootProject.ext.properties + } +} + +subprojects { + version rootProject.version + archivesBaseName = "${rootProject.name}-${project.name.capitalize()}" + + if (['bukkit', 'plugin'].contains(project.name)) { + shadowJar { + destinationDirectory.set(file("$rootDir/target")) + archiveClassifier.set('') + } + jar.dependsOn shadowJar + clean.delete "$rootDir/target" + } +} + +logger.lifecycle("Building HuskHomes ${version} by William278") + +@SuppressWarnings('GrMethodMayBeStatic') +def versionMetadata() { + if (grgit == null) { + return System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown' + } + return 'rev.' + grgit.head().abbreviatedId + (grgit.status().clean ? '' : '-indev') +} \ No newline at end of file diff --git a/bukkit/build.gradle b/bukkit/build.gradle new file mode 100644 index 00000000..a107da87 --- /dev/null +++ b/bukkit/build.gradle @@ -0,0 +1,14 @@ +dependencies { + implementation project(path: ':common', configuration: 'shadow') + + implementation 'commons-io:commons-io:2.11.0' + implementation 'de.themoep:minedown:1.7.1-SNAPSHOT' + + compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' + compileOnly 'org.jetbrains:annotations:23.0.0' +} + +shadowJar { + relocate 'org.apache', 'net.william278.huskhomes.libraries' + relocate 'de.themoep', 'net.william278.huskhomes.libraries.minedown' +} \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 00000000..d0233d18 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,11 @@ +dependencies { + compileOnly 'commons-io:commons-io:2.11.0' + compileOnly 'dev.dejvokep:boosted-yaml:1.2' + compileOnly 'de.themoep:minedown:1.7.1-SNAPSHOT' +} + +shadowJar { + relocate 'org.apache.commons-io', 'net.william278.huskhomes.libraries.commons-io' + relocate 'dev.dejvokep.boosted-yaml', 'net.william278.huskhomes.libraries.boosted-yaml' + relocate 'de.themoep', 'net.william278.huskhomes.libraries.minedown' +} \ No newline at end of file diff --git a/common/src/main/java/net/william278/huskhomes/HuskHomes.java b/common/src/main/java/net/william278/huskhomes/HuskHomes.java new file mode 100644 index 00000000..676ff890 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/HuskHomes.java @@ -0,0 +1,27 @@ +package net.william278.huskhomes; + +import net.william278.huskhomes.player.Player; +import net.william278.huskhomes.util.Logger; + +import java.util.Set; + +/** + * Represents a cross-platform instance of the plugin + */ +public interface HuskHomes { + + /** + * Returns the platform plugin console logger + * + * @return the {@link Logger} implementation to use + */ + Logger getLogger(); + + /** + * Returns a {@link Set} of online {@link Player}s on this server + * + * @return a {@link Set} of currently online {@link Player}s + */ + Set getOnlinePlayers(); + +} diff --git a/common/src/main/java/net/william278/huskhomes/command/CommandBase.java b/common/src/main/java/net/william278/huskhomes/command/CommandBase.java new file mode 100644 index 00000000..5164680d --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/command/CommandBase.java @@ -0,0 +1,58 @@ +package net.william278.huskhomes.command; + +import net.william278.huskhomes.HuskHomes; +import net.william278.huskhomes.player.Player; + +import java.util.List; + +/** + * Represents an abstract cross-platform representation for a plugin command + */ +public abstract class CommandBase { + + /** + * The input string to match for this command + */ + public final String command; + + /** + * The permission node required to use this command + */ + public final String permission; + + /** + * Alias input strings for this command + */ + public final String[] aliases; + + /** + * Instance of the proxy plugin implementor + */ + public final HuskHomes implementor; + + + public CommandBase(String command, String permission, HuskHomes implementingPlugin, String... aliases) { + this.command = command; + this.permission = permission; + this.implementor = implementingPlugin; + this.aliases = aliases; + } + + /** + * Fires when the command is executed + * + * @param player {@link Player} executing the command + * @param args Command arguments + */ + public abstract void onExecute(Player player, String[] args); + + /** + * What should be returned when the player attempts to TAB complete the command + * + * @param player {@link Player} doing the TAB completion + * @param args Current command arguments + * @return List of String arguments to offer TAB suggestions + */ + public abstract List onTabComplete(Player player, String[] args); + +} \ No newline at end of file diff --git a/common/src/main/java/net/william278/huskhomes/player/Player.java b/common/src/main/java/net/william278/huskhomes/player/Player.java new file mode 100644 index 00000000..13b3c540 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/player/Player.java @@ -0,0 +1,67 @@ +package net.william278.huskhomes.player; + +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.teleport.TeleportResult; + +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +/** + * A cross-platform representation of a player + */ +public interface Player { + + /** + * Return the player's name + * + * @return the player's name + */ + String getName(); + + /** + * Return the player's {@link UUID} + * + * @return the player {@link UUID} + */ + UUID getUuid(); + + /** + * Returns the current {@link Position} of this player + * + * @return the player's current {@link Position} + */ + Position getPosition(); + + /** + * Returns if the player has the permission node + * + * @param node The permission node string + * @return {@code true} if the player has the node; {@code false} otherwise + */ + boolean hasPermission(String node); + + void sendMessage(); + + /** + * Returns the maximum number of homes this player can set + * + * @return a {@link CompletableFuture} providing the max number of homes this player can set + */ + CompletableFuture getMaxHomes(); + + /** + * Returns the number of homes this player can set for free + * + * @return a {@link CompletableFuture} providing the max number of homes this player can set + */ + CompletableFuture getFreeHomes(); + + /** + * Teleport the player to a specified {@link Position} + * + * @param position the target {@link Position} to teleport to + * @return A {@link CompletableFuture} callback returning the {@link TeleportResult} of completing the teleport + */ + CompletableFuture teleport(Position position); + +} \ No newline at end of file diff --git a/common/src/main/java/net/william278/huskhomes/position/Home.java b/common/src/main/java/net/william278/huskhomes/position/Home.java new file mode 100644 index 00000000..43ff129f --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/Home.java @@ -0,0 +1,30 @@ +package net.william278.huskhomes.position; + +import net.william278.huskhomes.player.Player; +import org.jetbrains.annotations.NotNull; + +/** + * Represents a home set by a {@link Player} + */ +public class Home extends SavedPosition { + + /** + * The {@link Player} who owns this home + */ + @NotNull + public final Player owner; + + /** + * {@code true} if this home is public + */ + public boolean isPublic; + + public Home(double x, double y, double z, float yaw, float pitch, + @NotNull World world, @NotNull Server server, + @NotNull PositionMeta positionMeta, + @NotNull Player owner, boolean isPublic) { + super(x, y, z, yaw, pitch, world, server, positionMeta); + this.owner = owner; + this.isPublic = isPublic; + } +} diff --git a/common/src/main/java/net/william278/huskhomes/position/Position.java b/common/src/main/java/net/william278/huskhomes/position/Position.java new file mode 100644 index 00000000..3bfeb186 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/Position.java @@ -0,0 +1,57 @@ +package net.william278.huskhomes.position; + +import org.jetbrains.annotations.NotNull; + +/** + * Represents a position somewhere on the proxy network or server + */ +public class Position { + + /** + * The double-precision defined x coordinate of the position + */ + public double x; + + /** + * The double-precision defined y coordinate of the position + */ + public double y; + + /** + * The double-precision defined z coordinate of the position + */ + public double z; + + /** + * The float-precision defined yaw facing of the position + */ + public float yaw; + + /** + * The float-precision defined pitch facing of the position + */ + public float pitch; + + /** + * The {@link World} the position is within + */ + @NotNull + public World world; + + /** + * The {@link Server} the position is on + */ + @NotNull + public Server server; + + public Position(double x, double y, double z, float yaw, float pitch, @NotNull World world, @NotNull Server server) { + this.x = x; + this.y = y; + this.z = z; + this.yaw = yaw; + this.pitch = pitch; + this.world = world; + this.server = server; + } + +} diff --git a/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java b/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java new file mode 100644 index 00000000..12f1e688 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/PositionMeta.java @@ -0,0 +1,27 @@ +package net.william278.huskhomes.position; + +import org.jetbrains.annotations.NotNull; + +/** + * Represents metadata about a {@link Position}, used in {@link SavedPosition} implementations + */ +public class PositionMeta { + + /** + * The name of this position + */ + @NotNull + public String name; + + /** + * A description of this position + */ + @NotNull + public String description; + + public PositionMeta(@NotNull String name, @NotNull String description) { + this.name = name; + this.description = description; + } + +} diff --git a/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java b/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java new file mode 100644 index 00000000..71f0f7e8 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/SavedPosition.java @@ -0,0 +1,16 @@ +package net.william278.huskhomes.position; + +import org.jetbrains.annotations.NotNull; + +public class SavedPosition extends Position { + @NotNull + public final PositionMeta positionMeta; + + public SavedPosition(double x, double y, double z, float yaw, float pitch, + @NotNull World world, @NotNull Server server, + @NotNull PositionMeta positionMeta) { + super(x, y, z, yaw, pitch, world, server); + this.positionMeta = positionMeta; + } + +} diff --git a/common/src/main/java/net/william278/huskhomes/position/Server.java b/common/src/main/java/net/william278/huskhomes/position/Server.java new file mode 100644 index 00000000..7609ce14 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/Server.java @@ -0,0 +1,20 @@ +package net.william278.huskhomes.position; + +import java.util.UUID; + +/** + * Represents a server on a proxied network + */ +public class Server { + + /** + * Proxy-defined identifier of this server + */ + public String id; + + /** + * Plugin-assigned identifier of this server + */ + public UUID uuid; + +} diff --git a/common/src/main/java/net/william278/huskhomes/position/Warp.java b/common/src/main/java/net/william278/huskhomes/position/Warp.java new file mode 100644 index 00000000..bae143a1 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/Warp.java @@ -0,0 +1,16 @@ +package net.william278.huskhomes.position; + +import org.jetbrains.annotations.NotNull; + +/** + * Represents a server warp + */ +public class Warp extends SavedPosition { + + public Warp(double x, double y, double z, float yaw, float pitch, + @NotNull World world, @NotNull Server server, + @NotNull PositionMeta positionMeta) { + super(x, y, z, yaw, pitch, world, server, positionMeta); + } + +} diff --git a/common/src/main/java/net/william278/huskhomes/position/World.java b/common/src/main/java/net/william278/huskhomes/position/World.java new file mode 100644 index 00000000..6f260834 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/position/World.java @@ -0,0 +1,25 @@ +package net.william278.huskhomes.position; + +import java.util.UUID; + +/** + * Represents a world on a server + */ +public class World { + + /** + * The name of this world, as defined by the world directory name + */ + public String name; + + /** + * UUID of this world, as defined by the {@code uid.dat} file in the world directory + */ + public UUID uuid; + + public World(String name, UUID uuid) { + this.name = name; + this.uuid = uuid; + } + +} diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java new file mode 100644 index 00000000..a5507e18 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportResult.java @@ -0,0 +1,46 @@ +package net.william278.huskhomes.teleport; + +import net.william278.huskhomes.position.Position; +import net.william278.huskhomes.position.World; + +/** + * Represents the result of a completed teleport + */ +public enum TeleportResult { + + /** + * Returns if the teleport completed successfully + */ + SUCCESS(true), + + /** + * Returns if the teleport failed because the {@link World} of the + * target {@link Position} could not be found + *

+ */ + FAILED_INVALID_WORLD(false), + + /** + * Returns if the teleport failed because the server of the target + * {@link Position} was invalid or not online + *

+ */ + FAILED_INVALID_SERVER(false), + + /** + * Returns if the teleport failed because the coordinates of the + * target {@link Position} were outside the world border limits + *

+ */ + FAILED_INVALID_COORDINATES(false); + + /** + * Is {@code true} if the teleport was a success + */ + public final boolean successful; + + TeleportResult(boolean successful) { + this.successful = successful; + } + +} diff --git a/common/src/main/java/net/william278/huskhomes/util/Logger.java b/common/src/main/java/net/william278/huskhomes/util/Logger.java new file mode 100644 index 00000000..cb5542dd --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/util/Logger.java @@ -0,0 +1,17 @@ +package net.william278.huskhomes.util; + +import java.util.logging.Level; + +public interface Logger { + + void log(Level level, String message, Exception e); + + void log(Level level, String message); + + void info(String message); + + void severe(String message); + + void config(String message); + +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..2cc42224 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,8 @@ +org.gradle.jvmargs='-Dfile.encoding=UTF-8' + +org.gradle.parallel=true +org.gradle.daemon=true +javaVersion=16 + +plugin_version=3.0 +plugin_archive=huskhomes \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..41d9927a Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..41dfb879 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..1b6c7873 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +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" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@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 execute + +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 execute + +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 + +: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 %* + +: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/plugin/build.gradle b/plugin/build.gradle new file mode 100644 index 00000000..0912057d --- /dev/null +++ b/plugin/build.gradle @@ -0,0 +1,21 @@ +plugins { + id 'maven-publish' +} + +dependencies { + implementation project(path: ':bukkit', configuration: 'shadow') +} + +shadowJar { +} + +publishing { + publications { + mavenJava(MavenPublication) { + groupId = 'net.william278' + artifactId = 'huskhomes-plugin' + version = "$rootProject.version" + artifact shadowJar + } + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..7cbc5301 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,11 @@ +pluginManagement { + repositories { + gradlePluginPortal() + } +} + +rootProject.name = 'HuskHomes' + +include 'common' +include 'bukkit' +include 'plugin' \ No newline at end of file