Skip to content

Commit

Permalink
Move away from google java format
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Apr 4, 2024
1 parent 3bc251c commit e75c0b7
Show file tree
Hide file tree
Showing 279 changed files with 7,848 additions and 7,722 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true
ij_continuation_indent_size = 2
ij_java_keep_simple_blocks_in_one_line = false
ij_java_keep_simple_classes_in_one_line = true
ij_java_keep_simple_lambdas_in_one_line = true
ij_java_keep_simple_methods_in_one_line = true
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 🐞 Bug
description: File a bug/issue report
labels: ["type: :bug: bug"]
labels: [ "type: :bug: bug" ]

body:
- type: checkboxes
Expand All @@ -11,8 +11,8 @@ body:
Tip: You can go to the [GitHub issue tab](https://github.com/AlexProgrammerDE/SoulFire/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+%3Abug%3A+bug%22) for a list of open issues
options:
- label: I have searched the existing issues
required: true
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Describe your issue
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 💡 Feature Request
description: Request a feature/enhancement
labels: ["type: :bulb: enhancement"]
labels: [ "type: :bulb: enhancement" ]

body:
- type: checkboxes
Expand All @@ -11,8 +11,8 @@ body:
Tip: You can go to the [GitHub issue tab](https://github.com/AlexProgrammerDE/SoulFire/labels/type%3A%20%3Abulb%3A%20enhancement) for a list of open feature requests
options:
- label: I have searched the existing feature requests
required: true
- label: I have searched the existing feature requests
required: true
- type: textarea
attributes:
label: Describe your feature request
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Java CI with Gradle
on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build:
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Package with jpackage
run: |
$projectVersion = Select-String -Path gradle.properties -Pattern '^maven_version=' | ForEach-Object { $_.ToString().Split('=')[1] }
$projectVersionStripped = $projectVersion -replace '-SNAPSHOT', ''
$projectVersionStripped = $projectVersion -replace '-SNAPSHOT', ''
jpackage --app-version $projectVersionStripped --main-jar "SoulFireClient-$projectVersion.jar" "@installer/jpackage.cfg" "@installer/jpackage-windows.cfg"
- name: Upload installer
uses: actions/upload-artifact@v4
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ jobs:
dependency-submission:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
with:
build-scan-publish: true
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-service-agree: "yes"
env:
DEPENDENCY_GRAPH_EXCLUDE_PROJECTS: ':(buildSrc|data\-generator)'
- name: Checkout sources
uses: actions/checkout@v4
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
with:
build-scan-publish: true
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-service-agree: "yes"
env:
DEPENDENCY_GRAPH_EXCLUDE_PROJECTS: ':(buildSrc|data\-generator)'
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Contributing to SoulFire

Thank you for considering to contribute to SoulFire! Please read the following paragraphs about how to adapt your code style.
Thank you for considering to contribute to SoulFire! Please read the following paragraphs about how to adapt your code
style.

## Code style

This project uses the google-java-format loosely. While most recommended options are enforced, some others are not.
As a rule of thumb, if your IDE spits the same code out with the "Reformat" task, it should be fine.

To setup the google java format, please read the official page and follow the instructions for your IDE:
https://github.com/google/google-java-format
This project does not have a strict code style.
However we will only accept pull requests that use the format specified in `.editorconfig`.

### Var keyword

Expand All @@ -20,4 +18,5 @@ those should be abbreviated to `var map = new HashMap<String, String>()`

If you use IntelliJ you can import the file `config/checkstyle/checkstyle.xml` under `Settings -> Editor -> Code Style`.
(Requires the Checkstyle plugin to be installed)
You can also import the recommended inspections at `config/intellij_inspections.xml` at `Settings -> Editor -> Inspections`.
You can also import the recommended inspections at `config/intellij_inspections.xml`
at `Settings -> Editor -> Inspections`.
46 changes: 7 additions & 39 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
This document is intended to help developers get started with the project and learn how to learn the tools used.

## Protocol Sniffing

To learn about how some packets are structured and their data works, you need a MITM proxy. This is a proxy that sits between the client and the server and can intercept and modify packets.
`
To learn about how some packets are structured and their data works, you need a MITM proxy. This is a proxy that sits
between the client and the server and can intercept and modify packets.
This is useful for learning how the client and server communicate and how to modify packets to get the desired result.

### pakkit
Expand All @@ -14,42 +15,9 @@ GitHub: https://github.com/Heath123/pakkit
### SniffCraft

GitHub: https://github.com/adepierre/SniffCraft

`
## MC Data

### Chunk Data

How do you calculate bitPerEntry on chunks???
It's the log2(maxBlockStateId). Download the latest mc server jar and run:

```bash
java -DbundlerMainClass=net.minecraft.data.Main -jar server.jar --all
```

Then go into the generated folder `generated/reports`. Then execute:
```bash
state_ids=$(jq -r '.[].states[].id' assets/minecraft/blocks.json)

# Sort the IDs in descending order and get the highest one
highest_id=$(echo "${state_ids}" | sort -rn | head -n 1)

echo "The highest state ID is ${highest_id}"
```

Take the ID, log2 it and then round up. That's your `bitsPerEntry`.

## Update to a newer mc version

### Dependencies

- Update MCProtocolLib
- Update ViaVersion

### Translations

Replace `assets/minecraft/en_us.json` with a newer version from:
https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.20/assets/minecraft/lang/en_us.json

### Update code

Replace the latest version in SFConstants.
All data that SoulFire sources from the Minecraft game are inside the
`data-generator` module. Inside of it run `runServer` and it'll generate all
files for SoulFire into the `data-generator/run/minecraft-data` directory.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ performance.

> [!WARNING]
> This is a very powerful tool that shall only be used to attack your own servers. Ensure your own DDoS protection
> provider, and your host are okay with stress-tests. If you use this software to attack others, you make yourself (or your
> provider, and your host are okay with stress-tests. If you use this software to attack others, you make yourself (or
> your
> legal guardians) criminally liable; the developers of SoulFire are not responsible for your own actions.
---
Expand Down Expand Up @@ -58,7 +59,8 @@ SoulFire supports many versions of Minecraft, including releases, april fools sn
classic (including [CPE](https://wiki.vg/Classic_Protocol_Extension)) and even Minecraft Bedrock edition,
and that includes every single subversion, not just a few specific versions.

You can find an up-to-date list of supported versions in the [documentation](https://soulfiremc.com/docs/usage/versions).
You can find an up-to-date list of supported versions in
the [documentation](https://soulfiremc.com/docs/usage/versions).

### How does this work?

Expand Down
40 changes: 20 additions & 20 deletions build-data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
plugins {
`sf-project-conventions`
alias(libs.plugins.blossom)
`sf-project-conventions`
alias(libs.plugins.blossom)
}

sourceSets {
main {
blossom {
javaSources {
property("version", rootProject.version.toString())
property("description", rootProject.description)
property("url", "https://soulfiremc.com")
property("commit", indraGit.commit()?.name ?: "unknown")
}
}
main {
blossom {
javaSources {
property("version", rootProject.version.toString())
property("description", rootProject.description)
property("url", "https://soulfiremc.com")
property("commit", indraGit.commit()?.name ?: "unknown")
}
}
}
}

idea {
module {
generatedSourceDirs.addAll(
listOf(
project.layout.buildDirectory
.dir("generated/sources/blossom/main/java")
.get().asFile,
)
)
}
module {
generatedSourceDirs.addAll(
listOf(
project.layout.buildDirectory
.dir("generated/sources/blossom/main/java")
.get().asFile,
)
)
}
}
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
base
base
}

allprojects {
group = "com.soulfiremc"
version = property("maven_version")!!
description = "Advanced Minecraft Server-Stresser Tool."
group = "com.soulfiremc"
version = property("maven_version")!!
description = "Advanced Minecraft Server-Stresser Tool."
}
20 changes: 10 additions & 10 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
plugins {
`kotlin-dsl`
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
mavenCentral()
gradlePluginPortal()
mavenCentral()
}

dependencies {
// this is OK as long as the same version catalog is used in the main build and build-logic
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(libs.gradle.plugin.shadow)
implementation(libs.gradle.plugin.licenser)
implementation(libs.gradle.plugin.lombok)
implementation(libs.gradle.plugin.indra.git)
// this is OK as long as the same version catalog is used in the main build and build-logic
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(libs.gradle.plugin.shadow)
implementation(libs.gradle.plugin.licenser)
implementation(libs.gradle.plugin.lombok)
implementation(libs.gradle.plugin.indra.git)
}
8 changes: 4 additions & 4 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

rootProject.name = "soulfire-buildsrc"
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/LibsAccessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType

val Project.libs: LibrariesForLibs
get() = rootProject.extensions.getByType()
get() = rootProject.extensions.getByType()
14 changes: 7 additions & 7 deletions buildSrc/src/main/kotlin/sf-checkstyle-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
plugins {
checkstyle
checkstyle
}

checkstyle {
maxErrors = 0
maxWarnings = 0
toolVersion = libs.checkstyle.get().version.toString()
maxErrors = 0
maxWarnings = 0
toolVersion = libs.checkstyle.get().version.toString()
}

// To fix a conflict in checkstyle dependencies
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:" + libs.guava.get().version)
}
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:" + libs.guava.get().version)
}
}
Loading

0 comments on commit e75c0b7

Please sign in to comment.