1
0
mirror of https://github.com/kami-blue/client synced 2025-03-31 07:51:58 +00:00

[refactor] Rewrite build system

This commit is contained in:
living 2020-11-27 02:18:32 -05:00 committed by Dominika
parent e80c719539
commit b6ad6209be
No known key found for this signature in database
GPG Key ID: B4A5A6DCA70F861F
30 changed files with 451 additions and 140 deletions

View File

@ -1,6 +1,6 @@
org.gradle.jvmargs=-Xmx3G
modGroup=me.zeroeightsix
modVersion=1.1.7-beta
modVersion=1.11.xx-dev
modBaseName=kamiblue
forgeVersion=1.12.2-14.23.5.2847
mcpVersion=stable_39

37
scripts/buildNamed.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./buildNamed.sh"
source ~/.profile
if [ -z "$KAMI_DIR" ]; then
echo "[buildNamed] Environment variable KAMI_DIR is not set, exiting." >&2
exit 1
fi
cd "$KAMI_DIR" || exit $?
rm -rf build/libs/* || {
echo "[buildNamed] Failed to remove existing files in 'build/libs/', exiting." >&2
exit 1
}
chmod +x gradlew
./gradlew build &>/dev/null || {
echo "[buildNamed] Gradle build failed, exiting." >&2
exit 1
}
cd build/libs/ || exit $?
__named=$(find . -maxdepth 1 -not -name "*release*" | tail -n +2)
__bad_named=$(find . -maxdepth 1 -name "*release*")
rm -f "$__named"
mv "$__bad_named" "$__named"
echo "$__named" | sed "s/^\.\///g"

27
scripts/bumpMajor.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# Bumps the version and creates a commit ready for push
#
# Usage: "./bumpMajor.sh"
__utils="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils.sh"
source "$__utils"
check_git || exit $?
CUR_R=$(($(date +"%Y") - 2019))
CUR_M=$(date +".%m")
VERSION="$CUR_R$CUR_M.01"
VERSION_DEV="$CUR_R$CUR_M.xx-dev"
sed -i "s/modVersion=.*/modVersion=$VERSION_DEV/" gradle.properties
sed -i "s/VERSION = \".*\";/VERSION = \"$VERSION_DEV\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_SIMPLE = \".*\";/VERSION_SIMPLE = \"$VERSION_DEV\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_MAJOR = \".*\";/VERSION_MAJOR = \"$VERSION\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/\"version\": \".*\",/\"version\": \"$VERSION_DEV\",/" src/main/resources/mcmod.info
git commit -am "[bump] Release Major $VERSION"
echo "[bumpMajor] Created commit for version '$VERSION', remember to push!"

36
scripts/bumpVersion.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./bumpVersion.sh <major or empty>"
# First argument can be empty or "major"
# Get version numbers
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/version.sh"
VERSION=$("$__dir" "$1") || exit $?
VERSION_SIMPLE=$("$__dir" "$1" "simple") || exit $?
VERSION_MAJOR=$("$__dir" "major") || exit $?
# Get and parse build number
BUILD_NUMBER_PREVIOUS=$(curl -s https://kamiblue.org/api/v1/builds)
BUILD_NUMBER=$((BUILD_NUMBER_PREVIOUS + 1))
if [ "$BUILD_NUMBER" == "$BUILD_NUMBER_PREVIOUS" ]; then
echo "[bumpBuildNumber] Failed to bump build number, exiting." >&2
exit 1
fi
if [[ ! "$BUILD_NUMBER" =~ ^-?[0-9]+$ ]]; then
echo "[bumpBuildNumber] Could not parse '$BUILD_NUMBER' as an Int, exiting." >&2
exit 1
fi
# Set above information
sed -i "s/modVersion=.*/modVersion=$VERSION/" gradle.properties
sed -i "s/VERSION = \".*\";/VERSION = \"$VERSION\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_SIMPLE = \".*\";/VERSION_SIMPLE = \"$VERSION_SIMPLE\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VERSION_MAJOR = \".*\";/VERSION_MAJOR = \"$VERSION_MAJOR\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/BUILD_NUMBER = .*;/BUILD_NUMBER = $BUILD_NUMBER;/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/\"version\": \".*\",/\"version\": \"$VERSION\",/" src/main/resources/mcmod.info

53
scripts/bumpWebsite.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./bumpWebsite.sh <jar name> <version> <version major>"
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$__dir/utils.sh"
source ~/.profile
check_var "KAMI_WEBSITE_DIR" "$KAMI_WEBSITE_DIR" || exit $?
check_var "KAMI_OWNER" "$KAMI_OWNER" || exit $?
check_var "KAMI_REPO_MAJOR" "$KAMI_REPO_MAJOR" || exit $?
check_var "KAMI_REPO_NIGHTLY" "$KAMI_REPO_NIGHTLY" || exit $?
check_var "1" "$1" || exit $?
check_var "2" "$2" || exit $?
check_var "3" "$3" || exit $?
if [ ! -f "$KAMI_WEBSITE_DIR/api/v1/builds" ]; then
echo "[bumpBuildNumber] '$KAMI_WEBSITE_DIR/api/v1/builds' couldn't be found, be sure you're running the latest commit and API version, exiting." >&2
exit 1
fi
BUILD_NUMBER_PREVIOUS=$(curl -s https://kamiblue.org/api/v1/builds)
BUILD_NUMBER=$((BUILD_NUMBER_PREVIOUS + 1))
if [ "$BUILD_NUMBER" == "$BUILD_NUMBER_PREVIOUS" ]; then
echo "[bumpBuildNumber] Failed to bump build number, exiting." >&2
exit 1
fi
if [[ ! "$BUILD_NUMBER" =~ ^-?[0-9]+$ ]]; then
echo "[bumpBuildNumber] Could not parse '$BUILD_NUMBER' as an Int, exiting." >&2
exit 1
fi
cd "$KAMI_WEBSITE_DIR" || exit $?
git reset --hard origin/master || exit $?
git pull || exit $?
sed -i "s/^build_number:.*/build_number: $BUILD_NUMBER/g" _config.yml
sed -i "s/^cur_ver:.*/cur_ver: $4/g" _config.yml
sed -i "s/^beta_ver:.*/beta_ver: $2/g" _config.yml
sed -i "s|jar_url:.*|jar_url: https://github.com/$KAMI_OWNER/$KAMI_REPO_MAJOR/releases/download/$4/kamiblue-$4.jar|g" _config.yml
sed -i "s|jar_sig_url:.*|jar_sig_url: https://github.com/$KAMI_OWNER/$KAMI_REPO_MAJOR/releases/download/$4/kamiblue-$4.jar.sig|g" _config.yml
sed -i "s|beta_jar_url:.*|beta_jar_url: https://github.com/$KAMI_OWNER/$KAMI_REPO_NIGHTLY/releases/download/$2/$1|g" _config.yml
git commit -am "[bump] Release $2" || exit $?
git push origin master

22
scripts/changelog.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# Returns a changelog when given a single short hash or two hashes
# Defaults to head when no second hash is given
# Usage: "./changelog.sh <first hash> <second hash or empty>"
__scripts="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils.sh"
source "$__scripts"
check_git || exit $?
check_var "1" "$1" || exit $?
CHANGELOG="$(git log --format=%s "$1"..."$2" | sed ':a;N;$!ba;s/\n/\\n/g')" || {
echo "[changelog] Failed to create changelog from commits, exiting." >&2
exit 1
}
[ -n "$CHANGELOG" ] || exit 1
echo "$CHANGELOG"

View File

@ -1 +0,0 @@
-beta

View File

@ -1 +0,0 @@
v1.1.6

View File

@ -1 +0,0 @@
v1.1.7

View File

@ -1,39 +0,0 @@
#!/bin/bash
source ~/.profile
CUR_VER="$(tail -c +2 ./scripts/curVer)"
COMMIT_TRIM="$(git log --format=%h -1)"
COMMIT_FULL="$(git log --format=%H -1)"
COMMIT_MSG="$(git log --format=%s -1)"
# Find the release file and rename it to kamiblue-version-commit-release.jar
BUILD_DIR=$HOME/kamiblue/build/libs/
JAR_DIR="$(ls "$BUILD_DIR" | grep "release")"
CHANGELOG_FULL="$(git log --format=%s $COMMIT_TRIM...$COMMIT_LAST | sed ':a;N;$!ba;s/\n/\\n- /g')"
# remove ' and " from changelog, as those chars do not work with discord webhooks
CHANGELOG_FULL="$(echo $CHANGELOG_FULL | sed "s/['\"]//g")"
# delete the release in case it exists
git tag -d $CUR_VER-$COMMIT_TRIM
git push origin :refs/tags/$CUR_VER-$COMMIT_TRIM
sleep 2
# Upload the release
cd ~/
./github-release-linux-amd64 $CUR_VER-$COMMIT_TRIM $BUILD_DIR/$JAR_DIR --commit master --tag $CUR_VER-$COMMIT_TRIM --github-repository $GITHUB_RELEASE_REPOSITORY --github-access-token $GITHUB_RELEASE_ACCESS_TOKEN
sleep 5
# Send message with commit information
curl -H "Content-Type: application/json" -X POST -d '{"embeds": [{"title": "Download v'$CUR_VER\-$COMMIT_TRIM'","color": 10195199,"description": "[**DOWNLOAD**](https://github.com/kami-blue/nightly-releases/releases/download/'$CUR_VER\-$COMMIT_TRIM'/'${JAR_DIR}')\n\n**Changelog:** \n- '"$CHANGELOG_FULL"'\n\nDiff: ['$COMMIT_LAST'...'${COMMIT_TRIM}'](https://github.com/kami-blue/client/compare/'$COMMIT_LAST_FULL'...'$COMMIT_FULL') "}]}' "$WEBHOOK"
cd ~/website/
git pull
sleep 1
./scripts/bumpWebsiteNightlies.sh
sed -i "s|beta_jar_url:.*|beta_jar_url: https://github.com/kami-blue/nightly-releases/releases/download/${CUR_VER}-${COMMIT_TRIM}/${JAR_DIR}|g" _config.yml
sed -i "s|beta_ver:.*|beta_ver: v${CUR_VER}-${COMMIT_TRIM}|g" _config.yml
git commit -a -m "bump ver to v${CUR_VER}-${COMMIT_TRIM}"
git push origin master

View File

@ -1,8 +0,0 @@
#!/bin/bash
CUR_VER="$(cat ./scripts/curVer)"
COMMIT_TRIM="$(git log --format=%h -1)"
sed -i "s/modVersion=.*/modVersion=${CUR_VER:1}-$COMMIT_TRIM/" gradle.properties
sed -i "s/\"version\": \".*\",/\"version\": \"${CUR_VER:1}-$COMMIT_TRIM\",/" src/main/resources/mcmod.info
sed -i "s/VER_FULL_BETA = \".*\";/VER_FULL_BETA = \"$CUR_VER-$COMMIT_TRIM\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java

View File

@ -1,47 +0,0 @@
#!/bin/bash
# REQUIREMENTS:
#
# ~/.profile:
# $GITHUB_RELEASE_ACCESS_TOKEN with repo:status, repo_deployment, public_repo
# $GITHUB_RELEASE_REPOSITORY="kami-blue/nightly-releases"
# $WEBHOOK= webhook url
#
# ~/kamiblue
# git clone git@github.com:kami-blue/nightly-releases.git
# git remote add kamiblue git@github.com:kami-blue/client.git
#
# ~/Java JDK 8 is also required
#
# ~/https://github.com/buildkite/github-release/releases is also required
#
# crontab -e
# 0 0,12 * * * /home/user/releaseNightly >/tmp/cron1.log 2>&1
cd ~/kamiblue/
export COMMIT_LAST="$(git log --format=%h -1)"
export COMMIT_LAST_FULL="$(git log --format=%H -1)"
git fetch kamiblue master
git fetch origin master
sleep 0.5
git reset --hard kamiblue/master
git push --force origin HEAD:master
sleep 1
export COMMIT_TRIM="$(git log --format=%h -1)"
if [[ "$COMMIT_LAST" == "$COMMIT_TRIM" ]]; then
exit 0
fi
rm -rf build/libs
./scripts/preHook.sh
sleep 1
./gradlew build
sleep 2
./scripts/hook.sh

55
scripts/runAutomatedRelease.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./runAutomatedRelease.sh <major or empty>"
_d="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
source "$_d/scripts/utils.sh"
source ~/.profile
check_var "KAMI_DIR" "$KAMI_DIR" || exit $?
check_var "KAMI_MIRROR_DIR" "$KAMI_MIRROR_DIR" || exit $?
check_var "KAMI_REPO_MAJOR" "$KAMI_REPO_MAJOR" || exit $?
check_var "KAMI_REPO_NIGHTLY" "$KAMI_REPO_NIGHTLY" || exit $?
check_var "KAMI_OWNER" "$KAMI_OWNER" || exit $?
check_var "KAMI_WEBHOOK" "$KAMI_WEBHOOK" || exit $?
# Safely update repository
cd "$KAMI_DIR" || exit $?
check_git || exit $?
OLD_COMMIT=$(git log --pretty=%h -1)
git reset --hard origin/master || exit $?
git pull || exit $?
git submodule update --init --recursive || exit $?
# Update mirror
cd "$KAMI_MIRROR_DIR" || exit $? || exit $?
check_git || exit $? || exit $?
git reset --hard master || exit $?
git pull "$KAMI_DIR" || exit $?
git submodule update --init --recursive || exit $?
git push --force origin master || exit $?
cd "$KAMI_DIR" || exit $?
# Set some variables, run scripts
HEAD=$(git log --pretty=%h -1)
CHANGELOG="$("$_d"/scripts/changelog.sh "$OLD_COMMIT")" || exit $?
VERSION="$("$_d"/scripts/version.sh "$1")" || exit $?
VERSION_MAJOR="$("$_d"/scripts/version.sh "major")" || exit $?
"$_d"/scripts/bumpVersion.sh "$1" || exit $?
JAR_NAME="$("$_d"/scripts/buildNamed.sh)" || exit $?
"$_d"/scripts/uploadRelease.sh "$1" "$HEAD" "$VERSION" "$JAR_NAME" "$CHANGELOG" || exit $?
"$_d"/scripts/bumpWebsite.sh "$JAR_NAME" "$VERSION" "$VERSION_MAJOR" || exit $?
REPO="$KAMI_REPO_NIGHTLY"
[ "$1" == "major" ] && REPO="$KAMI_REPO_MAJOR"
curl -H "Content-Type: application/json" -X POST \
-d '{"embeds": [{"title": "Download v'"$VERSION"'","color": 10195199,"description": "[**DOWNLOAD**](https://github.com/'"$KAMI_OWNER"'/'"$REPO"'/releases/download/'"$VERSION"'/'"$JAR_NAME"')\n\n**Changelog:** \n'"$CHANGELOG"'\n\nDiff: ['"$OLD_COMMIT"'...'"$HEAD"'](https://github.com/'"$KAMI_OWNER"'/'"$REPO"'/compare/'"$OLD_COMMIT"'...'"$HEAD"') "}]}' "$KAMI_WEBHOOK"

27
scripts/uploadRelease.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# ONLY USED IN AUTOMATED BUILDS
#
# Usage: "./uploadRelease.sh <major or empty> <branch or commit> <version> <jar name> <changelog>"
__scripts="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$__scripts/utils.sh" # include check_var
source ~/.profile
check_var "2" "$2" || exit $?
check_var "3" "$3" || exit $?
check_var "KAMI_REPO_MAJOR" "$KAMI_REPO_MAJOR" || exit $?
check_var "KAMI_REPO" "$KAMI_REPO" || exit $?
check_var "GITHUB_TOKEN" "$GITHUB_TOKEN" || exit $?
REPO="$KAMI_REPO_NIGHTLY"
[ "$1" == "major" ] && REPO="$KAMI_REPO_MAJOR"
# Create release
curl -s -H "Authorization: token $GITHUB_TOKEN" -X POST --data "$(generate_release_data "$KAMI_OWNER" "$REPO" "$3" "$2" "$3" "$5" "false" "false")" "https://api.github.com/repos/$KAMI_OWNER/$REPO/releases" || exit $?
# Upload jar to release
"$__scripts/uploadReleaseAsset.sh" github_api_token="$GITHUB_TOKEN" owner="$KAMI_OWNER" repo="$REPO" tag="$3" filename="$KAMI_DIR/build/libs/$4"

71
scripts/uploadReleaseAsset.sh Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
# * repo
# * tag
# * filename
# * github_api_token
#
# Script to upload a release asset using the GitHub API v3.
#
# Example:
#
# uploadReleaseAsset.sh github_api_token=TOKEN owner=stefanbuck repo=playground tag=v0.1.0 filename=./build.zip
#
# Check dependencies.
set -e
xargs=$(which gxargs || which xargs)
# Validate settings.
[ "$TRACE" ] && set -x
CONFIG=$@
for line in $CONFIG; do
eval "$line"
done
# Define variables.
GH_API="https://api.github.com"
GH_REPO="$GH_API/repos/$owner/$repo"
GH_TAGS="$GH_REPO/releases/tags/$tag"
AUTH="Authorization: token $github_api_token"
WGET_ARGS="--content-disposition --auth-no-challenge --no-cookie"
CURL_ARGS="-LJO#"
if [[ "$tag" == 'LATEST' ]]; then
GH_TAGS="$GH_REPO/releases/latest"
fi
# Validate token.
curl -o /dev/null -sH "$AUTH" $GH_REPO || {
echo "Error: Invalid repo, token or network issue!"
exit 1
}
# Read asset tags.
response=$(curl -sH "$AUTH" $GH_TAGS)
# Get ID of the asset based on given filename.
eval $(echo "$response" | grep -m 1 "id.:" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
[ "$id" ] || {
echo "Error: Failed to get release id for tag: $tag"
echo "$response" | awk 'length($0)<100' >&2
exit 1
}
# Upload asset
echo "Uploading asset... "
# Construct url
GH_ASSET="https://uploads.github.com/repos/$owner/$repo/releases/$id/assets?name=$(basename $filename)"
curl "$GITHUB_OAUTH_BASIC" --data-binary @"$filename" -H "Authorization: token $github_api_token" -H "Content-Type: application/octet-stream" $GH_ASSET

57
scripts/utils.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
# Created by l1ving on 17/02/20
#
# Miscellaneous utilities used in other scripts
# Usage: "source ./utils.sh"
# Do not use this except to get relative script paths
root_kami_dir() {
pwd | sed "s/kamiblue.*/kamiblue/g"
}
check_var() {
if [ -z "$2" ]; then
echo "Variable '$1' is not set, exiting." >&2
exit 1
fi
}
check_git() {
if [ ! -d "$(root_kami_dir)/.git" ]; then
echo "Could not detect git repository, exiting" >&2
exit 1
elif [ ! "$(git status | head -n 4 | tail -n 1)" == "nothing to commit, working tree clean" ]; then
echo "Either not working in a clean tree or you have unpushed commits. Exiting." >&2
exit 1
fi
}
# Usage: "generate_release_data "owner" "repo" "version" "branch or commit" "name" "description" "draft (bool)", "prerelease (bool)""
generate_release_data() {
cat <<EOF
{
"owner": "$1",
"repo": "$2",
"tag_name": "$3",
"target_commitish": "$4",
"name": "$5",
"body": "$6",
"draft": $7,
"prerelease": $8
}
EOF
}
# Usage: "generate_asset_data "owner" "repo" "release id""
generate_asset_data() {
cat <<EOF
{
"accept": "application/vnd.github.v3+json",
"owner": "$1",
"repo": "$2",
"release_id": "$3"
}
EOF
}

View File

@ -1,15 +0,0 @@
#!/bin/sh
# Created by l1ving on 19/02/20
# echo "Usage: ./ver.sh"
CUR_VER="$(cat ./scripts/curVer)"
CUR_BETA="$(cat ./scripts/curBeta)"
CUR_RELEASE="$(cat ./scripts/curRelease)"
sed -i "s/modVersion=.*/modVersion=${CUR_VER:1}$CUR_BETA/" gradle.properties
sed -i "s/VER_FULL_BETA = \".*\";/VER_FULL_BETA = \"$CUR_VER$CUR_BETA\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VER_SMALL = \".*\";/VER_SMALL = \"$CUR_VER$CUR_BETA\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/VER_STABLE = \".*\";/VER_STABLE = \"$CUR_RELEASE\";/" src/main/java/me/zeroeightsix/kami/KamiMod.java
sed -i "s/\"version\": \".*\",/\"version\": \"${CUR_VER:1}$CUR_BETA\",/" src/main/resources/mcmod.info

34
scripts/version.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
# Created by l1ving on 17/11/20
#
# echos the current version.
#
# Usage: "./version.sh <major or empty> <simple or empty>"
#
# Major overrides Simple
# Version spec for major: R.MM.01
# Version spec for beta: R.MM.DD-hash
# Version spec for simple: R.MM.DD
#
# Example beta: 1.11.17-58a47a2f
__utils="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utils.sh"
source "$__utils"
check_git || exit $?
CUR_HASH="-"$(git log --pretty=%h -1) # for the -hash
CUR_R=$(($(date +"%Y") - 2019)) # Current year - 2019
CUR_M_D=$(date +".%m.%d") # Current month and day, formatted
if [ "$1" == "major" ]; then
CUR_HASH=""
CUR_M_D=$(date +".%m.01")
fi
if [ "$1" != "major" ] && [ "$2" == "simple" ]; then
CUR_HASH="-beta"
fi
echo "$CUR_R$CUR_M_D$CUR_HASH"

View File

@ -23,7 +23,7 @@ public class Installer extends JPanel {
String[] downloadsAPI = WebUtils.INSTANCE.getUrlContents(KamiMod.DOWNLOADS_API).replace("\n", "").split("\"");
public static void main(String[] args) throws IOException {
System.out.println("Ran the " + KamiMod.MODNAME + " " + KamiMod.VER_FULL_BETA + " installer!");
System.out.println("Ran the " + KamiMod.NAME + " " + KamiMod.VERSION + " installer!");
/* ensure mods exists */
new File(getModsFolder()).mkdirs();
@ -154,12 +154,12 @@ public class Installer extends JPanel {
}).start();
/* please ignore the clusterfuck of code that this is */
System.out.println(KamiMod.MODNAME + " download started!");
System.out.println(KamiMod.NAME + " download started!");
if (version == VersionType.STABLE) {
try {
WebUtils.INSTANCE.downloadUsingNIO(downloadsAPI[9], getModsFolder() + getFullJarName(downloadsAPI[9]));
dialog[0].hide();
System.out.println(KamiMod.MODNAME + " download finished!");
System.out.println(KamiMod.NAME + " download finished!");
} catch (IOException e) {
notifyAndExitWeb(e);
}
@ -167,7 +167,7 @@ public class Installer extends JPanel {
try {
WebUtils.INSTANCE.downloadUsingNIO(downloadsAPI[19], getModsFolder() + getFullJarName(downloadsAPI[19]));
dialog[0].hide();
System.out.println(KamiMod.MODNAME + " download finished!");
System.out.println(KamiMod.NAME + " download finished!");
} catch (IOException e) {
notifyAndExitWeb(e);
}

View File

@ -26,17 +26,18 @@ import javax.annotation.Nullable;
import java.io.File;
@Mod(
modid = KamiMod.MODID,
name = KamiMod.MODNAME,
version = KamiMod.VER_FULL_BETA
modid = KamiMod.ID,
name = KamiMod.NAME,
version = KamiMod.VERSION
)
public class KamiMod {
public static final String MODNAME = "KAMI Blue";
public static final String MODID = "kamiblue";
public static final String VER_FULL_BETA = "v1.1.7-beta"; // this is changed to v1.x.x-commit for debugging by automatic builds
public static final String VER_SMALL = "v1.1.7-beta"; // shown to the user, unchanged
public static final String VER_STABLE = "1.11.01"; // used for update checking
public static final String NAME = "KAMI Blue";
public static final String ID = "kamiblue";
public static final String VERSION = "1.11.xx-dev"; // Used for debugging. R.MM.DD-hash format.
public static final String VERSION_SIMPLE = "1.11.xx-dev"; // Shown to the user. R.MM.DD[-beta] format.
public static final String VERSION_MAJOR = "1.11.01"; // Used for update checking. RR.MM.01 format.
public static final int BUILD_NUMBER = -1; // Do not remove, currently unused but will be used in the future.
public static final String APP_ID = "638403216278683661";
@ -73,7 +74,7 @@ public class KamiMod {
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
LOG.info("Initializing " + MODNAME + " " + VER_FULL_BETA);
LOG.info("Initializing " + NAME + " " + VERSION);
ModuleManager.load();
ManagerLoader.load();
@ -107,7 +108,7 @@ public class KamiMod {
// Need to reload the font after the settings were loaded
KamiFontRenderer.INSTANCE.reloadFonts();
LOG.info(MODNAME + " Mod initialized!");
LOG.info(NAME + " Mod initialized!");
}
public KamiGUI getGuiManager() {

View File

@ -46,7 +46,7 @@ public class HelpCommand extends Command {
String commandPrefix = Command.getCommandPrefix();
if (args[0] == null) {
sendStringChatMessage(new String[]{
"KAMI Blue " + KamiMod.VER_FULL_BETA,
"KAMI Blue " + KamiMod.VERSION,
"&7Press &r" + ClickGUI.INSTANCE.getBind().getValue().toString() + "&7 to open GUI",
"&7see &b" + WEBSITE_LINK + "&7 for a full version of the faq",
commandPrefix + "commands&7 to view all available commands",

View File

@ -50,7 +50,7 @@ public class TroubleshootCommand extends Command {
sendChatMessage("Enabled modules: " + f + "\n" + TextFormatting.GRAY + enabled);
if (args.length >= 2) return;
sendChatMessage(ForgeVersion.getMajorVersion() + "." + ForgeVersion.getMinorVersion() + "." + ForgeVersion.getRevisionVersion() + "." + ForgeVersion.getBuildVersion());
sendChatMessage(KamiMod.MODNAME + " " + KamiMod.KAMI_KATAKANA + " " + KamiMod.VER_FULL_BETA);
sendChatMessage(KamiMod.NAME + " " + KamiMod.KAMI_KATAKANA + " " + KamiMod.VERSION);
sendChatMessage("CPU: " + OpenGlHelper.getCpu() + " GPU: " + GlStateManager.glGetString(GL11.GL_VENDOR));
sendChatMessage("Please send a screenshot of the full output to the developer or moderator who's helping you!");
}

View File

@ -53,12 +53,12 @@ class KamiGuiUpdateNotification(private val buttonId: Int) : GuiScreen() {
}
latest = parser.parse(rawJson).asJsonObject.getAsJsonObject("stable")["name"].asString
isLatest = latest.equals(KamiMod.VER_STABLE)
isLatest = latest.equals(KamiMod.VERSION_MAJOR)
if (!isLatest) {
KamiMod.LOG.warn("You are running an outdated version of KAMI Blue.\nCurrent: ${KamiMod.VER_STABLE}\nLatest: $latest")
KamiMod.LOG.warn("You are running an outdated version of KAMI Blue.\nCurrent: ${KamiMod.VERSION_MAJOR}\nLatest: $latest")
} else {
KamiMod.LOG.info("Your KAMI Blue (" + KamiMod.VER_STABLE + ") is up-to-date with the latest stable release.")
KamiMod.LOG.info("Your KAMI Blue (" + KamiMod.VERSION_MAJOR + ") is up-to-date with the latest stable release.")
}
} catch (e: IOException) {
KamiMod.LOG.error("Oes noes! An exception was thrown during the update check.", e)

View File

@ -98,7 +98,7 @@ object DiscordNotifs : Module() {
private fun sendMessage(content: String, avatarUrl: String) {
val tm = TemmieWebhook(url.value)
val dm = DiscordMessage(KamiMod.MODNAME + " " + KamiMod.VER_FULL_BETA, content, avatarUrl)
val dm = DiscordMessage(KamiMod.NAME + " " + KamiMod.VERSION, content, avatarUrl)
tm.sendMessage(dm)
}

View File

@ -30,7 +30,7 @@ object CommandConfig : Module() {
private val timer = TimerUtils.TickTimer(TimerUtils.TimeUnit.MINUTES)
private val prevTitle = Display.getTitle()
private const val title = "${KamiMod.MODNAME} ${KamiMod.KAMI_KATAKANA} ${KamiMod.VER_SMALL}"
private const val title = "${KamiMod.NAME} ${KamiMod.KAMI_KATAKANA} ${KamiMod.VERSION_SIMPLE}"
init {
listener<SafeTickEvent> {

View File

@ -95,7 +95,7 @@ object InfoOverlay : Module() {
}
private fun Setting<*>.infoMap() = when (this) {
version -> "${KamiMod.KAMI_KATAKANA} ${second()}${KamiMod.VER_SMALL}"
version -> "${KamiMod.KAMI_KATAKANA} ${second()}${KamiMod.VERSION_SIMPLE}"
username -> "Welcome ${second()}${mc.session.username}!"
time -> TimeUtils.getFinalTime(setToText(secondColor.value), setToText(firstColor.value), timeUnitSetting.value, timeTypeSetting.value, doLocale.value)
tps -> "${InfoCalculator.tps(decimalPlaces.value)} ${second()}tps"

View File

@ -104,7 +104,7 @@ object TotemPopCounter : Module() {
private fun grammar(player: EntityPlayer) = if (player == mc.player) "my" else "their"
private fun ending(): String = if (thanksTo.value) " thanks to ${KamiMod.MODNAME} !" else "!"
private fun ending(): String = if (thanksTo.value) " thanks to ${KamiMod.NAME} !" else "!"
private fun formatNumber(message: Int) = setToText(colorNumber.value) + message + TextFormatting.RESET

View File

@ -107,7 +107,7 @@ object DiscordRPC : Module() {
private fun getLine(line: LineInfo): String {
return when (line) {
LineInfo.VERSION -> {
KamiMod.VER_SMALL
KamiMod.VERSION_SIMPLE
}
LineInfo.WORLD -> {
when {

View File

@ -30,7 +30,7 @@ import java.util.Set;
name = "XRay",
category = Module.Category.RENDER,
description = "See through common blocks!")
@EventBusSubscriber(modid = KamiMod.MODID
@EventBusSubscriber(modid = KamiMod.ID
)
public class XRay extends Module {
// A default reasonable configuration for the XRay. Most people will want to use it like this.

View File

@ -3,11 +3,14 @@
"modid": "kamiblue",
"name": "KAMI Blue",
"description": "カミブル \nA Minecraft utility mod for anarchy servers \nWritten by 086 and continued by l1ving\n",
"version": "1.1.7-beta",
"version": "1.11.xx-dev",
"mcversion": "1.12.2",
"logoFile": "kami.png",
"url": "https://github.com/kami-blue/client",
"authorList": ["086", "l1ving"],
"authorList": [
"086",
"l1ving"
],
"credits": "Thank you 086 for the original KAMI\nThanks to all contributors for your help and time <3\n"
}
]