Skip to content

Commit

Permalink
Merge branch 'rework'
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ruf committed Jan 6, 2023
2 parents 77601d0 + 925de86 commit 79f7b86
Show file tree
Hide file tree
Showing 33 changed files with 977 additions and 367 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build

on:
workflow_dispatch:
push:
tags:
- '*'

env:
# For any reason, specifying this in the modrinth step does not work?
# But it is also well documented here, so this should be ok to do
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check tag condition
if: startsWith(github.ref, 'refs/tags/')
run: echo "Ref is a tag"

- name: Check out project
if: success()
uses: actions/checkout@v3

- name: Set up JDK 17
if: success()
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'microsoft'

- name: Setup Gradle
if: success()
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.4.2

- name: Build
if: success()
run: gradle remapJar

- name: Release on GitHub
if: success() && startsWith(github.ref, 'refs/tags/') # Failsafe check again
uses: softprops/action-gh-release@v1
with:
files: |
**/libs/invsync-*.jar
README.md
CHANGELOG.md
LICENSE
body_path: CHANGELOG.md
draft: false
prerelease: false
fail_on_unmatched_files: true

- name: Upload to modrinth
if: success()
run: gradle modrinth
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ gradle-app.setting

# Common working directory
/run/
/run2/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
!gradle-wrapper.jar
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initial release
67 changes: 49 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,68 @@
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)\
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)

[![name](https://github.com/modrinth/art/blob/main/Branding/Badge/badge-dark__184x72.png?raw=true)](https://modrinth.com/mod/invsync)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/G2G4DZF4D)
# InvSync

<img src="https://github.com/MrNavaStar/invSync/blob/master/src/main/resources/assets/invsync/icon.png" width="300" height="300">
<img src="https://github.com/michiruf/MCInvSync/blob/master/src/main/resources/assets/invsync/icon.png" width="300" height="300">

# InvSync
This is a fabric mod that Allows you to sync player inventories, health, food level, experience, score, status effects
and advancements across multiple servers or single player minecraft worlds! This is accomplished using a sql database
(SQLite and MySQL supported. SQLite will be setup automatically, you must set up MySQL). Most mods should have no
problem running alongside, and modded items will also be synchronized.

This is a fabric mod that Allows you to sync player inventories, health, food level, experience, score, status effects and advancements across multiple servers or single player minecraft worlds! This is accomplished using an sql database (SQLite and MySQL supported. SQLite will be setup automatically, you must set up MySQL). Most mods should have no problem running along side, and modded items will also be sync'd.
[![name](https://github.com/modrinth/art/blob/main/Branding/Badge/badge-dark__184x72.png?raw=true)](https://modrinth.com/mod/mr-invsync)

This mod uses [SQLib](https://github.com/MrNavaStar/SQLib) as a backend. Feel free to use it in your own projects!

## Support Me
## Support MrNavaStar

You can support me by [buying me a coffee!](https://ko-fi.com/mrnavastar)
This mod was initially forked from MrNavaStar.
You can support MrNavaStar by [buying him a coffee!](https://ko-fi.com/mrnavastar)
His original mod can be found [here](https://modrinth.com/mod/invsync).

## Requirements

- This mod requires [Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api)
- You can get the mod on [Modrith](https://modrinth.com/mod/invsync)
## Requirements

## Getting Started
* This mod requires [Fabric API](https://modrinth.com/mod/fabric-api)
* You can get the mod on [Modrith](https://modrinth.com/mod/mr-invsync)

Setup is very simple. Drop the mod into your mods folder on all the servers you want to sync. Starting a server will generate a config. The mod will not run until you edit the config.

## IMPORTANT NOTES
## Getting Started

- Configs MUST be identical between all participating servers in order for the mod to function correctly.
- This mod is known to have issues with: **GolfV**
Setup is very simple. Drop the mod into your mods folder on all the servers you want to sync. Starting a server will
generate a config. The mod will not run until you edit the config.

* Configs MUST be identical between all participating servers in order for the mod to function correctly.
* This mod is known to have issues with: **GolfV**


## Example configuration

Path: `/config/InvSync.mcfg`

```properties
DATABASE_TYPE=SQLITE
SQLITE_PATH=./InvSync.db
MYSQL_DATABASE=InvSync
MYSQL_ADDRESS=database-host
MYSQL_PORT=3306
MYSQL_USERNAME=username
MYSQL_PASSWORD=password
SYNC_INVENTORY=true
SYNC_ENDER_CHEST=true
SYNC_HEALTH=true
SYNC_FOOD_LEVEL=true
SYNC_XP_LEVEL=true
SYNC_SCORE=true
SYNC_STATUS_EFFECTS=true
SYNC_ADVANCEMENTS=true
SYNCHRONIZATION_DELAY=true
SYNCHRONIZATION_DELAY_SECONDS=1
INITIAL_SYNC_OVERWRITE_ENABLED=true
INITIAL_SYNC_SERVER_NAME=1
```

## Issues And Requests

If you find any bugs or glitches, be sure to make a bug report under issues and I will do my best to fix it! Just as well if you have a cool idea for something that I should add, let me know and I will consider adding it!
If you find any bugs or glitches, be sure to make a bug report under issues and I will do my best to fix it! Just as
well if you have a cool idea for something that I should add, let me know and I will consider adding it!
117 changes: 84 additions & 33 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,98 @@
plugins {
id 'fabric-loom' version '1.0.12'
id 'maven-publish'
id 'com.modrinth.minotaur' version '2.+'
}

def targetJavaVersion = 17
version = project.mod_version
group = project.maven_group
allprojects {
// This can get extracted into a root build.gradle if needed
ext {
getCurrentShortRevision = {
// Got from https://github.com/PaperMC/Velocity/blob/dev/3.0.0/build.gradle
new ByteArrayOutputStream().withStream { os ->
exec {
executable = "git"
args = ["rev-parse", "HEAD"]
standardOutput = os
}
return os.toString().trim().substring(0, 8)
}
}

getLatestTag = {
new ByteArrayOutputStream().withStream { os ->
exec {
executable = "git"
args = ["describe", "--tags", "--abbrev=0"]
standardOutput = os
}
return os.toString().trim()
}
}

getCurrentCommitCount = {
new ByteArrayOutputStream().withStream { os ->
exec {
executable = "git"
args = ["rev-list", "--all", "--count"]
standardOutput = os
}
return os.toString().trim()
}
}
}

try {
project.version = "${project.ext.getLatestTag()}-${project.ext.getCurrentCommitCount()}-${project.ext.getCurrentShortRevision()}"
} catch (Exception ignored) {
println('Either git is not set up properly, or there is no tag yet in the repository. Falling back to version \'0\'')
project.version = '0'
}
project.group = 'michiruf'
}

repositories {
maven { url 'https://jitpack.io' }
maven { url "https://maven.shedaniel.me/" }
mavenCentral()
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

include(modImplementation("com.github.MrNavaStar:SQLib:${project.sqlib_version}"))
include(modImplementation("com.github.P03W:Microconfig:${project.microconfig_version}"))
// Configuration microconfig library
modImplementation(include('com.github.P03W:Microconfig:2.2.1'))

// OrmLite
modImplementation(include('com.j256.ormlite:ormlite-jdbc:6.1'))
modImplementation(include('mysql:mysql-connector-java:8.0.30'))
modImplementation(include('org.xerial:sqlite-jdbc:3.40.0.0'))

// Tests
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
}

modrinth {
projectId = 'mr-invsync'
versionNumber = project.version
versionType = project.version.contains('SNAPSHOT') ? 'alpha' : 'release'
gameVersions = ['1.19.1', '1.19.2', '1.19.3']
loaders = ['fabric']
dependencies {
required.project 'fabric-api'
}
uploadFile = remapJar
syncBodyFrom = rootProject.file("README.md").text

// Use the environment variable `$MODRINTH_TOKEN` for the token
// token = 'mySecretToken'
}
tasks.modrinth.dependsOn(tasks.modrinthSyncBody)

processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
Expand All @@ -31,6 +102,7 @@ processResources {
}
}

def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
Expand All @@ -47,38 +119,17 @@ java {
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
archivesBaseName = 'invsync'
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
test {
useJUnitPlatform()
maxHeapSize = '1G'
testLogging {
events 'passed'
}
}
31 changes: 31 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
db:
container_name: db
image: mysql:5.7
ports:
- '3306:3306'
environment:
- MYSQL_DATABASE=InvSync
- MYSQL_USER=username
- MYSQL_PASSWORD=password
- MYSQL_RANDOM_ROOT_PASSWORD=yes
volumes:
# - './DATA/:/var/lib/mysql/'
- '/etc/timezone:/etc/timezone:ro'
tty: true
restart: always

phpmyadmin:
container_name: phpmyadmin
image: phpmyadmin/phpmyadmin
ports:
- '8080:80'
environment:
- PMA_HOST=db
- PMA_USER=username
- PMA_PASSWORD=password
volumes:
- '/etc/timezone:/etc/timezone:ro'
links:
- db
tty: true
restart: always
13 changes: 2 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx4G
# Fabric Properties

# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version=1.19.1
yarn_mappings=1.19.1+build.1
loader_version=0.14.11

# Mod Properties
mod_version=v2.3.1
maven_group=mrnavastar
archives_base_name=invsync

# Dependencies
loader_version=0.14.12
fabric_version=0.58.5+1.19.1
sqlib_version=v1.3.2
microconfig_version=2.2.1
Loading

0 comments on commit 79f7b86

Please sign in to comment.