Skip to content

Commit

Permalink
Merge pull request #75 from Shynixn/development
Browse files Browse the repository at this point in the history
Merge changes to master --release
  • Loading branch information
Shynixn authored Jan 24, 2025
2 parents 8d08e11 + 9c3342c commit 251cd71
Show file tree
Hide file tree
Showing 40 changed files with 598 additions and 875 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ jobs:

- name: Build Java Application
env:
SHYNIXN_MCUTILS_REPOSITORY: ${{ secrets.SHYNIXN_MCUTILS_REPOSITORY }}
SHYNIXN_MCUTILS_REPOSITORY_2025: ${{ secrets.SHYNIXN_MCUTILS_REPOSITORY_2025 }}
run: |
chmod +x gradlew
./gradlew build pluginJars
echo "RELEASE_VERSION=$(./gradlew -q printVersion)" >> $GITHUB_ENV
- name: Create Geyser Customizations
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'main')"
env:
GEYSER_PASSWORD: ${{ secrets.GEYSER_PASSWORD }}
run: |
7z x docs/resources/MCTennis-GeyserMC.7z -p${{ env.GEYSER_PASSWORD }}
- name: Create Github Release
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'main')"
id: create_release
Expand Down Expand Up @@ -77,6 +84,17 @@ jobs:
asset_name: MCTennis-Legacy.jar
asset_content_type: application/jar

- name: Geyser Customizations to Github
if: "contains(github.event.head_commit.message, '--release') && contains(github.ref, 'main')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/MCTennis/MCTennis/MCTennis-GeyserMC.zip
asset_name: MCTennis-GeyserMC.zip
asset_content_type: application/zip

Wiki:
runs-on: ubuntu-latest
if: "contains(github.ref, 'main')"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gradle
.idea
build
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# MCTennis

| branch | status | download |
|--------|----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| main | [![Build Status](https://github.com/Shynixn/MCTennis/workflows/CI/badge.svg?branch=main)](https://github.com/Shynixn/MCTennis<br/>/actions) | [Download latest release](https://github.com/Shynixn/MCtennis/releases) |
| branch | status | download |
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| main | [![Build Status](https://github.com/Shynixn/MCTennis/actions/workflows/main.yml/badge.svg)](https://github.com/Shynixn/MCTennis/actions) | [Download latest release](https://github.com/Shynixn/MCtennis/releases) |
| development | [![Build Status](https://github.com/Shynixn/MCTennis/actions/workflows/main.yml/badge.svg?branch=development)](https://github.com/Shynixn/MCTennis/actions) | |

## Description

Expand Down
145 changes: 77 additions & 68 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,30 @@ plugins {
}

group = "com.github.shynixn"
version = "1.13.0"
version = "1.14.0"

repositories {
mavenLocal()
mavenCentral()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi")
maven("https://repo.opencollab.dev/main/")
maven(System.getenv("SHYNIXN_MCUTILS_REPOSITORY")) // All MCUTILS libraries are private and not OpenSource.
}

tasks.register("printVersion") {
println(version)
maven(System.getenv("SHYNIXN_MCUTILS_REPOSITORY_2025")) // All MCUTILS libraries are private and not OpenSource.
}

dependencies {
// Compile Only
compileOnly("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.6")
compileOnly("org.geysermc.geyser:api:2.2.0-SNAPSHOT")

// Plugin.yml Shade dependencies
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-api:2.20.0")
implementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-core:2.20.0")
implementation("com.google.inject:guice:5.0.1")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.3.0")
implementation("com.fasterxml.jackson.core:jackson-databind:2.2.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
implementation("com.google.code.gson:gson:2.8.6")

// Custom dependencies
implementation("com.github.shynixn.mcutils:common:2024.39")
implementation("com.github.shynixn.mcutils:packet:2024.51")
implementation("com.github.shynixn.mcutils:sign:2024.3")
implementation("com.github.shynixn.mcutils:guice:2024.2")

// Test
testImplementation(kotlin("test"))
testImplementation("org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT")
testImplementation("org.mockito:mockito-core:2.23.0")
}

tasks.test {
useJUnitPlatform()
testLogging.showStandardStreams = true
failFast = true

testLogging {
events(
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STARTED
)
displayGranularity = 0
showExceptions = true
showCauses = true
showStackTraces = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
implementation("com.github.shynixn.mcutils:common:2025.3")
implementation("com.github.shynixn.mcutils:packet:2025.3")
implementation("com.github.shynixn.mcutils:sign:2025.1")
}

tasks.withType<KotlinCompile> {
Expand All @@ -83,7 +48,7 @@ java {
*/
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
dependsOn("jar")
archiveName = "${baseName}-${version}-shadowjar.${extension}"
archiveFileName.set("${archiveBaseName.get()}-${archiveVersion.get()}-shadowjar.${archiveExtension.get()}")
exclude("DebugProbesKt.bin")
exclude("module-info.class")
}
Expand All @@ -102,8 +67,8 @@ tasks.register("pluginJars") {
*/
tasks.register("relocatePluginJar", com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class.java) {
dependsOn("shadowJar")
from(zipTree(File("./build/libs/" + (tasks.getByName("shadowJar") as Jar).archiveName)))
archiveName = "${baseName}-${version}-relocate.${extension}"
from(zipTree(File("./build/libs/" + (tasks.getByName("shadowJar") as Jar).archiveFileName.get())))
archiveFileName.set("${archiveBaseName.get()}-${archiveVersion.get()}-relocate.${archiveExtension.get()}")
relocate("com.fasterxml", "com.github.shynixn.mctennis.lib.com.fasterxml")
relocate("com.github.shynixn.mcutils", "com.github.shynixn.mctennis.lib.com.github.shynixn.mcutils")
}
Expand All @@ -113,9 +78,9 @@ tasks.register("relocatePluginJar", com.github.jengelman.gradle.plugins.shadow.t
*/
tasks.register("pluginJarLatest", com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class.java) {
dependsOn("relocatePluginJar")
from(zipTree(File("./build/libs/" + (tasks.getByName("relocatePluginJar") as Jar).archiveName)))
archiveName = "${baseName}-${version}-latest.${extension}"
// destinationDir = File("C:\\temp\\plugins")
from(zipTree(File("./build/libs/" + (tasks.getByName("relocatePluginJar") as Jar).archiveFileName.get())))
archiveFileName.set("${archiveBaseName.get()}-${archiveVersion.get()}-latest.${archiveExtension.get()}")
// destinationDirectory.set(File("C:\\temp\\plugins"))

exclude("com/github/shynixn/mctennis/lib/com/github/shynixn/mcutils/packet/nms/v1_8_R3/**")
exclude("com/github/shynixn/mctennis/lib/com/github/shynixn/mcutils/packet/nms/v1_9_R2/**")
Expand Down Expand Up @@ -147,9 +112,9 @@ tasks.register("pluginJarLatest", com.github.jengelman.gradle.plugins.shadow.tas
*/
tasks.register("pluginJarPremium", com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class.java) {
dependsOn("relocatePluginJar")
from(zipTree(File("./build/libs/" + (tasks.getByName("relocatePluginJar") as Jar).archiveName)))
archiveName = "${baseName}-${version}-premium.${extension}"
// destinationDir = File("C:\\temp\\plugins")
from(zipTree(File("./build/libs/" + (tasks.getByName("relocatePluginJar") as Jar).archiveFileName.get())))
archiveFileName.set("${archiveBaseName.get()}-${archiveVersion.get()}-premium.${archiveExtension.get()}")
// destinationDirectory.set(File("C:\\temp\\plugins"))

exclude("com/github/shynixn/mcutils/**")
exclude("com/github/shynixn/mccoroutine/**")
Expand All @@ -167,12 +132,11 @@ tasks.register("pluginJarPremium", com.github.jengelman.gradle.plugins.shadow.ta
*/
tasks.register("relocateLegacyPluginJar", com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class.java) {
dependsOn("shadowJar")
from(zipTree(File("./build/libs/" + (tasks.getByName("shadowJar") as Jar).archiveName)))
archiveName = "${baseName}-${version}-legacy-relocate.${extension}"
from(zipTree(File("./build/libs/" + (tasks.getByName("shadowJar") as Jar).archiveFileName.get())))
archiveFileName.set("${archiveBaseName.get()}-${archiveVersion.get()}-legacy-relocate.${archiveExtension.get()}")
relocate("com.github.shynixn.mcutils", "com.github.shynixn.mctennis.lib.com.github.shynixn.mcutils")
relocate("kotlin", "com.github.shynixn.mctennis.lib.kotlin")
relocate("org.intellij", "com.github.shynixn.mctennis.lib.org.intelli")
relocate("org.aopalliance", "com.github.shynixn.mctennis.lib.org.aopalliance")
relocate("org.checkerframework", "com.github.shynixn.mctennis.lib.org.checkerframework")
relocate("org.jetbrains", "com.github.shynixn.mctennis.lib.org.jetbrains")
relocate("org.slf4j", "com.github.shynixn.mctennis.lib.org.slf4j")
Expand All @@ -191,9 +155,10 @@ tasks.register("relocateLegacyPluginJar", com.github.jengelman.gradle.plugins.sh
*/
tasks.register("pluginJarLegacy", com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class.java) {
dependsOn("relocateLegacyPluginJar")
from(zipTree(File("./build/libs/" + (tasks.getByName("relocateLegacyPluginJar") as Jar).archiveName)))
archiveName = "${baseName}-${version}-legacy.${extension}"
from(zipTree(File("./build/libs/" + (tasks.getByName("relocateLegacyPluginJar") as Jar).archiveFileName.get())))
archiveFileName.set("${archiveBaseName.get()}-${archiveVersion.get()}-legacy.${archiveExtension.get()}")
// destinationDir = File("C:\\temp\\plugins")

exclude("com/github/shynixn/mcutils/**")
exclude("org/**")
exclude("kotlin/**")
Expand All @@ -207,29 +172,73 @@ tasks.register("pluginJarLegacy", com.github.jengelman.gradle.plugins.shadow.tas

tasks.register("languageFile") {
val kotlinSrcFolder = project.sourceSets.toList()[0].allJava.srcDirs.first { e -> e.endsWith("kotlin") }
val contractFile = kotlinSrcFolder.resolve("com/github/shynixn/mctennis/contract/Language.kt")
val contractFile = kotlinSrcFolder.resolve("com/github/shynixn/mctennis/contract/MCTennisLanguage.kt")
val resourceFile = kotlinSrcFolder.parentFile.resolve("resources").resolve("lang").resolve("en_us.yml")
val lines = resourceFile.readLines()

val contents = ArrayList<String>()
contents.add("package com.github.shynixn.mctennis.contract")
contents.add("")
contents.add("import com.github.shynixn.mcutils.common.language.LanguageItem")
contents.add("import com.github.shynixn.mcutils.common.language.LanguageProvider")
contents.add("")
contents.add("interface Language : LanguageProvider {")
val contractContents = ArrayList<String>()
contractContents.add("package com.github.shynixn.mctennis.contract")
contractContents.add("")
contractContents.add("import com.github.shynixn.mcutils.common.language.LanguageItem")
contractContents.add("import com.github.shynixn.mcutils.common.language.LanguageProvider")
contractContents.add("")
contractContents.add("interface MCTennisLanguage : LanguageProvider {")
for (key in lines) {
if (key.toCharArray()[0].isLetter()) {
contents.add(" var ${key} LanguageItem")
contents.add("")
contractContents.add(" var ${key} LanguageItem")
contractContents.add("")
}
}
contents.removeLast()
contents.add("}")
contractContents.removeLast()
contractContents.add("}")

contractFile.printWriter().use { out ->
for (line in contents) {
for (line in contractContents) {
out.println(line)
}
}

val implFile = kotlinSrcFolder.resolve("com/github/shynixn/mctennis/MCTennisLanguageImpl.kt")
val implContents = ArrayList<String>()
implContents.add("package com.github.shynixn.mctennis")
implContents.add("")
implContents.add("import com.github.shynixn.mcutils.common.language.LanguageItem")
implContents.add("import com.github.shynixn.mctennis.contract.MCTennisLanguage")
implContents.add("")
implContents.add("class MCTennisLanguageImpl : MCTennisLanguage {")
implContents.add(" override val names: List<String>\n" +
" get() = listOf(\"en_us\")")

for (i in 0 until lines.size) {
val key = lines[i]

if (key.toCharArray()[0].isLetter()) {
var text : String

var j = i
while (true){
if(lines[j].contains("text:")){
text = lines[j]
break
}
j++
}

implContents.add(" override var ${key.replace(":","")} = LanguageItem(${text.replace(" text: ","")})")
implContents.add("")
}
}
implContents.removeLast()
implContents.add("}")

implFile.printWriter().use { out ->
for (line in implContents) {
out.println(line)
}
}
}


tasks.register("printVersion") {
println(version)
}
Binary file added docs/resources/MCTennis-GeyserMC.7z
Binary file not shown.
1 change: 0 additions & 1 deletion docs/wiki/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ MCTennis is a spigot plugin to play tennis games in Minecraft.
* Adds a new playable tennis minigame
* A moving TennisBall without any resource pack
* A customizable physic engine for the TennisBall
* Additionally, works on Bedrock Clients using Geyser
* PlaceHolderApi Support
* Multiple games per server (Patreon Only)

Expand Down
35 changes: 35 additions & 0 deletions docs/wiki/docs/bedrock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Bedrock

MCTennis supports crossplay with Bedrock clients (SmartPhone,Windows,Console, etc.) using [GeyserMC](https://geysermc.org/).

### Initial Setup

* Install [GeyserMC](https://geysermc.org/) on your server or on your proxy server.
* Install MCTennis on your Spigot/Paper based server
* Join your server with a BedRock client and join the MCTennis game ``/mctennis join game1``.
* Observe that the ball will be displayed as a simple player_head because bedrock does not support custom player heads.
* Observe, that the ball will not be able to rotate.

### Fixing skin and rotations via GeyserMC (PatreonOnly)

Thanks to my **Patreon supporters**, who have funded this feature :heart: .
They can download my [prepared zip file](https://www.patreon.com/Shynixn) to easily setup MCTennis for Bedrock.

If you are using the free version of MCTennis, you can still configure MCTennis for Bedrock, but it is more work for you. If you want
to save time, become a patreon member at [https://www.patreon.com/Shynixn](https://www.patreon.com/Shynixn).

=== "Spigot/Paper"

* Download the ``MCTennis-GeyserMC.zip`` file from [https://www.patreon.com/Shynixn](https://www.patreon.com/Shynixn).
* Extract the ``MCTennis-GeyserMC.zip`` contents into your ``plugins\Geyser-Spigot``.
* Extract the ``custom-skulls_mctennis.yml`` into ``plugins\Geyser-Spigot\custom-skulls_mctennis.yml``
* Extract the ``packs/MCTennisPack.mcpack`` into ``plugins\Geyser-Spigot\packs\MCTennisPack.mcpack``
* Copy the ``player-profiles`` values from ``plugins\Geyser-Spigot\custom-skulls_mctennis.yml`` into the ``plugins\Geyser-Spigot\custom-skulls.yml`` file.

=== "Proxies (BungeeCord, Velocity, etc.)"

* Download the ``MCTennis-GeyserMC.zip`` file from [https://www.patreon.com/Shynixn](https://www.patreon.com/Shynixn).
* Extract the ``MCTennis-GeyserMC.zip`` contents into your ``plugins\Geyser-<Proxy>``.
* Extract the ``custom-skulls_mctennis.yml`` into ``plugins\Geyser-<Proxy>\custom-skulls_mctennis.yml``
* Extract the ``packs/MCTennisPack.mcpack`` into ``plugins\Geyser-<Proxy>\packs\MCTennisPack.mcpack``
* Copy the ``player-profiles`` values from ``plugins\Geyser-<Proxy>\custom-skulls_mctennis.yml`` into the ``plugins\Geyser-<Proxy>\custom-skulls.yml`` file.
31 changes: 31 additions & 0 deletions docs/wiki/docs/sign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Signs

This page explains how to create signs for joining and leave.

### Create a join sign

* Place a new sign in your world
* Execute the following command:

```
/mctennis sign game1 join
```

* Rightclick on a sign
* This sign simply executes the ``/mctennis join`` command on behalf of the player. You can create team join signs by searching for the created sign in your ``game1.yml`` and editing the command to e.g. ``/mctennis join red``

### Create a leave sign

* Place a new sign in your world
* Execute the following command:

```
/mctennis sign game1 leave
```

* Rightclick on a sign
* This sign simply executes the ``/mctennis leave`` command on behalf of the player.

### Removing a sign

* Simply destroy the sign with your hand
2 changes: 2 additions & 0 deletions docs/wiki/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ nav:
- Permission: permission.md
- Creating the game: game.md
- Interactions: interaction.md
- Signs: sign.md
- Bedrock: bedrock.md
- Commands: commands.md
- PlaceHolders: placeholders.md
- Developer Api: api.md
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
kotlin.code.style=official
org.gradle.jvmargs=-Xms4g
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
6 changes: 0 additions & 6 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
rootProject.name = "mctennis"

pluginManagement {
plugins {
kotlin("jvm") version "1.6.21"
}
}
Loading

0 comments on commit 251cd71

Please sign in to comment.