Skip to content

Commit

Permalink
v2 rewrite (#12)
Browse files Browse the repository at this point in the history
* v2 rewrite

* untested commands!

* more tweaks?

* hmmm

* finish it
  • Loading branch information
thewilloftheshadow authored Aug 30, 2024
1 parent 8ce7648 commit 0bd48b9
Show file tree
Hide file tree
Showing 21 changed files with 988 additions and 332 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish to GitHub Packages

on:
push:
branches:
- main

jobs:
build-and-publish:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "17"

- name: Grant execute permission for Gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: Publish to GitHub Packages
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
113 changes: 23 additions & 90 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# User-specific stuff
.idea/
.gradle
**/build/
!src/**/build/

*.iml
*.ipr
*.iws
# Ignore Gradle GUI config
gradle-app.setting

# IntelliJ
out/
# 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

# Compiled class file
*.class
Expand All @@ -17,6 +29,9 @@ out/
# BlueJ files
*.ctxt

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

# Package Files #
*.jar
*.war
Expand All @@ -28,86 +43,4 @@ out/

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

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

target/

pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next

release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml

# Common working directory
run/
replay_pid*
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"https://json.schemastore.org/bukkit-plugin.json": "file:///Users/shadow/Documents/Coding/KiaiMC/src/main/resources/plugin.yml"
},
"cSpell.words": [
"kiaimc"
]
"addxp",
"gson",
"kiaimc",
"removexp"
],
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

KiaiMC is a simple plugin that enables players to receive XP in [Kiai](https://kiai.app) for their messages sent in-game.

There are three ways that players can receive XP

1. Players can send messages in-game that will be converted into XP, just like Discord messages would
2. Every X seconds, the user will receive a fixed amount of XP.
3. Every X seconds, the user will receive a "bonus message", where they get the same amount of XP calculated as they would have received if they had sent a message, based on your settings in Kiai on Discord.

This plugin uses [DiscordSRV](https://modrinth.com/plugin/discordsrv) as the linking system between your Minecraft server and Discord server, so make sure that you have it installed and setup using the `linking.yml` file in DiscordSRV's configuration, and have a chat channel set within Discord.

You can use the `global` channel you setup in DiscordSRV to add any multipliers or blacklists to in-game chat. User and role blacklists will be applied based on the Minecraft player's linked Discord account.
Expand All @@ -23,3 +29,9 @@ We are working on a web dashboard to make this process automated, but in the mea

- A unique ID (typically your bot's ID)
- An application name


[KiaiMC] Sending request to https://api.kiai.app/v1/guild/1041045270659604701/virtual_message with body



117 changes: 117 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id("java")
id("java-library")
id("maven-publish")
id("signing")
id("com.gradleup.shadow") version "8.3.0"
}

repositories {
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://nexus.scarsz.me/content/groups/public/")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://repo1.maven.org/maven2/")
maven("https://repo.codemc.org/repository/maven-public/")
}

dependencies {
compileOnly("com.discordsrv:discordsrv:1.28.0")
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
implementation("commons-io:commons-io:2.16.1")
implementation("dev.jorel:commandapi-bukkit-shade:9.5.2")
}

tasks.withType<ShadowJar> {
dependencies {
include(dependency("dev.jorel:commandapi-bukkit-shade:9.5.2"))
include(dependency("org.bstats:bstats-bukkit:3.0.3"))
}

relocate("dev.jorel.commandapi", "com.buape.kiaimc.commandapi")
}

tasks.named<ShadowJar>("shadowJar") {
archiveClassifier.set("")
}

tasks.build {
dependsOn("shadowJar")
}

group = "com.buape"
version = "2.0.0"
description = "KiaiMC - Integrating Kiai's extensive leveling system with Minecraft servers"

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])

pom {
name.set("KiaiMC API")
description.set("KiaiMC - Integrating Kiai's extensive leveling system with Minecraft servers")
url.set("https://github.com/buape/kiaimc")

licenses {
license {
name.set("GNU General Public License, Version 3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
}
}

developers {
developer {
id.set("buape")
name.set("Buape Studios")
email.set("[email protected]")
}
developer {
id.set("thewilloftheshadow")
name.set("Shadow")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:git://github.com/buape/kiaimc.git")
developerConnection.set("scm:git:ssh://github.com:buape/kiaimc.git")
url.set("https://github.com/buape/kiaimc")
}
}
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/buape/kiaimc")
credentials {
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}

signing {
useInMemoryPgpKeys(
System.getenv("GPG_KEY_ID"),
System.getenv("GPG_KEY"),
System.getenv("GPG_KEY_PASSWORD")
)
sign(publishing.publications["mavenJava"])
}

tasks.processResources {
filesMatching("plugin.yml") {
expand("version" to project.version)
}
}
2 changes: 2 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#This file is generated by updateDaemonJvm
toolchainVersion=21
16 changes: 16 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format

[versions]
com-discordsrv-discordsrv = "1.28.0"
com-fasterxml-jackson-core-jackson-databind = "2.17.1"
commons-io-commons-io = "2.16.1"
io-papermc-paper-paper-api = "1.20-R0.1-SNAPSHOT"
org-bstats-bstats-bukkit = "3.0.2"

[libraries]
com-discordsrv-discordsrv = { module = "com.discordsrv:discordsrv", version.ref = "com-discordsrv-discordsrv" }
com-fasterxml-jackson-core-jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "com-fasterxml-jackson-core-jackson-databind" }
commons-io-commons-io = { module = "commons-io:commons-io", version.ref = "commons-io-commons-io" }
io-papermc-paper-paper-api = { module = "io.papermc.paper:paper-api", version.ref = "io-papermc-paper-paper-api" }
org-bstats-bstats-bukkit = { module = "org.bstats:bstats-bukkit", version.ref = "org-bstats-bstats-bukkit" }
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-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0bd48b9

Please sign in to comment.