Skip to content

Commit

Permalink
Added initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
kruthers committed Aug 28, 2023
1 parent 71aaa3d commit 25f030a
Show file tree
Hide file tree
Showing 14 changed files with 714 additions and 6 deletions.
26 changes: 22 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.gradle
**/build/
!src/**/build/
!gradle/wrapper/gradle-wrapper.jar

# Ignore Gradle GUI config
gradle-app.setting
Expand All @@ -14,8 +15,25 @@ gradle-app.setting
# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,62 @@
# panda_lib
A Common Libary plugin used by my plugins
# PandaLib

- [About](#about)
- [Included Libraries](#packaged-libraries)
- [How to use](#using-the-library)

---

# About
[^ back to top](#pandalib)

A Common Library plugin containing common libraries and functions for my plugins.

This is mainly used to help keep plugin sizes down and allow for easy cross compatibility

# Packaged Libraries
[^ back to top](#pandalib)

These are the induced libraries and their versions.

- [Kotlin](https://kotlinlang.org/) ![Version](https://img.shields.io/badge/V-1.9.0-green.svg)
- [Cloud](https://github.com/Incendo/cloud/tree/master/docs) ![Version](https://img.shields.io/badge/V-1.7.1-green.svg)
- cloud-core
- cloud-kotlin-extensions
- cloud-paper
- cloud-minecraft-extras
- [Kyori Adventure](https://docs.advntr.dev/index.html) ![Version](https://img.shields.io/badge/V-4.14.0-green.svg)
- adventure-api
- adventure-text-serializer-plain
- adventure-text-minimessage
- adventure-text-feature-pagination ![Version](https://img.shields.io/badge/V-4.0.0%20SNAPSHOT-yellow.svg)

# Using the library
[^ back to top](#pandalib)

To proven clashes with other plugins all the packaged libraries have been relocated to `com.kruthers.lib`

To use on gradle it requires use of [Shadow](https://imperceptiblethoughts.com/shadow/)

### Gradle (Groovy)
```groovy
dependencies {
compileonly "<library here from its sources>"
}
//todo
```

### Gradle (Kotlin DSL)
```groovy
dependencies {
compileonly("<library here from its sources>")
}
tasks {
shadowJar {
relocate("net.kyori","com.kruthers.lib.net.kyori")
relocate("cloud","com.kruthers.lib.cloud")
relocate("kotlin","com.kruthers.lib.kotlin")
}
}
```
78 changes: 78 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
plugins {
kotlin("jvm") version "1.9.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
}

group = project.properties["maven_group"].toString()
version = project.properties["plugin_version"].toString()

repositories {
mavenCentral()
repositories {
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "sonatype-oss-snapshots"
}
}

maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
implementation(kotlin("stdlib"))

//paper
val paperVersion = "${project.properties["minecraft_version"]}-${project.properties["paper_version"]}"
compileOnly("io.papermc.paper","paper-api", paperVersion)


//cloud
val cloudVersion = project.properties["cloud_version"].toString()
implementation("cloud.commandframework","cloud-core",cloudVersion)
implementation("cloud.commandframework","cloud-kotlin-extensions",cloudVersion)
implementation("cloud.commandframework","cloud-paper",cloudVersion)
implementation("cloud.commandframework","cloud-minecraft-extras",cloudVersion)

//kyori
val adventureVersion = project.properties["adventure_version"].toString()
implementation("net.kyori","adventure-api",adventureVersion)
implementation("net.kyori","adventure-text-serializer-plain",adventureVersion)
implementation("net.kyori","adventure-text-minimessage",adventureVersion)

implementation("net.kyori","adventure-text-feature-pagination","4.0.0-SNAPSHOT")

}

tasks {
shadowJar {
archiveClassifier = ""

relocate("net.kyori","com.kruthers.lib.net.kyori")
relocate("cloud","com.kruthers.lib.cloud")
relocate("kotlin","com.kruthers.lib.kotlin")
}
build {
dependsOn(shadowJar)
dependsOn(processResources)
}
processResources {
expand(
"plugin_name" to project.name,
"plugin_version" to project.version,
"maven_group" to project.group,
"kotlin_version" to kotlin.coreLibrariesVersion,
"minecraft_version" to project.properties["minecraft_version"].toString(),
"paper_version" to project.properties["paper_version"].toString(),
"cloud_version" to project.properties["cloud_version"].toString(),
"adventure_version" to project.properties["adventure_version"].toString(),
)
}
}


kotlin {
jvmToolchain(17)
}

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
14 changes: 14 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kotlin.code.style=official

# Plugin Properties
plugin_version=1.0.0
maven_group=com.kruthers

#Minectraft verions
minecraft_version=1.20.1
paper_version=R0.1-SNAPSHOT

#APi Versions
cloud_version=1.7.1
adventure_version=4.14.0

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 25f030a

Please sign in to comment.