Compare commits
55 Commits
Author | SHA1 | Date |
---|---|---|
Zeshan | 6226feeb32 | |
Zeshan | 6d0dfff1f8 | |
yellagoya | a817bef7e7 | |
whitebear13579 | ba5925f80c | |
zeshanaslam | 210ae03593 | |
Zeshan Aslam | aacbf3af3d | |
WolfAURman | 5e676ee355 | |
Zeshan Aslam | c173525983 | |
Mortal_chen | c2e845fdd0 | |
Zeshan Aslam | 4f24701b79 | |
Zeshan Aslam | b58356e84d | |
Zeshan Aslam | 99f411f0b3 | |
SkyGhostK | 4cbc75e50c | |
Zeshan Aslam | 6184f8ff0a | |
Zeshan Aslam | 52fba93322 | |
Zeshan Aslam | 794135b02e | |
Zeshan Aslam | ecfda68d2c | |
Zeshan Aslam | fc693d29a3 | |
Kikisito | d1812f0c6a | |
Kikisito | dfde78a5e4 | |
Kikisito | 95d8f4a693 | |
Kikisito | 993442286e | |
Kikisito | d720d763ab | |
Kikisito | 9c791b494f | |
Kikisito | 6ae7244f08 | |
Zeshan Aslam | 62fc50877a | |
Kikisito | 0fee3f6601 | |
Kikisito | 8ffbd2b074 | |
Zeshan Aslam | fd46f6c70d | |
PoulpY2K | f9e67354fb | |
Zeshan Aslam | 09c02c1edf | |
Miguel Angelo | 40e0dbaab6 | |
Zeshan Aslam | d02518a1c4 | |
ybw0014 | e946d6e0c3 | |
Zeshan Aslam | ea6cf922f8 | |
Zeshan Aslam | 85d2a0dd21 | |
syldium | 00d80cfbd6 | |
Zeshan Aslam | 64ad990db8 | |
Zeshan Aslam | 3278a39d5d | |
Zeshan Aslam | ea922e9730 | |
Zeshan Aslam | a9c97c933b | |
Zeshan Aslam | b8d5146d2f | |
Zeshan Aslam | 6c0a799198 | |
Zeshan Aslam | 9e2121e7f4 | |
Zeshan Aslam | 475e2a2c2b | |
Nikox3003 | db2e8e9e82 | |
Zeshan Aslam | 58a4025f2f | |
Zeshan Aslam | 6b0bf8ef30 | |
Zeshan Aslam | c78cbddafe | |
ShadowG25OQ | 6f0f1a7ba7 | |
Zeshan Aslam | fb6e0241b2 | |
Aurélien | 2c376d8e64 | |
Aurélien | 1a3282d64d | |
Zeshan Aslam | dd70abd7d5 | |
ybw0014 | e645945fa1 |
|
@ -1,4 +1,118 @@
|
||||||
ActionHealth.iml
|
# User-specific stuff
|
||||||
.idea/*
|
.idea/
|
||||||
libs/*
|
|
||||||
out/*
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
out/
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
Thumbs.db:encryptable
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
**/build/
|
||||||
|
|
||||||
|
# Common working directory
|
||||||
|
run/
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
|
@ -5,7 +5,10 @@ Spigot page: [Click Here](https://www.spigotmc.org/resources/action-bar-health.2
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
**Required**
|
**Required**
|
||||||
- Java 8 or greater
|
- Version v3.5.7 or greater
|
||||||
|
- Java 16 or greater
|
||||||
|
- Versions below v3.5.7
|
||||||
|
- Java 8 or greater
|
||||||
|
|
||||||
**Optional**
|
**Optional**
|
||||||
- For region disable option:
|
- For region disable option:
|
||||||
|
@ -28,6 +31,9 @@ Default config: [Click Here](https://github.com/zeshan321/ActionHealth/blob/mast
|
||||||
|
|
||||||
A list of the community made translations: [Click Here](https://github.com/zeshan321/ActionHealth/wiki/Community-Translations)
|
A list of the community made translations: [Click Here](https://github.com/zeshan321/ActionHealth/wiki/Community-Translations)
|
||||||
|
|
||||||
|
# Compiling
|
||||||
|
To compile ActionHealth, you need at least **Java 16** and an internet connection. Then, clone this repo, run `./gradlew clean shadowJar` and get your jar from `build/libs/ActionHealh-VERSION-all.jar`.
|
||||||
|
|
||||||
# More info
|
# More info
|
||||||
Custom styles, screenshots, command information and more can be found on the spigot page.
|
Custom styles, screenshots, command information and more can be found on the spigot page.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.zeshanaslam'
|
||||||
|
version = '3.5.9'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
name = 'spigotmc-repo'
|
||||||
|
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'sonatype-repo'
|
||||||
|
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'codemc-repo'
|
||||||
|
url = 'https://repo.codemc.org/repository/maven-public/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'langutils-repo'
|
||||||
|
url = 'https://raw.github.com/MascusJeoraly/LanguageUtils/mvn-repo/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'Lumine Releases'
|
||||||
|
url = 'https://mvn.lumine.io/repository/maven-public/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'papi-repo'
|
||||||
|
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'IntellectualSites'
|
||||||
|
url = 'https://mvn.intellectualsites.com/content/repositories/releases/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
||||||
|
compileOnly 'me.clip:placeholderapi:2.10.10'
|
||||||
|
compileOnly 'org.apache.commons:commons-lang3:3.12.0'
|
||||||
|
compileOnly 'com.meowj:LangUtils:1.9'
|
||||||
|
compileOnly files('temp_libs/MVdWPlaceholderAPI.jar')
|
||||||
|
compileOnly files('temp_libs/MythicMobs-5.0.2.jar')
|
||||||
|
implementation 'org.codemc.worldguardwrapper:worldguardwrapper:1.2.0-SNAPSHOT'
|
||||||
|
}
|
||||||
|
|
||||||
|
def targetJavaVersion = 16
|
||||||
|
java {
|
||||||
|
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
|
||||||
|
sourceCompatibility = javaVersion
|
||||||
|
targetCompatibility = javaVersion
|
||||||
|
if (JavaVersion.current() < javaVersion) {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||||
|
options.release = targetJavaVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
def props = [version: version]
|
||||||
|
inputs.properties props
|
||||||
|
filteringCharset 'UTF-8'
|
||||||
|
filesMatching('plugin.yml') {
|
||||||
|
expand props
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shadowJar {
|
||||||
|
minimize()
|
||||||
|
dependencies {
|
||||||
|
include(dependency('org.codemc.worldguardwrapper:worldguardwrapper:1.2.0-SNAPSHOT'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.build.dependsOn tasks.shadowJar
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,185 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed 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
|
||||||
|
#
|
||||||
|
# https://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.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MSYS* | MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
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
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -0,0 +1 @@
|
||||||
|
rootProject.name = 'ActionHealth'
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zeshanaslam.actionhealth.support;
|
|
||||||
|
|
||||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
|
|
||||||
public class MythicMobsSupport {
|
|
||||||
public String getMythicName(Entity entity) {
|
|
||||||
if (MythicMobs.inst().getAPIHelper().isMythicMob(entity)) {
|
|
||||||
return MythicMobs.inst().getAPIHelper().getMythicMobInstance(entity).getType().getInternalName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,27 +7,15 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
public class LookThread extends BukkitRunnable {
|
public class LookThread extends BukkitRunnable {
|
||||||
|
|
||||||
private Main plugin;
|
private Main plugin;
|
||||||
private Set<Byte> transparentTypeIds;
|
|
||||||
private TargetHelper targetHelper;
|
private TargetHelper targetHelper;
|
||||||
|
|
||||||
public LookThread(Main plugin) {
|
public LookThread(Main plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.targetHelper = new TargetHelper(plugin);
|
this.targetHelper = new TargetHelper(plugin);
|
||||||
this.transparentTypeIds = new TreeSet<>();
|
|
||||||
|
|
||||||
transparentTypeIds.add((byte) 0);
|
|
||||||
transparentTypeIds.add((byte) 20);
|
|
||||||
transparentTypeIds.add((byte) 95);
|
|
||||||
transparentTypeIds.add((byte) 102);
|
|
||||||
transparentTypeIds.add((byte) 160);
|
|
||||||
transparentTypeIds.add((byte) 8);
|
|
||||||
transparentTypeIds.add((byte) 9);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +23,7 @@ public class LookThread extends BukkitRunnable {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||||
if (plugin.configStore.toggleMessage != null && !plugin.configStore.toggleMessage.equals("")) {
|
if (plugin.configStore.toggleMessage != null && !plugin.configStore.toggleMessage.equals("")) {
|
||||||
plugin.healthUtil.sendActionBar(player, plugin.configStore.toggleMessage.replace("{name}", player.getName()));
|
plugin.healthUtil.sendActionBar(player, plugin.healthUtil.replacePlaceholders(plugin.configStore.toggleMessage, "name", player.getName()));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +35,7 @@ public class LookThread extends BukkitRunnable {
|
||||||
|
|
||||||
String name = plugin.healthUtil.getName(livingEntity, player);
|
String name = plugin.healthUtil.getName(livingEntity, player);
|
||||||
|
|
||||||
if (targetHelper.canSee(player, livingEntity.getLocation(), transparentTypeIds) && !plugin.healthUtil.isBlacklisted(livingEntity, name)) {
|
if (targetHelper.canSee(player, livingEntity.getLocation()) && !plugin.healthUtil.isBlacklisted(livingEntity, name)) {
|
||||||
if (plugin.configStore.isUsingWhiteList()) {
|
if (plugin.configStore.isUsingWhiteList()) {
|
||||||
if (!plugin.healthUtil.isWhiteListed(livingEntity, name)) {
|
if (!plugin.healthUtil.isWhiteListed(livingEntity, name)) {
|
||||||
continue;
|
continue;
|
|
@ -7,6 +7,7 @@ import com.zeshanaslam.actionhealth.commands.HealthCommand;
|
||||||
import com.zeshanaslam.actionhealth.config.ConfigStore;
|
import com.zeshanaslam.actionhealth.config.ConfigStore;
|
||||||
import com.zeshanaslam.actionhealth.events.HealthListeners;
|
import com.zeshanaslam.actionhealth.events.HealthListeners;
|
||||||
import com.zeshanaslam.actionhealth.utils.HealthUtil;
|
import com.zeshanaslam.actionhealth.utils.HealthUtil;
|
||||||
|
import com.zeshanaslam.actionhealth.utils.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
@ -26,6 +27,7 @@ public class Main extends JavaPlugin {
|
||||||
public boolean mythicMobsEnabled;
|
public boolean mythicMobsEnabled;
|
||||||
public boolean langUtilsEnabled;
|
public boolean langUtilsEnabled;
|
||||||
public BukkitTask actionTask;
|
public BukkitTask actionTask;
|
||||||
|
public Metrics metrics;
|
||||||
|
|
||||||
public List<UUID> toggle = new ArrayList<>();
|
public List<UUID> toggle = new ArrayList<>();
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.bukkit.projectiles.ProjectileSource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ActionHelper {
|
public class ActionHelper {
|
||||||
|
|
||||||
|
@ -28,7 +27,7 @@ public class ActionHelper {
|
||||||
|
|
||||||
public void executeTriggers(ActionStore.ActionType actionType, Player player, ItemStack itemStack) {
|
public void executeTriggers(ActionStore.ActionType actionType, Player player, ItemStack itemStack) {
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
for (String name: getName(itemStack))
|
for (String name : getName(itemStack))
|
||||||
executeTriggers(actionType, player, name);
|
executeTriggers(actionType, player, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +76,9 @@ public class ActionHelper {
|
||||||
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
|
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
|
||||||
|
|
||||||
PotionData potionData = potionMeta.getBasePotionData();
|
PotionData potionData = potionMeta.getBasePotionData();
|
||||||
possibleMaterials.add(potionData.getType().getEffectType().getName() + "_" + name);
|
if (potionData.getType().getEffectType() != null) {
|
||||||
|
possibleMaterials.add(potionData.getType().getEffectType().getName() + "_" + name);
|
||||||
|
}
|
||||||
|
|
||||||
if (potionMeta.hasCustomEffects()) {
|
if (potionMeta.hasCustomEffects()) {
|
||||||
for (PotionEffect potionEffect : potionMeta.getCustomEffects()) {
|
for (PotionEffect potionEffect : potionMeta.getCustomEffects()) {
|
|
@ -4,7 +4,6 @@ import com.zeshanaslam.actionhealth.Main;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
@ -15,15 +14,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
|
||||||
import org.bukkit.potion.Potion;
|
|
||||||
import org.bukkit.potion.PotionData;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.projectiles.ProjectileSource;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ActionListener implements Listener {
|
public class ActionListener implements Listener {
|
||||||
|
|
||||||
|
@ -113,7 +103,7 @@ public class ActionListener implements Listener {
|
||||||
ActionStore.ActionType actionType = ActionStore.ActionType.RIGHTCLICK;
|
ActionStore.ActionType actionType = ActionStore.ActionType.RIGHTCLICK;
|
||||||
|
|
||||||
actionHelper.executeTriggers(actionType, player, itemStack);
|
actionHelper.executeTriggers(actionType, player, itemStack);
|
||||||
} else if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
} else if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
ActionStore.ActionType actionType = ActionStore.ActionType.LEFTCLICK;
|
ActionStore.ActionType actionType = ActionStore.ActionType.LEFTCLICK;
|
||||||
actionHelper.executeTriggers(actionType, player, itemStack);
|
actionHelper.executeTriggers(actionType, player, itemStack);
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
package com.zeshanaslam.actionhealth.action;
|
package com.zeshanaslam.actionhealth.action;
|
||||||
|
|
||||||
import com.zeshanaslam.actionhealth.Main;
|
import com.zeshanaslam.actionhealth.Main;
|
||||||
import com.zeshanaslam.actionhealth.action.data.Action;
|
import com.zeshanaslam.actionhealth.action.data.Action;
|
||||||
import com.zeshanaslam.actionhealth.action.data.Tagged;
|
import com.zeshanaslam.actionhealth.action.data.Tagged;
|
||||||
|
@ -22,11 +23,11 @@ public class ActionStore {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
enabled = main.getConfig().getBoolean("Action.Enabled");
|
enabled = main.getConfig().getBoolean("Action.Enabled");
|
||||||
tagLength = main.getConfig().getInt("Action.TagLength");
|
tagLength = main.getConfig().getInt("Action.TagLength");
|
||||||
tagAmount = main.getConfig().getInt("Action.TagAmount");
|
tagAmount = main.getConfig().getInt("Action.TagAmount");
|
||||||
events = new HashMap<>();
|
events = new HashMap<>();
|
||||||
|
|
||||||
for (String action: main.getConfig().getConfigurationSection("Action.Events").getKeys(false)) {
|
for (String action : main.getConfig().getConfigurationSection("Action.Events").getKeys(false)) {
|
||||||
for (String type: main.getConfig().getConfigurationSection("Action.Events." + action).getKeys(false)) {
|
for (String type : main.getConfig().getConfigurationSection("Action.Events." + action).getKeys(false)) {
|
||||||
String output = main.getConfig().getString("Action.Events." + action + "." + type);
|
String output = main.getConfig().getString("Action.Events." + action + "." + type);
|
||||||
ActionType actionType = ActionType.valueOf(action);
|
ActionType actionType = ActionType.valueOf(action);
|
||||||
|
|
||||||
|
@ -70,8 +71,8 @@ public class ActionStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessage(LivingEntity entity, String message, Optional<Double> health) {
|
private void sendMessage(LivingEntity entity, String message, Optional<Double> health) {
|
||||||
for (List<Tagged> taggedList: tagged.values()) {
|
for (List<Tagged> taggedList : tagged.values()) {
|
||||||
for (Tagged tagged: taggedList) {
|
for (Tagged tagged : taggedList) {
|
||||||
if (tagged.damaged.equals(entity.getUniqueId())) {
|
if (tagged.damaged.equals(entity.getUniqueId())) {
|
||||||
Player damager = Bukkit.getServer().getPlayer(tagged.damager);
|
Player damager = Bukkit.getServer().getPlayer(tagged.damager);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class ActionTask extends BukkitRunnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (UUID key: main.configStore.actionStore.tagged.keySet()) {
|
for (UUID key : main.configStore.actionStore.tagged.keySet()) {
|
||||||
Iterator<Tagged> taggedIterator = main.configStore.actionStore.tagged.get(key).iterator();
|
Iterator<Tagged> taggedIterator = main.configStore.actionStore.tagged.get(key).iterator();
|
||||||
while (taggedIterator.hasNext()) {
|
while (taggedIterator.hasNext()) {
|
||||||
Tagged tagged = taggedIterator.next();
|
Tagged tagged = taggedIterator.next();
|
|
@ -42,11 +42,12 @@ public class HealthCommand implements CommandExecutor {
|
||||||
if (plugin.toggle.contains(player.getUniqueId())) {
|
if (plugin.toggle.contains(player.getUniqueId())) {
|
||||||
plugin.toggle.remove(player.getUniqueId());
|
plugin.toggle.remove(player.getUniqueId());
|
||||||
|
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.configStore.enableMessage).replace("{name}", player.getName()));
|
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.healthUtil.replacePlaceholders(plugin.configStore.enableMessage, "name", player.getName())));
|
||||||
} else {
|
} else {
|
||||||
plugin.toggle.add(player.getUniqueId());
|
plugin.toggle.add(player.getUniqueId());
|
||||||
|
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.configStore.disableMessage).replace("{name}", player.getName()));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.healthUtil.replacePlaceholders(plugin.configStore.disableMessage, "name", player.getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.configStore.rememberToggle) {
|
if (plugin.configStore.rememberToggle) {
|
|
@ -3,6 +3,7 @@ package com.zeshanaslam.actionhealth.config;
|
||||||
import com.zeshanaslam.actionhealth.LookThread;
|
import com.zeshanaslam.actionhealth.LookThread;
|
||||||
import com.zeshanaslam.actionhealth.Main;
|
import com.zeshanaslam.actionhealth.Main;
|
||||||
import com.zeshanaslam.actionhealth.action.ActionStore;
|
import com.zeshanaslam.actionhealth.action.ActionStore;
|
||||||
|
import com.zeshanaslam.actionhealth.utils.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
@ -55,6 +56,7 @@ public class ConfigStore {
|
||||||
public String upperLimit;
|
public String upperLimit;
|
||||||
public int upperLimitStart;
|
public int upperLimitStart;
|
||||||
public int upperLimitLength;
|
public int upperLimitLength;
|
||||||
|
public boolean allowMetrics;
|
||||||
|
|
||||||
public ConfigStore(Main plugin) {
|
public ConfigStore(Main plugin) {
|
||||||
// Clear settings for reloads
|
// Clear settings for reloads
|
||||||
|
@ -210,6 +212,16 @@ public class ConfigStore {
|
||||||
} else {
|
} else {
|
||||||
upperLimit = null;
|
upperLimit = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (plugin.getConfig().contains("Allow Metrics")) {
|
||||||
|
allowMetrics = plugin.getConfig().getBoolean("Allow Metrics");
|
||||||
|
} else {
|
||||||
|
allowMetrics = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allowMetrics && plugin.metrics == null) {
|
||||||
|
plugin.metrics = new Metrics(plugin, 11639);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingWhiteList() {
|
public boolean isUsingWhiteList() {
|
|
@ -2,7 +2,6 @@ package com.zeshanaslam.actionhealth.events;
|
||||||
|
|
||||||
import com.zeshanaslam.actionhealth.Main;
|
import com.zeshanaslam.actionhealth.Main;
|
||||||
import com.zeshanaslam.actionhealth.utils.FileHandler;
|
import com.zeshanaslam.actionhealth.utils.FileHandler;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -11,7 +10,6 @@ import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.zeshanaslam.actionhealth.support;
|
||||||
|
|
||||||
|
import io.lumine.mythic.bukkit.BukkitAPIHelper;
|
||||||
|
import io.lumine.mythic.bukkit.MythicBukkit;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
|
public class MythicMobsSupport {
|
||||||
|
private static final MythicBukkit plugin = (MythicBukkit) Bukkit.getServer().getPluginManager().getPlugin("MythicMobs");
|
||||||
|
|
||||||
|
public String getMythicName(Entity entity) {
|
||||||
|
if (plugin == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BukkitAPIHelper bucketApiHelper = plugin.getAPIHelper();
|
||||||
|
if (bucketApiHelper.isMythicMob(entity)) {
|
||||||
|
return bucketApiHelper.getMythicMobInstance(entity).getType().getInternalName();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.zeshanaslam.actionhealth.support;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class NewAction {
|
||||||
|
public NewAction(Player player, String message) throws ClassNotFoundException {
|
||||||
|
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message));
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,9 @@
|
||||||
package com.zeshanaslam.actionhealth.utils;
|
package com.zeshanaslam.actionhealth.utils;
|
||||||
|
|
||||||
import be.maximvdw.placeholderapi.PlaceholderAPI;
|
|
||||||
import com.zeshanaslam.actionhealth.Main;
|
import com.zeshanaslam.actionhealth.Main;
|
||||||
import com.zeshanaslam.actionhealth.api.HealthSendEvent;
|
import com.zeshanaslam.actionhealth.api.HealthSendEvent;
|
||||||
import com.zeshanaslam.actionhealth.support.*;
|
import com.zeshanaslam.actionhealth.support.*;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -103,16 +102,16 @@ public class HealthUtil {
|
||||||
displayName = player.getDisplayName();
|
displayName = player.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
output = output.replace("{displayname}", displayName);
|
output = replacePlaceholders(output, "displayname", displayName);
|
||||||
|
|
||||||
// Set placeholders as attacker
|
// Set placeholders as attacker
|
||||||
if (plugin.configStore.hasMVdWPlaceholderAPI) {
|
if (plugin.configStore.hasMVdWPlaceholderAPI) {
|
||||||
output = output.replace("ATTACKEDPLAYER_", "");
|
output = replacePlaceholders(output, "ATTACKEDPLAYER_", "");
|
||||||
output = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, output);
|
output = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.configStore.hasPlaceholderAPI) {
|
if (plugin.configStore.hasPlaceholderAPI) {
|
||||||
output = output.replace("ATTACKEDPLAYER_", "");
|
output = replacePlaceholders(output, "ATTACKEDPLAYER_", "");
|
||||||
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, output);
|
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, output);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -120,7 +119,7 @@ public class HealthUtil {
|
||||||
output = plugin.configStore.healthMessageOther;
|
output = plugin.configStore.healthMessageOther;
|
||||||
}
|
}
|
||||||
|
|
||||||
output = output.replace("{displayname}", name);
|
output = replacePlaceholders(output, "displayname", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set placeholders as receiver
|
// Set placeholders as receiver
|
||||||
|
@ -132,13 +131,13 @@ public class HealthUtil {
|
||||||
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(receiver, output);
|
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(receiver, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
output = output.replace("{name}", name);
|
output = replacePlaceholders(output, "name", name);
|
||||||
output = output.replace("{health}", String.valueOf((int) health));
|
output = replacePlaceholders(output, "health", String.valueOf((int) health));
|
||||||
output = output.replace("{maxhealth}", String.valueOf((int) maxHealth));
|
output = replacePlaceholders(output, "maxhealth", String.valueOf((int) maxHealth));
|
||||||
output = output.replace("{percenthealth}", String.valueOf((int) ((health / maxHealth) * 100.0)));
|
output = replacePlaceholders(output, "percenthealth", String.valueOf((int) ((health / maxHealth) * 100.0)));
|
||||||
output = output.replace("{opponentlastdamage}", String.valueOf((int) entity.getLastDamage()));
|
output = replacePlaceholders(output, "opponentlastdamage", String.valueOf((int) entity.getLastDamage()));
|
||||||
|
|
||||||
if (output.contains("{usestyle}")) {
|
if (output.contains("usestyle")) {
|
||||||
StringBuilder style = new StringBuilder();
|
StringBuilder style = new StringBuilder();
|
||||||
int left = getLimitHealth(maxHealth);
|
int left = getLimitHealth(maxHealth);
|
||||||
double heart = maxHealth / getLimitHealth(maxHealth);
|
double heart = maxHealth / getLimitHealth(maxHealth);
|
||||||
|
@ -176,7 +175,7 @@ public class HealthUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output = output.replace("{usestyle}", style.toString());
|
output = replacePlaceholders(output, "usestyle", style.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
HealthSendEvent healthSendEvent = new HealthSendEvent(receiver, entity, output);
|
HealthSendEvent healthSendEvent = new HealthSendEvent(receiver, entity, output);
|
||||||
|
@ -234,6 +233,10 @@ public class HealthUtil {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String replacePlaceholders(String s, String key, String value) {
|
||||||
|
return s.replace("{" + key + "}", value).replace("{ah" + key + "}", value);
|
||||||
|
}
|
||||||
|
|
||||||
private String getNameReflection(LivingEntity entity) {
|
private String getNameReflection(LivingEntity entity) {
|
||||||
String name;
|
String name;
|
||||||
Method getName = null;
|
Method getName = null;
|
||||||
|
@ -265,11 +268,13 @@ public class HealthUtil {
|
||||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(plugin.configStore.mcVersion.equals("v1_16_R1") || plugin.configStore.mcVersion.equals("v1_16_R2")){
|
if (plugin.configStore.mcVersion.contains("v1_17") || plugin.configStore.mcVersion.contains("v1_18") || plugin.configStore.mcVersion.contains("v1_19") || plugin.configStore.mcVersion.contains("v1_20")) {
|
||||||
|
new NewAction(player, message);
|
||||||
|
} else if (plugin.configStore.mcVersion.contains("v1_16")) {
|
||||||
new PreAction(player, message);
|
new PreAction(player, message);
|
||||||
} else if (plugin.configStore.mcVersion.equals("v1_12_R1") || plugin.configStore.mcVersion.startsWith("v1_13") || plugin.configStore.mcVersion.startsWith("v1_14_") || plugin.configStore.mcVersion.startsWith("v1_15_")) {
|
} else if (plugin.configStore.mcVersion.equals("v1_12_R1") || plugin.configStore.mcVersion.startsWith("v1_13") || plugin.configStore.mcVersion.startsWith("v1_14_") || plugin.configStore.mcVersion.startsWith("v1_15_")) {
|
||||||
new LegacyPreAction(player, message);
|
new LegacyPreAction(player, message);
|
||||||
} else if (!(plugin.configStore.mcVersion.equalsIgnoreCase("v1_8_R1") || (plugin.configStore.mcVersion.contains("v1_7_")))) {
|
} else if (!(plugin.configStore.mcVersion.equalsIgnoreCase("v1_8_R1") || plugin.configStore.mcVersion.contains("v1_7_"))) {
|
||||||
Class<?> c1 = Class.forName("org.bukkit.craftbukkit." + plugin.configStore.mcVersion + ".entity.CraftPlayer");
|
Class<?> c1 = Class.forName("org.bukkit.craftbukkit." + plugin.configStore.mcVersion + ".entity.CraftPlayer");
|
||||||
Object p = c1.cast(player);
|
Object p = c1.cast(player);
|
||||||
Object ppoc;
|
Object ppoc;
|
||||||
|
@ -373,7 +378,7 @@ public class HealthUtil {
|
||||||
|
|
||||||
private void sendMessage(Player player) {
|
private void sendMessage(Player player) {
|
||||||
if (plugin.configStore.toggleMessage != null && !plugin.configStore.toggleMessage.equals("")) {
|
if (plugin.configStore.toggleMessage != null && !plugin.configStore.toggleMessage.equals("")) {
|
||||||
plugin.healthUtil.sendActionBar(player, plugin.configStore.toggleMessage.replace("{name}", player.getName()));
|
plugin.healthUtil.sendActionBar(player, replacePlaceholders(plugin.configStore.toggleMessage, "name", player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,848 @@
|
||||||
|
package com.zeshanaslam.actionhealth.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class Metrics {
|
||||||
|
|
||||||
|
private final Plugin plugin;
|
||||||
|
|
||||||
|
private final MetricsBase metricsBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Metrics instance.
|
||||||
|
*
|
||||||
|
* @param plugin Your plugin instance.
|
||||||
|
* @param serviceId The id of the service. It can be found at <a
|
||||||
|
* href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a>
|
||||||
|
*/
|
||||||
|
public Metrics(JavaPlugin plugin, int serviceId) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
// Get the config file
|
||||||
|
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
||||||
|
File configFile = new File(bStatsFolder, "config.yml");
|
||||||
|
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
|
if (!config.isSet("serverUuid")) {
|
||||||
|
config.addDefault("enabled", true);
|
||||||
|
config.addDefault("serverUuid", UUID.randomUUID().toString());
|
||||||
|
config.addDefault("logFailedRequests", false);
|
||||||
|
config.addDefault("logSentData", false);
|
||||||
|
config.addDefault("logResponseStatusText", false);
|
||||||
|
// Inform the server owners about bStats
|
||||||
|
config
|
||||||
|
.options()
|
||||||
|
.header(
|
||||||
|
"bStats (https://bStats.org) collects some basic information for plugin authors, like how\n"
|
||||||
|
+ "many people use their plugin and their total player count. It's recommended to keep bStats\n"
|
||||||
|
+ "enabled, but if you're not comfortable with this, you can turn this setting off. There is no\n"
|
||||||
|
+ "performance penalty associated with having metrics enabled, and data sent to bStats is fully\n"
|
||||||
|
+ "anonymous.")
|
||||||
|
.copyDefaults(true);
|
||||||
|
try {
|
||||||
|
config.save(configFile);
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Load the data
|
||||||
|
boolean enabled = config.getBoolean("enabled", true);
|
||||||
|
String serverUUID = config.getString("serverUuid");
|
||||||
|
boolean logErrors = config.getBoolean("logFailedRequests", false);
|
||||||
|
boolean logSentData = config.getBoolean("logSentData", false);
|
||||||
|
boolean logResponseStatusText = config.getBoolean("logResponseStatusText", false);
|
||||||
|
metricsBase =
|
||||||
|
new MetricsBase(
|
||||||
|
"bukkit",
|
||||||
|
serverUUID,
|
||||||
|
serviceId,
|
||||||
|
enabled,
|
||||||
|
this::appendPlatformData,
|
||||||
|
this::appendServiceData,
|
||||||
|
submitDataTask -> Bukkit.getScheduler().runTask(plugin, submitDataTask),
|
||||||
|
plugin::isEnabled,
|
||||||
|
(message, error) -> this.plugin.getLogger().log(Level.WARNING, message, error),
|
||||||
|
(message) -> this.plugin.getLogger().log(Level.INFO, message),
|
||||||
|
logErrors,
|
||||||
|
logSentData,
|
||||||
|
logResponseStatusText);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a custom chart.
|
||||||
|
*
|
||||||
|
* @param chart The chart to add.
|
||||||
|
*/
|
||||||
|
public void addCustomChart(CustomChart chart) {
|
||||||
|
metricsBase.addCustomChart(chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendPlatformData(JsonObjectBuilder builder) {
|
||||||
|
builder.appendField("playerAmount", getPlayerAmount());
|
||||||
|
builder.appendField("onlineMode", Bukkit.getOnlineMode() ? 1 : 0);
|
||||||
|
builder.appendField("bukkitVersion", Bukkit.getVersion());
|
||||||
|
builder.appendField("bukkitName", Bukkit.getName());
|
||||||
|
builder.appendField("javaVersion", System.getProperty("java.version"));
|
||||||
|
builder.appendField("osName", System.getProperty("os.name"));
|
||||||
|
builder.appendField("osArch", System.getProperty("os.arch"));
|
||||||
|
builder.appendField("osVersion", System.getProperty("os.version"));
|
||||||
|
builder.appendField("coreCount", Runtime.getRuntime().availableProcessors());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appendServiceData(JsonObjectBuilder builder) {
|
||||||
|
builder.appendField("pluginVersion", plugin.getDescription().getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getPlayerAmount() {
|
||||||
|
try {
|
||||||
|
// Around MC 1.8 the return type was changed from an array to a collection,
|
||||||
|
// This fixes java.lang.NoSuchMethodError:
|
||||||
|
// org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
|
||||||
|
Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
|
||||||
|
return onlinePlayersMethod.getReturnType().equals(Collection.class)
|
||||||
|
? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
|
||||||
|
: ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Just use the new method if the reflection failed
|
||||||
|
return Bukkit.getOnlinePlayers().size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MetricsBase {
|
||||||
|
|
||||||
|
/** The version of the Metrics class. */
|
||||||
|
public static final String METRICS_VERSION = "2.2.1";
|
||||||
|
|
||||||
|
private static final ScheduledExecutorService scheduler =
|
||||||
|
Executors.newScheduledThreadPool(1, task -> new Thread(task, "bStats-Metrics"));
|
||||||
|
|
||||||
|
private static final String REPORT_URL = "https://bStats.org/api/v2/data/%s";
|
||||||
|
|
||||||
|
private final String platform;
|
||||||
|
|
||||||
|
private final String serverUuid;
|
||||||
|
|
||||||
|
private final int serviceId;
|
||||||
|
|
||||||
|
private final Consumer<JsonObjectBuilder> appendPlatformDataConsumer;
|
||||||
|
|
||||||
|
private final Consumer<JsonObjectBuilder> appendServiceDataConsumer;
|
||||||
|
|
||||||
|
private final Consumer<Runnable> submitTaskConsumer;
|
||||||
|
|
||||||
|
private final Supplier<Boolean> checkServiceEnabledSupplier;
|
||||||
|
|
||||||
|
private final BiConsumer<String, Throwable> errorLogger;
|
||||||
|
|
||||||
|
private final Consumer<String> infoLogger;
|
||||||
|
|
||||||
|
private final boolean logErrors;
|
||||||
|
|
||||||
|
private final boolean logSentData;
|
||||||
|
|
||||||
|
private final boolean logResponseStatusText;
|
||||||
|
|
||||||
|
private final Set<CustomChart> customCharts = new HashSet<>();
|
||||||
|
|
||||||
|
private final boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new MetricsBase class instance.
|
||||||
|
*
|
||||||
|
* @param platform The platform of the service.
|
||||||
|
* @param serviceId The id of the service.
|
||||||
|
* @param serverUuid The server uuid.
|
||||||
|
* @param enabled Whether or not data sending is enabled.
|
||||||
|
* @param appendPlatformDataConsumer A consumer that receives a {@code JsonObjectBuilder} and
|
||||||
|
* appends all platform-specific data.
|
||||||
|
* @param appendServiceDataConsumer A consumer that receives a {@code JsonObjectBuilder} and
|
||||||
|
* appends all service-specific data.
|
||||||
|
* @param submitTaskConsumer A consumer that takes a runnable with the submit task. This can be
|
||||||
|
* used to delegate the data collection to a another thread to prevent errors caused by
|
||||||
|
* concurrency. Can be {@code null}.
|
||||||
|
* @param checkServiceEnabledSupplier A supplier to check if the service is still enabled.
|
||||||
|
* @param errorLogger A consumer that accepts log message and an error.
|
||||||
|
* @param infoLogger A consumer that accepts info log messages.
|
||||||
|
* @param logErrors Whether or not errors should be logged.
|
||||||
|
* @param logSentData Whether or not the sent data should be logged.
|
||||||
|
* @param logResponseStatusText Whether or not the response status text should be logged.
|
||||||
|
*/
|
||||||
|
public MetricsBase(
|
||||||
|
String platform,
|
||||||
|
String serverUuid,
|
||||||
|
int serviceId,
|
||||||
|
boolean enabled,
|
||||||
|
Consumer<JsonObjectBuilder> appendPlatformDataConsumer,
|
||||||
|
Consumer<JsonObjectBuilder> appendServiceDataConsumer,
|
||||||
|
Consumer<Runnable> submitTaskConsumer,
|
||||||
|
Supplier<Boolean> checkServiceEnabledSupplier,
|
||||||
|
BiConsumer<String, Throwable> errorLogger,
|
||||||
|
Consumer<String> infoLogger,
|
||||||
|
boolean logErrors,
|
||||||
|
boolean logSentData,
|
||||||
|
boolean logResponseStatusText) {
|
||||||
|
this.platform = platform;
|
||||||
|
this.serverUuid = serverUuid;
|
||||||
|
this.serviceId = serviceId;
|
||||||
|
this.enabled = enabled;
|
||||||
|
this.appendPlatformDataConsumer = appendPlatformDataConsumer;
|
||||||
|
this.appendServiceDataConsumer = appendServiceDataConsumer;
|
||||||
|
this.submitTaskConsumer = submitTaskConsumer;
|
||||||
|
this.checkServiceEnabledSupplier = checkServiceEnabledSupplier;
|
||||||
|
this.errorLogger = errorLogger;
|
||||||
|
this.infoLogger = infoLogger;
|
||||||
|
this.logErrors = logErrors;
|
||||||
|
this.logSentData = logSentData;
|
||||||
|
this.logResponseStatusText = logResponseStatusText;
|
||||||
|
checkRelocation();
|
||||||
|
if (enabled) {
|
||||||
|
startSubmitting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCustomChart(CustomChart chart) {
|
||||||
|
this.customCharts.add(chart);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startSubmitting() {
|
||||||
|
final Runnable submitTask =
|
||||||
|
() -> {
|
||||||
|
if (!enabled || !checkServiceEnabledSupplier.get()) {
|
||||||
|
// Submitting data or service is disabled
|
||||||
|
scheduler.shutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (submitTaskConsumer != null) {
|
||||||
|
submitTaskConsumer.accept(this::submitData);
|
||||||
|
} else {
|
||||||
|
this.submitData();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution
|
||||||
|
// of requests on the
|
||||||
|
// bStats backend. To circumvent this problem, we introduce some randomness into the initial
|
||||||
|
// and second delay.
|
||||||
|
// WARNING: You must not modify and part of this Metrics class, including the submit delay or
|
||||||
|
// frequency!
|
||||||
|
// WARNING: Modifying this code will get your plugin banned on bStats. Just don't do it!
|
||||||
|
long initialDelay = (long) (1000 * 60 * (3 + Math.random() * 3));
|
||||||
|
long secondDelay = (long) (1000 * 60 * (Math.random() * 30));
|
||||||
|
scheduler.schedule(submitTask, initialDelay, TimeUnit.MILLISECONDS);
|
||||||
|
scheduler.scheduleAtFixedRate(
|
||||||
|
submitTask, initialDelay + secondDelay, 1000 * 60 * 30, TimeUnit.MILLISECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void submitData() {
|
||||||
|
final JsonObjectBuilder baseJsonBuilder = new JsonObjectBuilder();
|
||||||
|
appendPlatformDataConsumer.accept(baseJsonBuilder);
|
||||||
|
final JsonObjectBuilder serviceJsonBuilder = new JsonObjectBuilder();
|
||||||
|
appendServiceDataConsumer.accept(serviceJsonBuilder);
|
||||||
|
JsonObjectBuilder.JsonObject[] chartData =
|
||||||
|
customCharts.stream()
|
||||||
|
.map(customChart -> customChart.getRequestJsonObject(errorLogger, logErrors))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.toArray(JsonObjectBuilder.JsonObject[]::new);
|
||||||
|
serviceJsonBuilder.appendField("id", serviceId);
|
||||||
|
serviceJsonBuilder.appendField("customCharts", chartData);
|
||||||
|
baseJsonBuilder.appendField("service", serviceJsonBuilder.build());
|
||||||
|
baseJsonBuilder.appendField("serverUUID", serverUuid);
|
||||||
|
baseJsonBuilder.appendField("metricsVersion", METRICS_VERSION);
|
||||||
|
JsonObjectBuilder.JsonObject data = baseJsonBuilder.build();
|
||||||
|
scheduler.execute(
|
||||||
|
() -> {
|
||||||
|
try {
|
||||||
|
// Send the data
|
||||||
|
sendData(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Something went wrong! :(
|
||||||
|
if (logErrors) {
|
||||||
|
errorLogger.accept("Could not submit bStats metrics data", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendData(JsonObjectBuilder.JsonObject data) throws Exception {
|
||||||
|
if (logSentData) {
|
||||||
|
infoLogger.accept("Sent bStats metrics data: " + data.toString());
|
||||||
|
}
|
||||||
|
String url = String.format(REPORT_URL, platform);
|
||||||
|
HttpsURLConnection connection = (HttpsURLConnection) new URL(url).openConnection();
|
||||||
|
// Compress the data to save bandwidth
|
||||||
|
byte[] compressedData = compress(data.toString());
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
connection.addRequestProperty("Accept", "application/json");
|
||||||
|
connection.addRequestProperty("Connection", "close");
|
||||||
|
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||||
|
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
|
||||||
|
connection.setRequestProperty("Content-Type", "application/json");
|
||||||
|
connection.setRequestProperty("User-Agent", "Metrics-Service/1");
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
|
||||||
|
outputStream.write(compressedData);
|
||||||
|
}
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
try (BufferedReader bufferedReader =
|
||||||
|
new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||||
|
String line;
|
||||||
|
while ((line = bufferedReader.readLine()) != null) {
|
||||||
|
builder.append(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (logResponseStatusText) {
|
||||||
|
infoLogger.accept("Sent data to bStats and received response: " + builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Checks that the class was properly relocated. */
|
||||||
|
private void checkRelocation() {
|
||||||
|
// You can use the property to disable the check in your test environment
|
||||||
|
if (System.getProperty("bstats.relocatecheck") == null
|
||||||
|
|| !System.getProperty("bstats.relocatecheck").equals("false")) {
|
||||||
|
// Maven's Relocate is clever and changes strings, too. So we have to use this little
|
||||||
|
// "trick" ... :D
|
||||||
|
final String defaultPackage =
|
||||||
|
new String(new byte[] {'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's'});
|
||||||
|
final String examplePackage =
|
||||||
|
new String(new byte[] {'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
|
||||||
|
// We want to make sure no one just copy & pastes the example and uses the wrong package
|
||||||
|
// names
|
||||||
|
if (MetricsBase.class.getPackage().getName().startsWith(defaultPackage)
|
||||||
|
|| MetricsBase.class.getPackage().getName().startsWith(examplePackage)) {
|
||||||
|
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gzips the given string.
|
||||||
|
*
|
||||||
|
* @param str The string to gzip.
|
||||||
|
* @return The gzipped string.
|
||||||
|
*/
|
||||||
|
private static byte[] compress(final String str) throws IOException {
|
||||||
|
if (str == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) {
|
||||||
|
gzip.write(str.getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
return outputStream.toByteArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AdvancedBarChart extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<Map<String, int[]>> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||||
|
Map<String, int[]> map = callable.call();
|
||||||
|
if (map == null || map.isEmpty()) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
boolean allSkipped = true;
|
||||||
|
for (Map.Entry<String, int[]> entry : map.entrySet()) {
|
||||||
|
if (entry.getValue().length == 0) {
|
||||||
|
// Skip this invalid
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
allSkipped = false;
|
||||||
|
valuesBuilder.appendField(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
if (allSkipped) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SimpleBarChart extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<Map<String, Integer>> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||||
|
Map<String, Integer> map = callable.call();
|
||||||
|
if (map == null || map.isEmpty()) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||||
|
valuesBuilder.appendField(entry.getKey(), new int[] {entry.getValue()});
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MultiLineChart extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<Map<String, Integer>> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||||
|
Map<String, Integer> map = callable.call();
|
||||||
|
if (map == null || map.isEmpty()) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
boolean allSkipped = true;
|
||||||
|
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||||
|
if (entry.getValue() == 0) {
|
||||||
|
// Skip this invalid
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
allSkipped = false;
|
||||||
|
valuesBuilder.appendField(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
if (allSkipped) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AdvancedPie extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<Map<String, Integer>> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||||
|
Map<String, Integer> map = callable.call();
|
||||||
|
if (map == null || map.isEmpty()) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
boolean allSkipped = true;
|
||||||
|
for (Map.Entry<String, Integer> entry : map.entrySet()) {
|
||||||
|
if (entry.getValue() == 0) {
|
||||||
|
// Skip this invalid
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
allSkipped = false;
|
||||||
|
valuesBuilder.appendField(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
if (allSkipped) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract static class CustomChart {
|
||||||
|
|
||||||
|
private final String chartId;
|
||||||
|
|
||||||
|
protected CustomChart(String chartId) {
|
||||||
|
if (chartId == null) {
|
||||||
|
throw new IllegalArgumentException("chartId must not be null");
|
||||||
|
}
|
||||||
|
this.chartId = chartId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonObjectBuilder.JsonObject getRequestJsonObject(
|
||||||
|
BiConsumer<String, Throwable> errorLogger, boolean logErrors) {
|
||||||
|
JsonObjectBuilder builder = new JsonObjectBuilder();
|
||||||
|
builder.appendField("chartId", chartId);
|
||||||
|
try {
|
||||||
|
JsonObjectBuilder.JsonObject data = getChartData();
|
||||||
|
if (data == null) {
|
||||||
|
// If the data is null we don't send the chart.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
builder.appendField("data", data);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
if (logErrors) {
|
||||||
|
errorLogger.accept("Failed to get data for custom chart with id " + chartId, t);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract JsonObjectBuilder.JsonObject getChartData() throws Exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SingleLineChart extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<Integer> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public SingleLineChart(String chartId, Callable<Integer> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
int value = callable.call();
|
||||||
|
if (value == 0) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("value", value).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SimplePie extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<String> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public SimplePie(String chartId, Callable<String> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
String value = callable.call();
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("value", value).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DrilldownPie extends CustomChart {
|
||||||
|
|
||||||
|
private final Callable<Map<String, Map<String, Integer>>> callable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param chartId The id of the chart.
|
||||||
|
* @param callable The callable which is used to request the chart data.
|
||||||
|
*/
|
||||||
|
public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>> callable) {
|
||||||
|
super(chartId);
|
||||||
|
this.callable = callable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonObjectBuilder.JsonObject getChartData() throws Exception {
|
||||||
|
JsonObjectBuilder valuesBuilder = new JsonObjectBuilder();
|
||||||
|
Map<String, Map<String, Integer>> map = callable.call();
|
||||||
|
if (map == null || map.isEmpty()) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
boolean reallyAllSkipped = true;
|
||||||
|
for (Map.Entry<String, Map<String, Integer>> entryValues : map.entrySet()) {
|
||||||
|
JsonObjectBuilder valueBuilder = new JsonObjectBuilder();
|
||||||
|
boolean allSkipped = true;
|
||||||
|
for (Map.Entry<String, Integer> valueEntry : map.get(entryValues.getKey()).entrySet()) {
|
||||||
|
valueBuilder.appendField(valueEntry.getKey(), valueEntry.getValue());
|
||||||
|
allSkipped = false;
|
||||||
|
}
|
||||||
|
if (!allSkipped) {
|
||||||
|
reallyAllSkipped = false;
|
||||||
|
valuesBuilder.appendField(entryValues.getKey(), valueBuilder.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (reallyAllSkipped) {
|
||||||
|
// Null = skip the chart
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new JsonObjectBuilder().appendField("values", valuesBuilder.build()).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An extremely simple JSON builder.
|
||||||
|
*
|
||||||
|
* <p>While this class is neither feature-rich nor the most performant one, it's sufficient enough
|
||||||
|
* for its use-case.
|
||||||
|
*/
|
||||||
|
public static class JsonObjectBuilder {
|
||||||
|
|
||||||
|
private StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
private boolean hasAtLeastOneField = false;
|
||||||
|
|
||||||
|
public JsonObjectBuilder() {
|
||||||
|
builder.append("{");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a null field to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendNull(String key) {
|
||||||
|
appendFieldUnescaped(key, "null");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a string field to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param value The value of the field.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendField(String key, String value) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new IllegalArgumentException("JSON value must not be null");
|
||||||
|
}
|
||||||
|
appendFieldUnescaped(key, "\"" + escape(value) + "\"");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an integer field to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param value The value of the field.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendField(String key, int value) {
|
||||||
|
appendFieldUnescaped(key, String.valueOf(value));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an object to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param object The object.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendField(String key, JsonObject object) {
|
||||||
|
if (object == null) {
|
||||||
|
throw new IllegalArgumentException("JSON object must not be null");
|
||||||
|
}
|
||||||
|
appendFieldUnescaped(key, object.toString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a string array to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param values The string array.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendField(String key, String[] values) {
|
||||||
|
if (values == null) {
|
||||||
|
throw new IllegalArgumentException("JSON values must not be null");
|
||||||
|
}
|
||||||
|
String escapedValues =
|
||||||
|
Arrays.stream(values)
|
||||||
|
.map(value -> "\"" + escape(value) + "\"")
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
appendFieldUnescaped(key, "[" + escapedValues + "]");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an integer array to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param values The integer array.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendField(String key, int[] values) {
|
||||||
|
if (values == null) {
|
||||||
|
throw new IllegalArgumentException("JSON values must not be null");
|
||||||
|
}
|
||||||
|
String escapedValues =
|
||||||
|
Arrays.stream(values).mapToObj(String::valueOf).collect(Collectors.joining(","));
|
||||||
|
appendFieldUnescaped(key, "[" + escapedValues + "]");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an object array to the JSON.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param values The integer array.
|
||||||
|
* @return A reference to this object.
|
||||||
|
*/
|
||||||
|
public JsonObjectBuilder appendField(String key, JsonObject[] values) {
|
||||||
|
if (values == null) {
|
||||||
|
throw new IllegalArgumentException("JSON values must not be null");
|
||||||
|
}
|
||||||
|
String escapedValues =
|
||||||
|
Arrays.stream(values).map(JsonObject::toString).collect(Collectors.joining(","));
|
||||||
|
appendFieldUnescaped(key, "[" + escapedValues + "]");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a field to the object.
|
||||||
|
*
|
||||||
|
* @param key The key of the field.
|
||||||
|
* @param escapedValue The escaped value of the field.
|
||||||
|
*/
|
||||||
|
private void appendFieldUnescaped(String key, String escapedValue) {
|
||||||
|
if (builder == null) {
|
||||||
|
throw new IllegalStateException("JSON has already been built");
|
||||||
|
}
|
||||||
|
if (key == null) {
|
||||||
|
throw new IllegalArgumentException("JSON key must not be null");
|
||||||
|
}
|
||||||
|
if (hasAtLeastOneField) {
|
||||||
|
builder.append(",");
|
||||||
|
}
|
||||||
|
builder.append("\"").append(escape(key)).append("\":").append(escapedValue);
|
||||||
|
hasAtLeastOneField = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the JSON string and invalidates this builder.
|
||||||
|
*
|
||||||
|
* @return The built JSON string.
|
||||||
|
*/
|
||||||
|
public JsonObject build() {
|
||||||
|
if (builder == null) {
|
||||||
|
throw new IllegalStateException("JSON has already been built");
|
||||||
|
}
|
||||||
|
JsonObject object = new JsonObject(builder.append("}").toString());
|
||||||
|
builder = null;
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escapes the given string like stated in https://www.ietf.org/rfc/rfc4627.txt.
|
||||||
|
*
|
||||||
|
* <p>This method escapes only the necessary characters '"', '\'. and '\u0000' - '\u001F'.
|
||||||
|
* Compact escapes are not used (e.g., '\n' is escaped as "\u000a" and not as "\n").
|
||||||
|
*
|
||||||
|
* @param value The value to escape.
|
||||||
|
* @return The escaped value.
|
||||||
|
*/
|
||||||
|
private static String escape(String value) {
|
||||||
|
final StringBuilder builder = new StringBuilder();
|
||||||
|
for (int i = 0; i < value.length(); i++) {
|
||||||
|
char c = value.charAt(i);
|
||||||
|
if (c == '"') {
|
||||||
|
builder.append("\\\"");
|
||||||
|
} else if (c == '\\') {
|
||||||
|
builder.append("\\\\");
|
||||||
|
} else if (c <= '\u000F') {
|
||||||
|
builder.append("\\u000").append(Integer.toHexString(c));
|
||||||
|
} else if (c <= '\u001F') {
|
||||||
|
builder.append("\\u00").append(Integer.toHexString(c));
|
||||||
|
} else {
|
||||||
|
builder.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A super simple representation of a JSON object.
|
||||||
|
*
|
||||||
|
* <p>This class only exists to make methods of the {@link JsonObjectBuilder} type-safe and not
|
||||||
|
* allow a raw string inputs for methods like {@link JsonObjectBuilder#appendField(String,
|
||||||
|
* JsonObject)}.
|
||||||
|
*/
|
||||||
|
public static class JsonObject {
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
private JsonObject(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,9 +9,7 @@ import org.bukkit.util.BlockIterator;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Helper class for getting targets using various methods</p>
|
* <p>Helper class for getting targets using various methods</p>
|
||||||
|
@ -302,24 +300,11 @@ public class TargetHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getTarget(Location from, int distance, byte... transparentTypeIds) {
|
public Block getTarget(Location from, int distance) {
|
||||||
if (transparentTypeIds.length == 0) {
|
|
||||||
return getTarget(from, distance, (Set<Byte>) null);
|
|
||||||
} else {
|
|
||||||
Set<Byte> types = new HashSet<>(transparentTypeIds.length);
|
|
||||||
for (byte b : transparentTypeIds) types.add(b);
|
|
||||||
return getTarget(from, distance, types);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Block getTarget(Location from, int distance, Set<Byte> transparentTypeIds) {
|
|
||||||
BlockIterator itr = new BlockIterator(from, 0, distance);
|
BlockIterator itr = new BlockIterator(from, 0, distance);
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
Block block = itr.next();
|
Block block = itr.next();
|
||||||
int id = block.getType().getId();
|
if (!block.getType().isOccluding()) {
|
||||||
if (transparentTypeIds == null) {
|
|
||||||
if (id == 0) continue;
|
|
||||||
} else if (transparentTypeIds.contains((byte) id)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
|
@ -327,19 +312,7 @@ public class TargetHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getTarget(LivingEntity from, int distance, Set<Byte> transparentTypeIds) {
|
public boolean canSee(LivingEntity from, Location to) {
|
||||||
return getTarget(from.getEyeLocation(), distance, transparentTypeIds);
|
return getTarget(from.getEyeLocation(), (int) Math.ceil(from.getLocation().distance(to))) == null;
|
||||||
}
|
|
||||||
|
|
||||||
public Block getTarget(LivingEntity from, int distance, byte... transparentTypeIds) {
|
|
||||||
return getTarget(from.getEyeLocation(), distance, transparentTypeIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSee(LivingEntity from, Location to, Set<Byte> transparentTypeIds) {
|
|
||||||
return getTarget(from, (int) Math.ceil(from.getLocation().distance(to)), transparentTypeIds) == null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSee(LivingEntity from, Location to, byte... transparentTypeIds) {
|
|
||||||
return getTarget(from, (int) Math.ceil(from.getLocation().distance(to)), transparentTypeIds) == null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
# {displayname} will use player/mob custom name.
|
# {displayname} will use player/mob custom name.
|
||||||
# {opponentlastdamage} the amount of damage the enemy last received.
|
# {opponentlastdamage} the amount of damage the enemy last received.
|
||||||
# {percenthealth} displays the percentage of health left.
|
# {percenthealth} displays the percentage of health left.
|
||||||
|
# Note: if placeholders are being overridden by other plugins you can add 'ah' in front of it i.e {ahhealth}
|
||||||
#
|
#
|
||||||
# For PlaceholderAPI or MVdWPlaceholderAPI:
|
# For PlaceholderAPI or MVdWPlaceholderAPI:
|
||||||
# By default placeholders will be retrieved as the attacking player.
|
# By default placeholders will be retrieved as the attacking player.
|
||||||
|
@ -107,9 +108,12 @@ Invisible Potion: true
|
||||||
# Hide if entity is in spectator mode.
|
# Hide if entity is in spectator mode.
|
||||||
Spectator Mode: true
|
Spectator Mode: true
|
||||||
|
|
||||||
# If to show MiniaturePets health or not
|
# If true show MiniaturePets health or not
|
||||||
ShowMiniaturePets: true
|
ShowMiniaturePets: true
|
||||||
|
|
||||||
|
# If true show Armor Stand health or not
|
||||||
|
ShowArmorStand: true
|
||||||
|
|
||||||
# Translate names. Case sensitive!
|
# Translate names. Case sensitive!
|
||||||
# Check ActionHealth page if translations already exist for the language you plan on using.
|
# Check ActionHealth page if translations already exist for the language you plan on using.
|
||||||
#
|
#
|
||||||
|
@ -123,6 +127,9 @@ Name:
|
||||||
# https://www.spigotmc.org/resources/1-7-x-1-12-language-utils.8859/
|
# https://www.spigotmc.org/resources/1-7-x-1-12-language-utils.8859/
|
||||||
Use Client Language: false
|
Use Client Language: false
|
||||||
|
|
||||||
|
# Allows bstats metrics. Useful to allow better understanding of version support and more metrics useful for maintaining
|
||||||
|
Allow Metrics: true
|
||||||
|
|
||||||
# If enabled, when a player gets into combat they will be tagged for the configurable amount of time.
|
# If enabled, when a player gets into combat they will be tagged for the configurable amount of time.
|
||||||
# When the enemy triggers an action the provided message will be sent.
|
# When the enemy triggers an action the provided message will be sent.
|
||||||
# Supports all placeholders from above.
|
# Supports all placeholders from above.
|
|
@ -1,7 +1,8 @@
|
||||||
name: ActionHealth
|
name: ActionHealth
|
||||||
main: com.zeshanaslam.actionhealth.Main
|
main: com.zeshanaslam.actionhealth.Main
|
||||||
version: 3.5.1
|
version: "${version}"
|
||||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI, WorldGuard, mcMMO, MythicMobs, LangUtils]
|
||||||
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
Actionhealth:
|
Actionhealth:
|
||||||
description: Actionhealth main commands.
|
description: Actionhealth main commands.
|
|
@ -1,6 +1,6 @@
|
||||||
Name Change: true
|
Name Change: true
|
||||||
Name:
|
Name:
|
||||||
- Snow Golem = Golem de Gelo
|
- Snow Golem = Golem de Neve
|
||||||
- Bat = Morcego
|
- Bat = Morcego
|
||||||
- Cat = Gato
|
- Cat = Gato
|
||||||
- Cave Spider = Aranha da Caverna
|
- Cave Spider = Aranha da Caverna
|
||||||
|
@ -9,12 +9,12 @@ Name:
|
||||||
- Cow = Vaca
|
- Cow = Vaca
|
||||||
- Dolphin = Golfinho
|
- Dolphin = Golfinho
|
||||||
- Donkey = Burro
|
- Donkey = Burro
|
||||||
- Drowned = Zumbi do Mar
|
- Drowned = Afogado
|
||||||
- Elder Guardian = Guardião Ancião
|
- Elder Guardian = Guardião Ancião
|
||||||
- Ender Dragon = Dragão do End
|
- Ender Dragon = Dragão do End
|
||||||
- Enderman = Enderman
|
- Enderman = Enderman
|
||||||
- Endermite = Rato do End
|
- Endermite = Endermite
|
||||||
- Evoker = Evocador
|
- Evoker = Invocador
|
||||||
- Fox = Raposa
|
- Fox = Raposa
|
||||||
- Giant = Gigante
|
- Giant = Gigante
|
||||||
- Guardian = Guardião
|
- Guardian = Guardião
|
||||||
|
@ -23,16 +23,16 @@ Name:
|
||||||
- Illusioner = Ilusionista
|
- Illusioner = Ilusionista
|
||||||
- Iron Golem = Golem de Ferro
|
- Iron Golem = Golem de Ferro
|
||||||
- Llama = Lhama
|
- Llama = Lhama
|
||||||
- Magma Cube = Slime de Magma
|
- Magma Cube = Cubo de Magma
|
||||||
- Mooshroom = Coguvaca
|
- Mooshroom = Coguvaca
|
||||||
- Mule = Mula
|
- Mule = Mula
|
||||||
- Parrot = Papagaio
|
- Parrot = Papagaio
|
||||||
- Phantom = Espectro
|
- Phantom = Espectro
|
||||||
- Pig = Porco
|
- Pig = Porco
|
||||||
- Pillager = Saqueador
|
- Pillager = Pillager
|
||||||
- Polar Bear = Urso Polar
|
- Polar Bear = Urso Polar
|
||||||
- Puffer Fish = Baiacu
|
- Puffer Fish = Baiacu
|
||||||
- Ocelot = Gato
|
- Ocelot = Onça
|
||||||
- Rabbit = Coelho
|
- Rabbit = Coelho
|
||||||
- Ravager = Destruidor
|
- Ravager = Destruidor
|
||||||
- Salmon = Salmão
|
- Salmon = Salmão
|
||||||
|
@ -40,19 +40,19 @@ Name:
|
||||||
- Skeleton = Esqueleto
|
- Skeleton = Esqueleto
|
||||||
- Skeleton Horse = Cavalo Esqueleto
|
- Skeleton Horse = Cavalo Esqueleto
|
||||||
- Slime = Slime
|
- Slime = Slime
|
||||||
- Snow Golem = Golem de Gelo
|
- Snow Golem = Golem de Neve
|
||||||
- Spider = Aranha
|
- Spider = Aranha
|
||||||
- Squid = Lula
|
- Squid = Lula
|
||||||
- Stray = Esqueleto de Gelo
|
- Stray = Esqueleto Errante
|
||||||
- Trader Llama = Lhama Trader
|
- Trader Llama = Lhama Trader
|
||||||
- Tropical Fish = Peixe Tropical
|
- Tropical Fish = Peixe Tropical
|
||||||
- Turtle = Tartaruga
|
- Turtle = Tartaruga
|
||||||
- Vindicator = Vindicador
|
- Vindicator = Vindicador
|
||||||
- Wandering Trader = Trader Ambulante
|
- Wandering Trader = Mercador Ambulante
|
||||||
- Witch = Bruxa
|
- Witch = Bruxa
|
||||||
- Wither Skeleton = Esqueleto Wither
|
- Wither Skeleton = Esqueleto Wither
|
||||||
- Wolf = Lobo
|
- Wolf = Lobo
|
||||||
- Zombie = Zumbi
|
- Zombie = Zumbi
|
||||||
- Zombie Horse = Zumbi Cavalo
|
- Zombie Horse = Cavalo Zumbi
|
||||||
- Zombie PigMan = Zumbi Porco
|
- Zombified Piglin = Piglin Zumbi
|
||||||
- Zombie Villager = Villager Zumbi
|
- Zombie Villager = Villager Zumbi
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
#French translation for "Action bar Health" made with ♥baguette♥ by PoulpY2K
|
||||||
|
Name Change: true
|
||||||
|
Name:
|
||||||
|
- Armorer = Armurier
|
||||||
|
- Axolotl = Axolotl
|
||||||
|
- Bat = Chauve-Souris
|
||||||
|
- Bee = Abeille
|
||||||
|
- Blaze = Blaze
|
||||||
|
- Butcher = Boucher
|
||||||
|
- Cartographer = Cartographe
|
||||||
|
- Cat = Chat
|
||||||
|
- Cave Spider = Araignée venimeuse
|
||||||
|
- Chicken = Poulet
|
||||||
|
- Cleric = Prêtre
|
||||||
|
- Cod = Morue
|
||||||
|
- Cow = Vache
|
||||||
|
- Creeper = Creeper
|
||||||
|
- Dolphin = Dauphin
|
||||||
|
- Donkey = Âne
|
||||||
|
- Drowned = Noyé
|
||||||
|
- Elder Guardian = Gardien Ancestral
|
||||||
|
- Ender Dragon = Ender Dragon
|
||||||
|
- Enderman = Enderman
|
||||||
|
- Endermite = Endermite
|
||||||
|
- Evoker = Évocateur
|
||||||
|
- Farmer = Fermier
|
||||||
|
- Fisherman = Pêcheur
|
||||||
|
- Fletcher = Fléchier
|
||||||
|
- Fox = Renard
|
||||||
|
- Ghast = Ghast
|
||||||
|
- Glow Squid = Poulpe luisant
|
||||||
|
- Goat = Chèvre
|
||||||
|
- Guardian = Gardien
|
||||||
|
- Hoglin = Hoglin
|
||||||
|
- Horse = Cheval
|
||||||
|
- Husk = Zombie momifié
|
||||||
|
- Iron Golem = Golem de fer
|
||||||
|
- Llama = Lama
|
||||||
|
- Leatherworker = Tanneur
|
||||||
|
- Librarian = Bibliothécaire
|
||||||
|
- Magma Cube = Cube de magma
|
||||||
|
- Mason = Maçon
|
||||||
|
- Mooshroom = Champimeuh
|
||||||
|
- Mule = Mule
|
||||||
|
- Nitwit = Idiot du village
|
||||||
|
- Ocelot = Ocelot
|
||||||
|
- Panda = Panda
|
||||||
|
- Parrot = Perroquet
|
||||||
|
- Phantom = Phantom
|
||||||
|
- Pig = Cochon
|
||||||
|
- Piglin Brute = Brute Piglin
|
||||||
|
- Pillager = Pillard
|
||||||
|
- Polar Bear = Ours Polaire
|
||||||
|
- Pufferfish = Poisson-globe
|
||||||
|
- Rabbit = Lapin
|
||||||
|
- Ravager = Ravageur
|
||||||
|
- Salmon = Saumon
|
||||||
|
- Sheep = Mouton
|
||||||
|
- Shepherd = Berger
|
||||||
|
- Shulker = Bernard-l'hermite
|
||||||
|
- Silverfish = Poisson d'argent
|
||||||
|
- Skeleton = Squelette
|
||||||
|
- Skeleton Horse = Cheval-squelette
|
||||||
|
- Slime = Slime
|
||||||
|
- Snow Golem = Golem de neige
|
||||||
|
- Spider = Araignée
|
||||||
|
- Squid = Poulpe
|
||||||
|
- Stray = Vagabond
|
||||||
|
- Strider = Arpenteur
|
||||||
|
- Toolsmith = Forgeron d'outils
|
||||||
|
- Trader Llama = Lama de marchand
|
||||||
|
- Tropical Fish = Poisson tropical
|
||||||
|
- Turtle = Tortue
|
||||||
|
- Vex = Vex
|
||||||
|
- Villager = Villageois
|
||||||
|
- Vindicator = Vindicateur
|
||||||
|
- Wandering Trader = Marchand ambulant
|
||||||
|
- Weaponsmith = Forgeron d'armes
|
||||||
|
- Witch = Sorcière
|
||||||
|
- Wither = Wither
|
||||||
|
- Wither Skeleton = Wither squelette
|
||||||
|
- Wolf = Loup
|
||||||
|
- Zoglin = Zoglin
|
||||||
|
- Zombie = Zombie
|
||||||
|
- Zombie Horse = Cheval-zombie
|
||||||
|
- Zombie Villager = Zombie-villageois
|
||||||
|
- Zombified Piglin = Piglin zombifié
|
|
@ -1,3 +1,51 @@
|
||||||
Name Change: true
|
Name Change: true
|
||||||
Name:
|
Name:
|
||||||
- Bat = To be translated
|
- Bat = Pipistrello
|
||||||
|
- Bee = Ape
|
||||||
|
- Cat = Gatto
|
||||||
|
- Cave Spider = Ragno delle caverne
|
||||||
|
- Chicken = Gallina
|
||||||
|
- Cod = Merluzzo
|
||||||
|
- Cow = Mucca
|
||||||
|
- Dolphin = Delfino
|
||||||
|
- Donkey = Asino
|
||||||
|
- Drowned = Annegato
|
||||||
|
- Elder Guardian = Guardiano antico
|
||||||
|
- Evoker = Evocatore
|
||||||
|
- Fox = Volpe
|
||||||
|
- Guardian = Guardiano
|
||||||
|
- Horse = Cavallo
|
||||||
|
- Husk = Zombi secco
|
||||||
|
- Llama = Lama
|
||||||
|
- Magma Cube = Cubo di magma
|
||||||
|
- Mule = Mulo
|
||||||
|
- Ocelot = Gattopardo
|
||||||
|
- Parrot = Pappagallo
|
||||||
|
- Pig = Maiale
|
||||||
|
- Piglin Brute = Piglin Bruto
|
||||||
|
- Pillager = Predone
|
||||||
|
- Polar Bear = Orso polare
|
||||||
|
- Pufferfish = Pesce palla
|
||||||
|
- Rabbit = Coniglio
|
||||||
|
- Ravanger = Devastatore
|
||||||
|
- Salmon = Salmone
|
||||||
|
- Sheep = Pecora
|
||||||
|
- Silverfish = Pesciolino d'argento
|
||||||
|
- Skeleton = Scheletro
|
||||||
|
- Skeleton Horse = Cavallo scheletro
|
||||||
|
- Spider = Ragno
|
||||||
|
- Squid = Calamaro
|
||||||
|
- Stray = Errante
|
||||||
|
- Trader Llama = Lama del mercante
|
||||||
|
- Tropical Fish = Pesce tropicale
|
||||||
|
- Turtle = Tartaruga
|
||||||
|
- Villager = Villico
|
||||||
|
- Vindicator = Difensore
|
||||||
|
- Wandering Trader = Mercante ambulante
|
||||||
|
- Witch = Strega
|
||||||
|
- Wither Skeleton = Scheletro wither
|
||||||
|
- Wolf = Lupo
|
||||||
|
- Zombie = Zombi
|
||||||
|
- Zombie Horse = Cavallo zombi
|
||||||
|
- Zombie Villager = Villico zombi
|
||||||
|
- Zombified Piglin = Piglin zombificato
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
Name Change: true
|
||||||
|
Name:
|
||||||
|
- Bat = コウモリ
|
||||||
|
- Bee = ミツバチ
|
||||||
|
- Blaze = ブレイズ
|
||||||
|
- Cat = ネコ
|
||||||
|
- Cave Spider = 洞窟グモ
|
||||||
|
- Chicken = ニワトリ
|
||||||
|
- Cod = タラ
|
||||||
|
- Cow = 牛
|
||||||
|
- Creeper = クリーパー
|
||||||
|
- Dolphin = イルカ
|
||||||
|
- Donkey = ロバ
|
||||||
|
- Drowned = ドラウンド
|
||||||
|
- Elder Guardian = エルダーガーディアン
|
||||||
|
- Enderman = エンダーマン
|
||||||
|
- Endermite = エンダーマイト
|
||||||
|
- Evoker = エヴォーカー
|
||||||
|
- Fox = キツネ
|
||||||
|
- Ghast = ガスト
|
||||||
|
- Guardian = ガーディアン
|
||||||
|
- Hoglin = ホグリン
|
||||||
|
- Horse = ウマ
|
||||||
|
- Husk = ハスク
|
||||||
|
- Llama = ラマ
|
||||||
|
- Magma Cube = マグマキューブ
|
||||||
|
- Mooshroom = ムーシュルーム
|
||||||
|
- Mule = ラバ
|
||||||
|
- Ocelot = ヤマネコ
|
||||||
|
- Panda = パンダ
|
||||||
|
- Parrot = オウム
|
||||||
|
- Phantom = ファントム
|
||||||
|
- Pig = ブタ
|
||||||
|
- Piglin = ピグリン
|
||||||
|
- Piglin Brute = ピグリンブルート
|
||||||
|
- Pillager = ピリジャー
|
||||||
|
- Polar Bear = シロクマ
|
||||||
|
- Pufferfish = フグ
|
||||||
|
- Rabbit = ウサギ
|
||||||
|
- Ravager = ラヴェジャー
|
||||||
|
- Salmon = サケ
|
||||||
|
- Sheep = ヒツジ
|
||||||
|
- Shulker = シュルカー
|
||||||
|
- Silverfish = シルバーフィッシュ
|
||||||
|
- Skeleton = スケルトン
|
||||||
|
- Skeleton Horse = スケルトンホース
|
||||||
|
- Slime = スライム
|
||||||
|
- Spider = クモ
|
||||||
|
- Squid = イカ
|
||||||
|
- Stray = ストレイ
|
||||||
|
- Strider = ストライダー
|
||||||
|
- Trader Llama = 商人のラマ
|
||||||
|
- Tropical Fish = 熱帯魚
|
||||||
|
- Turtle = カメ
|
||||||
|
- Vex = ヴェックス
|
||||||
|
- Villager = 村人
|
||||||
|
- Vindicator = ヴィンディケーター
|
||||||
|
- Wandering Trader = 行商人
|
||||||
|
- Witch = ウィッチ
|
||||||
|
- Wither Skeleton = ウィザースケルトン
|
||||||
|
- Wolf = オオカミ
|
||||||
|
- Zoglin = ゾグリン
|
||||||
|
- Zombie = ゾンビ
|
||||||
|
- Zombie Horse = ゾンビホース
|
||||||
|
- Zombie Villager = 村人ゾンビ
|
||||||
|
- Zombified Piglin = ゾンビピグリン
|
||||||
|
- Snow Golem = スノウゴーレム
|
||||||
|
- Iron Golem = アイアンゴーレム
|
||||||
|
- Ender Dragon = エンダードラゴン
|
|
@ -0,0 +1,77 @@
|
||||||
|
Name Change: true
|
||||||
|
Name:
|
||||||
|
- Allay = 알레이
|
||||||
|
- Axolotl = 아홀로틀
|
||||||
|
- Bat = 박쥐
|
||||||
|
- Bee = 꿀벌
|
||||||
|
- Blaze = 블레이즈
|
||||||
|
- Camel = 낙타
|
||||||
|
- Cat = 고양이
|
||||||
|
- Cave Spider = 동굴 거미
|
||||||
|
- Chicken = 닭
|
||||||
|
- Cod = 대구
|
||||||
|
- Cow = 소
|
||||||
|
- Creeper = 크리퍼
|
||||||
|
- Dolphin = 돌고래
|
||||||
|
- Donkey = 당나귀
|
||||||
|
- Drowned = 드라운드
|
||||||
|
- Elder Guardian = 엘더 가디언
|
||||||
|
- Enderman = 엔더맨
|
||||||
|
- Endermite = 엔더마이트
|
||||||
|
- Evoker = 소환사
|
||||||
|
- Fox = 여우
|
||||||
|
- Frog = 개구리
|
||||||
|
- Ghast = 가스트
|
||||||
|
- Glow Squid = 발광 오징어
|
||||||
|
- Goat = 염소
|
||||||
|
- Guardian = 가디언
|
||||||
|
- Hoglin = 호글린
|
||||||
|
- Horse = 말
|
||||||
|
- Husk = 허스크
|
||||||
|
- Iron Golem = 철 골렘
|
||||||
|
- Llama = 라마
|
||||||
|
- Magma Cube = 마그마 큐브
|
||||||
|
- Mooshroom = 무시룸
|
||||||
|
- Mule = 노새
|
||||||
|
- Ocelot = 오실롯
|
||||||
|
- Panda = 판다
|
||||||
|
- Parrot = 앵무새
|
||||||
|
- Phantom = 팬텀
|
||||||
|
- Pig = 돼지
|
||||||
|
- Piglin = 피글린
|
||||||
|
- Piglin Brute = 난폭한 피글린
|
||||||
|
- Pillager = 약탈자
|
||||||
|
- Polar Bear = 북극곰
|
||||||
|
- Pufferfish = 복어
|
||||||
|
- Rabbit = 토끼
|
||||||
|
- Ravager = 파괴수
|
||||||
|
- Salmon = 연어
|
||||||
|
- Sheep = 양
|
||||||
|
- Shulker = 셜커
|
||||||
|
- Silverfish = 좀벌레
|
||||||
|
- Skeleton = 스켈레톤
|
||||||
|
- Skeleton Horse = 스켈레톤 말
|
||||||
|
- Slime = 슬라임
|
||||||
|
- Sniffer = 스니퍼
|
||||||
|
- Snow Golem = 눈사람
|
||||||
|
- Spider = 거미
|
||||||
|
- Squid = 오징어
|
||||||
|
- Stray = 스트레이
|
||||||
|
- Strider = 스트라이더
|
||||||
|
- Tadpole = 올챙이
|
||||||
|
- Trader Llama = 상인 라마
|
||||||
|
- Tropical Fish = 열대어
|
||||||
|
- Turtle = 거북
|
||||||
|
- Vex = 벡스
|
||||||
|
- Villager = 주민
|
||||||
|
- Vindicator = 변명자
|
||||||
|
- Wandering Trader = 떠돌이 상인
|
||||||
|
- Warden = 워든
|
||||||
|
- Witch = 마녀
|
||||||
|
- Wither Skeleton = 위더 스켈레톤
|
||||||
|
- Wolf = 늑대
|
||||||
|
- Zoglin = 좀비 호글린
|
||||||
|
- Zombie = 좀비
|
||||||
|
- Zombie Horse = 좀비 말
|
||||||
|
- Zombie Villager = 좀비 주민
|
||||||
|
- Zombified Piglin = 좀비 피글린
|
|
@ -1,6 +1,7 @@
|
||||||
Name Change: true
|
Name Change: true
|
||||||
Name:
|
Name:
|
||||||
- Bat = Nietoperz
|
- Bat = Nietoperz
|
||||||
|
- Bee = Pszczoła
|
||||||
- Blaze = Płomyk
|
- Blaze = Płomyk
|
||||||
- Cat = Kot
|
- Cat = Kot
|
||||||
- Cave Spider = Pająk Jaskiniowy
|
- Cave Spider = Pająk Jaskiniowy
|
||||||
|
@ -11,11 +12,13 @@ Name:
|
||||||
- Donkey = Osioł
|
- Donkey = Osioł
|
||||||
- Drowned = Utopiec
|
- Drowned = Utopiec
|
||||||
- Elder Guardian = Starszy Strażnik
|
- Elder Guardian = Starszy Strażnik
|
||||||
|
- Ender Dragon = Smok Kresu
|
||||||
- Evoker = Przywoływacz
|
- Evoker = Przywoływacz
|
||||||
- Fox = Lis
|
- Fox = Lis
|
||||||
- Guardian = Strażnik
|
- Guardian = Strażnik
|
||||||
- Horse = Koń
|
- Horse = Koń
|
||||||
- Husk = Posuch
|
- Husk = Posuch
|
||||||
|
- Iron Golem = Żelazny Golem
|
||||||
- Llama = Lama
|
- Llama = Lama
|
||||||
- Magma Cube = Kostka Magmy
|
- Magma Cube = Kostka Magmy
|
||||||
- Mule = Muł
|
- Mule = Muł
|
||||||
|
@ -23,6 +26,8 @@ Name:
|
||||||
- Phantom = Fantom
|
- Phantom = Fantom
|
||||||
- Pig = Świnia
|
- Pig = Świnia
|
||||||
- Pillager = Rozbójnik
|
- Pillager = Rozbójnik
|
||||||
|
- Piglin = Piglin
|
||||||
|
- Piglin Brute = Piglin Okrutnik
|
||||||
- Polar Bear = Niedźwiedź Polarny
|
- Polar Bear = Niedźwiedź Polarny
|
||||||
- Pufferfish = Rozdymka
|
- Pufferfish = Rozdymka
|
||||||
- Rabbit = Królik
|
- Rabbit = Królik
|
||||||
|
@ -32,9 +37,11 @@ Name:
|
||||||
- Silverfish = Rybik
|
- Silverfish = Rybik
|
||||||
- Skeleton = Szkielet
|
- Skeleton = Szkielet
|
||||||
- Skeleton Horse = Szkielet Konia
|
- Skeleton Horse = Szkielet Konia
|
||||||
|
- Snow Golem = Bałwan
|
||||||
- Spider = Pająk
|
- Spider = Pająk
|
||||||
- Squid = Kałamarnica
|
- Squid = Kałamarnica
|
||||||
- Stray = Tułacz
|
- Stray = Tułacz
|
||||||
|
- Strider = Magmołaz
|
||||||
- Trader Llama = Lama Handlarza
|
- Trader Llama = Lama Handlarza
|
||||||
- Tropical Fish = Ryba Tropikalna
|
- Tropical Fish = Ryba Tropikalna
|
||||||
- Turtle = Żółw
|
- Turtle = Żółw
|
||||||
|
@ -46,8 +53,5 @@ Name:
|
||||||
- Wither Skeleton = Witherowy Szkielet
|
- Wither Skeleton = Witherowy Szkielet
|
||||||
- Wolf = Wilk
|
- Wolf = Wilk
|
||||||
- Zombie Horse = Koń Zombie
|
- Zombie Horse = Koń Zombie
|
||||||
|
- Zombified Piglin = Piglin Zombie
|
||||||
- Zombie Villager = Osadnik Zombie
|
- Zombie Villager = Osadnik Zombie
|
||||||
- Iron Golem = Żelazny Golem
|
|
||||||
- Snow Golem = Bałwan
|
|
||||||
- Ender Dragon = Smok Kresu
|
|
||||||
- Bee = Pszczoła
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Name:
|
||||||
- Bee = Пчела
|
- Bee = Пчела
|
||||||
- Blaze = Ифрит
|
- Blaze = Ифрит
|
||||||
- Cat = Кот
|
- Cat = Кот
|
||||||
- Cave Spider = Ядовитый паук
|
- Cave Spider = Пещерный паук
|
||||||
- Chicken = Курица
|
- Chicken = Курица
|
||||||
- Cod = Треска
|
- Cod = Треска
|
||||||
- Cow = Корова
|
- Cow = Корова
|
||||||
|
@ -14,7 +14,7 @@ Name:
|
||||||
- Drowned = Утопленник
|
- Drowned = Утопленник
|
||||||
- Fox = Лиса
|
- Fox = Лиса
|
||||||
- Elder Guardian = Древний страж
|
- Elder Guardian = Древний страж
|
||||||
- Ender Dragon = Дракон Края
|
- Ender Dragon = Дракон края
|
||||||
- Enderman = Эндермен
|
- Enderman = Эндермен
|
||||||
- Endermite = Эндермит
|
- Endermite = Эндермит
|
||||||
- Evoker = Заклинатель
|
- Evoker = Заклинатель
|
||||||
|
@ -27,7 +27,7 @@ Name:
|
||||||
- Iron Golem = Железный голем
|
- Iron Golem = Железный голем
|
||||||
- Llama = Лама
|
- Llama = Лама
|
||||||
- Magma Cube = Магмовый куб
|
- Magma Cube = Магмовый куб
|
||||||
- Mooshroom = Корова
|
- Mooshroom = Грибная корова
|
||||||
- Ocelot = Оцелот
|
- Ocelot = Оцелот
|
||||||
- Mule = Мул
|
- Mule = Мул
|
||||||
- Panda = Панда
|
- Panda = Панда
|
||||||
|
@ -37,7 +37,7 @@ Name:
|
||||||
- Piglin = Пиглин
|
- Piglin = Пиглин
|
||||||
- Pillager = Разбойник
|
- Pillager = Разбойник
|
||||||
- Polar Bear = Белый медведь
|
- Polar Bear = Белый медведь
|
||||||
- Pufferfish = Рыба Фугу
|
- Pufferfish = Иглобрюх
|
||||||
- Rabbit = Кролик
|
- Rabbit = Кролик
|
||||||
- Ravager = Разоритель
|
- Ravager = Разоритель
|
||||||
- Salmon = Лосось
|
- Salmon = Лосось
|
||||||
|
@ -47,23 +47,43 @@ Name:
|
||||||
- Skeleton = Скелет
|
- Skeleton = Скелет
|
||||||
- Skeleton Horse = Лошадь скелет
|
- Skeleton Horse = Лошадь скелет
|
||||||
- Snow Golem = Снежный голем
|
- Snow Golem = Снежный голем
|
||||||
- Slime = Слим
|
- Slime = Слайм
|
||||||
- Spider = Паук
|
- Spider = Паук
|
||||||
- Squid = Спрут
|
- Squid = Спрут
|
||||||
- Stray = Бродяга
|
- Stray = Зимогор
|
||||||
- Strider = Страйдер
|
- Strider = Лавомерка
|
||||||
- Tropical Fish = Тропическая Рыба
|
- Tropical Fish = Тропическая рыба
|
||||||
- Turtle = Черепаха
|
- Turtle = Черепаха
|
||||||
- Vex = Досаждатель
|
- Vex = Досаждатель
|
||||||
- Villager = Житель
|
- Villager = Житель
|
||||||
- Vindicator = Поборник
|
- Vindicator = Поборник
|
||||||
- Wandering Trader = Странствующий Торговец
|
- Wandering Trader = Странствующий торговец
|
||||||
- Witch = Ведьма
|
- Witch = Ведьма
|
||||||
- Wither = Иссушитель
|
- Wither = Иссушитель
|
||||||
- Wither Skeleton = Скелет Иссушитель
|
- Wither Skeleton = Скелет иссушитель
|
||||||
- Wolf = Волк
|
- Wolf = Волк
|
||||||
- Zombie = Зомби
|
- Zombie = Зомби
|
||||||
- Zombie Horse = Зомби лошадь
|
- Zombie Horse = Зомби лошадь
|
||||||
- Zombie Villager = Зомби житель
|
- Zombie Villager = Зомби житель
|
||||||
- Zombified Piglin = Зомбифицированный Пиглин
|
- Zombified Piglin = Зомбифицированный пиглин
|
||||||
- Zoglin = Зоглин
|
- Zoglin = Зоглин
|
||||||
|
- Armorer = Бронник
|
||||||
|
- Librarian = Библиотекарь
|
||||||
|
- Weaponsmith = Оружейник
|
||||||
|
- Cleric = Священник
|
||||||
|
- Toolsmith = Инструментальщик
|
||||||
|
- Fletcher = Лучник
|
||||||
|
- Leatherworker = Кожевник
|
||||||
|
- Farmer = Фермер
|
||||||
|
- Fisherman = Рыбак
|
||||||
|
- Mason = Каменщик
|
||||||
|
- Shepherd = Пастух
|
||||||
|
- Cartographer = Картограф
|
||||||
|
- Butcher = Мясник
|
||||||
|
- Unemployed = Нищий
|
||||||
|
- Axolotl = Аксолотль
|
||||||
|
- Piglin Brute = Брутальный пиглин
|
||||||
|
- Illusioner = Иллюзор
|
||||||
|
- Goat = Коза
|
||||||
|
- Trader Llama = Лама торговца
|
||||||
|
- Glow Squid = Светящийся спрут
|
|
@ -0,0 +1,90 @@
|
||||||
|
Name Change: true
|
||||||
|
Name:
|
||||||
|
- Axolotl = 美西螈
|
||||||
|
- Bat = 蝙蝠
|
||||||
|
- Chicken = 鸡
|
||||||
|
- Cod = 鳕鱼
|
||||||
|
- Cow = 牛
|
||||||
|
- Fox = 狐狸
|
||||||
|
- Glow Squid = 发光鱿鱼
|
||||||
|
- Mooshroom = 哞菇
|
||||||
|
- Ocelot = 豹猫
|
||||||
|
- Pig = 猪
|
||||||
|
- Rabbit = 兔子
|
||||||
|
- Salmon = 鲑鱼
|
||||||
|
- Sheep = 绵羊
|
||||||
|
- Squid = 鱿鱼
|
||||||
|
- Strider = 炽足兽
|
||||||
|
- Tropical Fish = 热带鱼
|
||||||
|
- Turtle = 海龟
|
||||||
|
- Villager = 村民
|
||||||
|
- Nitwit = 傻子
|
||||||
|
- Armorer = 盔甲匠
|
||||||
|
- Butcher = 屠夫
|
||||||
|
- Cartographer = 制图师
|
||||||
|
- Cleric = 牧师
|
||||||
|
- Farmer = 农民
|
||||||
|
- Fisherman = 渔夫
|
||||||
|
- Fletcher = 制箭师
|
||||||
|
- Leatherworker = 皮匠
|
||||||
|
- Librarian = 图书管理员
|
||||||
|
- Mason = 石匠
|
||||||
|
- Shepherd = 牧羊人
|
||||||
|
- Toolsmith = 工具匠
|
||||||
|
- Weaponsmith = 武器匠
|
||||||
|
- Wandering Trader = 流浪商人
|
||||||
|
- Pufferfish = 河豚
|
||||||
|
- Bee = 蜜蜂
|
||||||
|
- Cave Spider = 洞穴蜘蛛
|
||||||
|
- Dolphin = 海豚
|
||||||
|
- Enderman = 末影人
|
||||||
|
- Goat = 山羊
|
||||||
|
- Panda = 熊猫
|
||||||
|
- Piglin = 猪灵
|
||||||
|
- Polar Bear = 北极熊
|
||||||
|
- Spider = 蜘蛛
|
||||||
|
- Zombified Piglin = 僵尸猪灵
|
||||||
|
- Blaze = 烈焰人
|
||||||
|
- Creeper = 苦力怕
|
||||||
|
- Drowned = 溺尸
|
||||||
|
- Elder Guardian = 远古守卫者
|
||||||
|
- Endermite = 末影螨
|
||||||
|
- Evoker = 唤魔者
|
||||||
|
- Ghast = 恶魂
|
||||||
|
- Guardian = 守卫者
|
||||||
|
- Hoglin = 疣猪兽
|
||||||
|
- Husk = 尸壳
|
||||||
|
- Magma Cube = 岩浆怪
|
||||||
|
- Phantom = 幻翼
|
||||||
|
- Piglin Brute = 猪灵蛮兵
|
||||||
|
- Pillager = 掠夺者
|
||||||
|
- Ravager = 劫掠兽
|
||||||
|
- Shulker = 潜影贝
|
||||||
|
- Silverfish = 蠹虫
|
||||||
|
- Skeleton = 骷髅
|
||||||
|
- Slime = 史莱姆
|
||||||
|
- Stray = 流浪者
|
||||||
|
- Vex = 恼鬼
|
||||||
|
- Vindicator = 卫道士
|
||||||
|
- Witch = 女巫
|
||||||
|
- Wither Skeleton = 凋零骷髅
|
||||||
|
- Zoglin = 僵尸疣猪兽
|
||||||
|
- Zombie Villager = 僵尸村民
|
||||||
|
- Zombie = 僵尸
|
||||||
|
- Cat = 猫
|
||||||
|
- Donkey = 驴
|
||||||
|
- Horse = 马
|
||||||
|
- Llama = 羊驼
|
||||||
|
- Trader Llama = 行商羊驼
|
||||||
|
- Mule = 骡
|
||||||
|
- Parrot = 鹦鹉
|
||||||
|
- Skeleton Horse = 骷髅马
|
||||||
|
- Wolf = 狼
|
||||||
|
- Iron Golem = 铁傀儡
|
||||||
|
- Snow Golem = 雪傀儡
|
||||||
|
- Ender Dragon = 末影龙
|
||||||
|
- Wither = 凋灵
|
||||||
|
- Allay = 悦灵
|
||||||
|
- Warden = 监守者
|
||||||
|
- Frog = 青蛙
|
||||||
|
- Tadpole = 蝌蚪
|
|
@ -16,7 +16,7 @@ Name:
|
||||||
- Giant = Gigante
|
- Giant = Gigante
|
||||||
- Guardian = Guardián
|
- Guardian = Guardián
|
||||||
- Horse = Caballo
|
- Horse = Caballo
|
||||||
- Husk = Cáscara
|
- Husk = Zombi momificado
|
||||||
- Iron Golem = Golem de Hierro
|
- Iron Golem = Golem de Hierro
|
||||||
- Llama = Llama
|
- Llama = Llama
|
||||||
- Magma Cube = Cubo de Magma
|
- Magma Cube = Cubo de Magma
|
||||||
|
@ -42,8 +42,31 @@ Name:
|
||||||
- Vindicator = Vindicador
|
- Vindicator = Vindicador
|
||||||
- Witch = Bruja
|
- Witch = Bruja
|
||||||
- Wither = Wither
|
- Wither = Wither
|
||||||
- Wither Skeleton = Wither Esqueleto
|
- Wither Skeleton = Esqueleto Wither
|
||||||
- Wolf = Lobo
|
- Wolf = Lobo
|
||||||
- Zombie = Zombi
|
- Zombie = Zombi
|
||||||
- Zombie Horse = Caballo Zombi
|
- Zombie Horse = Caballo Zombi
|
||||||
- Zombie Villager = Aldeano Zombi
|
- Zombie Villager = Aldeano Zombi
|
||||||
|
- Glow Squid = Calamar Luminoso
|
||||||
|
- Fox = Zorro
|
||||||
|
- Zombified Piglin = Piglin Zombificado
|
||||||
|
- Cod = Bacalao
|
||||||
|
- Wandering Trader = Vendedor Ambulante
|
||||||
|
- Trader Llama = Llama Ambulante
|
||||||
|
- Drowned = Ahogado
|
||||||
|
- Turtle = Tortuga
|
||||||
|
- Dolphin = Delfin
|
||||||
|
- Axolotl = Ajolote
|
||||||
|
- Bee = Abeja
|
||||||
|
- Cat = Gato
|
||||||
|
- Evoker = Invocador
|
||||||
|
- Goat = Cabra
|
||||||
|
- Phantom = Fantasma
|
||||||
|
- Piglin Brute = Piglin Bruto
|
||||||
|
- Pillager = Saqueador
|
||||||
|
- Pufferfish = Pez Globo
|
||||||
|
- Ravager = Devastador
|
||||||
|
- Stray = Esqueleto Glacial
|
||||||
|
- Strider = Lavagante
|
||||||
|
- Tropical Fish = Pez Tropical
|
||||||
|
- Vex = Ánima
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
Name Change: true
|
||||||
|
Name:
|
||||||
|
- Axolotl = 六角恐龍
|
||||||
|
- Bat = 蝙蝠
|
||||||
|
- Chicken = 雞
|
||||||
|
- Cod = 鱈魚
|
||||||
|
- Cow = 牛
|
||||||
|
- Fox = 狐狸
|
||||||
|
- Glow Squid = 螢光魷魚
|
||||||
|
- Mooshroom = 哞菇牛
|
||||||
|
- Ocelot = 山貓
|
||||||
|
- Pig = 豬
|
||||||
|
- Rabbit = 兔子
|
||||||
|
- Salmon = 鮭魚
|
||||||
|
- Sheep = 綿羊
|
||||||
|
- Squid = 魷魚
|
||||||
|
- Strider = 熾足獸
|
||||||
|
- Tropical Fish = 熱帶魚
|
||||||
|
- Turtle = 海龜
|
||||||
|
- Villager = 村民
|
||||||
|
- Nitwit = 傻子
|
||||||
|
- Armorer = 盔甲匠
|
||||||
|
- Butcher = 屠夫
|
||||||
|
- Cartographer = 製圖師
|
||||||
|
- Cleric = 神職人員
|
||||||
|
- Farmer = 農夫
|
||||||
|
- Fisherman = 漁夫
|
||||||
|
- Fletcher = 製箭師
|
||||||
|
- Leatherworker = 皮匠
|
||||||
|
- Librarian = 圖書管理員
|
||||||
|
- Mason = 石匠
|
||||||
|
- Shepherd = 牧羊人
|
||||||
|
- Toolsmith = 工具匠
|
||||||
|
- Weaponsmith = 武器匠
|
||||||
|
- Wandering Trader = 流浪商人
|
||||||
|
- Pufferfish = 河豚
|
||||||
|
- Bee = 蜜蜂
|
||||||
|
- Cave Spider = 洞穴蜘蛛
|
||||||
|
- Dolphin = 海豚
|
||||||
|
- Enderman = 終界使者
|
||||||
|
- Goat = 山羊
|
||||||
|
- Panda = 熊貓
|
||||||
|
- Piglin = 豬布林
|
||||||
|
- Polar Bear = 北極熊
|
||||||
|
- Spider = 蜘蛛
|
||||||
|
- Zombified Piglin = 殭屍化豬布林
|
||||||
|
- Blaze = 烈焰使者
|
||||||
|
- Creeper = 苦力怕
|
||||||
|
- Drowned = 沉屍
|
||||||
|
- Elder Guardian = 遠古深海守衛
|
||||||
|
- Endermite = 終界蟎
|
||||||
|
- Evoker = 喚魔者
|
||||||
|
- Ghast = 地獄幽靈
|
||||||
|
- Guardian = 深海守衛
|
||||||
|
- Hoglin = 豬布獸
|
||||||
|
- Husk = 屍殼
|
||||||
|
- Magma Cube = 岩漿立方怪
|
||||||
|
- Phantom = 夜魅
|
||||||
|
- Piglin Brute = 豬布林蠻兵
|
||||||
|
- Pillager = 掠奪者
|
||||||
|
- Ravager = 劫毀獸
|
||||||
|
- Shulker = 界伏蚌
|
||||||
|
- Silverfish = 蠹魚
|
||||||
|
- Skeleton = 骷髏
|
||||||
|
- Slime = 史萊姆
|
||||||
|
- Stray = 流髑
|
||||||
|
- Vex = 惱鬼
|
||||||
|
- Vindicator = 衛道士
|
||||||
|
- Witch = 女巫
|
||||||
|
- Wither Skeleton = 凋零骷髏
|
||||||
|
- Zoglin = 豬屍獸
|
||||||
|
- Zombie Villager = 殭屍村民
|
||||||
|
- Zombie = 殭屍
|
||||||
|
- Cat = 貓
|
||||||
|
- Donkey = 驢子
|
||||||
|
- Horse = 馬
|
||||||
|
- Llama = 駱馬
|
||||||
|
- Trader Llama = 商駝
|
||||||
|
- Mule = 騾子
|
||||||
|
- Parrot = 鸚鵡
|
||||||
|
- Skeleton Horse = 骷髏馬
|
||||||
|
- Wolf = 狼
|
||||||
|
- Iron Golem = 鐵魔像
|
||||||
|
- Snow Golem = 雪人
|
||||||
|
- Ender Dragon = 終界龍
|
||||||
|
- Wither = 凋零怪
|
||||||
|
- Allay = 悅靈
|
||||||
|
- Warden = 伏守者
|
||||||
|
- Frog = 青蛙
|
||||||
|
- Tadpole = 蝌蚪
|
Loading…
Reference in New Issue