-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
127 lines (110 loc) · 4.26 KB
/
build.gradle
File metadata and controls
127 lines (110 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
plugins {
id 'java'
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.3'
}
ext {
hytaleHome = "C:\\Users\\alber\\AppData\\Roaming\\Hytale"
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
withSourcesJar()
withJavadocJar()
}
// Quiet warnings about missing Javadocs.
javadoc {
options.addStringOption('Xdoclint:-missing', '-quiet')
}
repositories {
mavenCentral()
maven { url 'https://dl.cloudsmith.io/public/lio/neotale/maven/' }
}
// Adds the Hytale server as a build dependency, allowing you to reference and
// compile against their code. This requires you to have Hytale installed using
// the official launcher for now.
dependencies {
implementation(files("$hytaleHome/install/$patchline/package/game/latest/Server/HytaleServer.jar"))
// implementation "net.liopyu:neotale:${neoTaleVersion}"
compileOnly("org.projectlombok:lombok:1.18.42")
annotationProcessor("org.projectlombok:lombok:1.18.42")
}
// Create the working directory to run the server if it does not already exist.
def serverRunDir = file("$projectDir/run")
if (!serverRunDir.exists()) {
serverRunDir.mkdirs()
}
// Updates the manifest.json file with the latest properties defined in the
// build.properties file. Currently we update the version and if packs are
// included with the plugin.
tasks.register('updatePluginManifest') {
def manifestFile = file('src/main/resources/manifest.json')
doLast {
if (!manifestFile.exists()) {
throw new GradleException("Could not find manifest.json at ${manifestFile.path}!")
}
def manifestJson = new groovy.json.JsonSlurper().parseText(manifestFile.text)
manifestJson.Version = version
manifestJson.IncludesAssetPack = includes_pack.toBoolean()
manifestFile.text = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(manifestJson))
}
}
def modsRunDir = file("$serverRunDir/mods")
tasks.register('prepareRunMods', Sync) {
dependsOn 'jar'
into modsRunDir
from(tasks.named('jar').flatMap { it.archiveFile })
from(configurations.runtimeClasspath) {
include '**/*.jar'
exclude 'HytaleServer.jar'
}
}
tasks.named('processResources') {
dependsOn 'updatePluginManifest'
}
def pluginDirForModsArg = sourceSets.main.java.srcDirs.first().parentFile.absolutePath
def assetsZipPath = file("$hytaleHome/install/$patchline/package/game/latest/Assets.zip").absolutePath
def serverJarPath = file("$hytaleHome/install/$patchline/package/game/latest/Server/HytaleServer.jar").absolutePath
idea.project.settings.runConfigurations {
'HytaleServer'(org.jetbrains.gradle.ext.Application) {
mainClass = 'com.hypixel.hytale.Main'
moduleName = project.idea.module.name + '.main'
programParameters = "--allow-op --assets=\"$hytaleHome/install/$patchline/package/game/latest/Assets.zip\""
if (includes_pack.toBoolean()) {
programParameters += " --mods=${sourceSets.main.java.srcDirs.first().parentFile.absolutePath}"
}
if (load_user_mods.toBoolean()) {
programParameters += " --mods=$hytaleHome/UserData/Mods"
}
workingDirectory = serverRunDir.absolutePath
}
}
//idea.project.settings.runConfigurations {
// 'HytaleServer'(org.jetbrains.gradle.ext.Application) {
// mainClass = 'com.hypixel.hytale.Main'
// moduleName = project.idea.module.name + '.main'
// jvmArgs = "-Xms4G -Xmx10G"
//
// programParameters = "--allow-op --assets=\"${assetsZipPath}\" --mods=\"${modsRunDir.absolutePath}\""
//
// if (load_user_mods.toBoolean()) {
// programParameters += " --mods=\"$hytaleHome/UserData/Mods\""
// }
//
// workingDirectory = serverRunDir.absolutePath
// }
//}
tasks.register('runServer', JavaExec) {
group = 'hytale'
description = 'Runs the Hytale server with this plugin and default assets.'
dependsOn 'prepareRunMods'
classpath = files(serverJarPath)
mainClass = 'com.hypixel.hytale.Main'
workingDir = serverRunDir
jvmArgs "-Xms4G", "-Xmx10G"
args '--allow-op', "--assets=${assetsZipPath}"
if (load_user_mods.toBoolean()) {
args "--mods=$hytaleHome/UserData/Mods"
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}