Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Jan 7, 2023
1 parent 9310fd6 commit 868cdd7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 112 deletions.
99 changes: 6 additions & 93 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,13 @@
# TemplatePlugin
# NoPayloadConveyorCrashPlugin

[![Xpdustry latest](https://maven.xpdustry.fr/api/badge/latest/releases/fr/xpdustry/template?color=00FFFF&name=TemplatePlugin&prefix=v)](https://github.com/Xpdustry/TemplatePlugin/releases)
[![Build status](https://github.com/Xpdustry/TemplatePlugin/actions/workflows/build.yml/badge.svg?branch=master&event=push)](https://github.com/Xpdustry/TemplatePlugin/actions/workflows/build.yml)
[![Mindustry 7.0 ](https://img.shields.io/badge/Mindustry-7.0-ffd37f)](https://github.com/Anuken/Mindustry/releases)

**Xpdustry variation for publishing packages to our repo.**
This plugin prevents players from crashing a server by constantly changing the direction of a payload conveyor router.

Get your Mindustry plugin started with this awesome template repository, it features :

- GitHub actions for easier testing (the plugin is built for each commit and pull request).

- [Toxopid](https://plugins.gradle.org/plugin/fr.xpdustry.toxopid) Gradle plugin for faster Mindustry plugin
development and testing.

- [Indra](https://plugins.gradle.org/plugin/net.kyori.indra) Gradle plugin for easier java development.

- It also comes with `indra.licenser-spotless`, a powerful formatting tool that applies your
licence header automatically in your source files with the `./gradlew spotlessApply` task (and much more).

- Bundling and automatic relocation (isolating your dependencies to avoid class loading issues) with the
[Shadow](https://imperceptiblethoughts.com/shadow/) gradle plugin.

- The default relocation is `(plugin-root-package).shadow` (example with gson: `fr.xpdustry.template.shadow.gson`).

- Every unused classes is removed from the final jar.

- Very easy configuration :

- If you're not an advanced user, just editing the properties in `plugin.json` and `gradle.properties` is enough.
For example :

- Changing `version` in `plugin.json` will change the whole project version.

- The project is compiled with the version of Mindustry provided by `minGameVersion` in `plugin.json`.

## How to use

1. Update `plugin.json` and `gradle.properties`.

2. Reset `CHANGELOG.md`.

3. Start **K O D I N G**.

4. When ready for release, set the release version in your `plugin.json`, push the change and create a release on
GitHub. Once published, the plugin jar will be added to the release and the `CHANGELOG.md` file will be updated
with the release notes of the release.
> Unlike this [mod](https://github.com/Agzam4/Mindustry-bugfixes-plugin), this plugin doesn't reload the entire game but
> uses reflection
> to change the broken code. It also preserves the binary compatibility with other plugins.
## Installation

Expand All @@ -57,60 +20,10 @@ This plugin requires :
## Building

- `./gradlew shadowJar` to compile the plugin into a usable jar (will be located
at `builds/libs/(plugin-display-name.jar`).
at `builds/libs/NoPayloadConveyorCrashPlugin.jar`).

- `./gradlew jar` for a plain jar that contains only the plugin code.

- `./gradlew runMindustryServer` to run the plugin in a local Mindustry server.

- `./gradlew test` to run the unit tests of the plugin.

## Notes

- If you eventually need to change the project licence (`LICENSE.md` and `LICENSE_HEADER.md`), also change the licence
function call in the `indra` configuration of the build script, more info in the
[Indra wiki](https://github.com/KyoriPowered/indra/wiki/indra-publishing#indra-extension-properties-and-methods).

- If you want to expose some of your plugin dependencies, or you are using a dependency that cannot be relocated like
some SQL drivers, you will have to relocate them manually by replacing :

```gradle
val relocate = tasks.create<ConfigureShadowRelocation>("relocateShadowJar") {
target = tasks.shadowJar.get()
prefix = project.property("props.root-package").toString() + ".shadow"
}
tasks.shadowJar {
dependsOn(relocate)
minimize()
}
```

With :

```gradle
tasks.shadowJar {
val shadowPackage = project.property("props.root-package").toString() + ".shadow"
// Put the internal dependencies here
relocate("com.example.artifact1", "$shadowPackage.artifact1")
relocate("com.example.artifact2", "$shadowPackage.artifact2")
minimize {
// Put the exposed dependencies and unrelocatable dependencies here
exclude(dependency("com.example:artifact3:.*"))
exclude(dependency("com.example:some-sql-driver:.*"))
}
}
```

- If you are from Xpdustry, before doing anything, run this in your terminal to set the `xpdustry-master` branch as master :

```batch
git fetch origin xpdustry-master
git checkout xpdustry-master
git branch -m master old-master
git branch -m xpdustry-master master
git branch -rD origin/master
git push origin master -f
git branch -D old-master
git push origin --delete xpdustry-master
```
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ indra {
minimumToolchain(17)
}

publishSnapshotsTo("xpdustry", "https://maven.xpdustry.fr/snapshots")
publishReleasesTo("xpdustry", "https://maven.xpdustry.fr/releases")
// publishSnapshotsTo("xpdustry", "https://maven.xpdustry.fr/snapshots")
// publishReleasesTo("xpdustry", "https://maven.xpdustry.fr/releases")

// The license of your project, kyori has already functions for the most common licenses
// such as gpl3OnlyLicense() for GPLv3, apache2License() for Apache 2.0, etc.
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# The project name, used as the artifact name
props.project-name=template
props.project-name=no-payload-conveyor-crash
# The group of the project, usually a domain backwards such as com.google
props.project-group=fr.xpdustry
# The year the project started
props.project-year=2021
props.project-year=2023
# The root java package of the plugin for NullAway and Shadow
props.root-package=fr.xpdustry.template
props.root-package=fr.xpdustry.patches
# Whether a snapshot suffix should be added to the version string.
# This option is for more advanced plugins, basically for any non-official builds, the "-SNAPSHOT" suffix
# is added to the version string to be able to distinguish between experimental and stable builds.
props.enable-snapshots=true
props.enable-snapshots=false
10 changes: 5 additions & 5 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "template",
"displayName": "TemplatePlugin",
"name": "no-payload-conveyor-crash",
"displayName": "NoPayloadConveyorCrashPlugin",
"author": "Xpdustry",
"description": "A template for faster plugin development.",
"version": "3.4.1",
"description": "No more payload conveyor crashes.",
"version": "1.0.0",
"minGameVersion": "140",
"hidden": true,
"java": true,
"main": "fr.xpdustry.template.TemplatePlugin",
"main": "fr.xpdustry.patches.NoPayloadConveyorCrashPlugin",
"repo": "Xpdustry/TemplatePlugin",
"dependencies": []
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* This file is part of TemplatePlugin. A template for faster plugin development.
* This file is part of NoPayloadConveyorCrashPlugin. No more payload conveyor crashes.
*
* MIT License
*
* Copyright (c) 2021 Xpdustry
* Copyright (c) 2023 Xpdustry
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,18 +23,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package fr.xpdustry.template;
package fr.xpdustry.patches;

import arc.util.CommandHandler;
import arc.util.Log;
import mindustry.mod.Plugin;
import org.checkerframework.checker.nullness.qual.NonNull;

/**
* Template plugin.
*/
@SuppressWarnings("unused")
public class TemplatePlugin extends Plugin {
public final class NoPayloadConveyorCrashPlugin extends Plugin {

/**
* This method is called when game initializes.
Expand Down

0 comments on commit 868cdd7

Please sign in to comment.