Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Taucher2003 authored Sep 13, 2024
0 parents commit a5c6a97
Show file tree
Hide file tree
Showing 12 changed files with 669 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Gradle Upload

on:
push:
branches:
- main

jobs:
upload:
name: Upload to server
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4.1.7
- uses: gradle/wrapper-validation-action@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 21
- name: Build with Gradle
run: ./gradlew --build-cache test build
- name: Publish
run: ./gradlew uploadJar
env:
UPLOAD_URL: ${{ secrets.UPLOAD_URL }}
151 changes: 151 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# Created by https://www.toptal.com/developers/gitignore/api/intellij,gradle,java
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij,gradle,java

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### Gradle ###
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### Gradle Patch ###
# Java heap dump
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/intellij,gradle,java
.envrc
.direnv
shell.nix
run
Binary file added .gradle/file-system.probe
Binary file not shown.
85 changes: 85 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.nio.file.Files

plugins {
java
`maven-publish`
id("com.gradleup.shadow") version "8.3.1"
id("xyz.jpenilla.run-paper") version "2.3.1"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("io.papermc.paperweight.userdev") version "1.7.2"
}

repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-releases/")
}

group = "club.devcord.gamejam"
version = "1.0.0"
description = "gamejam"

dependencies {
testImplementation("junit:junit:4.13.2")
paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
compileOnly("de.chojo.pluginjam:plugin-paper:1.0.3")
}

paperweight {
reobfArtifactConfiguration = ReobfArtifactConfiguration.MOJANG_PRODUCTION
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}

tasks {
compileJava {
options.encoding = "UTF-8"
}

runServer {
minecraftVersion("1.21.1")
}

register("uploadJar") {
dependsOn(jar)

doLast {
val filePath = project.tasks.jar.get().archiveFile.get().asFile.toPath()
// Add the upload api url to your repo secrets under UPLOAD_URL
// Obtain the upload url via /team api
val apiUrl = System.getenv("UPLOAD_URL") ?: throw RuntimeException("Please set UPLOAD_URL in your github secrets")
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create(apiUrl))
//.uri(URI.create("$apiUrl?restart=true"))
.header("Content-Type", "application/octet-stream")
.POST(HttpRequest.BodyPublishers.ofByteArray(Files.readAllBytes(filePath)))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
if (response.statusCode() != 202) throw RuntimeException("Could not upload:\n" + response.body())
println("Upload successful")
}
}
}

bukkit {
name = "GameJamPlugin"
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.STARTUP
main = "club.devcord.gamejam.JamPlugin"
apiVersion = "1.21"
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit a5c6a97

Please sign in to comment.