Initial commit

master
Julius 2019-08-20 17:21:56 +02:00
commit 144d2d3025
35 changed files with 1041 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
**/build/
.gradle/
.idea/

42
VoidPlugin/build.gradle Normal file
View File

@ -0,0 +1,42 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
id 'com.github.johnrengelman.shadow'
id 'net.minecrell.plugin-yml.bukkit'
}
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
api 'org.jetbrains.exposed:exposed:0.17.1'
implementation "com.squareup.moshi:moshi-kotlin:1.8.0"
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
}
bukkit {
main = "nl.voidcorp.mainplugin.VoidPlugin"
apiVersion = '1.13'
author = 'J00LZ'
commands {
memes {
description = "Memes"
}
nick {
description = "Set a nickname (prolly broken if im honest)"
}
heal {
description = "Heal yourself (if you have the permissions to do so)"
permission = 'voidplugin.heal'
permissionMessage = 'You are not allowed to heal yourself!'
}
}
permissions {
'voidplugin.*' {
children = ['voidplugin.heal']
}
'voidplugin.heal' {
description = 'Allows you to heal'
setDefault('OP') // 'TRUE', 'FALSE', 'OP' or 'NOT_OP'
}
}
}

View File

@ -0,0 +1,32 @@
package nl.voidcorp.mainplugin
import nl.voidcorp.mainplugin.commands.VoidCommand
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.command.TabExecutor
class CommandHandler(
private val plugin: VoidPluginBase
) : TabExecutor {
private val commands: MutableMap<String, VoidCommand> = mutableMapOf()
override fun onTabComplete(
sender: CommandSender,
command: Command,
alias: String,
args: Array<out String>
) = commands[command.name]?.onTabComplete(sender, command, alias, args) ?: mutableListOf()
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
return commands[command.name]?.onCommand(sender, command, label, args) ?: false
}
fun registerCommand(commandName: String, command: VoidCommand): CommandHandler {
plugin.getCommand(commandName)?.setExecutor(this)
commands[commandName] = command
return this
}
}

View File

@ -0,0 +1,6 @@
package nl.voidcorp.mainplugin
data class Config(
var databaseUrl: String = "jdbc:sqlite:plugins/VoidPlugin/voidplugin.db",
val driver: String = "org.sqlite.JDBC"
)

View File

@ -0,0 +1,18 @@
package nl.voidcorp.mainplugin
import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
import org.jetbrains.exposed.dao.IntIdTable
object NickTable : IntIdTable() {
val userid = uuid("userid").uniqueIndex()
val nickname = varchar("nickname", 50)
}
class Nick(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<Nick>(NickTable)
var userid by NickTable.userid
var nickname by NickTable.nickname
}

View File

@ -0,0 +1,9 @@
package nl.voidcorp.mainplugin
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
val moshi: Moshi = Moshi.Builder().add(KotlinJsonAdapterFactory()).build()
inline fun <reified T> Moshi.adapter(): JsonAdapter<T> = this.adapter(T::class.java).indent(" ")

View File

@ -0,0 +1,21 @@
package nl.voidcorp.mainplugin
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
import org.jetbrains.exposed.sql.transactions.transaction
object VoidEvents : Listener {
@EventHandler
fun onJoin(evt: PlayerJoinEvent) {
transaction {
val nick = Nick.find { NickTable.userid eq evt.player.uniqueId }.firstOrNull()?.nickname
if (nick != null) {
evt.player.setDisplayName(nick)
}
}
evt.joinMessage = "Hello ${evt.player.displayName}, and welcome to the server!"
}
}

View File

@ -0,0 +1,71 @@
package nl.voidcorp.mainplugin
import nl.voidcorp.mainplugin.commands.HealCommand
import nl.voidcorp.mainplugin.commands.MemeCommand
import nl.voidcorp.mainplugin.commands.NickCommand
import nl.voidcorp.mainplugin.messaging.Message
import nl.voidcorp.mainplugin.messaging.MessageType
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.transactions.transaction
import java.io.File
class VoidPlugin(
override val comment: String = "What are we going to do today?"
) : VoidPluginBase() {
lateinit var conf: Config
var db: Database? = null
override fun enable() {
server.pluginManager.registerEvents(VoidEvents, this)
CommandHandler(this)
.registerCommand("memes", MemeCommand())
.registerCommand("nick", NickCommand())
.registerCommand("heal", HealCommand())
send(name, MessageType.GET_CONFIG)
send(name, MessageType.POST_CONFIG, moshi.adapter<Config>().toJson(conf))
if (db == null)
db = Database.connect(
conf.databaseUrl,
driver = conf.driver
)
transaction {
SchemaUtils.createMissingTablesAndColumns(NickTable)
}
}
override fun disable() {
send(name, MessageType.POST_CONFIG, moshi.adapter<Config>().toJson(conf))
}
override fun recieve(message: Message) {
when (message.messageType) {
MessageType.POST_CONFIG -> {
writeConfig(message.from, message.content)
logger.info("Saved config for ${message.from}")
}
MessageType.GET_CONFIG -> {
if (message.from == name) {
conf = moshi.adapter<Config>().fromJson(readConfig(name))!!
} else {
send(message.from, MessageType.GET_CONFIG, readConfig(message.from))
}
}
}
}
private fun readConfig(filename: String): String {
val config = File(dataFolder.apply { mkdirs() }, "$filename.json")
if (!config.exists()) {
config.createNewFile()
return "{}"
}
return config.readText()
}
private fun writeConfig(filename: String, configString: String) {
val config = File(dataFolder.apply { mkdirs() }, "$filename.json")
config.writeText(configString)
}
}

View File

@ -0,0 +1,54 @@
package nl.voidcorp.mainplugin
import nl.voidcorp.mainplugin.messaging.Message
import nl.voidcorp.mainplugin.messaging.MessageType
import org.bukkit.plugin.java.JavaPlugin
abstract class VoidPluginBase : JavaPlugin() {
final override fun onLoad() {
plugins += this
load()
}
final override fun onEnable() {
enable()
memeLog()
}
final override fun onDisable() {
disable()
}
open fun load() {}
open fun enable() {}
open fun disable() {}
open fun recieve(message: Message) {}
open fun send(message: Message) {
pluginMap[message.to]?.recieve(message)
}
fun send(to: String, messageType: MessageType, content: String = "") = send(Message(to, name, content, messageType))
abstract val comment: String
var doMeme = false
private fun memeLog() {
plugins.last().doMeme = true
if (doMeme)
for (plugin in plugins) {
plugin.logger.info(plugin.comment)
}
}
companion object {
private val plugins = mutableListOf<VoidPluginBase>()
internal val pluginMap: Map<String, VoidPluginBase>
get() = plugins.map { it.name to it }.toMap()
}
}

View File

@ -0,0 +1,19 @@
package nl.voidcorp.mainplugin.commands
import org.bukkit.attribute.Attribute
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
class HealCommand : VoidCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (!sender.hasPermission("voidplugin.heal")) return false
if (sender is Player) {
sender.health = sender.getAttribute(Attribute.GENERIC_MAX_HEALTH)!!.value
sender.saturation = 20f
sender.foodLevel = 20
sender.sendMessage("All better now")
}
return true
}
}

View File

@ -0,0 +1,17 @@
package nl.voidcorp.mainplugin.commands
import org.bukkit.Sound
import org.bukkit.SoundCategory
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
class MemeCommand : VoidCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (sender is Player) {
sender.playSound(sender.location, Sound.ENTITY_CREEPER_PRIMED, SoundCategory.BLOCKS, 10.0f, 1.0f)
sender.sendTitle("Memes", "That's a creeper", 10, 60, 10)
}
return true
}
}

View File

@ -0,0 +1,37 @@
package nl.voidcorp.mainplugin.commands
import nl.voidcorp.mainplugin.Nick
import nl.voidcorp.mainplugin.NickTable
import org.bukkit.ChatColor
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.jetbrains.exposed.sql.transactions.transaction
class NickCommand : VoidCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (sender is Player) {
if (args.isEmpty()) {
sender.sendMessage("Your nickname is ${sender.displayName}")
} else {
val nick = args[0]
transaction {
val n = Nick.find { NickTable.userid eq sender.uniqueId }.firstOrNull()
if (n != null) {
n.nickname = nick + ChatColor.RESET
} else {
Nick.new {
userid = sender.uniqueId
nickname = nick + ChatColor.RESET
}
}
}
sender.setDisplayName(nick)
sender.sendMessage("Set nickname to ${sender.displayName}")
}
}
return true
}
}

View File

@ -0,0 +1,21 @@
package nl.voidcorp.mainplugin.commands
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.command.TabExecutor
abstract class VoidCommand : TabExecutor {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
return false
}
override fun onTabComplete(
sender: CommandSender,
command: Command,
alias: String,
args: Array<out String>
): List<String> {
return mutableListOf()
}
}

View File

@ -0,0 +1,3 @@
package nl.voidcorp.mainplugin.messaging
data class Message(val to: String, val from: String, val content: String, val messageType: MessageType)

View File

@ -0,0 +1,6 @@
package nl.voidcorp.mainplugin.messaging
enum class MessageType {
POST_CONFIG,
GET_CONFIG
}

54
VoidTeleport/build.gradle Normal file
View File

@ -0,0 +1,54 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
id 'com.github.johnrengelman.shadow'
id 'net.minecrell.plugin-yml.bukkit'
}
dependencies {
compileOnly project(":VoidPlugin")
}
bukkit {
main = "nl.voidcorp.teleportplugin.VoidTeleport"
apiVersion = '1.13'
author = 'J00LZ'
depend = ['VoidPlugin']
commands {
home {
description = "Teleport to a home"
}
sethome {
description = "Set a home"
}
delhome {
description = "Delete a home"
}
warp {
description = "Warp to a location"
}
spawn {
description = "Warp to the worldspawn"
}
}
permissions {
'voidteleport.*' {
children = ['voidteleport.setspawn']
}
'voidteleport.home' {
description = "Allows setting a home and teleporting to it"
setDefault("true")
}
'voidteleport.setspawn' {
description = "Allows setting the worldspawn to a different location"
setDefault("OP")
}
'voidteleport.spawn' {
description = "Allows usage of the spawn command"
setDefault("true")
}
}
}

View File

@ -0,0 +1,3 @@
package nl.voidcorp.teleportplugin
data class Config(val allowHome: Boolean = true, val allowSpawn: Boolean = true, val allowTpx: Boolean = true)

View File

@ -0,0 +1,26 @@
package nl.voidcorp.teleportplugin
import nl.voidcorp.mainplugin.CommandHandler
import nl.voidcorp.mainplugin.VoidPluginBase
import nl.voidcorp.teleportplugin.commands.*
import nl.voidcorp.teleportplugin.models.Homes
import nl.voidcorp.teleportplugin.models.Warps
import org.jetbrains.exposed.sql.SchemaUtils
import org.jetbrains.exposed.sql.transactions.transaction
class VoidTeleport(override val comment: String = "Teleport around :D") :
VoidPluginBase() {
override fun enable() {
CommandHandler(this)
.registerCommand("sethome", SetHomeCommand())
.registerCommand("home", HomeCommand())
.registerCommand("delhome", DelHomeCommand())
.registerCommand("warp", WarpCommand())
.registerCommand("spawn",SpawnCommand())
.registerCommand("setworldspawn", SetWorldspawnCommand())
transaction {
SchemaUtils.createMissingTablesAndColumns(Homes, Warps)
}
}
}

View File

@ -0,0 +1,47 @@
package nl.voidcorp.teleportplugin.commands
import nl.voidcorp.mainplugin.commands.VoidCommand
import nl.voidcorp.teleportplugin.models.Homes
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
class DelHomeCommand : VoidCommand() {
override fun onTabComplete(
sender: CommandSender,
command: Command,
alias: String,
args: Array<out String>
): MutableList<String> {
return if (sender is Player) {
val current = args.lastOrNull()
transaction {
Homes.select {
(Homes.userid eq sender.uniqueId) and if (current != null) (Homes.name like "$current%") else Op.TRUE
}.map { it[Homes.name] }.toMutableList()
}
} else mutableListOf()
}
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (sender is Player) {
transaction {
Homes.deleteWhere {
(Homes.userid eq sender.uniqueId) and
(Homes.name eq (args.firstOrNull() ?: "home"))
}
commit()
sender.sendMessage("Delete home '${args.firstOrNull() ?: "home"}'")
}
}
return true
}
}

View File

@ -0,0 +1,43 @@
package nl.voidcorp.teleportplugin.commands
import nl.voidcorp.mainplugin.commands.VoidCommand
import nl.voidcorp.teleportplugin.models.Home
import nl.voidcorp.teleportplugin.models.Homes
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.transactions.transaction
class HomeCommand : VoidCommand() {
override fun onTabComplete(
sender: CommandSender,
command: Command,
alias: String,
args: Array<out String>
): List<String> {
return if (sender is Player) {
val current = args.lastOrNull()
transaction {
Home.find { (Homes.userid eq sender.uniqueId) and (Homes.name like "$current%") }
.map { it.name }.toList()
}
} else mutableListOf()
}
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
return if (sender is Player) {
val where = args.firstOrNull() ?: "home"
transaction {
val res = Home.find { (Homes.userid eq sender.uniqueId) and (Homes.name eq where) }.firstOrNull()
if (res == null) {
sender.sendMessage("The home '$where' does not exist!")
} else {
sender.teleport(res.location)
}
}
true
} else false
}
}

View File

@ -0,0 +1,37 @@
package nl.voidcorp.teleportplugin.commands
import nl.voidcorp.mainplugin.commands.VoidCommand
import nl.voidcorp.teleportplugin.models.Home
import nl.voidcorp.teleportplugin.models.Homes
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
class SetHomeCommand : VoidCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (sender is Player) {
transaction {
val home = Home.find {
(Homes.userid eq sender.uniqueId) and
(Homes.name eq (args.firstOrNull() ?: "home"))
}.any()
if (home) {
sender.sendMessage("The home '${args.firstOrNull() ?: "home"}' already exists!")
} else {
val name = args.firstOrNull() ?: "home"
Home.new {
location = sender.location
this.name = name
userId = sender.uniqueId
}
sender.sendMessage("Created home '$name'")
}
}
}
return true
}
}

View File

@ -0,0 +1,16 @@
package nl.voidcorp.teleportplugin.commands
import nl.voidcorp.mainplugin.commands.VoidCommand
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
class SetWorldspawnCommand : VoidCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if ((sender is Player) && sender.hasPermission("voidteleport.setspawn")) {
sender.world.spawnLocation = sender.location
}
return true
}
}

View File

@ -0,0 +1,15 @@
package nl.voidcorp.teleportplugin.commands
import nl.voidcorp.mainplugin.commands.VoidCommand
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
class SpawnCommand : VoidCommand() {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if ((sender is Player) && sender.hasPermission("voidteleport.spawn")) {
sender.teleport(sender.world.spawnLocation)
}
return true
}
}

View File

@ -0,0 +1,43 @@
package nl.voidcorp.teleportplugin.commands
import nl.voidcorp.mainplugin.commands.VoidCommand
import nl.voidcorp.teleportplugin.models.Warps
import org.bukkit.Bukkit
import org.bukkit.Location
import org.bukkit.command.Command
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.transactions.transaction
class WarpCommand : VoidCommand() {
override fun onTabComplete(
sender: CommandSender,
command: Command,
alias: String,
args: Array<out String>
): List<String> {
return if (sender is Player) {
transaction {
Warps.select { Warps.name like "${args.lastOrNull() ?: ""}%" }.map { it[Warps.name] }
}
} else mutableListOf()
}
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
return if (sender is Player) {
val where = args.firstOrNull() ?: return false
transaction {
val res = Warps.select { (Warps.name eq where) }.firstOrNull()
if (res == null) {
sender.sendMessage("The warp '$where' does not exist!")
} else {
val w = Bukkit.getWorld(res[Warps.world]) ?: throw NullPointerException()
val loc = Location(w, res[Warps.x], res[Warps.y], res[Warps.z], res[Warps.yaw], res[Warps.pitch])
sender.teleport(loc)
}
}
true
} else false
}
}

View File

@ -0,0 +1,30 @@
package nl.voidcorp.teleportplugin.models
import org.bukkit.Bukkit
import org.bukkit.Location
import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
class Home(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<Home>(Homes)
var userId by Homes.userid
var x by Homes.x
var y by Homes.y
var z by Homes.z
var world by Homes.world
var pitch by Homes.pitch
var yaw by Homes.yaw
var name by Homes.name
var location: Location
get() = Location(Bukkit.getWorld(world), x, y, z, yaw, pitch)
set(value) {
this.x = value.x
this.y = value.y
this.z = value.z
this.world = value.world.uid
this.yaw = value.yaw
this.pitch = value.pitch
}
}

View File

@ -0,0 +1,14 @@
package nl.voidcorp.teleportplugin.models
import org.jetbrains.exposed.dao.IntIdTable
object Homes : IntIdTable() {
val userid = uuid("userid")
val x = double("x")
val y = double("y")
val z = double("z")
val world = uuid("world")
val pitch = float("pitch").default(0.0f)
val yaw = float("yaw").default(0.0f)
val name = varchar("name", 50)
}

View File

@ -0,0 +1,30 @@
package nl.voidcorp.teleportplugin.models
import org.bukkit.Bukkit
import org.bukkit.Location
import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.dao.IntEntity
import org.jetbrains.exposed.dao.IntEntityClass
class Warp(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<Warp>(Warps)
var x by Warps.x
var y by Warps.y
var z by Warps.z
var world by Warps.world
var pitch by Warps.pitch
var yaw by Warps.yaw
var name by Warps.name
var location: Location
get() = Location(Bukkit.getWorld(world), x, y, z, yaw, pitch)
set(value) {
this.x = value.x
this.y = value.y
this.z = value.z
this.world = value.world.uid
this.yaw = value.yaw
this.pitch = value.pitch
}
}

View File

@ -0,0 +1,13 @@
package nl.voidcorp.teleportplugin.models
import org.jetbrains.exposed.dao.IntIdTable
object Warps : IntIdTable() {
val world = uuid("world")
val x = double("x")
val y = double("y")
val z = double("z")
val pitch = float("pitch")
val yaw = float("yaw")
val name = varchar("name", 50).uniqueIndex()
}

45
build.gradle Normal file
View File

@ -0,0 +1,45 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.41' apply false
id 'com.github.johnrengelman.shadow' version '5.1.0' apply false
id 'net.minecrell.plugin-yml.bukkit' version '0.3.0' apply false
}
subprojects {
apply plugin: 'java'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.minecrell.plugin-yml.bukkit'
repositories {
jcenter()
maven {
url 'https://papermc.io/repo/repository/maven-public/'
}
maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compileOnly 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
group 'nl.voidcorp.paperplugin'
version '1.0'
sourceCompatibility = 1.8
shadowJar {
destinationDirectory = file("$rootDir/build/libs")
getArchiveClassifier().set(null)
}
}

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
kotlin.code.style=official

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
gradlew vendored Normal file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# 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
;;
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
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
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
gradlew.bat vendored Normal file
View File

@ -0,0 +1,84 @@
@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 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=
@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
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
: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

4
settings.gradle Normal file
View File

@ -0,0 +1,4 @@
rootProject.name = 'VoidPluginBase'
include 'VoidTeleport'
include 'VoidPlugin'