Skip to content

Commit 0fffa21

Browse files
committed
Fix paperclip updating
1 parent a3f50b2 commit 0fffa21

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

src/main/groovy/ru/endlesscode/bukkitgradle/DevServerPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DevServerPlugin implements Plugin<Project> {
2626
PrepareServer prepareServer = project.task(
2727
'prepareServer',
2828
type: PrepareServer,
29-
dependsOn: ['build', 'copyServerCore', 'downloadPaperclip']
29+
dependsOn: ['build', 'copyServerCore']
3030
) {
3131
group = BukkitGradlePlugin.GROUP
3232
description = 'Prepare server ro run. Configure server and copy compiled plugin to plugins dir'

src/main/groovy/ru/endlesscode/bukkitgradle/server/ServerCore.groovy

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class ServerCore {
2525
private static final String BUILDTOOLS_HOME_ENV = "BUILDTOOLS_HOME"
2626
private static final String MAVEN_METADATA = "maven-metadata.xml"
2727
private static final String PAPER_VERSIONS = "paper-versions.json"
28+
private static final String PAPERCLIP_FILE = "paperclip.jar"
2829
private static final String FALLBACK_VERSION = "1.12.2"
2930

3031
private final Project project
@@ -33,7 +34,7 @@ class ServerCore {
3334
private boolean forceRebuild = false
3435
private Properties localProps = new Properties()
3536

36-
private Closure<CoreType> coreType = { project.bukkit.run.coreType }
37+
private Closure<CoreType> getCoreType = { project.bukkit.run.coreType }
3738
private String paperBuild = "lastSuccessfulBuild"
3839

3940
ServerCore(Project project) {
@@ -93,7 +94,7 @@ class ServerCore {
9394
description = 'Download BuildTools)'
9495

9596
// Skip it for not spigot
96-
if (coreType() != CoreType.SPIGOT) {
97+
if (getCoreType() != CoreType.SPIGOT) {
9798
enabled = false
9899
return
99100
}
@@ -139,7 +140,7 @@ class ServerCore {
139140
}
140141

141142
src 'https://ci.destroystokyo.com/job/Paper/lastSuccessfulBuild/artifact/paperclip.jar'
142-
dest destDir.resolve(CORE_NAME).toString()
143+
dest bukkitGradleDir.toString()
143144
onlyIfModified true
144145
}
145146
}
@@ -197,20 +198,24 @@ class ServerCore {
197198
private void registerCoreCopyTask() {
198199
project.with {
199200
task('copyServerCore', type: Copy,
200-
dependsOn: ['buildServerCore']) {
201+
dependsOn: ['buildServerCore', 'downloadPaperclip']) {
201202
group = BukkitGradlePlugin.GROUP
202-
description = 'Copy built server core to server directory'
203-
204-
if (!tasks.buildServerCore.enabled) {
205-
enabled = false
206-
return
203+
description = 'Copy server core to server directory'
204+
205+
def srcDir
206+
def fileName
207+
if (getCoreType() == CoreType.SPIGOT) {
208+
srcDir = MavenApi.getSpigotDir(coreVersion)
209+
fileName = getSpigotCoreName()
210+
} else {
211+
srcDir = bukkitGradleDir
212+
fileName = PAPERCLIP_FILE
207213
}
208214

209-
def coreName = getSpigotCoreName()
210-
from MavenApi.getSpigotDir(coreVersion)
211-
include coreName
212-
rename(coreName, CORE_NAME)
213-
into getServerDir().toString()
215+
from srcDir
216+
include fileName
217+
rename(fileName, CORE_NAME)
218+
into serverDir.toString()
214219
}
215220
}
216221
}
@@ -300,7 +305,7 @@ class ServerCore {
300305
* @return Real Bukkit version
301306
*/
302307
private String getCoreVersion() {
303-
switch (coreType()) {
308+
switch (getCoreType()) {
304309
case CoreType.SPIGOT:
305310
return getSpigotCoreVersion()
306311
case CoreType.PAPER:

0 commit comments

Comments
 (0)