Skip to content

Commit 241379d

Browse files
Merge pull request #19 from p0t4t0sandwich/java
Merge Java into the monorepo
2 parents a3c4053 + 1ea3e76 commit 241379d

File tree

125 files changed

+11162
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+11162
-12
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,49 @@ API module inheritance for different instance types:
2222

2323
<https://github.com/p0t4t0sandwich/ampapi-spec/blob/main/ModuleInheritance.json>
2424

25-
## AMP API and Library Info
26-
27-
### API docs
25+
## API docs
2826

2927
Go to `http(s)://your.domain.com/API` to see the API docs.
3028

31-
### Libraries
29+
## Libraries
30+
31+
### C\#
3232

33-
#### C#
3433
- [Developer Licence Usage](https://github.com/cubecoders/amp/wiki/Getting-started-with-AMP-developer-licences)
3534
- Examples:
3635
- [SampleAMPModule](https://github.com/CubeCoders/SampleAMPModule) - official code example
3736
- [AMP-Discord-Bot](https://github.com/winglessraven/AMP-Discord-Bot) - a great community developed Discord bot
38-
#### NodeJS
37+
38+
### NodeJS
39+
3940
- [ampapi-node](https://github.com/CubeCoders/ampapi-node) - bare bones, but generates new methods on the fly, not requiring library updates
4041
- [ampapi-js](https://github.com/p0t4t0sandwich/ampapi-js) - auto-generated from the API, includes `d.ts` type definitions and code-completion
4142
- Examples:
4243
- [taterland-discord-bot](https://github.com/p0t4t0sandwich/taterland-discord-bot)
43-
#### Python
44-
- [ampapi-py](https://github.com/p0t4t0sandwich/ampapi-py) - auto-generated from the API, though a bit bland in terms of tooling
44+
45+
### Python
46+
4547
- [AMPAPI_Python](https://github.com/k8thekat/AMPAPI_Python) - built with developer experiences in mind, with all the bells and whistles you'll need
4648
- Examples:
4749
- [GatekeeperV2](https://github.com/k8thekat/GatekeeperV2)
48-
#### Java
49-
- [ampapi-java](https://github.com/p0t4t0sandwich/ampapi-java)
50+
- [ampapi-py](https://github.com/p0t4t0sandwich/ampapi/tree/main/readmes/Python.md) - auto-generated from the API, though a bit bland in terms of tooling
51+
52+
### Java
53+
54+
- [ampapi-java](https://github.com/p0t4t0sandwich/ampapi/tree/main/readmes/Java.md)
5055
- Examples:
5156
- [ServerPanelManager](https://github.com/p0t4t0sandwich/ServerPanelManager)
5257
- [taterlib-ci](https://github.com/p0t4t0sandwich/taterlib-ci)
5358
- [CustomServerManager](https://github.com/p0t4t0sandwich/CustomServerManager)
54-
#### Go/Golang
59+
60+
### Go/Golang
61+
5562
- [ampapi-go](https://github.com/p0t4t0sandwich/ampapi-go)
5663
- Examples:
5764
- [ampapi-stats-wrapper](https://github.com/p0t4t0sandwich/ampapi-stats-wrapper)
58-
#### Rust
65+
66+
### Rust
67+
5968
- [ampapi-rs](https://github.com/p0t4t0sandwich/ampapi-rs)
6069

6170
### Work in Progress

libraries/java/.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Compiled class file
2+
*.class
3+
4+
# Log file
5+
*.log
6+
7+
# BlueJ files
8+
*.ctxt
9+
10+
# Mobile Tools for Java (J2ME)
11+
.mtj.tmp/
12+
13+
# Package Files #
14+
*.jar
15+
*.war
16+
*.nar
17+
*.ear
18+
*.zip
19+
*.tar.gz
20+
*.rar
21+
22+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23+
hs_err_pid*
24+
replay_pid*
25+
26+
# Build files
27+
build
28+
bin
29+
target
30+
run
31+
libs
32+
33+
# Gradle
34+
.gradle
35+
36+
# IntelliJ
37+
.idea
38+
*.iml
39+
*.ipr
40+
*.iws

libraries/java/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Dylan Sperrer
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

libraries/java/build.gradle.kts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
plugins {
2+
id("java")
3+
id("maven-publish")
4+
id("com.diffplug.spotless") version("7.0.2")
5+
id("xyz.wagyourtail.jvmdowngrader") version("1.2.2")
6+
}
7+
8+
group = "dev.neuralnexus"
9+
version = "2608.3.0"
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
dependencies {
16+
compileOnly("org.jetbrains:annotations:24.1.0")
17+
implementation("com.google.code.gson:gson:2.12.1")
18+
implementation("com.github.sviperll:result4j:1.2.0")
19+
}
20+
21+
spotless {
22+
format("misc") {
23+
target("*.gradle", ".gitattributes", ".gitignore")
24+
trimTrailingWhitespace()
25+
leadingTabsToSpaces()
26+
endWithNewline()
27+
}
28+
java {
29+
importOrder()
30+
removeUnusedImports()
31+
cleanthat()
32+
googleJavaFormat("1.24.0")
33+
.aosp()
34+
.formatJavadoc(true)
35+
.reorderImports(true)
36+
formatAnnotations()
37+
licenseHeader("""/**
38+
* Copyright (c) 2025 Dylan Sperrer - dylan@sperrer.ca
39+
* This project is Licensed under <a href="https://github.com/p0t4t0sandwich/ampapi/blob/main/LICENSE">MIT</a>
40+
*/
41+
"""
42+
)
43+
}
44+
}
45+
46+
tasks.withType<JavaCompile>().configureEach {
47+
options.encoding = "UTF-8"
48+
}
49+
50+
java {
51+
withSourcesJar()
52+
withJavadocJar()
53+
val javaVersion = JavaVersion.toVersion(21)
54+
sourceCompatibility = javaVersion
55+
targetCompatibility = javaVersion
56+
if (JavaVersion.current() < javaVersion) {
57+
toolchain.languageVersion = JavaLanguageVersion.of(21)
58+
}
59+
}
60+
61+
tasks.downgradeJar {
62+
downgradeTo = JavaVersion.VERSION_1_8
63+
dependsOn(tasks.spotlessApply)
64+
}
65+
66+
tasks.shadeDowngradedApi {
67+
downgradeTo = JavaVersion.VERSION_1_8
68+
shadePath = {
69+
it.substringBefore(".")
70+
.substringBeforeLast("-")
71+
.replace(Regex("[.;\\[/]"), "-")
72+
.replace("ampapi", "dev/neuralnexus/ampapi/jvmdg")
73+
}
74+
archiveClassifier.set("downgraded-8-shaded")
75+
}
76+
77+
tasks.assemble {
78+
dependsOn(tasks.shadeDowngradedApi)
79+
}
80+
81+
tasks.withType<GenerateModuleMetadata> {
82+
enabled = false
83+
}
84+
85+
publishing {
86+
repositories {
87+
mavenLocal()
88+
maven("https://maven.neuralnexus.dev/releases") {
89+
name = "NeuralNexusReleases"
90+
credentials {
91+
username = project.findProperty("neuralNexusUsername") as? String ?: System.getenv("NEURALNEXUS_USERNAME") ?: ""
92+
password = project.findProperty("neuralNexusPassword") as? String ?: System.getenv("NEURALNEXUS_PASSWORD") ?: ""
93+
}
94+
}
95+
maven("https://maven.neuralnexus.dev/snapshots") {
96+
name = "NeuralNexusSnapshots"
97+
credentials {
98+
username = project.findProperty("neuralNexusUsername") as? String ?: System.getenv("NEURALNEXUS_USERNAME") ?: ""
99+
password = project.findProperty("neuralNexusPassword") as? String ?: System.getenv("NEURALNEXUS_PASSWORD") ?: ""
100+
}
101+
}
102+
}
103+
publications {
104+
create<MavenPublication>("maven") {
105+
from(components["java"])
106+
artifact(tasks.downgradeJar.get())
107+
artifact(tasks.shadeDowngradedApi.get())
108+
}
109+
}
110+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)