Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
747d176f8d | ||
|
|
1375679df8 | ||
|
|
b2c7d12b60 | ||
|
|
b363efe530 | ||
|
|
876b5ac50e | ||
|
|
d2825df01b | ||
|
|
bc85864134 | ||
|
|
4808addaa5 | ||
|
|
05e7abccbd | ||
|
|
cfd1ff851d | ||
|
|
f29bc746af | ||
|
|
e12ee8aaed | ||
|
|
fe60b25f61 | ||
|
|
503d67903e | ||
|
|
e1625d38c8 |
No files matched your search
@@ -28,7 +28,7 @@ jobs:
|
||||
distribution: 'adopt'
|
||||
cache: 'maven'
|
||||
- name: Build with Maven
|
||||
run: mvn -B -U package --file pom.xml
|
||||
run: ./mvnw -B -U package --file pom.xml
|
||||
- name: Upload Build Artifact
|
||||
if: "${{ matrix.java-version == 16 }}"
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
@@ -8,14 +8,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 1.8
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
java-version: 16
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Upload artifact
|
||||
uses: itsmeow/curseforge-upload@v3
|
||||
with:
|
||||
|
||||
@@ -8,14 +8,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 1.8
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
java-version: 16
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Upload artifact
|
||||
uses: RubixDev/modrinth-upload@v1.0.0
|
||||
with:
|
||||
|
||||
@@ -21,9 +21,9 @@ jobs:
|
||||
cache: 'maven'
|
||||
distribution: 'adopt'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
run: ./mvnw -B package --file pom.xml
|
||||
- name: Publish to Reposilite
|
||||
run: mvn -B deploy
|
||||
run: ./mvnw -B deploy
|
||||
env:
|
||||
MAVEN_USERNAME: simpleclans
|
||||
MAVEN_PASSWORD: ${{ secrets.REPOSILITE_TOKEN }}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
@@ -1,5 +1,20 @@
|
||||
# Changelog
|
||||
|
||||
## [2.19.2](https://github.com/RoinujNosde/SimpleClans/compare/v2.19.1...v2.19.2) (2023-08-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cause check should return true on granting ([#397](https://github.com/RoinujNosde/SimpleClans/issues/397)) ([f29bc74](https://github.com/RoinujNosde/SimpleClans/commit/f29bc746af4940b493ebc43b1e25ff0fc00ab8d0))
|
||||
|
||||
## [2.19.1](https://github.com/RoinujNosde/SimpleClans/compare/v2.19.0...v2.19.1) (2023-08-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* charge money on deposit ([#394](https://github.com/RoinujNosde/SimpleClans/issues/394)) ([fe60b25](https://github.com/RoinujNosde/SimpleClans/commit/fe60b25f6107281a9771f6498400c3f8ce81c916))
|
||||
* consider uppercase when checking for disallowed colors ([#391](https://github.com/RoinujNosde/SimpleClans/issues/391)) ([503d679](https://github.com/RoinujNosde/SimpleClans/commit/503d67903e386b1c4b6eb7903a1addbfd42a684a))
|
||||
|
||||
## [2.19.0](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.1...v2.19.0) (2023-07-27)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||
else
|
||||
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="$(which javac)"
|
||||
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=$(which readlink)
|
||||
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
|
||||
else
|
||||
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||
fi
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
# Remove \r in case we run on Windows within Git Bash
|
||||
# and check out the repository with auto CRLF management
|
||||
# enabled. Otherwise, we may read lines that are delimited with
|
||||
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||
# splitting rules.
|
||||
tr -s '\r\n' ' ' < "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
printf '%s\n' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||
log "$MAVEN_PROJECTBASEDIR"
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if [ -r "$wrapperJarPath" ]; then
|
||||
log "Found $wrapperJarPath"
|
||||
else
|
||||
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
else
|
||||
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
fi
|
||||
while IFS="=" read -r key value; do
|
||||
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||
safeValue=$(echo "$value" | tr -d '\r')
|
||||
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
log "Downloading from: $wrapperUrl"
|
||||
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
log "Found wget ... using wget"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
log "Found curl ... using curl"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
else
|
||||
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
else
|
||||
log "Falling back to using Java to download"
|
||||
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaSource=$(cygpath --path --windows "$javaSource")
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaSource" ]; then
|
||||
if [ ! -e "$javaClass" ]; then
|
||||
log " - Compiling MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
log " - Running MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
wrapperSha256Sum=""
|
||||
while IFS="=" read -r key value; do
|
||||
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ -n "$wrapperSha256Sum" ]; then
|
||||
wrapperSha256Result=false
|
||||
if command -v sha256sum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
elif command -v shasum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||
exit 1
|
||||
fi
|
||||
if [ $wrapperSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
# shellcheck disable=SC2086 # safe args
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
@@ -0,0 +1,205 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %WRAPPER_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
SET WRAPPER_SHA_256_SUM=""
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||
)
|
||||
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||
powershell -Command "&{"^
|
||||
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||
" exit 1;"^
|
||||
"}"^
|
||||
"}"
|
||||
if ERRORLEVEL 1 goto error
|
||||
)
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
|
||||
<artifactId>SimpleClans</artifactId>
|
||||
<version>2.19.1-SNAPSHOT</version>
|
||||
<version>2.19.3-SNAPSHOT</version>
|
||||
<name>SimpleClans</name>
|
||||
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
|
||||
|
||||
@@ -29,10 +29,9 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
<release>16</release>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgs>
|
||||
@@ -45,21 +44,21 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
|
||||
<!-- Release plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>3.0.1</version>
|
||||
</plugin>
|
||||
|
||||
<!-- Shade plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<version>3.5.0</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
@@ -114,7 +113,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-installed</id>
|
||||
@@ -141,7 +140,7 @@
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>4.9.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -169,16 +168,13 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<release>16</release>
|
||||
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<additionalOptions>-Xdoclint:none</additionalOptions>
|
||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||
<doclint>all,-missing</doclint>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.1.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@@ -317,8 +313,6 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<!-- Upstream Distribution -->
|
||||
|
||||
@@ -10,6 +10,8 @@ import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.DateFormat;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@@ -113,13 +115,13 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
@Deprecated
|
||||
public void deposit(double amount, Player player) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().playerHasMoney(player, amount)) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, amount));
|
||||
addBb(player.getName(), lang("bb.clan.deposit", amount));
|
||||
if (SimpleClans.getInstance().getPermissionsManager().chargePlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, CurrencyFormat.format(amount)));
|
||||
addBb(player.getName(), lang("bb.clan.deposit", CurrencyFormat.format(amount)));
|
||||
setBalance(getBalance() + amount);
|
||||
SimpleClans.getInstance().getStorageManager().updateClan(this);
|
||||
} else {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, amount));
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, CurrencyFormat.format(amount)));
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, amount));
|
||||
@@ -151,8 +153,8 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
public void withdraw(double amount, Player player) {
|
||||
if (getBalance() >= amount) {
|
||||
if (SimpleClans.getInstance().getPermissionsManager().grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, amount));
|
||||
addBb(player.getName(), lang("bb.clan.withdraw", amount));
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, CurrencyFormat.format(amount)));
|
||||
addBb(player.getName(), lang("bb.clan.withdraw", CurrencyFormat.format(amount)));
|
||||
setBalance(getBalance() - amount);
|
||||
}
|
||||
} else {
|
||||
@@ -246,6 +248,16 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
return balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the clan's balance formatted
|
||||
*
|
||||
* @return the balance formatted
|
||||
*/
|
||||
@Placeholder("balance_formatted")
|
||||
public String getBalanceFormatted() {
|
||||
return CurrencyFormat.format(balance);
|
||||
}
|
||||
|
||||
/**
|
||||
* (used internally)
|
||||
*
|
||||
@@ -453,7 +465,7 @@ public class Clan implements Serializable, Comparable<Clan> {
|
||||
*/
|
||||
@Placeholder("founded")
|
||||
public String getFoundedString() {
|
||||
return new java.text.SimpleDateFormat("MMM dd, ''yy h:mm a").format(new Date(this.founded));
|
||||
return DateFormat.formatDateTime(founded);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.sacredlabyrinth.phaed.simpleclans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.papi.Placeholder;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ProtectionManager.Action;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.DateFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -487,8 +488,7 @@ public class ClanPlayer implements Serializable, Comparable<ClanPlayer> {
|
||||
if (joinDate == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return new java.text.SimpleDateFormat("MMM dd, ''yy h:mm a").format(new Date(joinDate));
|
||||
return DateFormat.formatDateTime(joinDate);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -512,7 +512,7 @@ public class ClanPlayer implements Serializable, Comparable<ClanPlayer> {
|
||||
if (!VanishUtils.isVanished(sender, this)) {
|
||||
return lang("online", sender);
|
||||
}
|
||||
return new java.text.SimpleDateFormat("MMM dd, ''yy h:mm a").format(new Date(lastSeen));
|
||||
return DateFormat.formatDateTime(lastSeen);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.sacredlabyrinth.phaed.simpleclans.events.BankWithdrawEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class BankCommand extends BaseCommand {
|
||||
@Conditions("rank:name=BANK_BALANCE")
|
||||
@Description("{@@command.description.bank.status}")
|
||||
public void bankStatus(Player player, Clan clan) {
|
||||
player.sendMessage(AQUA + lang("clan.balance", player, clan.getBalance()));
|
||||
player.sendMessage(AQUA + lang("clan.balance", player, clan.getBalanceFormatted()));
|
||||
}
|
||||
|
||||
@Subcommand("%withdraw %all")
|
||||
@@ -73,8 +74,8 @@ public class BankCommand extends BaseCommand {
|
||||
switch (clan.withdraw(operator, COMMAND, amount)) {
|
||||
case SUCCESS -> {
|
||||
if (permissions.grantPlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, amount));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", amount, player.getName()));
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, CurrencyFormat.format(amount)));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", CurrencyFormat.format(amount), player.getName()));
|
||||
} else {
|
||||
clan.setBalance(operator, REVERT, BankLogger.Operation.WITHDRAW, clan.getBalance() + amount);
|
||||
}
|
||||
@@ -121,15 +122,15 @@ public class BankCommand extends BaseCommand {
|
||||
*/
|
||||
|
||||
if (!permissions.playerHasMoney(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, amount));
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, CurrencyFormat.format(amount)));
|
||||
return;
|
||||
}
|
||||
BankOperator operator = new BankOperator(player, permissions.playerGetMoney(player));
|
||||
EconomyResponse response = clan.deposit(operator, COMMAND, amount);
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
if (permissions.chargePlayer(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, amount));
|
||||
clan.addBb(player.getName(), lang("bb.clan.deposit", amount, player.getName()));
|
||||
player.sendMessage(AQUA + lang("player.clan.deposit", player, CurrencyFormat.format(amount)));
|
||||
clan.addBb(player.getName(), lang("bb.clan.deposit", CurrencyFormat.format(amount), player.getName()));
|
||||
} else {
|
||||
//Reverts the deposit if something went wrong with Vault
|
||||
clan.setBalance(operator, REVERT, BankLogger.Operation.DEPOSIT, clan.getBalance() - amount);
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.sacredlabyrinth.phaed.simpleclans.conversation.SCConversation;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.TagChangeEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -188,12 +189,12 @@ public class ClanCommands extends BaseCommand {
|
||||
double maxFee = settings.getDouble(ECONOMY_MAX_MEMBER_FEE);
|
||||
if (fee > maxFee) {
|
||||
ChatBlock.sendMessage(player, RED
|
||||
+ lang("max.fee.allowed.is.0", player, maxFee));
|
||||
+ lang("max.fee.allowed.is.0", player, CurrencyFormat.format(maxFee)));
|
||||
return;
|
||||
}
|
||||
if (cm.purchaseMemberFeeSet(player)) {
|
||||
clan.setMemberFee(fee);
|
||||
clan.addBb(player.getName(), lang("bb.fee.set", fee));
|
||||
clan.addBb(player.getName(), lang("bb.fee.set", CurrencyFormat.format(fee)));
|
||||
ChatBlock.sendMessage(player, AQUA + lang("fee.set", player));
|
||||
storage.updateClan(clan);
|
||||
}
|
||||
|
||||
+22
-5
@@ -9,6 +9,8 @@ import net.sacredlabyrinth.phaed.simpleclans.conversation.SCConversation;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.discord.DiscordHook;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.hooks.discord.exceptions.DiscordHookException;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -89,7 +91,8 @@ public class LeaderCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
if (settings.is(CLAN_CONFIRMATION_FOR_PROMOTE) && clan.getLeaders().size() > 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.PROMOTE, otherPl.getName(), "asking.for.the.promotion", otherPl.getName());
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.PROMOTE, otherPl.getName(), "asking.for.the.promotion",
|
||||
player.getName(), otherPl.getName());
|
||||
ChatBlock.sendMessage(player, AQUA + lang("promotion.vote.has.been.requested.from.all.leaders",
|
||||
player));
|
||||
return;
|
||||
@@ -104,7 +107,8 @@ public class LeaderCommands extends BaseCommand {
|
||||
@Description("{@@command.description.disband}")
|
||||
public void disband(Player player, ClanPlayer cp, Clan clan) {
|
||||
if (clan.getLeaders().size() != 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.DISBAND, clan.getTag(), "asking.to.disband");
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.DISBAND, clan.getTag(), "asking.to.disband",
|
||||
player.getName());
|
||||
ChatBlock.sendMessage(player, AQUA +
|
||||
lang("clan.disband.vote.has.been.requested.from.all.leaders", player));
|
||||
return;
|
||||
@@ -190,14 +194,27 @@ public class LeaderCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.leader.rename")
|
||||
@CommandCompletion("@nothing")
|
||||
@Description("{@@command.description.rename}")
|
||||
public void rename(ClanPlayer cp, Clan clan, @Name("name") String clanName) {
|
||||
public void rename(Player player, ClanPlayer cp, Clan clan, @Name("name") String clanName) {
|
||||
if (clanName.contains("&")) {
|
||||
ChatBlock.sendMessageKey(cp, "your.clan.name.cannot.contain.color.codes");
|
||||
return;
|
||||
}
|
||||
boolean bypass = plugin.getPermissionsManager().has(player, "simpleclans.mod.bypass");
|
||||
if (!bypass) {
|
||||
if (ChatUtils.stripColors(clanName).length() > plugin.getSettingsManager().getInt(CLAN_MAX_LENGTH)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clan.name.cannot.be.longer.than.characters",
|
||||
player, plugin.getSettingsManager().getInt(CLAN_MAX_LENGTH)));
|
||||
return;
|
||||
}
|
||||
if (ChatUtils.stripColors(clanName).length() <= plugin.getSettingsManager().getInt(CLAN_MIN_LENGTH)) {
|
||||
ChatBlock.sendMessage(player, RED + lang("your.clan.name.must.be.longer.than.characters",
|
||||
player, plugin.getSettingsManager().getInt(CLAN_MIN_LENGTH)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clan.getLeaders().size() != 1) {
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.RENAME, "asking.to.rename", clanName);
|
||||
requestManager.requestAllLeaders(cp, ClanRequest.RENAME, clanName, "asking.to.rename", cp.getName(), clanName);
|
||||
ChatBlock.sendMessageKey(cp, "rename.vote.has.been.requested.from.all.leaders");
|
||||
return;
|
||||
}
|
||||
@@ -222,7 +239,7 @@ public class LeaderCommands extends BaseCommand {
|
||||
double amount = settings.getDouble(ECONOMY_DISCORD_CREATION_PRICE);
|
||||
if (settings.is(ECONOMY_PURCHASE_DISCORD_CREATE)) {
|
||||
if (!permissions.playerHasMoney(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, amount));
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, CurrencyFormat.format(amount)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ public class GeneralCommands extends BaseCommand {
|
||||
Clan clan = clans.get(i);
|
||||
String name = " " + (clan.isVerified() ? settings.getColored(PAGE_CLAN_NAME_COLOR) : GRAY) + clan.getName();
|
||||
String line = MessageFormat.format(lineFormat, i + 1, leftBracket, clan.getColorTag(),
|
||||
rightBracket, name, clan.getBalance());
|
||||
rightBracket, name, clan.getBalanceFormatted());
|
||||
sender.sendMessage(line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankLogger;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -31,7 +32,7 @@ public class BankCommand extends BaseCommand {
|
||||
@Description("{@@command.description.bank.admin.status}")
|
||||
public void status(CommandSender sender, @Name("clan") ClanInput clanInput) {
|
||||
Clan clan = clanInput.getClan();
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.balance", sender, clan.getName(), clan.getBalance()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.balance", sender, clan.getName(), clan.getBalanceFormatted()));
|
||||
}
|
||||
|
||||
@Subcommand("%take")
|
||||
@@ -46,8 +47,8 @@ public class BankCommand extends BaseCommand {
|
||||
EconomyResponse economyResponse = clan.withdraw(operator, ClanBalanceUpdateEvent.Cause.COMMAND, amount);
|
||||
switch (economyResponse) {
|
||||
case SUCCESS:
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.take", sender, amount, clan.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.take", sender, amount, sender.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.take", sender, CurrencyFormat.format(amount), clan.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.take", sender, CurrencyFormat.format(amount), sender.getName()));
|
||||
break;
|
||||
case NOT_ENOUGH_BALANCE:
|
||||
sender.sendMessage(RED + lang("clan.admin.bank.not.enough.money", sender, clan.getName()));
|
||||
@@ -66,8 +67,8 @@ public class BankCommand extends BaseCommand {
|
||||
|
||||
EconomyResponse economyResponse = clan.deposit(operator, ClanBalanceUpdateEvent.Cause.COMMAND, amount);
|
||||
if (economyResponse == EconomyResponse.SUCCESS) {
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.give", sender, amount, clan.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.give", sender, amount, sender.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.give", sender, CurrencyFormat.format(amount), clan.getName()));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.give", sender, CurrencyFormat.format(amount), sender.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +83,8 @@ public class BankCommand extends BaseCommand {
|
||||
|
||||
EconomyResponse response = clan.setBalance(operator, ClanBalanceUpdateEvent.Cause.COMMAND, BankLogger.Operation.SET, amount);
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.set", sender, clan.getName(), amount));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.set", sender, amount, sender.getName()));
|
||||
ChatBlock.sendMessage(sender, AQUA + lang("clan.admin.set", sender, clan.getName(), CurrencyFormat.format(amount)));
|
||||
clan.addBb(sender.getName(), lang("bb.clan.set", sender, CurrencyFormat.format(amount), sender.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -626,11 +626,7 @@ public class DiscordHook implements Listener {
|
||||
}
|
||||
|
||||
private void updateLeaderRole(@NotNull Member member, @NotNull ClanPlayer clanPlayer, DiscordAction action) {
|
||||
if (!clanPlayer.isLeader()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == ADD) {
|
||||
if (action == ADD && clanPlayer.isLeader()) {
|
||||
guild.addRoleToMember(member, leaderRole).queue();
|
||||
} else {
|
||||
guild.removeRoleFromMember(member, leaderRole).queue();
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.sacredlabyrinth.phaed.simpleclans.events.CreateClanEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.EconomyTransactionEvent.Cause;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -78,7 +79,7 @@ public final class ClanManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
//cleaning
|
||||
// cleaning
|
||||
final int delay = plugin.getSettingsManager().getInt(KDR_DELAY_BETWEEN_KILLS);
|
||||
long timePassed = oldKill.getTime().until(LocalDateTime.now(), ChronoUnit.MINUTES);
|
||||
if (timePassed >= delay) {
|
||||
@@ -149,7 +150,7 @@ public final class ClanManager {
|
||||
importClan(clan);
|
||||
plugin.getStorageManager().updateClanPlayer(cp);
|
||||
|
||||
plugin.getRequestManager().deny(cp); //denies any previous invitation
|
||||
plugin.getRequestManager().deny(cp); // denies any previous invitation
|
||||
SimpleClans.getInstance().getPermissionsManager().updateClanPermissions(clan);
|
||||
SimpleClans.getInstance().getServer().getPluginManager().callEvent(new CreateClanEvent(clan));
|
||||
}
|
||||
@@ -417,8 +418,10 @@ public final class ClanManager {
|
||||
|
||||
if (plugin.getSettingsManager().is(DISPLAY_CHAT_TAGS)) {
|
||||
String prefix = plugin.getPermissionsManager().getPrefix(player);
|
||||
//String suffix = plugin.getPermissionsManager().getSuffix(player);
|
||||
String lastColor = plugin.getSettingsManager().is(COLOR_CODE_FROM_PREFIX_FOR_NAME) ? ChatUtils.getLastColorCode(prefix) : ChatColor.WHITE + "";
|
||||
// String suffix = plugin.getPermissionsManager().getSuffix(player);
|
||||
String lastColor = plugin.getSettingsManager().is(COLOR_CODE_FROM_PREFIX_FOR_NAME)
|
||||
? ChatUtils.getLastColorCode(prefix)
|
||||
: ChatColor.WHITE + "";
|
||||
String fullName = player.getName();
|
||||
|
||||
ClanPlayer cp = plugin.getClanManager().getAnyClanPlayer(player.getUniqueId());
|
||||
@@ -932,9 +935,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.MEMBER_FEE_SET);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -955,9 +958,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_CREATION);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -978,9 +981,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_INVITATION);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1001,9 +1004,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_HOME_TELEPORT);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1024,9 +1027,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_HOME_TELEPORT_SET);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1047,9 +1050,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.RESET_KDR);
|
||||
player.spigot().sendMessage(new TextComponent(RED + MessageFormat.format(lang("account.has.been.debited", player), price)));
|
||||
player.spigot().sendMessage(new TextComponent(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price))));
|
||||
} else {
|
||||
player.spigot().sendMessage(new TextComponent(RED + MessageFormat.format(lang("not.sufficient.money", player), price)));
|
||||
player.spigot().sendMessage(new TextComponent(RED + MessageFormat.format(lang("not.sufficient.money", player), CurrencyFormat.format(price))));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1079,9 +1082,9 @@ public final class ClanManager {
|
||||
if (plugin.getSettingsManager().is(ECONOMY_ISSUER_PAYS_REGROUP) && plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_REGROUP);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@@ -1089,8 +1092,8 @@ public final class ClanManager {
|
||||
switch (clan.withdraw(new BankOperator(player, money), ClanBalanceUpdateEvent.Cause.COMMAND, price)) {
|
||||
case SUCCESS -> {
|
||||
if (plugin.getPermissionsManager().grantPlayer(player, price)) {
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, price));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", price));
|
||||
player.sendMessage(AQUA + lang("player.clan.withdraw", player, CurrencyFormat.format(price)));
|
||||
clan.addBb(player.getName(), lang("bb.clan.withdraw", CurrencyFormat.format(price)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1114,9 +1117,9 @@ public final class ClanManager {
|
||||
if (plugin.getPermissionsManager().hasEconomy()) {
|
||||
if (plugin.getPermissionsManager().playerHasMoney(player, price)) {
|
||||
plugin.getPermissionsManager().chargePlayer(player, price, Cause.CLAN_VERIFICATION);
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), price));
|
||||
player.sendMessage(RED + MessageFormat.format(lang("account.has.been.debited", player), CurrencyFormat.format(price)));
|
||||
} else {
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, price));
|
||||
player.sendMessage(RED + lang("not.sufficient.money", player, CurrencyFormat.format(price)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -167,6 +167,9 @@ public final class PermissionsManager {
|
||||
return permissions.get(clan.getTag());
|
||||
}
|
||||
|
||||
public String format(double value) {
|
||||
return Objects.requireNonNull(economy, "Can't find economy provider").format(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge a player some money
|
||||
@@ -267,8 +270,10 @@ public final class PermissionsManager {
|
||||
*/
|
||||
public boolean grantPlayer(@NotNull OfflinePlayer player, double money, @Nullable Cause cause) {
|
||||
EconomyResponse response = Objects.requireNonNull(economy, "Can't find economy provider").depositPlayer(player, money);
|
||||
if (!response.transactionSuccess() || cause == null) {
|
||||
if (!response.transactionSuccess()) {
|
||||
return false;
|
||||
} else if (cause == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EconomyTransactionEvent event = new EconomyTransactionEvent(player, response.amount, cause, EconomyTransactionEvent.TransactionType.DEPOSIT);
|
||||
|
||||
@@ -92,15 +92,15 @@ public final class RequestManager {
|
||||
}
|
||||
|
||||
Clan clan = requester.getClan();
|
||||
if (clan == null || requests.containsKey(target)) {
|
||||
if (clan == null || requests.containsKey(clan.getTag())) {
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = MessageFormat.format(lang(key), args);
|
||||
String msg = lang(key, args);
|
||||
List<ClanPlayer> acceptors = Helper.stripOffLinePlayers(clan.getLeaders());
|
||||
|
||||
Request req = new Request(request, acceptors, requester, target, clan, msg);
|
||||
requests.put(req.getTarget(), req);
|
||||
requests.put(clan.getTag(), req);
|
||||
req.vote(requester.getName(), VoteResult.ACCEPT);
|
||||
|
||||
ask(req);
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.sacredlabyrinth.phaed.simpleclans.Rank;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -12,6 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver.RankingType;
|
||||
@@ -89,8 +91,8 @@ public final class SettingsManager {
|
||||
if (configFile.exists()) {
|
||||
try {
|
||||
config.load(configFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException | InvalidConfigurationException ex) {
|
||||
SimpleClans.getInstance().getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +102,8 @@ public final class SettingsManager {
|
||||
public void save() {
|
||||
try {
|
||||
config.save(configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
SimpleClans.getInstance().getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +117,7 @@ public final class SettingsManager {
|
||||
" that matches their clan tag.");
|
||||
}
|
||||
|
||||
if (discordSrv == null && is (DISCORDCHAT_ENABLE)) {
|
||||
if (discordSrv == null && is(DISCORDCHAT_ENABLE)) {
|
||||
plugin.getLogger().warning("DiscordChat can't be initialized, please, install DiscordSRV.");
|
||||
}
|
||||
}
|
||||
@@ -148,7 +150,7 @@ public final class SettingsManager {
|
||||
* Check whether a word is disallowed
|
||||
*
|
||||
* @param word the world
|
||||
* @return whether its a disallowed word
|
||||
* @return whether its disallowed word
|
||||
*/
|
||||
public boolean isDisallowedWord(String word) {
|
||||
for (String disallowedTag : getStringList(DISALLOWED_TAGS)) {
|
||||
@@ -168,13 +170,8 @@ public final class SettingsManager {
|
||||
* @return whether the string contains the color code
|
||||
*/
|
||||
public boolean hasDisallowedColor(String str) {
|
||||
for (String disallowedTag : getStringList(DISALLOWED_TAG_COLORS)) {
|
||||
if (str.contains("&" + disallowedTag)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
var loweredString = str.toLowerCase();
|
||||
return getStringList(DISALLOWED_TAG_COLORS).stream().map(String::toLowerCase).anyMatch(color -> loweredString.contains("&" + color));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,6 +312,7 @@ public final class SettingsManager {
|
||||
USERNAME_REGEX("settings.username-regex", "^\\**[a-zA-Z0-9_$]{1,16}$"),
|
||||
TAG_REGEX("settings.tag-regex", ""),
|
||||
ACCEPT_OTHER_ALPHABETS_LETTERS("settings.accept-other-alphabets-letters-on-tag", false),
|
||||
DATE_TIME_PATTERN("settings.date-time-pattern", "HH:mm - dd/MM/yyyy"),
|
||||
/*
|
||||
================
|
||||
> Tag Settings
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.sacredlabyrinth.phaed.simpleclans.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -54,7 +55,7 @@ public class CollectFeeTask extends BukkitRunnable {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(cp.getUniqueId());
|
||||
boolean success = pm.chargePlayer(player, memberFee);
|
||||
if (success) {
|
||||
ChatBlock.sendMessage(cp, AQUA + lang("fee.collected", cp, memberFee));
|
||||
ChatBlock.sendMessage(cp, AQUA + lang("fee.collected", cp, CurrencyFormat.format(memberFee)));
|
||||
|
||||
clan.deposit(new BankOperator(cp, pm.playerGetMoney(player)), Cause.MEMBER_FEE, memberFee);
|
||||
plugin.getStorageManager().updateClan(clan);
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.events.ClanBalanceUpdateEvent;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.loggers.BankOperator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
@@ -59,7 +60,7 @@ public class CollectUpkeepTask extends BukkitRunnable {
|
||||
clan.disband(null, true, false);
|
||||
}
|
||||
if (response == EconomyResponse.SUCCESS) {
|
||||
clan.addBb(MessageFormat.format(lang("upkeep.collected"), upkeep), false);
|
||||
clan.addBb(MessageFormat.format(lang("upkeep.collected"), CurrencyFormat.format(upkeep)), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -164,7 +165,7 @@ public class ClanDetailsFrame extends SCFrame {
|
||||
List<String> lore = verified ? null : new ArrayList<>();
|
||||
if (!verified) {
|
||||
if (purchaseVerification) {
|
||||
lore.add(lang("gui.clandetails.verify.price.lore", getViewer(), settings.getDouble(ECONOMY_VERIFICATION_PRICE)));
|
||||
lore.add(lang("gui.clandetails.verify.price.lore", getViewer(), CurrencyFormat.format(settings.getDouble(ECONOMY_VERIFICATION_PRICE))));
|
||||
}
|
||||
lore.add(lang("gui.clandetails.not.verified.lore", getViewer()));
|
||||
}
|
||||
@@ -180,7 +181,7 @@ public class ClanDetailsFrame extends SCFrame {
|
||||
String withdrawStatus = clan.isAllowWithdraw() ? lang("allowed",getViewer()) : lang("blocked",getViewer());
|
||||
String depositStatus = clan.isAllowDeposit() ? lang("allowed", getViewer()) : lang("blocked", getViewer());
|
||||
SCComponent bank = new SCComponentImpl(lang("gui.clandetails.bank.title", getViewer()),
|
||||
Arrays.asList(lang("gui.clandetails.bank.balance.lore", getViewer(), clan.getBalance()),
|
||||
Arrays.asList(lang("gui.clandetails.bank.balance.lore", getViewer(), clan.getBalanceFormatted()),
|
||||
lang("gui.clandetails.bank.withdraw.status.lore", getViewer(), withdrawStatus),
|
||||
lang("gui.clandetails.bank.deposit.status.lore", getViewer(), depositStatus),
|
||||
lang("gui.clandetails.bank.withdraw.toggle.lore", getViewer()),
|
||||
@@ -245,7 +246,7 @@ public class ClanDetailsFrame extends SCFrame {
|
||||
}
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (price != 0) lore.add(lang("gui.clandetails.regroup.lore.price", getViewer(), price));
|
||||
if (price != 0) lore.add(lang("gui.clandetails.regroup.lore.price", getViewer(), CurrencyFormat.format(price)));
|
||||
lore.add(lang("gui.clandetails.regroup.lore.home", getViewer()));
|
||||
lore.add(lang("gui.clandetails.regroup.lore.me", getViewer()));
|
||||
|
||||
@@ -267,9 +268,9 @@ public class ClanDetailsFrame extends SCFrame {
|
||||
double setPrice = settings.is(ECONOMY_PURCHASE_HOME_TELEPORT_SET) ? settings.getDouble(ECONOMY_HOME_TELEPORT_SET_PRICE) : 0;
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (homePrice != 0) lore.add(lang("gui.clandetails.home.lore.teleport.price", getViewer(), homePrice));
|
||||
if (homePrice != 0) lore.add(lang("gui.clandetails.home.lore.teleport.price", getViewer(), CurrencyFormat.format(homePrice)));
|
||||
lore.add(lang("gui.clandetails.home.lore.teleport", getViewer()));
|
||||
if (setPrice != 0) lore.add(lang("gui.clandetails.home.lore.set.price", getViewer(), setPrice));
|
||||
if (setPrice != 0) lore.add(lang("gui.clandetails.home.lore.set.price", getViewer(), CurrencyFormat.format(setPrice)));
|
||||
lore.add(lang("gui.clandetails.home.lore.set", getViewer()));
|
||||
lore.add(lang("gui.clandetails.home.lore.clear", getViewer()));
|
||||
|
||||
|
||||
@@ -6,10 +6,7 @@ import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Helper;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.KDRFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.Paginator;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -121,7 +118,7 @@ public class Components {
|
||||
double price = pl.getSettingsManager().is(ECONOMY_PURCHASE_CLAN_CREATE) ? pl.getSettingsManager().getDouble(ECONOMY_CREATION_PRICE) : 0;
|
||||
lore = new ArrayList<>();
|
||||
if (price != 0) {
|
||||
lore.add(lang("gui.clandetails.free.agent.create.clan.price.lore", frame.getViewer(), price));
|
||||
lore.add(lang("gui.clandetails.free.agent.create.clan.price.lore", frame.getViewer(), CurrencyFormat.format(price)));
|
||||
}
|
||||
lore.add(lang("gui.clandetails.free.agent.create.clan.lore", frame.getViewer()));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.sacredlabyrinth.phaed.simpleclans.RankPermission;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.Paginator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -54,7 +55,7 @@ public class InviteFrame extends SCFrame {
|
||||
private SCComponent createPlayerComponent(@NotNull Player player, int slot) {
|
||||
double price = plugin.getSettingsManager().is(ECONOMY_PURCHASE_CLAN_INVITE) ? plugin.getSettingsManager().getDouble(ECONOMY_INVITE_PRICE) : 0;
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (price != 0) lore.add(lang("gui.invite.player.price.lore", getViewer(), price));
|
||||
if (price != 0) lore.add(lang("gui.invite.player.price.lore", getViewer(), CurrencyFormat.format(price)));
|
||||
lore.add(lang("gui.invite.player.lore", getViewer()));
|
||||
|
||||
SCComponent c = new SCComponentImpl(
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.cryptomorin.xseries.XMaterial;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.frames.staff.StaffFrame;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.CurrencyFormat;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -93,8 +94,9 @@ public class MainFrame extends SCFrame {
|
||||
|
||||
List<String> resetKdrLore;
|
||||
if (plugin.getSettingsManager().is(ECONOMY_PURCHASE_RESET_KDR)) {
|
||||
double price = plugin.getSettingsManager().getDouble(ECONOMY_RESET_KDR_PRICE);
|
||||
resetKdrLore = Arrays.asList(
|
||||
lang("gui.main.reset.kdr.lore.price", getViewer(), plugin.getSettingsManager().getString(ECONOMY_RESET_KDR_PRICE)),
|
||||
lang("gui.main.reset.kdr.lore.price", getViewer(), CurrencyFormat.format(price)),
|
||||
lang("gui.main.reset.kdr.lore", getViewer()));
|
||||
} else {
|
||||
resetKdrLore = Collections.singletonList(lang("gui.main.reset.kdr.lore", getViewer()));
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class ClanDetailsFrame extends SCFrame {
|
||||
}
|
||||
|
||||
private void addBank() {
|
||||
List<String> lore = Collections.singletonList(lang("gui.clandetails.bank.balance.lore", getViewer(), clan.getBalance()));
|
||||
List<String> lore = Collections.singletonList(lang("gui.clandetails.bank.balance.lore", getViewer(), clan.getBalanceFormatted()));
|
||||
|
||||
SCComponent bank = new SCComponentImpl(lang("gui.clandetails.bank.title", getViewer()), lore, XMaterial.GOLD_INGOT, 40);
|
||||
add(bank);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ChatUtils {
|
||||
// https://www.spigotmc.org/threads/hex-color-code-translate.449748/#post-3867795
|
||||
if (HEX_COLOR_SUPPORT) {
|
||||
Matcher matcher = HEX_COLOR_PATTERN.matcher(text);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buffer, ChatColor.of("#" + matcher.group(1)).toString());
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class ChatUtils {
|
||||
public static String stripColors(String text) {
|
||||
Pattern pattern = HEX_COLOR_SUPPORT ? HEX_STRIP_COLOR_PATTERN : STRIP_COLOR_PATTERN;
|
||||
Matcher matcher = pattern.matcher(text);
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buffer, "");
|
||||
}
|
||||
@@ -162,4 +162,5 @@ public class ChatUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.PermissionsManager;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
public class CurrencyFormat {
|
||||
|
||||
private static final SimpleClans plugin = SimpleClans.getInstance();
|
||||
private static final NumberFormat fallbackFormat = NumberFormat.getCurrencyInstance();
|
||||
|
||||
public static String format(double value) {
|
||||
PermissionsManager permissionsManager = plugin.getPermissionsManager();
|
||||
if (permissionsManager.hasEconomy()) {
|
||||
return permissionsManager.format(value);
|
||||
}
|
||||
return fallbackFormat.format(value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.sacredlabyrinth.phaed.simpleclans.utils;
|
||||
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.DATE_TIME_PATTERN;
|
||||
|
||||
public class DateFormat {
|
||||
|
||||
private static final SimpleClans plugin = SimpleClans.getInstance();
|
||||
private static SimpleDateFormat format;
|
||||
|
||||
static {
|
||||
String pattern = plugin.getSettingsManager().getString(DATE_TIME_PATTERN);
|
||||
try {
|
||||
format = new SimpleDateFormat(pattern);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
plugin.getLogger().warning("%s is not a valid pattern!".formatted(pattern));
|
||||
format = new SimpleDateFormat("HH:mm - dd/MM/yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
public static String formatDateTime(long date) {
|
||||
return format.format(new Date(date));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
||||
|
||||
private static final double PROFILES_PER_REQUEST = 100;
|
||||
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
||||
private static final String PROFILE_URL = "https://api.minecraftservices.com/minecraft/profile/lookup/bulk/byname";
|
||||
private final Gson gson = new Gson();
|
||||
private final List<String> names;
|
||||
private final boolean rateLimiting;
|
||||
|
||||
@@ -56,6 +56,7 @@ settings:
|
||||
past-clans-limit: 10
|
||||
username-regex: '(\.|\*){0,1}[a-zA-Z0-9_$]{1,16}'
|
||||
tag-regex: ''
|
||||
date-time-pattern: 'HH:mm - dd/MM/yyyy'
|
||||
war-and-protection:
|
||||
war-enabled: false
|
||||
land-sharing: true
|
||||
|
||||
Reference in new issue
Block a user