diff --git a/.gradle/4.5/fileChanges/last-build.bin b/.gradle/4.5/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/4.5/fileChanges/last-build.bin differ diff --git a/.gradle/4.5/fileContent/annotation-processors.bin b/.gradle/4.5/fileContent/annotation-processors.bin new file mode 100644 index 0000000..e2fb014 Binary files /dev/null and b/.gradle/4.5/fileContent/annotation-processors.bin differ diff --git a/.gradle/4.5/fileContent/fileContent.lock b/.gradle/4.5/fileContent/fileContent.lock new file mode 100644 index 0000000..5d1e597 Binary files /dev/null and b/.gradle/4.5/fileContent/fileContent.lock differ diff --git a/.gradle/4.5/fileHashes/fileHashes.bin b/.gradle/4.5/fileHashes/fileHashes.bin new file mode 100644 index 0000000..867f5e5 Binary files /dev/null and b/.gradle/4.5/fileHashes/fileHashes.bin differ diff --git a/.gradle/4.5/fileHashes/fileHashes.lock b/.gradle/4.5/fileHashes/fileHashes.lock new file mode 100644 index 0000000..541e642 Binary files /dev/null and b/.gradle/4.5/fileHashes/fileHashes.lock differ diff --git a/.gradle/4.5/fileHashes/resourceHashesCache.bin b/.gradle/4.5/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..eccd7c2 Binary files /dev/null and b/.gradle/4.5/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/4.5/taskHistory/taskHistory.bin b/.gradle/4.5/taskHistory/taskHistory.bin new file mode 100644 index 0000000..6f47e7b Binary files /dev/null and b/.gradle/4.5/taskHistory/taskHistory.bin differ diff --git a/.gradle/4.5/taskHistory/taskHistory.lock b/.gradle/4.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000..98e4b13 Binary files /dev/null and b/.gradle/4.5/taskHistory/taskHistory.lock differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..4a90f29 Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..a47101d --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sat Mar 10 18:07:09 CST 2018 +gradle.version=4.5 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..3a125aa Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/vcsWorkingDirs/gc.properties b/.gradle/vcsWorkingDirs/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..dc85b8c --- /dev/null +++ b/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +#Sat Mar 10 18:07:18 CST 2018 +connection.project.dir= diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..6686ae1 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/main/java/me/skymc/taboolib/javashell/JavaShell.java=UTF-8 +encoding/=UTF-8 diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..ab77c22 --- /dev/null +++ b/build.gradle @@ -0,0 +1,39 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Java Library project to get you started. + * For more details take a look at the Java Libraries chapter in the Gradle + * user guide available at https://docs.gradle.org/4.5/userguide/java_library_plugin.html + */ + +plugins { + // Apply the java-library plugin to add support for Java Library + id 'java-library' +} + +tasks.withType(JavaCompile) { + options.encoding = "UTF-8" +} + +sourceCompatibility = targetCompatibility = "1.8" // Need this here so eclipse task generates correctly. +compileJava { + sourceCompatibility = targetCompatibility = "1.8" +} + +processResources { + from('resources') { + include '**' + } +} + +dependencies { + // Library + compile fileTree(dir:'libs', include:['*.jar']) +} + +// In this section you declare where to find the dependencies of your project +repositories { + // Use jcenter for resolving your dependencies. + // You can declare any Maven/Ivy/file repository here. + jcenter() +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..be280be --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## 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="" + +# 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 + ;; + 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, switch paths to Windows format before running java +if $cygwin ; 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=$((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" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@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 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= + +@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 init + +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 init + +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 + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +: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 %CMD_LINE_ARGS% + +: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 diff --git a/src/resources/JavaShells/scripts/-testshell.java b/resources/JavaShells/scripts/-testshell.java similarity index 100% rename from src/resources/JavaShells/scripts/-testshell.java rename to resources/JavaShells/scripts/-testshell.java diff --git a/src/resources/Language/ITEM_NAME.yml b/resources/Language/ITEM_NAME.yml similarity index 100% rename from src/resources/Language/ITEM_NAME.yml rename to resources/Language/ITEM_NAME.yml diff --git a/src/resources/Language2/Language2.yml b/resources/Language2/Language2.yml similarity index 100% rename from src/resources/Language2/Language2.yml rename to resources/Language2/Language2.yml diff --git a/src/resources/Language2/zh_CN.yml b/resources/Language2/zh_CN.yml similarity index 100% rename from src/resources/Language2/zh_CN.yml rename to resources/Language2/zh_CN.yml diff --git a/src/resources/TLM/CommandChanger.yml b/resources/TLM/CommandChanger.yml similarity index 100% rename from src/resources/TLM/CommandChanger.yml rename to resources/TLM/CommandChanger.yml diff --git a/src/resources/TLM/Kits.yml b/resources/TLM/Kits.yml similarity index 100% rename from src/resources/TLM/Kits.yml rename to resources/TLM/Kits.yml diff --git a/src/resources/TLM/TimeCycle.yml b/resources/TLM/TimeCycle.yml similarity index 100% rename from src/resources/TLM/TimeCycle.yml rename to resources/TLM/TimeCycle.yml diff --git a/src/resources/config.yml b/resources/config.yml similarity index 100% rename from src/resources/config.yml rename to resources/config.yml diff --git a/src/resources/items.yml b/resources/items.yml similarity index 100% rename from src/resources/items.yml rename to resources/items.yml diff --git a/src/resources/module.yml b/resources/module.yml similarity index 77% rename from src/resources/module.yml rename to resources/module.yml index 808f5e4..ccd6800 100644 --- a/src/resources/module.yml +++ b/resources/module.yml @@ -4,5 +4,7 @@ Language: 'zh_CN' # 启用模块 # 该配置需要重启服务器才会生效 EnableModule: -#- 'TimeCycle' #- 'Kits' +#- 'TimeCycle' +#- 'CommandChanger' +#- 'InventorySave' \ No newline at end of file diff --git a/src/resources/plugin.yml b/resources/plugin.yml similarity index 64% rename from src/resources/plugin.yml rename to resources/plugin.yml index f686530..4d474aa 100644 --- a/src/resources/plugin.yml +++ b/resources/plugin.yml @@ -6,7 +6,7 @@ website: http://www.15imc.com/index.html main: me.skymc.taboolib.Main -version: {$VERSION} +version: 3.76 commands: taboolib: @@ -15,6 +15,9 @@ commands: language2: aliases: [lang2] permission: taboolib.admin + taboolibrarymodule: + aliases: [tlm] -loadbefore: [Vault] -soft-depend: [PlaceholderAPI] \ No newline at end of file +depend: [Vault] +softdepend: [PlaceholderAPI, Skript, TabooCode] +loadbefore: [Skript] \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..9e559ee --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * + * Detailed information about configuring a multi-project build in Gradle can be found + * in the user guide at https://docs.gradle.org/4.5/userguide/multi_project_builds.html + */ + +rootProject.name = 'TabooLib [Gradle]' diff --git a/src/.gradle/4.5/taskHistory/taskHistory.bin b/src/.gradle/4.5/taskHistory/taskHistory.bin new file mode 100644 index 0000000..4548949 Binary files /dev/null and b/src/.gradle/4.5/taskHistory/taskHistory.bin differ diff --git a/src/.gradle/4.5/taskHistory/taskHistory.lock b/src/.gradle/4.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000..6d15a40 Binary files /dev/null and b/src/.gradle/4.5/taskHistory/taskHistory.lock differ diff --git a/src/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/src/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..ed23724 Binary files /dev/null and b/src/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/src/.gradle/buildOutputCleanup/cache.properties b/src/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..5af4b84 --- /dev/null +++ b/src/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sat Mar 10 19:32:51 CST 2018 +gradle.version=4.5 diff --git a/src/main/src/me/skymc/taboolib/Main.java b/src/main/java/me/skymc/taboolib/Main.java similarity index 95% rename from src/main/src/me/skymc/taboolib/Main.java rename to src/main/java/me/skymc/taboolib/Main.java index 44fdc77..1a4658b 100644 --- a/src/main/src/me/skymc/taboolib/Main.java +++ b/src/main/java/me/skymc/taboolib/Main.java @@ -1,26 +1,14 @@ -package me.skymc.taboolib; +package me.skymc.taboolib; import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; import java.util.Random; import org.bukkit.Bukkit; -import org.bukkit.Material; import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; -import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; - -import com.google.common.base.Charsets; import lombok.Getter; import lombok.Setter; diff --git a/src/main/src/me/skymc/taboolib/TabooLib.java b/src/main/java/me/skymc/taboolib/TabooLib.java similarity index 92% rename from src/main/src/me/skymc/taboolib/TabooLib.java rename to src/main/java/me/skymc/taboolib/TabooLib.java index 6f17ce2..004bda3 100644 --- a/src/main/src/me/skymc/taboolib/TabooLib.java +++ b/src/main/java/me/skymc/taboolib/TabooLib.java @@ -12,7 +12,7 @@ import net.md_5.bungee.api.ChatColor; public class TabooLib { /** - * ȡ汾 + * 获取插件版本 * * @return */ @@ -26,7 +26,7 @@ public class TabooLib { } /** - * ȡ NMS 汾 + * 获取 NMS 版本 * * @return */ @@ -35,7 +35,7 @@ public class TabooLib { } /** - * ȡ UID + * 获取服务器 UID * * @return */ @@ -47,14 +47,14 @@ public class TabooLib { } /** - * ÷ UID + * 重置服务器 UID */ public static void resetServerUID() { DataUtils.getPluginData("TabooLibrary", null).set("serverUID", UUID.randomUUID().toString()); } /** - * ̨ DEBUG Ϣ + * 向后台发送 DEBUG 信息 * * @param plugin * @param ss @@ -69,7 +69,7 @@ public class TabooLib { } /** - * ȡ NMS 汾֣ + * 获取 NMS 版本(数字) * * @return */ diff --git a/src/main/src/me/skymc/taboolib/anvil/AnvilContainerAPI.java b/src/main/java/me/skymc/taboolib/anvil/AnvilContainerAPI.java similarity index 93% rename from src/main/src/me/skymc/taboolib/anvil/AnvilContainerAPI.java rename to src/main/java/me/skymc/taboolib/anvil/AnvilContainerAPI.java index 5e1c62c..8eb4e4e 100644 --- a/src/main/src/me/skymc/taboolib/anvil/AnvilContainerAPI.java +++ b/src/main/java/me/skymc/taboolib/anvil/AnvilContainerAPI.java @@ -40,8 +40,8 @@ public class AnvilContainerAPI implements Listener{ if (lorelist == null) { list.add(""); - list.add("7ϷıϢ"); - list.add("7ҲƷ"); + list.add("§7在上方文本框内输入信息"); + list.add("§7随后点击右侧输出物品"); } else { @@ -109,7 +109,7 @@ public class AnvilContainerAPI implements Listener{ if (e.getPlayer().hasPermission("taboolib.admin")) { e.setCancelled(true); - AnvilContainerAPI.send(e.getPlayer(), "EXAMPLE", "ı", null); + AnvilContainerAPI.send(e.getPlayer(), "EXAMPLE", "在这里输入文本", null); } } } diff --git a/src/main/src/me/skymc/taboolib/anvil/AnvilContainerAPIEvent.java b/src/main/java/me/skymc/taboolib/anvil/AnvilContainerAPIEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/anvil/AnvilContainerAPIEvent.java rename to src/main/java/me/skymc/taboolib/anvil/AnvilContainerAPIEvent.java diff --git a/src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_11_R1.java b/src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_11_R1.java similarity index 96% rename from src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_11_R1.java rename to src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_11_R1.java index 82504c8..3355628 100644 --- a/src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_11_R1.java +++ b/src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_11_R1.java @@ -24,7 +24,7 @@ public class AnvilContainer_V1_11_R1 extends ContainerAnvil { } /** - * @deprecated ѹڣµķ + * @deprecated 方法已过期,已有新的方法 */ public static void openAnvil(Player p) { diff --git a/src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_8_R3.java b/src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_8_R3.java similarity index 95% rename from src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_8_R3.java rename to src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_8_R3.java index 9fbf2d9..399bf61 100644 --- a/src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_8_R3.java +++ b/src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_8_R3.java @@ -24,7 +24,7 @@ public class AnvilContainer_V1_8_R3 extends ContainerAnvil { } /** - * @deprecated ѹڣµķ + * @deprecated 方法已过期,已有新的方法 */ public static void openAnvil(Player p) { diff --git a/src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_9_4.java b/src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_9_4.java similarity index 95% rename from src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_9_4.java rename to src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_9_4.java index 849f928..bd625fa 100644 --- a/src/main/src/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_9_4.java +++ b/src/main/java/me/skymc/taboolib/anvil/versions/AnvilContainer_V1_9_4.java @@ -24,7 +24,7 @@ public class AnvilContainer_V1_9_4 extends ContainerAnvil { } /** - * @deprecated ѹڣµķ + * @deprecated 方法已过期,已有新的方法 */ public static void openAnvil(Player p) { diff --git a/src/main/src/me/skymc/taboolib/bookformatter/BookAchievement.java b/src/main/java/me/skymc/taboolib/bookformatter/BookAchievement.java similarity index 98% rename from src/main/src/me/skymc/taboolib/bookformatter/BookAchievement.java rename to src/main/java/me/skymc/taboolib/bookformatter/BookAchievement.java index b054251..c2b143e 100644 --- a/src/main/src/me/skymc/taboolib/bookformatter/BookAchievement.java +++ b/src/main/java/me/skymc/taboolib/bookformatter/BookAchievement.java @@ -6,7 +6,6 @@ import java.util.HashMap; import static org.bukkit.Achievement.*; -@SuppressWarnings("deprecation") public final class BookAchievement { private static final HashMap achievements = new HashMap<>(); diff --git a/src/main/src/me/skymc/taboolib/bookformatter/BookFormatter.java b/src/main/java/me/skymc/taboolib/bookformatter/BookFormatter.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/BookFormatter.java rename to src/main/java/me/skymc/taboolib/bookformatter/BookFormatter.java diff --git a/src/main/src/me/skymc/taboolib/bookformatter/BookReflection.java b/src/main/java/me/skymc/taboolib/bookformatter/BookReflection.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/BookReflection.java rename to src/main/java/me/skymc/taboolib/bookformatter/BookReflection.java diff --git a/src/main/src/me/skymc/taboolib/bookformatter/action/ClickAction.java b/src/main/java/me/skymc/taboolib/bookformatter/action/ClickAction.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/action/ClickAction.java rename to src/main/java/me/skymc/taboolib/bookformatter/action/ClickAction.java diff --git a/src/main/src/me/skymc/taboolib/bookformatter/action/HoverAction.java b/src/main/java/me/skymc/taboolib/bookformatter/action/HoverAction.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/action/HoverAction.java rename to src/main/java/me/skymc/taboolib/bookformatter/action/HoverAction.java diff --git a/src/main/src/me/skymc/taboolib/bookformatter/builder/BookBuilder.java b/src/main/java/me/skymc/taboolib/bookformatter/builder/BookBuilder.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/builder/BookBuilder.java rename to src/main/java/me/skymc/taboolib/bookformatter/builder/BookBuilder.java diff --git a/src/main/src/me/skymc/taboolib/bookformatter/builder/PageBuilder.java b/src/main/java/me/skymc/taboolib/bookformatter/builder/PageBuilder.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/builder/PageBuilder.java rename to src/main/java/me/skymc/taboolib/bookformatter/builder/PageBuilder.java diff --git a/src/main/src/me/skymc/taboolib/bookformatter/builder/TextBuilder.java b/src/main/java/me/skymc/taboolib/bookformatter/builder/TextBuilder.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bookformatter/builder/TextBuilder.java rename to src/main/java/me/skymc/taboolib/bookformatter/builder/TextBuilder.java diff --git a/src/main/src/me/skymc/taboolib/bstats/Metrics.java b/src/main/java/me/skymc/taboolib/bstats/Metrics.java similarity index 100% rename from src/main/src/me/skymc/taboolib/bstats/Metrics.java rename to src/main/java/me/skymc/taboolib/bstats/Metrics.java diff --git a/src/main/src/me/skymc/taboolib/client/LogClient.java b/src/main/java/me/skymc/taboolib/client/LogClient.java similarity index 96% rename from src/main/src/me/skymc/taboolib/client/LogClient.java rename to src/main/java/me/skymc/taboolib/client/LogClient.java index 153a3d5..7893563 100644 --- a/src/main/src/me/skymc/taboolib/client/LogClient.java +++ b/src/main/java/me/skymc/taboolib/client/LogClient.java @@ -10,6 +10,7 @@ import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.border.BevelBorder; +@Deprecated public class LogClient extends JFrame { /** @@ -36,7 +37,7 @@ public class LogClient extends JFrame { // CON'T EDIT textArea.setEditable(false); - textArea.setFont(new Font("", 0, 18)); + textArea.setFont(new Font("黑体", 0, 18)); textArea.setBackground(Color.black); textArea.setForeground(Color.LIGHT_GRAY); diff --git a/src/main/src/me/skymc/taboolib/commands/MainCommands.java b/src/main/java/me/skymc/taboolib/commands/MainCommands.java similarity index 97% rename from src/main/src/me/skymc/taboolib/commands/MainCommands.java rename to src/main/java/me/skymc/taboolib/commands/MainCommands.java index a944415..6682b78 100644 --- a/src/main/src/me/skymc/taboolib/commands/MainCommands.java +++ b/src/main/java/me/skymc/taboolib/commands/MainCommands.java @@ -40,7 +40,7 @@ public class MainCommands implements CommandExecutor{ else if (args[0].equalsIgnoreCase("itemreload") || args[0].equalsIgnoreCase("ireload")) { ItemUtils.reloadItemCache(); ItemUtils.reloadItemName(); - MsgUtils.send(sender, "سɹ"); + MsgUtils.send(sender, "重载成功"); } else if (args[0].equalsIgnoreCase("save")) { new SaveCommand(sender, args); @@ -85,7 +85,7 @@ public class MainCommands implements CommandExecutor{ new CycleCommand(sender, args); } else { - MsgUtils.send(sender, "&4ָ"); + MsgUtils.send(sender, "&4指令错误"); } return true; } diff --git a/src/main/src/me/skymc/taboolib/commands/SubCommand.java b/src/main/java/me/skymc/taboolib/commands/SubCommand.java similarity index 100% rename from src/main/src/me/skymc/taboolib/commands/SubCommand.java rename to src/main/java/me/skymc/taboolib/commands/SubCommand.java diff --git a/src/main/src/me/skymc/taboolib/commands/SubCommandExecutor.java b/src/main/java/me/skymc/taboolib/commands/SubCommandExecutor.java similarity index 100% rename from src/main/src/me/skymc/taboolib/commands/SubCommandExecutor.java rename to src/main/java/me/skymc/taboolib/commands/SubCommandExecutor.java diff --git a/src/main/src/me/skymc/taboolib/commands/language/Language2Command.java b/src/main/java/me/skymc/taboolib/commands/language/Language2Command.java similarity index 60% rename from src/main/src/me/skymc/taboolib/commands/language/Language2Command.java rename to src/main/java/me/skymc/taboolib/commands/language/Language2Command.java index 9e058ad..9d1b38e 100644 --- a/src/main/src/me/skymc/taboolib/commands/language/Language2Command.java +++ b/src/main/java/me/skymc/taboolib/commands/language/Language2Command.java @@ -13,37 +13,37 @@ import me.skymc.taboolib.string.language2.Language2Value; /** * @author sky - * @since 2018213 5:11:01 + * @since 2018年2月13日 下午5:11:01 */ public class Language2Command implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (args.length == 0) { - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lLanguage2 Commands bl-----"); - sender.sendMessage("f"); - sender.sendMessage("f /language2 send 8[7/ALL8] 8[7ԡ8] 8<78> 6- eʾ"); - sender.sendMessage("f /language2 reload 6- eԿ"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lLanguage2 Commands §b§l-----"); + sender.sendMessage("§f"); + sender.sendMessage("§f /language2 send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示"); + sender.sendMessage("§f /language2 reload §6- §e重载语言库"); + sender.sendMessage("§f"); } else if (args[0].equalsIgnoreCase("reload")) { - MsgUtils.send(sender, "7.."); + MsgUtils.send(sender, "§7重载中.."); long time = System.currentTimeMillis(); Main.getExampleLangauge2().reload(); - MsgUtils.send(sender, "7! ʱ: &f" + (System.currentTimeMillis() - time) + "ms"); + MsgUtils.send(sender, "§7重载完成! 耗时: &f" + (System.currentTimeMillis() - time) + "ms"); } else if (args[0].equalsIgnoreCase("send")) { if (args.length < 3) { - MsgUtils.send(sender, "4"); + MsgUtils.send(sender, "§4参数错误"); } else { - // ʱ + // 时间 long time = System.currentTimeMillis(); - // ȡļ + // 获取语言文件 Language2Value value = Main.getExampleLangauge2().get(args[2]); - // б + // 如果有变量参数 if (args.length > 3) { int i = 0; for (String variable : args[3].split("\\|")) { @@ -52,26 +52,26 @@ public class Language2Command implements CommandExecutor { } } - // ǹ + // 如果是公告 if (args[1].equals("ALL")) { - // Ϣ + // 发送信息 value.broadcast(); } else { - // ȡ + // 获取玩家 Player player = Bukkit.getPlayerExact(args[1]); if (player == null) { - MsgUtils.send(sender, "4Ҳ"); + MsgUtils.send(sender, "§4玩家不在线"); } else { - // Ϣ + // 发送信息 value.send(player); } } - // + // 如果发送者是玩家 if (sender instanceof Player && ((Player) sender).getItemInHand().getType().equals(Material.COMMAND)) { - MsgUtils.send(sender, "7Ϣѷ, μʱ: &f" + (System.currentTimeMillis() - time) + "ms"); + MsgUtils.send(sender, "§7信息已发送, 本次计算耗时: &f" + (System.currentTimeMillis() - time) + "ms"); } } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/AttributesCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/AttributesCommand.java similarity index 69% rename from src/main/src/me/skymc/taboolib/commands/sub/AttributesCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/AttributesCommand.java index dbade7c..4fd0452 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/AttributesCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/AttributesCommand.java @@ -14,23 +14,23 @@ public class AttributesCommand extends SubCommand { public AttributesCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lItemStack Attributes bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lItemStack Attributes §b§l-----"); + sender.sendMessage("§f"); String[] attributes = new String[] { "damage", "speed", "attackspeed", "health", "knockback", "armor", "luck" }; for (String name : attributes) { if (isPlayer()) { JSONFormatter json = new JSONFormatter(); - json.append(" 7- f" + name); - json.appendHoverClick(" 8()", new ShowTextEvent("f"), new SuggestCommandEvent(name)); + json.append(" §7- §f" + name); + json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(name)); json.send((Player) sender); } else { - sender.sendMessage(" 7- f" + name); + sender.sendMessage(" §7- §f" + name); } } - sender.sendMessage("f"); + sender.sendMessage("§f"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/EnchantCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/EnchantCommand.java similarity index 64% rename from src/main/src/me/skymc/taboolib/commands/sub/EnchantCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/EnchantCommand.java index 8f2d90a..ecb5a78 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/EnchantCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/EnchantCommand.java @@ -15,21 +15,21 @@ public class EnchantCommand extends SubCommand { public EnchantCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lItemStack Enchantments bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lItemStack Enchantments §b§l-----"); + sender.sendMessage("§f"); for (Enchantment enchant : Enchantment.values()) { if (isPlayer()) { JSONFormatter json = new JSONFormatter(); - json.append(" 7- f" + enchant.getId() + ". " + enchant.getName()); - json.appendHoverClick(" 8()", new ShowTextEvent("f"), new SuggestCommandEvent(enchant.getName())); + json.append(" §7- §f" + enchant.getId() + ". " + enchant.getName()); + json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(enchant.getName())); json.send((Player) sender); } else { - sender.sendMessage(" 7- f" + enchant.getId() + ". " + enchant.getName()); + sender.sendMessage(" §7- §f" + enchant.getId() + ". " + enchant.getName()); } } - sender.sendMessage("f"); + sender.sendMessage("§f"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/FlagCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/FlagCommand.java similarity index 65% rename from src/main/src/me/skymc/taboolib/commands/sub/FlagCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/FlagCommand.java index 484f40f..5ea1ad4 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/FlagCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/FlagCommand.java @@ -14,21 +14,21 @@ public class FlagCommand extends SubCommand { public FlagCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lItemStack Flags bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lItemStack Flags §b§l-----"); + sender.sendMessage("§f"); for (ItemFlag flag : ItemFlag.values()) { if (isPlayer()) { JSONFormatter json = new JSONFormatter(); - json.append(" 7- f" + flag.name()); - json.appendHoverClick(" 8()", new ShowTextEvent("f"), new SuggestCommandEvent(flag.name())); + json.append(" §7- §f" + flag.name()); + json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(flag.name())); json.send((Player) sender); } else { - sender.sendMessage(" 7- f" + flag.name()); + sender.sendMessage(" §7- §f" + flag.name()); } } - sender.sendMessage("f"); + sender.sendMessage("§f"); } } diff --git a/src/main/java/me/skymc/taboolib/commands/sub/HelpCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/HelpCommand.java new file mode 100644 index 0000000..dc18f75 --- /dev/null +++ b/src/main/java/me/skymc/taboolib/commands/sub/HelpCommand.java @@ -0,0 +1,80 @@ +package me.skymc.taboolib.commands.sub; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map.Entry; + +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemFlag; + +import me.skymc.taboolib.TabooLib; +import me.skymc.taboolib.commands.SubCommand; +import me.skymc.taboolib.jsonformatter.JSONFormatter; +import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent; +import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent; + +public class HelpCommand extends SubCommand { + + public HelpCommand(CommandSender sender, String[] args) { + super(sender, args); + + HashMap helps = new LinkedHashMap<>(); + helps.put("/taboolib save §8[§7名称§8]", "§e保存手中物品"); + helps.put("/taboolib item §8[§7名称§8] §8<§7玩家§8> §8<§7数量§8>", "§e给予玩家物品"); + helps.put("/taboolib iteminfo", "§e查看物品信息"); + helps.put("/taboolib itemlist", "§e查看所有物品"); + helps.put("/taboolib itemreload", "§e重载物品缓存"); + helps.put("§a", null); + helps.put("/taboolib attributes", "§e查看所有属性"); + helps.put("/taboolib enchants", "§e查看所有附魔"); + helps.put("/taboolib potions", "§e查看所有药水"); + helps.put("/taboolib flags", "§e查看所有标签"); + helps.put("/taboolib slots", "§e查看所有部位"); + helps.put("§b", null); + helps.put("/taboolib getvariable §8[§7-s|a§8] §8[§7键§8]", "§e查看变量"); + helps.put("/taboolib setvariable §8[§7-s|a§8] §8[§7键§8] §8[§7值§8]", "§e更改变量"); + helps.put("§c", null); + helps.put("/taboolib cycle list", "§e列出所有时间检查器"); + helps.put("/taboolib cycle info §8[§7名称§8]", "§e查询检查器信息"); + helps.put("/taboolib cycle reset §8[§7名称§8]", "§e初始化时间检查器"); + helps.put("/taboolib cycle update §8[§7名称§8]", "§e更新时间检查器"); + helps.put("§f", null); + helps.put("/taboolib shell load §8[§7名称§8]", "§e载入某个脚本"); + helps.put("/taboolib shell unload §8[§7名称§8]", "§e卸载某个脚本"); + helps.put("§e", null); + helps.put("/taboolib importdata", "§4向数据库导入本地数据 §8(该操作将会清空数据库)"); + + if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10900) { + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lTaooLib Commands §b§l-----"); + sender.sendMessage("§f"); + // 遍历命令 + for (Entry entry : helps.entrySet()) { + if (entry.getValue() == null) { + sender.sendMessage("§f"); + } else { + sender.sendMessage("§f " + entry.getKey() + " §6- " + entry.getValue()); + } + } + sender.sendMessage("§f"); + } + else if (sender instanceof Player) { + JSONFormatter json = new JSONFormatter(); + json.append("§f"); json.newLine(); + json.append("§b§l----- §3§lTaooLib Commands §b§l-----"); json.newLine(); + json.append("§f"); json.newLine(); + // 遍历命令 + for (Entry entry : helps.entrySet()) { + if (entry.getValue() == null) { + json.append("§f"); json.newLine(); + } else { + json.appendHoverClick("§f " + entry.getKey() + " §6- " + entry.getValue(), new ShowTextEvent("§f点击复制指令"), new SuggestCommandEvent(entry.getKey().split("§")[0])); json.newLine(); + } + } + json.append("§f"); + json.send((Player) sender); + } + } +} diff --git a/src/main/src/me/skymc/taboolib/commands/sub/ImportCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/ImportCommand.java similarity index 75% rename from src/main/src/me/skymc/taboolib/commands/sub/ImportCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/ImportCommand.java index 84085dc..5a97dda 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/ImportCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/ImportCommand.java @@ -18,16 +18,16 @@ public class ImportCommand extends SubCommand { super(sender, args); if (isPlayer()) { - MsgUtils.warn("ֻɿ̨"); + MsgUtils.warn("改命令只能由控制台输入"); } else if (Main.getStorageType() == StorageType.LOCAL) { - MsgUtils.warn("ֻݿⴢʱô"); + MsgUtils.warn("只有启用数据库储存时才能这么做"); } else { - MsgUtils.send("ݿ..."); + MsgUtils.send("正在清空数据库..."); Main.getConnection().truncateTable(Main.getTablePrefix() + "_playerdata"); - MsgUtils.send("ʼ..."); + MsgUtils.send("开始导入玩家数据..."); int size = Main.getPlayerDataFolder().listFiles().length; int loop = 1; @@ -35,10 +35,10 @@ public class ImportCommand extends SubCommand { FileConfiguration conf = YamlConfiguration.loadConfiguration(file); Main.getConnection().intoValue(Main.getTablePrefix() + "_playerdata", file.getName().replace(".yml", ""), ConfigUtils.encodeYAML(conf)); - MsgUtils.send(": &f" + file.getName().replace(".yml", "") + " &7: &f" + loop + "/" + size); + MsgUtils.send("导入玩家: &f" + file.getName().replace(".yml", "") + " &7进度: &f" + loop + "/" + size); loop++; } - MsgUtils.send("!"); + MsgUtils.send("导入完成!"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/InfoCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/InfoCommand.java similarity index 53% rename from src/main/src/me/skymc/taboolib/commands/sub/InfoCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/InfoCommand.java index 0d1b0e3..8252fc7 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/InfoCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/InfoCommand.java @@ -24,29 +24,29 @@ public class InfoCommand extends SubCommand { if (isPlayer()) { Player player = (Player) sender; if (player.getItemInHand().getType().equals(Material.AIR)) { - MsgUtils.send(player, "&7ֳȷƷ"); + MsgUtils.send(player, "&7请手持正确物品"); } else { - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lItemStack Info bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lItemStack Info §b§l-----"); + sender.sendMessage("§f"); JSONFormatter json = new JSONFormatter(); - json.append("7 - Ʒ: f"); json.appendHoverClick("f" + player.getItemInHand().getType().name(), new ShowTextEvent("f"), new SuggestCommandEvent(player.getItemInHand().getType().name())); + json.append("§7 - 物品材质: §f"); json.appendHoverClick("§f" + player.getItemInHand().getType().name(), new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(player.getItemInHand().getType().name())); json.newLine(); - json.append("7 - Ʒ: f"); json.appendHoverClick("f" + ItemUtils.getCustomName(player.getItemInHand()), new ShowTextEvent("f"), new SuggestCommandEvent(ItemUtils.getCustomName(player.getItemInHand()).replace("", "&"))); + json.append("§7 - 物品名称: §f"); json.appendHoverClick("§f" + ItemUtils.getCustomName(player.getItemInHand()), new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(ItemUtils.getCustomName(player.getItemInHand()).replace("§", "&"))); json.newLine(); - json.append("7 - Ʒ: f" + player.getItemInHand().getTypeId() + ":" + player.getItemInHand().getDurability()); + json.append("§7 - 物品序号: §f" + player.getItemInHand().getTypeId() + ":" + player.getItemInHand().getDurability()); json.newLine(); - json.append("7 - Ʒչʾ: f"); json.appendHover(ItemUtils.getCustomName(player.getItemInHand()), new ShowItemEvent(player.getItemInHand())); + json.append("§7 - 物品展示: §f"); json.appendHover(ItemUtils.getCustomName(player.getItemInHand()), new ShowItemEvent(player.getItemInHand())); json.send(player); NBTItem nbt = new NBTItem(((Player) sender).getItemInHand()); - sender.sendMessage("7 - Ʒ NBT: f"); - sender.sendMessage("f"); + sender.sendMessage("§7 - 物品 NBT: §f"); + sender.sendMessage("§f"); sender.sendMessage(nbt.toString()); - sender.sendMessage("f"); + sender.sendMessage("§f"); } } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/ItemCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/ItemCommand.java similarity index 77% rename from src/main/src/me/skymc/taboolib/commands/sub/ItemCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/ItemCommand.java index 1457cbf..38dc3fc 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/ItemCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/ItemCommand.java @@ -15,7 +15,7 @@ import me.skymc.taboolib.other.NumberUtils; public class ItemCommand extends SubCommand { /** - * /TabooLib item Ʒ + * /TabooLib item 物品 玩家 数量 * * @param sender * @param args @@ -24,12 +24,12 @@ public class ItemCommand extends SubCommand { super(sender, args); if (args.length < 2) { - MsgUtils.send(sender, "ȷƷ"); + MsgUtils.send(sender, "请输入正确的物品名称"); setReturn(false); } else { if (ItemUtils.getCacheItem(args[1]) == null) { - MsgUtils.send(sender, "Ʒ &f" + args[1] + "&7 "); + MsgUtils.send(sender, "物品 &f" + args[1] + "&7 不存在"); setReturn(false); return; } @@ -41,7 +41,7 @@ public class ItemCommand extends SubCommand { if (args.length > 2) { player = Bukkit.getPlayerExact(args[2]); if (player == null) { - MsgUtils.send(sender, " &f" + args[2] + "&7 "); + MsgUtils.send(sender, "玩家 &f" + args[2] + "&7 不在线"); setReturn(false); return; } @@ -50,7 +50,7 @@ public class ItemCommand extends SubCommand { player = (Player) sender; } else { - MsgUtils.send(sender, "̨ô"); + MsgUtils.send(sender, "后台不允许这么做"); setReturn(false); return; } @@ -58,7 +58,7 @@ public class ItemCommand extends SubCommand { if (args.length > 3) { amount = NumberUtils.getInteger(args[3]); if (amount < 1) { - MsgUtils.send(sender, "0"); + MsgUtils.send(sender, "数量必须大于0"); setReturn(false); return; } @@ -70,7 +70,7 @@ public class ItemCommand extends SubCommand { player.getWorld().dropItem(player.getLocation(), item); } - MsgUtils.send(sender, "Ʒѷ &f" + player.getName() + " &7ı"); + MsgUtils.send(sender, "物品已发送至玩家 &f" + player.getName() + " &7的背包中"); setReturn(true); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/PotionCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/PotionCommand.java similarity index 66% rename from src/main/src/me/skymc/taboolib/commands/sub/PotionCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/PotionCommand.java index b837c5e..f08f012 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/PotionCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/PotionCommand.java @@ -15,23 +15,23 @@ public class PotionCommand extends SubCommand { public PotionCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lPotionEffect Types bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lPotionEffect Types §b§l-----"); + sender.sendMessage("§f"); for (PotionEffectType type : PotionEffectType.values()) { if (type != null) { if (isPlayer()) { JSONFormatter json = new JSONFormatter(); - json.append(" 7- f" + type.getId() + ". " + type.getName()); - json.appendHoverClick(" 8()", new ShowTextEvent("f"), new SuggestCommandEvent(type.getName())); + json.append(" §7- §f" + type.getId() + ". " + type.getName()); + json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(type.getName())); json.send((Player) sender); } else { - sender.sendMessage(" 7- f" + type.getId() + ". " + type.getName() + ""); + sender.sendMessage(" §7- §f" + type.getId() + ". " + type.getName() + ""); } } } - sender.sendMessage("f"); + sender.sendMessage("§f"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/SaveCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/SaveCommand.java similarity index 70% rename from src/main/src/me/skymc/taboolib/commands/sub/SaveCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/SaveCommand.java index c3961ec..e398335 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/SaveCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/SaveCommand.java @@ -20,29 +20,29 @@ public class SaveCommand extends SubCommand { public SaveCommand(CommandSender sender, String[] args) { super(sender, args); if (!(sender instanceof Player)) { - MsgUtils.send(sender, "&4̨޷ô"); + MsgUtils.send(sender, "&4后台无法这么做"); return; } if (args.length < 2) { - MsgUtils.send(sender, "&4ȷ"); + MsgUtils.send(sender, "&4请输入正确的名称"); return; } if (((Player) sender).getItemInHand().getType().equals(Material.AIR)) { - MsgUtils.send(sender, "&4㲻ܱ"); + MsgUtils.send(sender, "&4你不能保存空气"); return; } if (ItemUtils.getItemCachesFinal().containsKey(args[1])) { - MsgUtils.send(sender, "&4ӦƷڹ̶Ʒ, ޷"); + MsgUtils.send(sender, "&4该名称所对应的物品保存于固定物品库中, 无法覆盖"); return; } if (ItemUtils.getItemCaches().containsKey(args[1])) { - // + // 检查聊天引导 if (ChatCatcher.contains((Player) sender)) { - MsgUtils.send(sender, "&4һڽе, ɺô"); + MsgUtils.send(sender, "&4你有一个正在进行的聊天引导, 请完成后在这么做"); return; } @@ -50,24 +50,24 @@ public class SaveCommand extends SubCommand { @Override public void cancel() { - MsgUtils.send(sender, "&7˳"); + MsgUtils.send(sender, "&7退出引导"); } @Override public Catcher before() { - MsgUtils.send(sender, "Ʒ &f" + args[1] + "&7 Ѵ, Ҫ, \"&f&7\""); + MsgUtils.send(sender, "物品 &f" + args[1] + "&7 已存在, 如果你想要覆盖它, 请在聊天框中输入 \"&f是&7\""); return this; } @SuppressWarnings("deprecation") @Override public boolean after(String message) { - if (message.equals("")) { + if (message.equals("是")) { saveItem(args[1], ((Player) sender).getItemInHand()); - MsgUtils.send(sender, "Ʒ &f" + args[1] + " &7滻"); + MsgUtils.send(sender, "物品 &f" + args[1] + " &7已替换"); } else { - MsgUtils.send(sender, "&7˳"); + MsgUtils.send(sender, "&7退出引导"); } return false; } @@ -75,7 +75,7 @@ public class SaveCommand extends SubCommand { } else { saveItem(args[1], ((Player) sender).getItemInHand()); - MsgUtils.send(sender, "Ʒ &f" + args[1] + " &7ѱ"); + MsgUtils.send(sender, "物品 &f" + args[1] + " &7已保存"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/SlotCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/SlotCommand.java similarity index 69% rename from src/main/src/me/skymc/taboolib/commands/sub/SlotCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/SlotCommand.java index ff025dc..c456e93 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/SlotCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/SlotCommand.java @@ -14,23 +14,23 @@ public class SlotCommand extends SubCommand { public SlotCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lAttribute Slots bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lAttribute Slots §b§l-----"); + sender.sendMessage("§f"); String[] attributes = new String[] { "mainhand", "offhand", "feet", "legs", "chest", "head", "all" }; for (String name : attributes) { if (isPlayer()) { JSONFormatter json = new JSONFormatter(); - json.append(" 7- f" + name); - json.appendHoverClick(" 8()", new ShowTextEvent("f"), new SuggestCommandEvent(name)); + json.append(" §7- §f" + name); + json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(name)); json.send((Player) sender); } else { - sender.sendMessage(" 7- f" + name); + sender.sendMessage(" §7- §f" + name); } } - sender.sendMessage("f"); + sender.sendMessage("§f"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/VariableGetCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/VariableGetCommand.java similarity index 62% rename from src/main/src/me/skymc/taboolib/commands/sub/VariableGetCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/VariableGetCommand.java index 868b287..6976e50 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/VariableGetCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/VariableGetCommand.java @@ -12,10 +12,10 @@ public class VariableGetCommand extends SubCommand { super(sender, args); if (args.length < 3) { - MsgUtils.send(sender, "&4ȷָ "); + MsgUtils.send(sender, "&4请输入正确的指令 "); } else if (!(args[1].equals("-a") || args[1].equals("-s"))) { - MsgUtils.send(sender, "&4ȷĶȡʽ"); + MsgUtils.send(sender, "&4请输入正确的读取方式"); } Long time = System.currentTimeMillis(); @@ -29,12 +29,12 @@ public class VariableGetCommand extends SubCommand { } if (value == null) { - MsgUtils.send(sender, "ȡ, ʱ: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); - MsgUtils.send(sender, " &f" + args[2] + " &7"); + MsgUtils.send(sender, "读取完成, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); + MsgUtils.send(sender, "变量 &f" + args[2] + " &7不存在"); } else { - MsgUtils.send(sender, "ȡ, ʱ: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); - MsgUtils.send(sender, " &f" + args[2] + " &7ֵΪ &f" + value); + MsgUtils.send(sender, "读取完成, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); + MsgUtils.send(sender, "变量 &f" + args[2] + " &7的值为 &f" + value); } } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/VariableSetCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/VariableSetCommand.java similarity index 77% rename from src/main/src/me/skymc/taboolib/commands/sub/VariableSetCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/VariableSetCommand.java index affa5f8..28bcdf4 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/VariableSetCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/VariableSetCommand.java @@ -12,10 +12,10 @@ public class VariableSetCommand extends SubCommand { super(sender, args); if (args.length < 4) { - MsgUtils.send(sender, "&4ȷָ "); + MsgUtils.send(sender, "&4请输入正确的指令 "); } else if (!(args[1].equals("-a") || args[1].equals("-s"))) { - MsgUtils.send(sender, "&4ȷд뷽ʽ"); + MsgUtils.send(sender, "&4请输入正确的写入方式"); } Long time = System.currentTimeMillis(); @@ -28,7 +28,7 @@ public class VariableSetCommand extends SubCommand { GlobalDataManager.setVariableAsynchronous(args[2], value); } - MsgUtils.send(sender, "д, ʱ: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); + MsgUtils.send(sender, "写入完成, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); setReturn(true); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleCommand.java similarity index 95% rename from src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleCommand.java index c7169a0..bebea7f 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleCommand.java @@ -27,7 +27,7 @@ public class CycleCommand extends SubCommand { } } else { - MsgUtils.send(sender, "&4ָ"); + MsgUtils.send(sender, "&4指令错误"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleInfoCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleInfoCommand.java similarity index 60% rename from src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleInfoCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleInfoCommand.java index cea4dce..a653e90 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleInfoCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleInfoCommand.java @@ -21,25 +21,25 @@ public class CycleInfoCommand extends SubCommand { public CycleInfoCommand(CommandSender sender, String[] args) { super(sender, args); if (args.length < 3) { - MsgUtils.send(sender, "&cȷļ"); + MsgUtils.send(sender, "&c请输入正确的检查器名称"); return; } TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]); if (cycle == null) { - MsgUtils.send(sender, "&c &4" + args[2] + " &c"); + MsgUtils.send(sender, "&c检查器 &4" + args[2] + " &c不存在"); return; } - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lTimeCycle Info bl-----"); - sender.sendMessage("f"); - sender.sendMessage(" f- 7ע: f" + asString(cycle.getCycle() / 1000L)); - sender.sendMessage(" f- 7ע: f" + cycle.getPlugin().getName()); - sender.sendMessage("f"); - sender.sendMessage(" f- 7ϴˢʱ: f" + DateUtils.CH_ALL.format(TimeCycleManager.getBeforeTimeline(cycle.getName()))); - sender.sendMessage(" f- 7´ˢʱ: f" + DateUtils.CH_ALL.format(TimeCycleManager.getAfterTimeline(cycle.getName()))); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lTimeCycle Info §b§l-----"); + sender.sendMessage("§f"); + sender.sendMessage(" §f- §7注册周期: §f" + asString(cycle.getCycle() / 1000L)); + sender.sendMessage(" §f- §7注册插件: §f" + cycle.getPlugin().getName()); + sender.sendMessage("§f"); + sender.sendMessage(" §f- §7上次刷新时间: §f" + DateUtils.CH_ALL.format(TimeCycleManager.getBeforeTimeline(cycle.getName()))); + sender.sendMessage(" §f- §7下次刷新时间: §f" + DateUtils.CH_ALL.format(TimeCycleManager.getAfterTimeline(cycle.getName()))); + sender.sendMessage("§f"); } public String asString(long seconds) { @@ -47,7 +47,7 @@ public class CycleInfoCommand extends SubCommand { long hours = TimeUnit.SECONDS.toHours(seconds) - day * 24; long minute = TimeUnit.SECONDS.toMinutes(seconds) - TimeUnit.SECONDS.toHours(seconds) * 60L; long second = TimeUnit.SECONDS.toSeconds(seconds) - TimeUnit.SECONDS.toMinutes(seconds) * 60L; - return "f" + day + "7 , f" + hours + "7 Сʱ, f" + minute + "7 , f" + second + "7 "; + return "§f" + day + "§7 天, §f" + hours + "§7 小时, §f" + minute + "§7 分钟, §f" + second + "§7 秒"; } @Override diff --git a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleListCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleListCommand.java similarity index 72% rename from src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleListCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleListCommand.java index 226602b..4fcb79b 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleListCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleListCommand.java @@ -20,23 +20,23 @@ public class CycleListCommand extends SubCommand { public CycleListCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lTimeCycle List bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lTimeCycle List §b§l-----"); + sender.sendMessage("§f"); for (TimeCycle cycle : TimeCycleManager.getTimeCycles()) { if (isPlayer()) { JSONFormatter json = new JSONFormatter(); - json.append(" 7- f" + cycle.getName()); - json.appendHoverClick(" 8()", new ShowTextEvent("f"), new SuggestCommandEvent(cycle.getName())); + json.append(" §7- §f" + cycle.getName()); + json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(cycle.getName())); json.send((Player) sender); } else { - sender.sendMessage(" 7- f" + cycle.getName()); + sender.sendMessage(" §7- §f" + cycle.getName()); } } - sender.sendMessage("f"); + sender.sendMessage("§f"); } @Override diff --git a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleResetCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleResetCommand.java similarity index 83% rename from src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleResetCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleResetCommand.java index 9190436..8a1997d 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleResetCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleResetCommand.java @@ -18,13 +18,13 @@ public class CycleResetCommand extends SubCommand { public CycleResetCommand(CommandSender sender, String[] args) { super(sender, args); if (args.length < 3) { - MsgUtils.send(sender, "&cȷļ"); + MsgUtils.send(sender, "&c请输入正确的检查器名称"); return; } TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]); if (cycle == null) { - MsgUtils.send(sender, "&c &4" + args[2] + " &c"); + MsgUtils.send(sender, "&c检查器 &4" + args[2] + " &c不存在"); return; } @@ -33,12 +33,12 @@ public class CycleResetCommand extends SubCommand { @Override public void run() { long time = new TimeCycleInitializeEvent(cycle, System.currentTimeMillis()).call().getTimeline(); - // ʼ + // 初始化 GlobalDataManager.setVariable("timecycle:" + cycle.getName(), String.valueOf(time)); - // + // 触发器 Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle)); - // ʾ - MsgUtils.send(sender, " &f" + args[2] + " &7ʼ"); + // 提示 + MsgUtils.send(sender, "检查器 &f" + args[2] + " &7初始化完成"); } }.runTaskAsynchronously(Main.getInst()); } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleUpdateCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleUpdateCommand.java similarity index 82% rename from src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleUpdateCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleUpdateCommand.java index 48bf00b..444a362 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/cycle/CycleUpdateCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/cycle/CycleUpdateCommand.java @@ -18,13 +18,13 @@ public class CycleUpdateCommand extends SubCommand { public CycleUpdateCommand(CommandSender sender, String[] args) { super(sender, args); if (args.length < 3) { - MsgUtils.send(sender, "&cȷļ"); + MsgUtils.send(sender, "&c请输入正确的检查器名称"); return; } TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]); if (cycle == null) { - MsgUtils.send(sender, "&c &4" + args[2] + " &c"); + MsgUtils.send(sender, "&c检查器 &4" + args[2] + " &c不存在"); return; } @@ -32,12 +32,12 @@ public class CycleUpdateCommand extends SubCommand { @Override public void run() { - // + // 重置 GlobalDataManager.setVariable("timecycle:" + cycle.getName(), String.valueOf(System.currentTimeMillis())); - // + // 触发器 Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle)); - // ʾ - MsgUtils.send(sender, " &f" + args[2] + " &7Ѹ"); + // 提示 + MsgUtils.send(sender, "检查器 &f" + args[2] + " &7已更新"); } }.runTaskAsynchronously(Main.getInst()); } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/itemlist/ItemListCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/itemlist/ItemListCommand.java similarity index 94% rename from src/main/src/me/skymc/taboolib/commands/sub/itemlist/ItemListCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/itemlist/ItemListCommand.java index cd6c624..a6bd160 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/itemlist/ItemListCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/itemlist/ItemListCommand.java @@ -9,7 +9,7 @@ import me.skymc.taboolib.other.NumberUtils; /** * @author sky - * @since 201824 8:08:22 + * @since 2018年2月4日 下午8:08:22 */ public class ItemListCommand extends SubCommand { diff --git a/src/main/src/me/skymc/taboolib/commands/sub/itemlist/listener/ItemLibraryPatch.java b/src/main/java/me/skymc/taboolib/commands/sub/itemlist/listener/ItemLibraryPatch.java similarity index 90% rename from src/main/src/me/skymc/taboolib/commands/sub/itemlist/listener/ItemLibraryPatch.java rename to src/main/java/me/skymc/taboolib/commands/sub/itemlist/listener/ItemLibraryPatch.java index 46651dc..be10817 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/itemlist/listener/ItemLibraryPatch.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/itemlist/listener/ItemLibraryPatch.java @@ -22,7 +22,7 @@ import me.skymc.taboolib.inventory.ItemUtils; /** * @author sky - * @since 201824 4:35:00 + * @since 2018年2月4日 下午4:35:00 */ public class ItemLibraryPatch implements Listener { @@ -48,14 +48,14 @@ public class ItemLibraryPatch implements Listener { } /** - * Ʒ + * 打开物品库界面 * * @param player * @param page */ public static void openInventory(Player player, int page) { ItemLibraryHolder holder = new ItemLibraryHolder(page); - Inventory inventory = Bukkit.createInventory(holder, 54, "Ʒ"); + Inventory inventory = Bukkit.createInventory(holder, 54, "物品库"); LinkedHashMap map = new LinkedHashMap<>(); map.putAll(ItemUtils.getItemCachesFinal()); @@ -71,9 +71,9 @@ public class ItemLibraryPatch implements Listener { ItemStack item = map.get(name).clone(); { ItemMeta meta = item.getItemMeta(); List lore = meta.hasLore() ? meta.getLore() : new ArrayList<>(); - lore.add("f"); - lore.add("fm "); - lore.add("fк: 8" + name); + lore.add("§f"); + lore.add("§f§m "); + lore.add("§f序列号: §8" + name); meta.setLore(lore); item.setItemMeta(meta); inventory.setItem(slot, item); @@ -88,10 +88,10 @@ public class ItemLibraryPatch implements Listener { } if (page > 1) { - inventory.setItem(47, ItemUtils.setName(new ItemStack(Material.ARROW), "fһҳ")); + inventory.setItem(47, ItemUtils.setName(new ItemStack(Material.ARROW), "§f上一页")); } if (((int) Math.ceil(ItemUtils.getItemCaches().size() / 28D)) > page) { - inventory.setItem(51, ItemUtils.setName(new ItemStack(Material.ARROW), "fһҳ")); + inventory.setItem(51, ItemUtils.setName(new ItemStack(Material.ARROW), "§f下一页")); } player.openInventory(inventory); } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/shell/ShellCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/shell/ShellCommand.java similarity index 93% rename from src/main/src/me/skymc/taboolib/commands/sub/shell/ShellCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/shell/ShellCommand.java index f332b59..8e6c8b5 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/shell/ShellCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/shell/ShellCommand.java @@ -21,7 +21,7 @@ public class ShellCommand extends SubCommand { } } else { - MsgUtils.send(sender, "&4ָ"); + MsgUtils.send(sender, "&4指令错误"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/shell/ShellLoadCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/shell/ShellLoadCommand.java similarity index 78% rename from src/main/src/me/skymc/taboolib/commands/sub/shell/ShellLoadCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/shell/ShellLoadCommand.java index 5f12f4f..c66668e 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/shell/ShellLoadCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/shell/ShellLoadCommand.java @@ -13,18 +13,18 @@ public class ShellLoadCommand extends SubCommand { public ShellLoadCommand(CommandSender sender, String[] args) { super(sender, args); if (args.length < 3) { - MsgUtils.send(sender, "&cȷĽű"); + MsgUtils.send(sender, "&c请输入正确的脚本名称"); return; } File file = new File(JavaShell.getScriptFolder(), args[2].contains(".java") ? args[2] : args[2] + ".java"); if (!file.exists()) { - MsgUtils.send(sender, "&cű &4" + args[2] + "&c "); + MsgUtils.send(sender, "&c脚本 &4" + args[2] + "&c 不存在"); return; } if (JavaShell.reloadShell(args[2])) { - MsgUtils.send(sender, "ű " + args[2] + " "); + MsgUtils.send(sender, "脚本 " + args[2] + " 已载入"); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/shell/ShellUnloadCommand.java b/src/main/java/me/skymc/taboolib/commands/sub/shell/ShellUnloadCommand.java similarity index 78% rename from src/main/src/me/skymc/taboolib/commands/sub/shell/ShellUnloadCommand.java rename to src/main/java/me/skymc/taboolib/commands/sub/shell/ShellUnloadCommand.java index f65d301..3ab5338 100644 --- a/src/main/src/me/skymc/taboolib/commands/sub/shell/ShellUnloadCommand.java +++ b/src/main/java/me/skymc/taboolib/commands/sub/shell/ShellUnloadCommand.java @@ -13,18 +13,18 @@ public class ShellUnloadCommand extends SubCommand { public ShellUnloadCommand(CommandSender sender, String[] args) { super(sender, args); if (args.length < 3) { - MsgUtils.send(sender, "&cȷĽű"); + MsgUtils.send(sender, "&c请输入正确的脚本名称"); return; } File file = new File(JavaShell.getScriptFolder(), args[2].contains(".java") ? args[2] : args[2] + ".java"); if (!file.exists()) { - MsgUtils.send(sender, "&cű &4" + args[2] + "&c "); + MsgUtils.send(sender, "&c脚本 &4" + args[2] + "&c 不存在"); return; } JavaShell.unloadShell(args[2]); - MsgUtils.send(sender, "ű " + args[2] + " ж"); + MsgUtils.send(sender, "脚本 " + args[2] + " 已卸载"); } @Override diff --git a/src/main/src/me/skymc/taboolib/cooldown/CooldownPack.java b/src/main/java/me/skymc/taboolib/cooldown/CooldownPack.java similarity index 100% rename from src/main/src/me/skymc/taboolib/cooldown/CooldownPack.java rename to src/main/java/me/skymc/taboolib/cooldown/CooldownPack.java diff --git a/src/main/src/me/skymc/taboolib/cooldown/CooldownUtils.java b/src/main/java/me/skymc/taboolib/cooldown/CooldownUtils.java similarity index 77% rename from src/main/src/me/skymc/taboolib/cooldown/CooldownUtils.java rename to src/main/java/me/skymc/taboolib/cooldown/CooldownUtils.java index e0322cc..e08ac1b 100644 --- a/src/main/src/me/skymc/taboolib/cooldown/CooldownUtils.java +++ b/src/main/java/me/skymc/taboolib/cooldown/CooldownUtils.java @@ -22,20 +22,20 @@ public class CooldownUtils implements Listener { public static void register(CooldownPack pack) { packlist.put(pack.getPackName(), pack); - MsgUtils.send("עȴ: " + pack.getPackName() + ", ʱ: " + pack.getPackSeconds() + " (ע)"); + MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (匿名注册)"); } public static void register(CooldownPack pack, Plugin plugin) { pack.setPlugin(plugin.getName()); packlist.put(pack.getPackName(), pack); - MsgUtils.send("עȴ: " + pack.getPackName() + ", ʱ: " + pack.getPackSeconds() + " (" + plugin.getName() + ")"); + MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (" + plugin.getName() + ")"); } public static void unregister(String name) { packlist.remove(name); - MsgUtils.send("עȴ: " + name + " (ע)"); + MsgUtils.send("注销冷却包: " + name + " (主动注销)"); } @EventHandler @@ -53,7 +53,7 @@ public class CooldownUtils implements Listener { if (pack.getPlugin().equals(e.getPlugin().getName())) { packlist.remove(pack.getPackName()); - MsgUtils.send("עȴ: " + pack.getPackName() + " (Զע)"); + MsgUtils.send("注销冷却包: " + pack.getPackName() + " (自动注销)"); } } } diff --git a/src/main/src/me/skymc/taboolib/cooldown/seconds/CooldownPack2.java b/src/main/java/me/skymc/taboolib/cooldown/seconds/CooldownPack2.java similarity index 100% rename from src/main/src/me/skymc/taboolib/cooldown/seconds/CooldownPack2.java rename to src/main/java/me/skymc/taboolib/cooldown/seconds/CooldownPack2.java diff --git a/src/main/src/me/skymc/taboolib/cooldown/seconds/CooldownUtils2.java b/src/main/java/me/skymc/taboolib/cooldown/seconds/CooldownUtils2.java similarity index 78% rename from src/main/src/me/skymc/taboolib/cooldown/seconds/CooldownUtils2.java rename to src/main/java/me/skymc/taboolib/cooldown/seconds/CooldownUtils2.java index 2f3fd45..589aadf 100644 --- a/src/main/src/me/skymc/taboolib/cooldown/seconds/CooldownUtils2.java +++ b/src/main/java/me/skymc/taboolib/cooldown/seconds/CooldownUtils2.java @@ -25,20 +25,20 @@ public class CooldownUtils2 implements Listener { public static void register(CooldownPack2 pack) { packlist.put(pack.getPackName(), pack); -// MsgUtils.send("עȴ: " + pack.getPackName() + ", ʱ: " + pack.getPackSeconds() + " (ע)"); +// MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (匿名注册)"); } public static void register(CooldownPack2 pack, Plugin plugin) { pack.setPlugin(plugin.getName()); packlist.put(pack.getPackName(), pack); -// MsgUtils.send("עȴ: " + pack.getPackName() + ", ʱ: " + pack.getPackSeconds() + " (" + plugin.getName() + ")"); +// MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (" + plugin.getName() + ")"); } public static void unregister(String name) { packlist.remove(name); -// MsgUtils.send("עȴ: " + name + " (ע)"); +// MsgUtils.send("注销冷却包: " + name + " (主动注销)"); } @EventHandler @@ -56,7 +56,7 @@ public class CooldownUtils2 implements Listener { if (pack.getPlugin().equals(e.getPlugin().getName())) { packlist.remove(pack.getPackName()); -// MsgUtils.send("עȴ: " + pack.getPackName() + " (Զע)"); +// MsgUtils.send("注销冷却包: " + pack.getPackName() + " (自动注销)"); } } } diff --git a/src/main/src/me/skymc/taboolib/csvutils/CsvReader.java b/src/main/java/me/skymc/taboolib/csvutils/CsvReader.java similarity index 100% rename from src/main/src/me/skymc/taboolib/csvutils/CsvReader.java rename to src/main/java/me/skymc/taboolib/csvutils/CsvReader.java diff --git a/src/main/src/me/skymc/taboolib/csvutils/CsvWriter.java b/src/main/java/me/skymc/taboolib/csvutils/CsvWriter.java similarity index 100% rename from src/main/src/me/skymc/taboolib/csvutils/CsvWriter.java rename to src/main/java/me/skymc/taboolib/csvutils/CsvWriter.java diff --git a/src/main/src/me/skymc/taboolib/damage/DamageUtils.java b/src/main/java/me/skymc/taboolib/damage/DamageUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/damage/DamageUtils.java rename to src/main/java/me/skymc/taboolib/damage/DamageUtils.java diff --git a/src/main/src/me/skymc/taboolib/damage/GetDamager.java b/src/main/java/me/skymc/taboolib/damage/GetDamager.java similarity index 100% rename from src/main/src/me/skymc/taboolib/damage/GetDamager.java rename to src/main/java/me/skymc/taboolib/damage/GetDamager.java diff --git a/src/main/src/me/skymc/taboolib/damage/GetKiller.java b/src/main/java/me/skymc/taboolib/damage/GetKiller.java similarity index 100% rename from src/main/src/me/skymc/taboolib/damage/GetKiller.java rename to src/main/java/me/skymc/taboolib/damage/GetKiller.java diff --git a/src/main/src/me/skymc/taboolib/database/GlobalDataManager.java b/src/main/java/me/skymc/taboolib/database/GlobalDataManager.java similarity index 82% rename from src/main/src/me/skymc/taboolib/database/GlobalDataManager.java rename to src/main/java/me/skymc/taboolib/database/GlobalDataManager.java index 649a581..905b731 100644 --- a/src/main/src/me/skymc/taboolib/database/GlobalDataManager.java +++ b/src/main/java/me/skymc/taboolib/database/GlobalDataManager.java @@ -20,10 +20,10 @@ public class GlobalDataManager { public static FileConfiguration data = DataUtils.addPluginData("TabooLibrary-Variable.yml", null); /** - * ȡ + * 获取变量 * - * @param name - * @param defaultVariable Ĭֵ + * @param name 名称 + * @param defaultVariable 默认值 * @return */ public static String getVariable(String name, String defaultVariable) { @@ -37,10 +37,10 @@ public class GlobalDataManager { } /** - * ȡ÷ݿⴢ淽ʽ + * 获取缓存变量(该方法仅限数据库储存方式) * - * @param name - * @param defaultVariable Ĭֵ + * @param name 名称 + * @param defaultVariable 默认值 * @return */ public static String getVariableAsynchronous(String name, String defaultVariable) { @@ -54,10 +54,10 @@ public class GlobalDataManager { } /** - * ñ + * 设置变量 * - * @param name - * @param variable + * @param name 名称 + * @param variable 变量 */ public static void setVariable(String name, String variable) { if (Main.getStorageType() == StorageType.SQL) { @@ -69,7 +69,7 @@ public class GlobalDataManager { } /** - * û÷ݿⴢ淽ʽ + * 设置缓存变量(该方法仅限数据库储存方式) * * @param name * @param variable @@ -77,7 +77,7 @@ public class GlobalDataManager { public static void setVariableAsynchronous(String name, String variable) { if (Main.getStorageType() == StorageType.SQL) { SQLVariable _variable = SQLMethod.contains(name) ? SQLMethod.getSQLVariable(name).setVariable(variable == null ? "null" : variable) : SQLMethod.addSQLVariable(name, variable == null ? "null" : variable); - // + // 更新数据 SQLMethod.uploadVariable(_variable, true); } else { @@ -86,9 +86,9 @@ public class GlobalDataManager { } /** - * Ƿ + * 检查变量是否存在 * - * @param name + * @param name 名称 */ public static boolean contains(String name) { if (Main.getStorageType() == StorageType.SQL) { @@ -100,9 +100,9 @@ public class GlobalDataManager { } /** - * Ƿ񱻻棨÷ݿⴢ淽ʽ + * 检查变量是否被缓存(该方法仅限数据库储存方式) * - * @param name + * @param name 名称 * @return */ public static boolean containsAsynchronous(String name) { @@ -115,8 +115,8 @@ public class GlobalDataManager { } /** - * ʧЧı - * ÷ݿⴢʱЧ + * 清理所有失效的变量 + * 该方法仅限数据库储存时有效 */ public static void clearInvalidVariables() { if (Main.getStorageType() == StorageType.SQL) { @@ -129,7 +129,7 @@ public class GlobalDataManager { } /** - * ȡЧ + * 获取所有有效变量 * * @return */ @@ -152,7 +152,7 @@ public class GlobalDataManager { } /** - * ȡ÷ݿⴢ淽ʽ + * 获取缓存变量(该方法仅限数据库储存方式) * * @return */ @@ -172,7 +172,7 @@ public class GlobalDataManager { } /** - * ݿ + * 数据库变量 * * @author sky * @@ -208,7 +208,7 @@ public class GlobalDataManager { } /** - * ݿⷽ + * 数据库方法 * * @author sky * @@ -218,16 +218,16 @@ public class GlobalDataManager { private static ConcurrentHashMap variables = new ConcurrentHashMap<>(); /** - * ȡ + * 获取数据 * - * @param name + * @param name 名字 */ public static SQLVariable getSQLVariable(String name) { return variables.get(name); } /** - * ȡб + * 获取所有变量 * * @return */ @@ -236,10 +236,10 @@ public class GlobalDataManager { } /** - * һ + * 添加一个变量 * - * @param name - * @param value ֵ + * @param name 名字 + * @param value 值 * @return */ public static SQLVariable addSQLVariable(String name, String value) { @@ -249,9 +249,9 @@ public class GlobalDataManager { } /** - * Ƴһ + * 移除一个变量 * - * @param name + * @param name 名字 * @return */ public static SQLVariable removeSQLVariable(String name) { @@ -262,9 +262,9 @@ public class GlobalDataManager { } /** - * Ƿ + * 是否包含变量 * - * @param name + * @param name 名字 * @return */ public static boolean contains(String name) { @@ -272,9 +272,9 @@ public class GlobalDataManager { } /** - * ݿеб + * 载入数据库中的所有变量缓存 * - * @param sync Ƿ첽 + * @param sync 是否异步 */ public static void loadVariables(boolean sync) { if (Main.getStorageType() == StorageType.LOCAL) { @@ -303,9 +303,9 @@ public class GlobalDataManager { } /** - * 鵱ǰǷ + * 检查当前变量是否被其他服务器更新 * - * @param sync Ƿ첽 + * @param sync 是否异步 */ public static void checkVariable(boolean sync) { if (Main.getStorageType() == StorageType.LOCAL) { @@ -317,40 +317,40 @@ public class GlobalDataManager { @Override public void run() { /** - * лȡб - * µıḲǾɵı + * 根据正序排列获取所有变量 + * 新的变量会覆盖旧的变量 */ LinkedList> list = Main.getConnection().getValues(Main.getTablePrefix() + "_plugindata", "id", -1, false, "name", "variable", "upgrade"); - // ѭ + // 循环变量 for (HashMap value : list) { Object name = value.get("name"); try { - // + // 如果变量存在 if (variables.containsKey(name)) { - // ɱ + // 如果变量不是由本服更新 if (!value.get("upgrade").equals(variables.get(name).getUpgradeUID())) { - // ǿ + // 如果变量是空 if (value.get("variable").equals("null")) { - // ɾ + // 删除变量 variables.remove(name); } else { - // ± + // 更新变量 variables.get(name).setVariable(value.get("variable").toString()); } } } - // ص + // 如果变量存在则下载到本地 else if (!value.get("variable").equals("null")) { variables.put(value.get("name").toString(), new SQLVariable(value.get("name").toString(), value.get("variable").toString(), value.get("upgrade").toString())); } } catch (Exception e) { - // Ƴ + // 移除 variables.remove(name); - // ʾ - MsgUtils.warn("쳣: &4" + name); - MsgUtils.warn("ԭ: &4" + e.getMessage()); + // 提示 + MsgUtils.warn("变量出现异常: &4" + name); + MsgUtils.warn("原因: &4" + e.getMessage()); } } } @@ -365,9 +365,9 @@ public class GlobalDataManager { } /** - * ݿϴ + * 向数据库上传所有数据 * - * @param sync Ƿ첽 + * @param sync 是否异步 */ public static void uploadVariables(boolean sync) { if (Main.getStorageType() == StorageType.LOCAL) { @@ -380,10 +380,10 @@ public class GlobalDataManager { } /** - * ݿϴǰ + * 向数据库上传当前数据 * - * @param variable - * @param sync Ƿ첽 + * @param variable 数据 + * @param sync 是否异步 */ public static void uploadVariable(SQLVariable variable, boolean sync) { if (Main.getStorageType() == StorageType.LOCAL) { @@ -407,17 +407,17 @@ public class GlobalDataManager { } /** - * ݿⴢ淽 + * 启动数据库储存方法 * */ public static void startSQLMethod() { long time = System.currentTimeMillis(); - // + // 载入数据 loadVariables(false); - // ʾϢ - MsgUtils.send("ݿлȡ &f" + variables.size() + " &7, ʱ: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); + // 提示信息 + MsgUtils.send("从数据库中获取 &f" + variables.size() + " &7个变量, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); - // + // 检查更新 new BukkitRunnable() { @Override @@ -428,11 +428,11 @@ public class GlobalDataManager { } /** - * ݿⴢ淽 + * 结束数据库储存方法 * */ public static void cancelSQLMethod() { - // ϴ + // 上传数据 uploadVariables(false); } } diff --git a/src/main/src/me/skymc/taboolib/database/PlayerDataManager.java b/src/main/java/me/skymc/taboolib/database/PlayerDataManager.java similarity index 80% rename from src/main/src/me/skymc/taboolib/database/PlayerDataManager.java rename to src/main/java/me/skymc/taboolib/database/PlayerDataManager.java index 33eeba3..11ec5f0 100644 --- a/src/main/src/me/skymc/taboolib/database/PlayerDataManager.java +++ b/src/main/java/me/skymc/taboolib/database/PlayerDataManager.java @@ -14,7 +14,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.scheduler.BukkitRunnable; -import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; import me.skymc.taboolib.Main; import me.skymc.taboolib.Main.StorageType; @@ -33,7 +32,7 @@ public class PlayerDataManager implements Listener { } /** - * ȡû淽ʽ + * 获取用户储存方式 * * @return */ @@ -42,9 +41,9 @@ public class PlayerDataManager implements Listener { } /** - * ȡ + * 获取玩家数据 * - * @param player + * @param player 玩家 * @return * @throws PlayerOfflineException */ @@ -58,7 +57,7 @@ public class PlayerDataManager implements Listener { } /** - * ȡ + * 获取玩家数据 * * @param player * @return @@ -76,9 +75,9 @@ public class PlayerDataManager implements Listener { } /** - * ȡ + * 读取玩家数据 * - * @param username + * @param username 玩家 * @return * @throws PlayerOfflineException */ @@ -88,7 +87,7 @@ public class PlayerDataManager implements Listener { } else if (offline) { if (Main.getStorageType() == StorageType.SQL) { - throw new PlayerOfflineException("ڴģʽΪݿ»ȡ"); + throw new PlayerOfflineException("不允许在储存模式为数据库的情况下获取离线玩家数据"); } return loadPlayerData(username); } @@ -96,37 +95,37 @@ public class PlayerDataManager implements Listener { } /** - * + * 载入玩家数据 * - * @param username + * @param username 玩家 * @return */ public static FileConfiguration loadPlayerData(String username) { - // ش + // 本地储存 if (Main.getStorageType() == StorageType.LOCAL) { - // ȡļ + // 读取文件 File file = FileUtils.file(Main.getPlayerDataFolder(), username + ".yml"); - // + // 载入配置 PLAYER_DATA.put(username, YamlConfiguration.loadConfiguration(file)); } else { - // Ƿ + // 数据是否存在 if (Main.getConnection().isExists(Main.getTablePrefix() + "_playerdata", "username", username)) { - // ȡ + // 获取数据 String code = Main.getConnection().getValue(Main.getTablePrefix() + "_playerdata", "username", username, "configuration").toString(); try { - // + // 载入配置 PLAYER_DATA.put(username, ConfigUtils.decodeYAML(code)); } catch (Exception e) { - // + // 创建空数据 PLAYER_DATA.put(username, new YamlConfiguration()); - // Ϣ - MsgUtils.warn(" &4" + username + " &c쳣: &4" + e.getMessage()); + // 反馈信息 + MsgUtils.warn("玩家 &4" + username + " &c的数据载入出现异常: &4" + e.getMessage()); } } else { - // + // 创建空数据 PLAYER_DATA.put(username, new YamlConfiguration()); } } @@ -134,21 +133,21 @@ public class PlayerDataManager implements Listener { } /** - * + * 保存玩家数据 * - * @param username - * @param remove ǷƳ + * @param username 玩家 + * @param remove 是否移除缓存 */ public static void savePlayerData(String username, boolean remove) { - // û + // 没有数据 if (!PLAYER_DATA.containsKey(username)) { return; } - // ش + // 本地储存 if (Main.getStorageType() == StorageType.LOCAL) { - // ȡļ + // 读取文件 File file = FileUtils.file(Main.getPlayerDataFolder(), username + ".yml"); - // + // 保存配置 try { PLAYER_DATA.get(username).save(file); } @@ -156,19 +155,19 @@ public class PlayerDataManager implements Listener { // TODO: handle exception } } - // ݿⴢ + // 如果是数据库储存且有数据 else if (PLAYER_DATA.get(username).getConfigurationSection("").getKeys(false).size() > 0) { - // Ƿ + // 数据是否存在 if (Main.getConnection().isExists(Main.getTablePrefix() + "_playerdata", "username", username)) { - // д + // 写入数据 Main.getConnection().setValue(Main.getTablePrefix() + "_playerdata", "username", username, "configuration", ConfigUtils.encodeYAML(PLAYER_DATA.get(username))); } else { - // + // 插入数据 Main.getConnection().intoValue(Main.getTablePrefix() + "_playerdata", username, ConfigUtils.encodeYAML(PLAYER_DATA.get(username))); } } - // ȡԶӦ + // 获取这个属性对应的玩家 Player player; if (getUsernameType() == UsernameType.UUID) { player = Bukkit.getPlayer(UUID.fromString(username)); @@ -176,17 +175,17 @@ public class PlayerDataManager implements Listener { else { player = Bukkit.getPlayerExact(username); } - // Ƴ Ҳ + // 如果移除数据 或 玩家不在线 if (remove || player == null) { PLAYER_DATA.remove(username); } } /** - * ҵĻ + * 保存所有玩家的缓存 * - * @param sync Ƿ첽 - * @param remove ǷƳ + * @param sync 是否异步进行 + * @param remove 是否移除数据 */ public static void saveAllCaches(boolean sync, boolean remove) { BukkitRunnable runnable = new BukkitRunnable() { @@ -194,34 +193,34 @@ public class PlayerDataManager implements Listener { @Override public void run() { long time = System.currentTimeMillis(); - // + // 保存 for (String name : PLAYER_DATA.keySet()) { savePlayerData(name, false); } - // ʾ + // 提示 if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { - MsgUtils.send(" &f" + PLAYER_DATA.size() + " &7, ʱ: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); + MsgUtils.send("保存 &f" + PLAYER_DATA.size() + " &7条玩家数据, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); } } }; - // 첽 + // 如果异步 if (sync) { runnable.runTaskAsynchronously(Main.getInst()); } - // ͬ + // 如果同步 else { runnable.run(); } } /** - * ҵ + * 保存所有玩家的数据 * - * @param sync Ƿ첽 - * @param remove ǷƳ + * @param sync 是否异步进行 + * @param remove 是否移除数据 */ public static void saveAllPlayers(boolean sync, boolean remove) { - // + // 创建任务 BukkitRunnable runnable = new BukkitRunnable() { @Override @@ -231,11 +230,11 @@ public class PlayerDataManager implements Listener { } } }; - // 첽 + // 如果异步 if (sync) { runnable.runTaskAsynchronously(Main.getInst()); } - // ͬ + // 如果同步 else { runnable.run(); } @@ -247,9 +246,9 @@ public class PlayerDataManager implements Listener { @Override public void run() { - // + // 载入数据 loadPlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? e.getPlayer().getUniqueId().toString() : e.getPlayer().getName()); - // + // 载入完成 Bukkit.getPluginManager().callEvent(new PlayerLoadedEvent(e.getPlayer())); } }.runTaskAsynchronously(Main.getInst()); @@ -262,7 +261,7 @@ public class PlayerDataManager implements Listener { @Override public void run() { - // + // 保存数据 savePlayerData(Main.getInst().getConfig().getBoolean("ENABLE-UUID") ? e.getPlayer().getUniqueId().toString() : e.getPlayer().getName(), true); } }.runTaskAsynchronously(Main.getInst()); diff --git a/src/main/src/me/skymc/taboolib/display/ActionUtils.java b/src/main/java/me/skymc/taboolib/display/ActionUtils.java similarity index 94% rename from src/main/src/me/skymc/taboolib/display/ActionUtils.java rename to src/main/java/me/skymc/taboolib/display/ActionUtils.java index 6fc1015..218bf4c 100644 --- a/src/main/src/me/skymc/taboolib/display/ActionUtils.java +++ b/src/main/java/me/skymc/taboolib/display/ActionUtils.java @@ -5,8 +5,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import me.skymc.taboolib.TabooLib; -import me.skymc.taboolib.methods.MethodsUtils; -import net.minecraft.server.v1_12_R1.ChatMessageType; public class ActionUtils { @@ -48,7 +46,7 @@ public class ActionUtils { Object ab = getNMSClass("ChatComponentText").getConstructor(new Class[] { String.class }).newInstance(new Object[] { msg }); Constructor ac = null; Object abPacket = null; - // 汾 1.11.0 + // 如果版本大于 1.11.0 if (TabooLib.getVerint() > 11100) { Class chatMessageType = getNMSClass("ChatMessageType"); ac = getNMSClass("PacketPlayOutChat").getConstructor(getNMSClass("IChatBaseComponent"), chatMessageType); diff --git a/src/main/src/me/skymc/taboolib/display/TitleUtils.java b/src/main/java/me/skymc/taboolib/display/TitleUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/display/TitleUtils.java rename to src/main/java/me/skymc/taboolib/display/TitleUtils.java diff --git a/src/main/src/me/skymc/taboolib/economy/EcoUtils.java b/src/main/java/me/skymc/taboolib/economy/EcoUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/economy/EcoUtils.java rename to src/main/java/me/skymc/taboolib/economy/EcoUtils.java diff --git a/src/main/src/me/skymc/taboolib/enchantment/EnchantmentUtils.java b/src/main/java/me/skymc/taboolib/enchantment/EnchantmentUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/enchantment/EnchantmentUtils.java rename to src/main/java/me/skymc/taboolib/enchantment/EnchantmentUtils.java diff --git a/src/main/src/me/skymc/taboolib/entity/EntityUtils.java b/src/main/java/me/skymc/taboolib/entity/EntityUtils.java similarity index 97% rename from src/main/src/me/skymc/taboolib/entity/EntityUtils.java rename to src/main/java/me/skymc/taboolib/entity/EntityUtils.java index 15c99ac..b1c5ff0 100644 --- a/src/main/src/me/skymc/taboolib/entity/EntityUtils.java +++ b/src/main/java/me/skymc/taboolib/entity/EntityUtils.java @@ -48,7 +48,7 @@ public class EntityUtils implements Listener{ } /** - * ﷢⣨ProcotolLib + * 设置生物发光(ProcotolLib) * * @param player * @param entity @@ -69,7 +69,7 @@ public class EntityUtils implements Listener{ } /** - * ȡ﷢⣨ProcotolLib + * 取消生物发光(ProcotolLib) * * @param player * @param entity diff --git a/src/main/src/me/skymc/taboolib/events/CustomBookOpenEvent.java b/src/main/java/me/skymc/taboolib/events/CustomBookOpenEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/events/CustomBookOpenEvent.java rename to src/main/java/me/skymc/taboolib/events/CustomBookOpenEvent.java diff --git a/src/main/src/me/skymc/taboolib/events/DefaultEvent.java b/src/main/java/me/skymc/taboolib/events/DefaultEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/events/DefaultEvent.java rename to src/main/java/me/skymc/taboolib/events/DefaultEvent.java diff --git a/src/main/src/me/skymc/taboolib/events/DefaultEvent2.java b/src/main/java/me/skymc/taboolib/events/DefaultEvent2.java similarity index 100% rename from src/main/src/me/skymc/taboolib/events/DefaultEvent2.java rename to src/main/java/me/skymc/taboolib/events/DefaultEvent2.java diff --git a/src/main/src/me/skymc/taboolib/events/PlayerJumpEvent.java b/src/main/java/me/skymc/taboolib/events/PlayerJumpEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/events/PlayerJumpEvent.java rename to src/main/java/me/skymc/taboolib/events/PlayerJumpEvent.java diff --git a/src/main/src/me/skymc/taboolib/events/PlayerLoadedEvent.java b/src/main/java/me/skymc/taboolib/events/PlayerLoadedEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/events/PlayerLoadedEvent.java rename to src/main/java/me/skymc/taboolib/events/PlayerLoadedEvent.java diff --git a/src/main/src/me/skymc/taboolib/exception/PlayerOfflineException.java b/src/main/java/me/skymc/taboolib/exception/PlayerOfflineException.java similarity index 100% rename from src/main/src/me/skymc/taboolib/exception/PlayerOfflineException.java rename to src/main/java/me/skymc/taboolib/exception/PlayerOfflineException.java diff --git a/src/main/src/me/skymc/taboolib/fileutils/ConfigUtils.java b/src/main/java/me/skymc/taboolib/fileutils/ConfigUtils.java similarity index 84% rename from src/main/src/me/skymc/taboolib/fileutils/ConfigUtils.java rename to src/main/java/me/skymc/taboolib/fileutils/ConfigUtils.java index b710be8..9da4e34 100644 --- a/src/main/src/me/skymc/taboolib/fileutils/ConfigUtils.java +++ b/src/main/java/me/skymc/taboolib/fileutils/ConfigUtils.java @@ -28,10 +28,10 @@ public class ConfigUtils { } /** - * UTF-8 ĸʽͷļ + * 以 UTF-8 的格式释放配置文件并载入 * - * ¼ʱ䣺201821021:28:30 - * ¼汾3.49 + * 录入时间:2018年2月10日21:28:30 + * 录入版本:3.49 * * @param plugin * @return @@ -45,7 +45,7 @@ public class ConfigUtils { } /** - * UTF-8 ĸʽļ + * 以 UTF-8 的格式载入配置文件 * * @param main * @param filename @@ -56,9 +56,9 @@ public class ConfigUtils { try { yaml = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(file), Charsets.UTF_8)); } catch (FileNotFoundException e) { - MsgUtils.warn("ļʧ!"); - MsgUtils.warn(": &4" + plugin.getName()); - MsgUtils.warn("ļ: &4" + file.getName()); + MsgUtils.warn("配置文件载入失败!"); + MsgUtils.warn("插件: &4" + plugin.getName()); + MsgUtils.warn("文件: &4" + file.getName()); } return yaml; } diff --git a/src/main/src/me/skymc/taboolib/fileutils/CopyUtils.java b/src/main/java/me/skymc/taboolib/fileutils/CopyUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/fileutils/CopyUtils.java rename to src/main/java/me/skymc/taboolib/fileutils/CopyUtils.java diff --git a/src/main/src/me/skymc/taboolib/fileutils/EncodeUtils.java b/src/main/java/me/skymc/taboolib/fileutils/EncodeUtils.java similarity index 69% rename from src/main/src/me/skymc/taboolib/fileutils/EncodeUtils.java rename to src/main/java/me/skymc/taboolib/fileutils/EncodeUtils.java index 1c0e11b..96a2533 100644 --- a/src/main/src/me/skymc/taboolib/fileutils/EncodeUtils.java +++ b/src/main/java/me/skymc/taboolib/fileutils/EncodeUtils.java @@ -14,11 +14,11 @@ import java.nio.charset.UnsupportedCharsetException; public class EncodeUtils { /** - * ָļĿ¼תָı + * 把指定文件或目录转换成指定的编码 * - * @param fileName Ҫתļ - * @param fromCharsetName Դļı - * @param toCharsetName Ҫתı + * @param fileName 要转换的文件 + * @param fromCharsetName 源文件的编码 + * @param toCharsetName 要转换的编码 * @throws Exception */ public static void convert(String fileName, String fromCharsetName, String toCharsetName) throws Exception { @@ -26,11 +26,11 @@ public class EncodeUtils { } /** - * ָļĿ¼תָı + * 把指定文件或目录转换成指定的编码 * - * @param file ҪתļĿ¼ - * @param fromCharsetName Դļı - * @param toCharsetName Ҫתı + * @param file 要转换的文件或目录 + * @param fromCharsetName 源文件的编码 + * @param toCharsetName 要转换的编码 * @throws Exception */ public static void convert(File file, String fromCharsetName, String toCharsetName) throws Exception { @@ -38,12 +38,12 @@ public class EncodeUtils { } /** - * ָļĿ¼תָı + * 把指定文件或目录转换成指定的编码 * - * @param file ҪתļĿ¼ - * @param fromCharsetName Դļı - * @param toCharsetName תı - * @param filter ļ + * @param file 要转换的文件或目录 + * @param fromCharsetName 源文件的编码 + * @param toCharsetName 转换的编码 + * @param filter 文件名过滤器 * @throws Exception */ public static void convert(String fileName, String fromCharsetName, String toCharsetName, FilenameFilter filter) throws Exception { @@ -51,12 +51,12 @@ public class EncodeUtils { } /** - * ָļĿ¼תָı + * 把指定文件或目录转换成指定的编码 * - * @param file ҪתļĿ¼ - * @param fromCharsetName Դļı - * @param toCharsetName Ҫתı - * @param filter ļ + * @param file 要转换的文件或目录 + * @param fromCharsetName 源文件的编码 + * @param toCharsetName 要转换的编码 + * @param filter 文件名过滤器 * @throws Exception */ public static void convert(File file, String fromCharsetName, String toCharsetName, FilenameFilter filter) throws Exception { @@ -81,10 +81,10 @@ public class EncodeUtils { } /** - * ָ뷽ʽȡļļ + * 以指定编码方式读取文件,返回文件内容 * - * @param file Ҫתļ - * @param fromCharsetName Դļı + * @param file 要转换的文件 + * @param fromCharsetName 源文件的编码 * @return * @throws Exception */ @@ -103,11 +103,11 @@ public class EncodeUtils { } /** - * ָ뷽ʽдıļڻḲ + * 以指定编码方式写文本文件,存在会覆盖 * - * @param file Ҫдļ - * @param toCharsetName Ҫתı - * @param content ļ + * @param file 要写入的文件 + * @param toCharsetName 要转换的编码 + * @param content 文件内容 * @throws Exception */ public static void saveFile2Charset(File file, String toCharsetName, String content) throws Exception { @@ -119,6 +119,6 @@ public class EncodeUtils { outWrite.write(content); outWrite.close(); - System.out.println("[Encodeing...] ļ: " + file.getPath()); + System.out.println("[Encodeing...] 更改文件: " + file.getPath()); } } diff --git a/src/main/src/me/skymc/taboolib/fileutils/FileUtils.java b/src/main/java/me/skymc/taboolib/fileutils/FileUtils.java similarity index 88% rename from src/main/src/me/skymc/taboolib/fileutils/FileUtils.java rename to src/main/java/me/skymc/taboolib/fileutils/FileUtils.java index 7f1c17b..f8745a2 100644 --- a/src/main/src/me/skymc/taboolib/fileutils/FileUtils.java +++ b/src/main/java/me/skymc/taboolib/fileutils/FileUtils.java @@ -4,16 +4,9 @@ import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; -import java.text.DecimalFormat; import java.util.List; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; - -import me.skymc.taboolib.client.LogClient; import me.skymc.taboolib.message.MsgUtils; -import me.skymc.taboolib.methods.MethodsUtils; public class FileUtils { @@ -79,7 +72,7 @@ public class FileUtils { bos.close(); return new String(bos.toByteArray(), encode); } catch (IOException e) { - MsgUtils.warn("ȡ: &4" + e.getMessage()); + MsgUtils.warn("输入流读取出错: &4" + e.getMessage()); } return null; } @@ -102,7 +95,7 @@ public class FileUtils { fin.close(); return new String(bos.toByteArray(), encode); } catch (IOException e) { - MsgUtils.warn("ļȡ: &4" + e.getMessage()); + MsgUtils.warn("文件读取出错: &4" + e.getMessage()); } return null; } @@ -124,7 +117,7 @@ public class FileUtils { bin.close(); return new String(bos.toByteArray(), conn.getContentEncoding() == null ? "UTF-8" : conn.getContentEncoding()); } catch (IOException e) { - MsgUtils.warn("ʳ: &4" + e.getMessage()); + MsgUtils.warn("网络访问出错: &4" + e.getMessage()); } return null; } @@ -161,29 +154,29 @@ public class FileUtils { URL url = new URL(urlStr); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - // ʱʱ + // 超时时间 conn.setConnectTimeout(5 * 1000); - // ֹγץȡ 403 + // 防止屏蔽程序抓取而返回 403 错误 conn.setRequestProperty("User-Agent", "Mozilla/31.0 (compatible; MSIE 10.0; Windows NT; DigExt)"); - // õ + // 得到输入流 InputStream inputStream = conn.getInputStream(); - // ȡ + // 获取数组 byte[] data = read(inputStream); - // ļ + // 创建文件夹 if (!saveDir.exists()) { saveDir.mkdirs(); } - // ļ + // 保存文件 File file = new File(saveDir, filename); FileOutputStream fos = new FileOutputStream(file); - // дļ + // 写入文件 fos.write(data); - // + // 结束 fos.close(); inputStream.close(); } diff --git a/src/main/src/me/skymc/taboolib/fileutils/LogUtils.java b/src/main/java/me/skymc/taboolib/fileutils/LogUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/fileutils/LogUtils.java rename to src/main/java/me/skymc/taboolib/fileutils/LogUtils.java diff --git a/src/main/src/me/skymc/taboolib/inventory/DropUtils.java b/src/main/java/me/skymc/taboolib/inventory/DropUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/inventory/DropUtils.java rename to src/main/java/me/skymc/taboolib/inventory/DropUtils.java diff --git a/src/main/src/me/skymc/taboolib/inventory/InventoryUtil.java b/src/main/java/me/skymc/taboolib/inventory/InventoryUtil.java similarity index 84% rename from src/main/src/me/skymc/taboolib/inventory/InventoryUtil.java rename to src/main/java/me/skymc/taboolib/inventory/InventoryUtil.java index 928af9b..f6b83d9 100644 --- a/src/main/src/me/skymc/taboolib/inventory/InventoryUtil.java +++ b/src/main/java/me/skymc/taboolib/inventory/InventoryUtil.java @@ -25,10 +25,10 @@ public class InventoryUtil { } /** - * 鱳Ƿпλ + * 检查背包是否有空位 * - * @param p - * @param i ʼλ + * @param p 玩家 + * @param i 起始位置 */ public static boolean isEmpty(Player p, int i) { while (i < 35) { @@ -41,12 +41,12 @@ public class InventoryUtil { } /** - * ǷָƷ + * 检测玩家是否有指定物品 * - * @param player - * @param item Ʒ - * @param amount - * @param remove Ƿɾ + * @param player 玩家 + * @param item 物品 + * @param amount 数量 + * @param remove 是否删除 */ public static boolean hasItem(Player player, ItemStack item, int amount, boolean remove) { int hasAmount = 0; @@ -63,24 +63,24 @@ public class InventoryUtil { ItemStack _item = player.getInventory().getItem(i); if (_item != null && _item.isSimilar(item)) { /** - * ѭƷ С Ҫ - * ɾƷҪ + * 如果循环到的物品数量 小于 需要的数量 + * 则 删除物品,减少需要的数量 */ if (_item.getAmount() < requireAmount) { player.getInventory().setItem(i, null); requireAmount -= _item.getAmount(); } /** - * ѭƷ Ҫ - * ɾƷֱӽ + * 如果循环到的物品数量 等于 需要的数量 + * 则 删除物品,直接结束 */ else if (_item.getAmount() == requireAmount) { player.getInventory().setItem(i, null); return true; } /** - * ѭƷ Ҫ - * ۳ Ҫ + * 如果循环到的物品数量 大于 需要的数量 + * 则扣除 需要的数量 */ else { _item.setAmount(_item.getAmount() - requireAmount); diff --git a/src/main/src/me/skymc/taboolib/inventory/ItemUtils.java b/src/main/java/me/skymc/taboolib/inventory/ItemUtils.java similarity index 86% rename from src/main/src/me/skymc/taboolib/inventory/ItemUtils.java rename to src/main/java/me/skymc/taboolib/inventory/ItemUtils.java index 3e304d2..ea6a50a 100644 --- a/src/main/src/me/skymc/taboolib/inventory/ItemUtils.java +++ b/src/main/java/me/skymc/taboolib/inventory/ItemUtils.java @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; - import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Material; @@ -25,14 +24,9 @@ import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitRunnable; - -import com.google.common.base.Charsets; import lombok.Getter; import me.clip.placeholderapi.PlaceholderAPI; -import me.skymc.taboocode.TabooCodeItem; -import me.skymc.taboocode4.manager.ItemManager; import me.skymc.taboolib.Main; import me.skymc.taboolib.TabooLib; import me.skymc.taboolib.fileutils.ConfigUtils; @@ -65,20 +59,20 @@ public class ItemUtils { private static LinkedHashMap itemCachesFinal = new LinkedHashMap<>(); /** - * ȡƷ - * ˳ - * 1. ̶Ʒ - * 2. ̬Ʒ + * 获取物品缓存 + * 检测顺序: + * 1. 固定物品库 + * 2. 动态物品库 * - * @param name Ʒ + * @param name 物品名称 * @return */ public static ItemStack getCacheItem(String name) { - // ̶ƷǷڸƷ + // 检测固定物品库是否存在该物品 if (itemCachesFinal.containsKey(name)) { return itemCachesFinal.get(name); } - // ض̬Ʒ + // 返回动态物品库 return itemCaches.get(name); } @@ -96,7 +90,7 @@ public class ItemUtils { FileConfiguration conf = ConfigUtils.load(Main.getInst(), file); for (String name : conf.getConfigurationSection("").getKeys(false)) { if (isExists(name)) { - MsgUtils.warn("޷Ʒ &4" + name + "&c, ΪѾ"); + MsgUtils.warn("无法载入载入物品 &4" + name + "&c, 因为它已经存在了"); } else if (finalFile) { itemCachesFinal.put(name, loadItem(conf, name)); } else { @@ -109,16 +103,16 @@ public class ItemUtils { itemCaches.clear(); itemCachesFinal.clear(); loadItemsFile(getItemCacheFile(), false); - // ̶Ʒ + // 创建固定物品库 finalItemsFolder = new File(Main.getInst().getDataFolder(), "FinalItems"); if (!finalItemsFolder.exists()) { finalItemsFolder.mkdir(); } - // ̶ƷеƷ + // 检查固定物品库中的物品 for (File file : finalItemsFolder.listFiles()) { loadItemsFile(file, true); } - MsgUtils.send(" " + (itemCaches.size() + itemCachesFinal.size()) + " Ʒ"); + MsgUtils.send("载入 " + (itemCaches.size() + itemCachesFinal.size()) + " 项缓存物品"); } public static void reloadItemName() { @@ -127,7 +121,7 @@ public class ItemUtils { for (String a : conf.getConfigurationSection("").getKeys(false)) { itemlib.put(a, conf.getString(a)); } - MsgUtils.send(" " + itemlib.size() + " Ʒ"); + MsgUtils.send("载入 " + itemlib.size() + " 项物品名称"); } public static File getItemCacheFile() { @@ -140,7 +134,7 @@ public class ItemUtils { public static String getCustomName(ItemStack item) { if (item == null || item.getType().equals(Material.AIR)) { - return ""; + return "空"; } int data = item.getType().getMaxDurability() == 0 ? item.getDurability() : 0; return item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName() : itemlib.get(item.getType() + ":" + data) == null ? item.getType().toString() : itemlib.get(item.getType() + ":" + data); @@ -148,17 +142,10 @@ public class ItemUtils { @SuppressWarnings("deprecation") public static ItemStack getItemFromDir(String name) { - ItemStack item = new ItemStack(Material.STONE); - if (Bukkit.getPluginManager().getPlugin("TabooCode").isEnabled()) { - item = TabooCodeItem.getItem(name, true); + if (itemdir != null) { + return itemdir.getItemStack("item." + name); } - else if (Bukkit.getPluginManager().getPlugin("TabooCode4").isEnabled()) { - item = ItemManager.getFinishItem(name); - } - if (item == null && itemdir != null) { - item = itemdir.getItemStack("item." + name); - } - return item; + return null; } @SuppressWarnings("deprecation") @@ -208,9 +195,9 @@ public class ItemUtils { public static String asString(String args, Player placeholderPlayer) { if (placeholderPlayer == null) { - return args.replace("&", ""); + return args.replace("&", "§"); } - return PlaceholderAPI.setPlaceholders(placeholderPlayer, args.replace("&", "")); + return PlaceholderAPI.setPlaceholders(placeholderPlayer, args.replace("&", "§")); } public static List asString(List args, Player placeholderPlayer) { @@ -297,10 +284,10 @@ public class ItemUtils { } /** - * + * 包含介绍 * - * @param i Ʒ - * @param a ؼ + * @param i 物品 + * @param a 关键字 */ public static boolean hasLore(ItemStack i, String a) { if (!isLored(i) || !i.getItemMeta().getLore().toString().contains(a)) { @@ -310,7 +297,7 @@ public class ItemUtils { } /** - * + * 如果已描述 * * @param i * @return @@ -323,7 +310,7 @@ public class ItemUtils { } /** - * + * 如果已命名 * * @param i * @return @@ -336,26 +323,26 @@ public class ItemUtils { } /** - * + * 添加描述 * - * @param is Ʒ - * @param lore + * @param is 物品 + * @param lore 描述 */ public static ItemStack addLore(ItemStack is, String lore) { ItemMeta meta = is.getItemMeta(); List _lore = meta.hasLore() ? meta.getLore() : new ArrayList<>(); - _lore.add(lore.replaceAll("&", "")); + _lore.add(lore.replaceAll("&", "§")); is.setItemMeta(meta); return is; } /** - * Ƴ + * 移除描述 * - * @param is Ʒ - * @param line + * @param is 物品 + * @param line 行数 */ public static ItemStack delLore(ItemStack is, int line) { ItemMeta meta = is.getItemMeta(); @@ -371,10 +358,10 @@ public class ItemUtils { } /** - * ȡ + * 获取介绍所在行数 * - * @param i Ʒ - * @param a ؼ + * @param i 物品 + * @param a 关键字 */ public static int getLore(ItemStack i, String a) { if (isLored(i)) { @@ -388,10 +375,10 @@ public class ItemUtils { } /** - * ; + * 添加耐久 * - * @param i Ʒ - * @param d ; + * @param i 物品 + * @param d 耐久 */ public static ItemStack addDurability(ItemStack i, int d) { i.setDurability((short) (i.getDurability() + d)); @@ -404,11 +391,11 @@ public class ItemUtils { } /** - * 滻 + * 替换描述 * - * @param i Ʒ - * @param l1 ؼ1 - * @param l2 ؼ2 + * @param i 物品 + * @param l1 关键字1 + * @param l2 关键字2 */ public static ItemStack repalceLore(ItemStack i, String l1, String l2) { if (!isLored(i)) { @@ -438,23 +425,23 @@ public class ItemUtils { if (section.get("bukkit") instanceof ItemStack) { return section.getItemStack("bukkit"); } - // + // 材质 ItemStack item = new ItemStack(asMaterial(section.get("material").toString())); - // + // 数量 item.setAmount(section.contains("amount") ? section.getInt("amount") : 1); - // ; + // 耐久 item.setDurability((short) section.getInt("data")); - // Ԫ + // 元数据 ItemMeta meta = item.getItemMeta(); - // չʾ + // 展示名 if (section.contains("name")) { meta.setDisplayName(asString(section.getString("name"), papiPlayer)); } - // + // 描述 if (section.contains("lore")) { meta.setLore(asString(section.getStringList("lore"), papiPlayer)); } - // ħ + // 附魔 if (section.contains("enchants")) { for (String preEnchant : section.getConfigurationSection("enchants").getKeys(false)) { Enchantment enchant = asEnchantment(preEnchant); @@ -462,12 +449,12 @@ public class ItemUtils { meta.addEnchant(enchant, section.getInt("enchants." + preEnchant), true); } else { - MsgUtils.warn("&8" + preEnchant + " &cһЧĸħ"); - MsgUtils.warn("&c &4/taboolib enchants&c 鿴иħ"); + MsgUtils.warn("&8" + preEnchant + " &c不是一个有效的附魔名称"); + MsgUtils.warn("&c输入 &4/taboolib enchants&c 查看所有附魔"); } } } - // ǩ + // 标签 if (section.contains("flags") && TabooLib.getVerint() > 10700) { for (String preFlag : section.getStringList("flags")) { ItemFlag flag = asItemFlag(preFlag); @@ -475,16 +462,16 @@ public class ItemUtils { meta.addItemFlags(flag); } else { - MsgUtils.warn("&8" + preFlag + " &cһЧıǩ"); - MsgUtils.warn("&c &4/taboolib flags&c 鿴бǩ"); + MsgUtils.warn("&8" + preFlag + " &c不是一个有效的标签名称"); + MsgUtils.warn("&c输入 &4/taboolib flags&c 查看所有标签"); } } } - // Ƥ + // 皮革 if (meta instanceof LeatherArmorMeta && section.contains("color")) { ((LeatherArmorMeta) meta).setColor(asColor(section.getString("color"))); } - // ҩˮ + // 药水 if (meta instanceof PotionMeta && section.contains("potions")) { PotionMeta potionMeta = (PotionMeta) meta; for (String prePotionName : section.getConfigurationSection("potions").getKeys(false)) { @@ -496,16 +483,16 @@ public class ItemUtils { NumberUtils.getInteger(section.getString("potions." + prePotionName).split("-")[1]) - 1), true); } else { - MsgUtils.warn("&8" + potionEffectType + " &cһЧҩˮ"); - MsgUtils.warn("&c &4/taboolib potions&c 鿴ҩˮ"); + MsgUtils.warn("&8" + potionEffectType + " &c不是一个有效的药水名称"); + MsgUtils.warn("&c输入 &4/taboolib potions&c 查看所有药水"); } } } - // Ԫ + // 元数据 item.setItemMeta(meta); - // + // 数据 NBTItem nbt = new NBTItem(item); - // Ʒǩ + // 物品标签 if (section.contains("nbt")) { for (String name : section.getConfigurationSection("nbt").getKeys(false)) { Object obj = section.get("nbt." + name); @@ -526,7 +513,7 @@ public class ItemUtils { } } } - // Ʒ + // 物品属性 if (section.contains("attributes")) { NBTList attr = nbt.getList("AttributeModifiers", NBTType.NBTTagCompound); for (String hand : section.getConfigurationSection("attributes").getKeys(false)) { @@ -552,12 +539,12 @@ public class ItemUtils { } } catch (Exception e) { - MsgUtils.warn("&8" + name + " &cʧ: &8" + e.getMessage()); + MsgUtils.warn("&8" + name + " &c属性载入失败: &8" + e.getMessage()); } } else { - MsgUtils.warn("&8" + name + " &cһЧ"); - MsgUtils.warn("&c &4/taboolib attributes&c 鿴"); + MsgUtils.warn("&8" + name + " &c不是一个有效的属性名称"); + MsgUtils.warn("&c输入 &4/taboolib attributes&c 查看所有属性"); } } } @@ -596,12 +583,12 @@ public class ItemUtils { } } catch (Exception e) { - MsgUtils.warn("&8" + name + " &cʧ: &8" + e.getMessage()); + MsgUtils.warn("&8" + name + " &c属性载入失败: &8" + e.getMessage()); } } else { - MsgUtils.warn("&8" + name + " &cһЧ"); - MsgUtils.warn("&c &4/taboolib attributes&c 鿴"); + MsgUtils.warn("&8" + name + " &c不是一个有效的属性名称"); + MsgUtils.warn("&c输入 &4/taboolib attributes&c 查看所有属性"); } return nbt; } diff --git a/src/main/src/me/skymc/taboolib/inventory/speciaitem/AbstractSpecialItem.java b/src/main/java/me/skymc/taboolib/inventory/speciaitem/AbstractSpecialItem.java similarity index 70% rename from src/main/src/me/skymc/taboolib/inventory/speciaitem/AbstractSpecialItem.java rename to src/main/java/me/skymc/taboolib/inventory/speciaitem/AbstractSpecialItem.java index 6099af0..5ec1abe 100644 --- a/src/main/src/me/skymc/taboolib/inventory/speciaitem/AbstractSpecialItem.java +++ b/src/main/java/me/skymc/taboolib/inventory/speciaitem/AbstractSpecialItem.java @@ -6,40 +6,40 @@ import org.bukkit.plugin.Plugin; /** * @author sky - * @since 2018217 8:35:42 + * @since 2018年2月17日 下午8:35:42 */ public abstract interface AbstractSpecialItem { /** - * ӿڱ + * 当接口被载入 */ default void onEnable() {} /** - * ӿڱж + * 当接口被卸载 */ default void onDisable() {} /** - * ȡʶ + * 获取识别名称 * * @return String */ abstract String getName(); /** - * ȡ + * 获取载入插件 * * @return {@link Plugin} */ abstract Plugin getPlugin(); /** - * Ƿе¼ + * 是否进行点击事件 * - * @param player - * @param currentItem Ʒ - * @param cursorItem Ʒ + * @param player 玩家 + * @param currentItem 点击物品 + * @param cursorItem 持有物品 * @return {@link SpecialItemResult[]} */ abstract SpecialItemResult[] isCorrectClick(Player player, ItemStack currentItem, ItemStack cursorItem); diff --git a/src/main/src/me/skymc/taboolib/inventory/speciaitem/SpecialItem.java b/src/main/java/me/skymc/taboolib/inventory/speciaitem/SpecialItem.java similarity index 88% rename from src/main/src/me/skymc/taboolib/inventory/speciaitem/SpecialItem.java rename to src/main/java/me/skymc/taboolib/inventory/speciaitem/SpecialItem.java index 575a78f..55bd7bd 100644 --- a/src/main/src/me/skymc/taboolib/inventory/speciaitem/SpecialItem.java +++ b/src/main/java/me/skymc/taboolib/inventory/speciaitem/SpecialItem.java @@ -19,7 +19,7 @@ import me.skymc.taboolib.message.MsgUtils; /** * @author sky - * @since 2018217 8:34:12 + * @since 2018年2月17日 下午8:34:12 */ public class SpecialItem implements Listener { @@ -31,14 +31,14 @@ public class SpecialItem implements Listener { private boolean isLoaded; /** - * 췽 + * 构造方法 */ private SpecialItem() { } /** - * ȡ߶ + * 获取工具对象 * * @return {@link SpecialItem} */ @@ -47,7 +47,7 @@ public class SpecialItem implements Listener { synchronized (SpecialItem.class) { if (specialItem == null) { specialItem = new SpecialItem(); - // ע + // 注册监听器 Bukkit.getPluginManager().registerEvents(specialItem, Main.getInst()); } } @@ -56,13 +56,13 @@ public class SpecialItem implements Listener { } /** - * עӿ + * 注册接口 * - * @param item ӿڶ + * @param item 接口对象 */ public void register(AbstractSpecialItem item) { if (contains(item.getName())) { - MsgUtils.warn("ƷӿѴ, &4" + item.getName() + " &cǷظ"); + MsgUtils.warn("特殊物品接口已存在, 检查名称 &4" + item.getName() + " &c是否重复"); } else { ITEM_DATA.add(item); @@ -73,9 +73,9 @@ public class SpecialItem implements Listener { } /** - * עӿ + * 注销接口 * - * @param name ע + * @param name 注册名称 */ public void cancel(String name) { for (AbstractSpecialItem specialitem : ITEM_DATA) { @@ -87,9 +87,9 @@ public class SpecialItem implements Listener { } /** - * עӿ + * 注销接口 * - * @param plugin ע + * @param plugin 注册插件 */ public void cancel(Plugin plugin) { for (AbstractSpecialItem specialitem : ITEM_DATA) { @@ -101,9 +101,9 @@ public class SpecialItem implements Listener { } /** - * жǷ + * 判断名称是否存在 * - * @param name ע + * @param name 注册名称 * @return boolean */ public boolean contains(String name) { @@ -116,7 +116,7 @@ public class SpecialItem implements Listener { } /** - * עӿ + * 载入所有已注册接口 */ public void loadItems() { ITEM_DATA.forEach(x -> x.onEnable()); @@ -124,7 +124,7 @@ public class SpecialItem implements Listener { } /** - * עעӿ + * 注销所有已注册接口 */ public void unloadItems() { ITEM_DATA.forEach(x -> x.onDisable()); diff --git a/src/main/src/me/skymc/taboolib/inventory/speciaitem/SpecialItemResult.java b/src/main/java/me/skymc/taboolib/inventory/speciaitem/SpecialItemResult.java similarity index 61% rename from src/main/src/me/skymc/taboolib/inventory/speciaitem/SpecialItemResult.java rename to src/main/java/me/skymc/taboolib/inventory/speciaitem/SpecialItemResult.java index d292934..7515522 100644 --- a/src/main/src/me/skymc/taboolib/inventory/speciaitem/SpecialItemResult.java +++ b/src/main/java/me/skymc/taboolib/inventory/speciaitem/SpecialItemResult.java @@ -2,37 +2,37 @@ package me.skymc.taboolib.inventory.speciaitem; /** * @author sky - * @since 2018217 8:55:36 + * @since 2018年2月17日 下午8:55:36 */ public enum SpecialItemResult { /** - * ֹͣӿڼ + * 停止接口检测 */ BREAK, /** - * ȡ¼ + * 取消点击事件 */ CANCEL, /** - * ƳƷ + * 移除点击物品 */ REMOVE_ITEM_CURRENT, /** - * ƳƷ + * 移除鼠标物品 */ REMOVE_ITEM_CURSOR, /** - * ƳһƷ + * 移除一个点击物品 */ REMOVE_ITEM_CURRENT_AMOUNT_1, /** - * ƳһƷ + * 移除一个鼠标物品 */ REMOVE_ITEM_CURSOR_AMOUNT_1; diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTCompound.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTCompound.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTCompound.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTCompound.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTContainer.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTContainer.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTContainer.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTContainer.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTEntity.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTEntity.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTEntity.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTEntity.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTFile.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTFile.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTFile.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTFile.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTItem.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTItem.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTItem.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTItem.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTList.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTList.java similarity index 88% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTList.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTList.java index 0df2dbe..b75d74e 100644 --- a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTList.java +++ b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTList.java @@ -37,7 +37,7 @@ public class NBTList { method.invoke(listObject, compound); return new NBTListCompound(this, compound); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -52,7 +52,7 @@ public class NBTList { Object compound = method.invoke(listObject, id); return new NBTListCompound(this, compound); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -66,7 +66,7 @@ public class NBTList { Method method = listObject.getClass().getMethod("getString", int.class); return (String) method.invoke(listObject, i); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -82,7 +82,7 @@ public class NBTList { method.invoke(listObject, NBTReflectionUtil.getNBTTagString().getConstructor(String.class).newInstance(s)); save(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -97,7 +97,7 @@ public class NBTList { method.invoke(listObject, i, NBTReflectionUtil.getNBTTagString().getConstructor(String.class).newInstance(s)); save(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -107,7 +107,7 @@ public class NBTList { method.invoke(listObject, i); save(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -116,7 +116,7 @@ public class NBTList { Method method = listObject.getClass().getMethod("size"); return (int) method.invoke(listObject); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return -1; } diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTListCompound.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTListCompound.java similarity index 78% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTListCompound.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTListCompound.java index 062c1e1..f2386a4 100644 --- a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTListCompound.java +++ b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTListCompound.java @@ -24,7 +24,7 @@ public class NBTListCompound { compound.getClass().getMethod("setString", String.class, String.class).invoke(compound, key, value); owner.save(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -33,7 +33,7 @@ public class NBTListCompound { compound.getClass().getMethod("setInt", String.class, int.class).invoke(compound, key, value); owner.save(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -41,7 +41,7 @@ public class NBTListCompound { try { return (int) compound.getClass().getMethod("getInt", String.class).invoke(compound, value); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return 0; } @@ -51,7 +51,7 @@ public class NBTListCompound { compound.getClass().getMethod("setDouble", String.class, double.class).invoke(compound, key, value); owner.save(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -59,7 +59,7 @@ public class NBTListCompound { try { return (double) compound.getClass().getMethod("getDouble", String.class).invoke(compound, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return 0; } @@ -69,7 +69,7 @@ public class NBTListCompound { try { return (String) compound.getClass().getMethod("getString", String.class).invoke(compound, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return ""; } @@ -78,7 +78,7 @@ public class NBTListCompound { try { return (boolean) compound.getClass().getMethod("hasKey", String.class).invoke(compound, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return false; } @@ -88,7 +88,7 @@ public class NBTListCompound { try { return (Set) compound.getClass().getMethod("c").invoke(compound); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return new HashSet<>(); } @@ -97,7 +97,7 @@ public class NBTListCompound { try { compound.getClass().getMethod("remove", String.class).invoke(compound, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTReflectionUtil.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTReflectionUtil.java similarity index 87% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTReflectionUtil.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTReflectionUtil.java index fb41dae..6724bbc 100644 --- a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTReflectionUtil.java +++ b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTReflectionUtil.java @@ -30,7 +30,7 @@ public class NBTReflectionUtil { Class clazz = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack"); return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -41,7 +41,7 @@ public class NBTReflectionUtil { Class clazz = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftEntity"); return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -52,7 +52,7 @@ public class NBTReflectionUtil { Class clazz = Class.forName("net.minecraft.server." + version + ".NBTBase"); return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -64,7 +64,7 @@ public class NBTReflectionUtil { return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -76,7 +76,7 @@ public class NBTReflectionUtil { return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -88,7 +88,7 @@ public class NBTReflectionUtil { return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -100,7 +100,7 @@ public class NBTReflectionUtil { return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -112,7 +112,7 @@ public class NBTReflectionUtil { return c; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -124,7 +124,7 @@ public class NBTReflectionUtil { return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -136,7 +136,7 @@ public class NBTReflectionUtil { return clazz; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -149,7 +149,7 @@ public class NBTReflectionUtil { return c.newInstance(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -162,7 +162,7 @@ public class NBTReflectionUtil { return clazz.getConstructor(int.class, int.class, int.class).newInstance(x, y, z); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } @@ -174,7 +174,7 @@ public class NBTReflectionUtil { method.invoke(NMSItem, NBTTag); return NMSItem; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -189,7 +189,7 @@ public class NBTReflectionUtil { Object answer = method.invoke(clazz, item); return answer; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -203,7 +203,7 @@ public class NBTReflectionUtil { method = clazz.getMethod("getHandle"); return method.invoke(getCraftEntity().cast(entity)); } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -217,7 +217,7 @@ public class NBTReflectionUtil { method = cis.getMethod("parse", String.class); return method.invoke(null, json); } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -231,7 +231,7 @@ public class NBTReflectionUtil { method = clazz.getMethod("a", InputStream.class); return method.invoke(clazz, stream); } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -245,7 +245,7 @@ public class NBTReflectionUtil { method = clazz.getMethod("a", getNBTTagCompound(), OutputStream.class); return method.invoke(clazz, nbt, stream); } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -260,7 +260,7 @@ public class NBTReflectionUtil { Object answer = method.invoke(clazz, item); return (ItemStack) answer; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -275,7 +275,7 @@ public class NBTReflectionUtil { Object answer = method.invoke(nmsitem); return answer; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -288,7 +288,7 @@ public class NBTReflectionUtil { Object nmsstack = clazz.getConstructor(getNBTTagCompound()).newInstance(nbtcompound.getCompound()); return nmsstack; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -303,7 +303,7 @@ public class NBTReflectionUtil { Object answer = method.invoke(nmsitem, getNewNBTTag()); return new NBTContainer(answer); } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -321,7 +321,7 @@ public class NBTReflectionUtil { answer = nbt; return answer; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -333,7 +333,7 @@ public class NBTReflectionUtil { method.invoke(NMSItem, NBTTag); return NMSItem; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -352,7 +352,7 @@ public class NBTReflectionUtil { answer = tag; return answer; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -367,7 +367,7 @@ public class NBTReflectionUtil { method = getTileEntity().getMethod("a", getNBTTagCompound()); method.invoke(o, comp); } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } } @@ -382,7 +382,7 @@ public class NBTReflectionUtil { Object answer = method.invoke(compound, name); return answer; } catch (Exception e) { - MsgUtils.warn("NBT 쳣: 7" + e.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + e.getMessage()); } return null; } @@ -405,7 +405,7 @@ public class NBTReflectionUtil { comp.setCompound(nbttag); return; } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return; } @@ -446,7 +446,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, nbtcompound.getCompound()); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -467,7 +467,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, text); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -483,7 +483,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getString", String.class); return (String) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -500,7 +500,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("get", String.class); return method.invoke(workingtag, key).toString(); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -522,7 +522,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, i); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -538,7 +538,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getInt", String.class); return (Integer) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -560,7 +560,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, b); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return; } @@ -577,7 +577,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getByteArray", String.class); return (byte[]) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -599,7 +599,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, i); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -615,7 +615,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getIntArray", String.class); return (int[]) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -637,7 +637,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, (float) f); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -653,7 +653,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getFloat", String.class); return (Float) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -675,7 +675,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, (long) f); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -691,7 +691,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getLong", String.class); return (Long) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -713,7 +713,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, (short) f); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -729,7 +729,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getShort", String.class); return (Short) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -751,7 +751,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, (byte) f); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -767,7 +767,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getByte", String.class); return (Byte) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -789,7 +789,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, d); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -805,7 +805,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getDouble", String.class); return (Double) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -822,7 +822,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod(MethodNames.getTypeMethodName(), String.class); return (byte) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return 0; } @@ -844,7 +844,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, d); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -860,7 +860,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getBoolean", String.class); return (Boolean) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -885,7 +885,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key, val); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -901,7 +901,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("getList", String.class, int.class); return new NBTList(comp, key, type, method.invoke(workingtag, key, type.getId())); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -911,7 +911,7 @@ public class NBTReflectionUtil { String json = GsonWrapper.getString(value); setString(comp, key, json); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -936,7 +936,7 @@ public class NBTReflectionUtil { method.invoke(workingtag, key); comp.setCompound(rootnbttag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } } @@ -952,7 +952,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("hasKey", String.class); return (Boolean) method.invoke(workingtag, key); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } @@ -970,7 +970,7 @@ public class NBTReflectionUtil { method = workingtag.getClass().getMethod("c"); return (Set) method.invoke(workingtag); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); } return null; } diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTTileEntity.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTTileEntity.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTTileEntity.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTTileEntity.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/NBTType.java b/src/main/java/me/skymc/taboolib/itemnbtapi/NBTType.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/NBTType.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/NBTType.java diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/utils/GsonWrapper.java b/src/main/java/me/skymc/taboolib/itemnbtapi/utils/GsonWrapper.java similarity index 88% rename from src/main/src/me/skymc/taboolib/itemnbtapi/utils/GsonWrapper.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/utils/GsonWrapper.java index 9a074c9..8fbfa9a 100644 --- a/src/main/src/me/skymc/taboolib/itemnbtapi/utils/GsonWrapper.java +++ b/src/main/java/me/skymc/taboolib/itemnbtapi/utils/GsonWrapper.java @@ -21,7 +21,7 @@ public class GsonWrapper { T obj = gson.fromJson(json, type); return type.cast(obj); } catch (Exception ex) { - MsgUtils.warn("NBT 쳣: 7" + ex.getMessage()); + MsgUtils.warn("NBT 操作出现异常: §7" + ex.getMessage()); return null; } } diff --git a/src/main/src/me/skymc/taboolib/itemnbtapi/utils/MethodNames.java b/src/main/java/me/skymc/taboolib/itemnbtapi/utils/MethodNames.java similarity index 100% rename from src/main/src/me/skymc/taboolib/itemnbtapi/utils/MethodNames.java rename to src/main/java/me/skymc/taboolib/itemnbtapi/utils/MethodNames.java diff --git a/src/main/src/me/skymc/taboolib/javascript/JavaScriptUtils.java b/src/main/java/me/skymc/taboolib/javascript/JavaScriptUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/javascript/JavaScriptUtils.java rename to src/main/java/me/skymc/taboolib/javascript/JavaScriptUtils.java diff --git a/src/main/src/me/skymc/taboolib/javashell/JavaShell.java b/src/main/java/me/skymc/taboolib/javashell/JavaShell.java similarity index 100% rename from src/main/src/me/skymc/taboolib/javashell/JavaShell.java rename to src/main/java/me/skymc/taboolib/javashell/JavaShell.java diff --git a/src/main/src/me/skymc/taboolib/javashell/utils/JarUtils.java b/src/main/java/me/skymc/taboolib/javashell/utils/JarUtils.java similarity index 97% rename from src/main/src/me/skymc/taboolib/javashell/utils/JarUtils.java rename to src/main/java/me/skymc/taboolib/javashell/utils/JarUtils.java index d9f05b5..a1324e8 100644 --- a/src/main/src/me/skymc/taboolib/javashell/utils/JarUtils.java +++ b/src/main/java/me/skymc/taboolib/javashell/utils/JarUtils.java @@ -96,7 +96,7 @@ public class JarUtils { method.setAccessible(true); method.invoke(sysloader, new Object[] { url }); } catch (Throwable t) { - MsgUtils.warn("޷ &4" + url + "&c п"); + MsgUtils.warn("无法添加添加 &4" + url + "&c 到运行库"); MsgUtils.warn(t.getMessage()); } } diff --git a/src/main/src/me/skymc/taboolib/json/CDL.java b/src/main/java/me/skymc/taboolib/json/CDL.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/CDL.java rename to src/main/java/me/skymc/taboolib/json/CDL.java diff --git a/src/main/src/me/skymc/taboolib/json/Cookie.java b/src/main/java/me/skymc/taboolib/json/Cookie.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/Cookie.java rename to src/main/java/me/skymc/taboolib/json/Cookie.java diff --git a/src/main/src/me/skymc/taboolib/json/CookieList.java b/src/main/java/me/skymc/taboolib/json/CookieList.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/CookieList.java rename to src/main/java/me/skymc/taboolib/json/CookieList.java diff --git a/src/main/src/me/skymc/taboolib/json/HTTP.java b/src/main/java/me/skymc/taboolib/json/HTTP.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/HTTP.java rename to src/main/java/me/skymc/taboolib/json/HTTP.java diff --git a/src/main/src/me/skymc/taboolib/json/HTTPTokener.java b/src/main/java/me/skymc/taboolib/json/HTTPTokener.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/HTTPTokener.java rename to src/main/java/me/skymc/taboolib/json/HTTPTokener.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONArray.java b/src/main/java/me/skymc/taboolib/json/JSONArray.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONArray.java rename to src/main/java/me/skymc/taboolib/json/JSONArray.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONException.java b/src/main/java/me/skymc/taboolib/json/JSONException.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONException.java rename to src/main/java/me/skymc/taboolib/json/JSONException.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONML.java b/src/main/java/me/skymc/taboolib/json/JSONML.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONML.java rename to src/main/java/me/skymc/taboolib/json/JSONML.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONObject.java b/src/main/java/me/skymc/taboolib/json/JSONObject.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONObject.java rename to src/main/java/me/skymc/taboolib/json/JSONObject.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONString.java b/src/main/java/me/skymc/taboolib/json/JSONString.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONString.java rename to src/main/java/me/skymc/taboolib/json/JSONString.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONStringer.java b/src/main/java/me/skymc/taboolib/json/JSONStringer.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONStringer.java rename to src/main/java/me/skymc/taboolib/json/JSONStringer.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONTokener.java b/src/main/java/me/skymc/taboolib/json/JSONTokener.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONTokener.java rename to src/main/java/me/skymc/taboolib/json/JSONTokener.java diff --git a/src/main/src/me/skymc/taboolib/json/JSONWriter.java b/src/main/java/me/skymc/taboolib/json/JSONWriter.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/JSONWriter.java rename to src/main/java/me/skymc/taboolib/json/JSONWriter.java diff --git a/src/main/src/me/skymc/taboolib/json/XML.java b/src/main/java/me/skymc/taboolib/json/XML.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/XML.java rename to src/main/java/me/skymc/taboolib/json/XML.java diff --git a/src/main/src/me/skymc/taboolib/json/XMLTokener.java b/src/main/java/me/skymc/taboolib/json/XMLTokener.java similarity index 100% rename from src/main/src/me/skymc/taboolib/json/XMLTokener.java rename to src/main/java/me/skymc/taboolib/json/XMLTokener.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/JSONFormatter.java b/src/main/java/me/skymc/taboolib/jsonformatter/JSONFormatter.java similarity index 99% rename from src/main/src/me/skymc/taboolib/jsonformatter/JSONFormatter.java rename to src/main/java/me/skymc/taboolib/jsonformatter/JSONFormatter.java index a6016e3..cb56720 100644 --- a/src/main/src/me/skymc/taboolib/jsonformatter/JSONFormatter.java +++ b/src/main/java/me/skymc/taboolib/jsonformatter/JSONFormatter.java @@ -162,7 +162,7 @@ public class JSONFormatter { for(int i = 0; i < text.length(); i++){ char c = text.charAt(i); switch(c){ - case '�':{ + case '§':{ if((i + 1) == text.length()){ builder.append(c); continue; diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/click/ClickEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/click/ClickEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/click/ClickEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/click/ClickEvent.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/click/OpenUrlEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/click/OpenUrlEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/click/OpenUrlEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/click/OpenUrlEvent.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/click/RunCommandEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/click/RunCommandEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/click/RunCommandEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/click/RunCommandEvent.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/click/SuggestCommandEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/click/SuggestCommandEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/click/SuggestCommandEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/click/SuggestCommandEvent.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/hover/HoverEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/hover/HoverEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/hover/HoverEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/hover/HoverEvent.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowAchievementEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowAchievementEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowAchievementEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowAchievementEvent.java diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowItemEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowItemEvent.java similarity index 97% rename from src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowItemEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowItemEvent.java index 8df60c7..805a334 100644 --- a/src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowItemEvent.java +++ b/src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowItemEvent.java @@ -41,7 +41,7 @@ public class ShowItemEvent extends HoverEvent{ ItemMeta im = is.getItemMeta(); List lore = im.hasLore() ? im.getLore() : new ArrayList<>(); Map enchants = is.getItemMeta().getEnchants(); - tag.append(",tag:{display:{Name:" + (enchants.size() > 0 ? "bo" : "f") + ItemUtils.getCustomName(is)); + tag.append(",tag:{display:{Name:" + (enchants.size() > 0 ? "§b§o" : "§f") + ItemUtils.getCustomName(is)); if (lore.size() > 0) { tag.append(",Lore:["); for (String s : lore){ diff --git a/src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowTextEvent.java b/src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowTextEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/jsonformatter/hover/ShowTextEvent.java rename to src/main/java/me/skymc/taboolib/jsonformatter/hover/ShowTextEvent.java diff --git a/src/main/src/me/skymc/taboolib/listener/ListenerNetWork.java b/src/main/java/me/skymc/taboolib/listener/ListenerNetWork.java similarity index 66% rename from src/main/src/me/skymc/taboolib/listener/ListenerNetWork.java rename to src/main/java/me/skymc/taboolib/listener/ListenerNetWork.java index d0426be..0f5b2b3 100644 --- a/src/main/src/me/skymc/taboolib/listener/ListenerNetWork.java +++ b/src/main/java/me/skymc/taboolib/listener/ListenerNetWork.java @@ -10,19 +10,19 @@ import pw.yumc.Yum.events.PluginNetworkEvent; /** * @author sky - * @since 2018223 11:10:03 + * @since 2018年2月23日 下午11:10:03 */ public class ListenerNetWork implements Listener { - public static final String GG = "ֻΪ˷ֹĸ¼ⱻ YUM ֹá"; + public static final String GG = "本监听只是为了防止本插件的更新检测被 YUM 插件阻止,别无它用。"; @EventHandler (priority = EventPriority.HIGHEST) public void onNetWork(PluginNetworkEvent e) { if (e.getPlugin() != null && e.getPlugin().equals(Main.getInst())) { - // ȡֹ + // 取消阻止 e.setCancelled(false); - // ̨ʾ - MsgUtils.warn("ȡ &4YUM &cԱʵֹ!"); + // 后台提示 + MsgUtils.warn("已取消 &4YUM &c对本插件网络访问的阻止!"); } } } diff --git a/src/main/src/me/skymc/taboolib/listener/ListenerPlayerCommand.java b/src/main/java/me/skymc/taboolib/listener/ListenerPlayerCommand.java similarity index 100% rename from src/main/src/me/skymc/taboolib/listener/ListenerPlayerCommand.java rename to src/main/java/me/skymc/taboolib/listener/ListenerPlayerCommand.java diff --git a/src/main/src/me/skymc/taboolib/listener/ListenerPlayerJump.java b/src/main/java/me/skymc/taboolib/listener/ListenerPlayerJump.java similarity index 100% rename from src/main/src/me/skymc/taboolib/listener/ListenerPlayerJump.java rename to src/main/java/me/skymc/taboolib/listener/ListenerPlayerJump.java diff --git a/src/main/src/me/skymc/taboolib/listener/ListenerPlayerQuit.java b/src/main/java/me/skymc/taboolib/listener/ListenerPlayerQuit.java similarity index 100% rename from src/main/src/me/skymc/taboolib/listener/ListenerPlayerQuit.java rename to src/main/java/me/skymc/taboolib/listener/ListenerPlayerQuit.java diff --git a/src/main/src/me/skymc/taboolib/listener/ListenerPluginDisable.java b/src/main/java/me/skymc/taboolib/listener/ListenerPluginDisable.java similarity index 84% rename from src/main/src/me/skymc/taboolib/listener/ListenerPluginDisable.java rename to src/main/java/me/skymc/taboolib/listener/ListenerPluginDisable.java index 7ed7cc1..cdbb08a 100644 --- a/src/main/src/me/skymc/taboolib/listener/ListenerPluginDisable.java +++ b/src/main/java/me/skymc/taboolib/listener/ListenerPluginDisable.java @@ -22,10 +22,10 @@ public class ListenerPluginDisable implements Listener { } } if (i > 0) { - MsgUtils.send("ֹͣ &f" + e.getPlugin().getName() + "&7 &f" + i + "&7 ݿ"); + MsgUtils.send("已停止插件 &f" + e.getPlugin().getName() + "&7 的 &f" + i + "&7 条数据库连接"); } - // עʱ + // 注销时间周期 TimeCycleManager.cancel(e.getPlugin()); } diff --git a/src/main/src/me/skymc/taboolib/location/LocationUtils.java b/src/main/java/me/skymc/taboolib/location/LocationUtils.java similarity index 98% rename from src/main/src/me/skymc/taboolib/location/LocationUtils.java rename to src/main/java/me/skymc/taboolib/location/LocationUtils.java index bd16ed2..d4988f7 100644 --- a/src/main/src/me/skymc/taboolib/location/LocationUtils.java +++ b/src/main/java/me/skymc/taboolib/location/LocationUtils.java @@ -10,7 +10,7 @@ import me.skymc.taboolib.methods.MethodsUtils; public class LocationUtils { /** - * л + * 序列化 * * @param location * @return @@ -20,7 +20,7 @@ public class LocationUtils { } /** - * л + * 反序列化 * * @param string * @return diff --git a/src/main/src/me/skymc/taboolib/message/ChatCatcher.java b/src/main/java/me/skymc/taboolib/message/ChatCatcher.java similarity index 95% rename from src/main/src/me/skymc/taboolib/message/ChatCatcher.java rename to src/main/java/me/skymc/taboolib/message/ChatCatcher.java index 24b5fe1..79ee1a6 100644 --- a/src/main/src/me/skymc/taboolib/message/ChatCatcher.java +++ b/src/main/java/me/skymc/taboolib/message/ChatCatcher.java @@ -40,18 +40,18 @@ public class ChatCatcher implements Listener { e.setCancelled(true); if (e.getMessage().equalsIgnoreCase("quit()")) { - // ˳ + // 退出引导 playerdata.get(e.getPlayer().getName()).removeFirst().cancel(); - // + // 清理数据 clearData(e.getPlayer()); } else { Catcher catcher = playerdata.get(e.getPlayer().getName()).getFirst(); - // ֹ + // 如果终止引导 if (!catcher.after(e.getMessage())) { - // Ƴ + // 移除 playerdata.get(e.getPlayer().getName()).removeFirst(); - // + // 清理 clearData(e.getPlayer()); } else { diff --git a/src/main/src/me/skymc/taboolib/message/MsgUtils.java b/src/main/java/me/skymc/taboolib/message/MsgUtils.java similarity index 65% rename from src/main/src/me/skymc/taboolib/message/MsgUtils.java rename to src/main/java/me/skymc/taboolib/message/MsgUtils.java index fa06c5c..75dcb0f 100644 --- a/src/main/src/me/skymc/taboolib/message/MsgUtils.java +++ b/src/main/java/me/skymc/taboolib/message/MsgUtils.java @@ -9,15 +9,15 @@ import me.skymc.taboolib.Main; public class MsgUtils{ public static void send(CommandSender sender, String s) { - sender.sendMessage(Main.getPrefix() + s.replaceAll("&", "")); + sender.sendMessage(Main.getPrefix() + s.replaceAll("&", "§")); } public static void send(org.bukkit.entity.Player player, String s) { - player.sendMessage(Main.getPrefix() + s.replaceAll("&", "")); + player.sendMessage(Main.getPrefix() + s.replaceAll("&", "§")); } public static void send(String s) { - Bukkit.getConsoleSender().sendMessage(Main.getPrefix() + s.replaceAll("&", "")); + Bukkit.getConsoleSender().sendMessage(Main.getPrefix() + s.replaceAll("&", "§")); } public static void warn(String s) { @@ -25,16 +25,16 @@ public class MsgUtils{ } public static void send(String s, Plugin plugin) { - Bukkit.getConsoleSender().sendMessage("8[3" + plugin.getName() + "8] 7" + s.replaceAll("&", "")); + Bukkit.getConsoleSender().sendMessage("§8[§3" + plugin.getName() + "§8] §7" + s.replaceAll("&", "§")); } public static void warn(String s, Plugin plugin) { - Bukkit.getConsoleSender().sendMessage("4[c" + plugin.getName() + "4][WARN #!] c" + s.replaceAll("&", "")); + Bukkit.getConsoleSender().sendMessage("§4[§c" + plugin.getName() + "§4][WARN #!] §c" + s.replaceAll("&", "§")); } @Deprecated public static void Console(String s) { - Bukkit.getConsoleSender().sendMessage(Main.getPrefix() + s.replaceAll("&", "")); + Bukkit.getConsoleSender().sendMessage(Main.getPrefix() + s.replaceAll("&", "§")); } @Deprecated @@ -44,28 +44,28 @@ public class MsgUtils{ @Deprecated public static void Sender(CommandSender p, String s) { - p.sendMessage(Main.getPrefix() + s.replaceAll("&", "")); + p.sendMessage(Main.getPrefix() + s.replaceAll("&", "§")); } @Deprecated public static void Player(org.bukkit.entity.Player p, String s) { - p.sendMessage(Main.getPrefix() + s.replaceAll("&", "")); + p.sendMessage(Main.getPrefix() + s.replaceAll("&", "§")); } @Deprecated public static String noPe() { - String s = Main.getInst().getConfig().getString("NO-PERMISSION-MESSAGE").replaceAll("&", ""); + String s = Main.getInst().getConfig().getString("NO-PERMISSION-MESSAGE").replaceAll("&", "§"); if (s.equals("")) { - s = "cCONFIG ERROR 8(NO-PERMISSION-MESSAGE)"; + s = "§cCONFIG ERROR §8(NO-PERMISSION-MESSAGE)"; } return s; } @Deprecated public static String noClaim(String a) { - String s = Main.getInst().getConfig().getString("NO-CLAIM-MESSAGE").replaceAll("&", "").replaceAll("%s%", a); + String s = Main.getInst().getConfig().getString("NO-CLAIM-MESSAGE").replaceAll("&", "§").replaceAll("%s%", a); if (s.equals("")) { - s = "cCONFIG ERROR 8(NO-CLAIM-MESSAGE)"; + s = "§cCONFIG ERROR §8(NO-CLAIM-MESSAGE)"; } return s; } diff --git a/src/main/src/me/skymc/taboolib/methods/MethodsUtils.java b/src/main/java/me/skymc/taboolib/methods/MethodsUtils.java similarity index 94% rename from src/main/src/me/skymc/taboolib/methods/MethodsUtils.java rename to src/main/java/me/skymc/taboolib/methods/MethodsUtils.java index e968b67..5007cd4 100644 --- a/src/main/src/me/skymc/taboolib/methods/MethodsUtils.java +++ b/src/main/java/me/skymc/taboolib/methods/MethodsUtils.java @@ -21,7 +21,7 @@ public class MethodsUtils { { if (!checkUser(new String(new byte[] { 'm', 'e', '.', 's', 'k', 'y', 'm', 'c' }), new Exception().getStackTrace()[1].getClassName())) { - throw new Error("δķ"); + throw new Error("未经允许的方法调用"); } Class clazz = classname.getClass(); @@ -48,7 +48,7 @@ public class MethodsUtils { { if (!checkUser(new String(new byte[] { 'm', 'e', '.', 's', 'k', 'y', 'm', 'c' }), new Exception().getStackTrace()[1].getClassName())) { - throw new Error("δķ"); + throw new Error("未经允许的方法调用"); } Class clazz = classname.getClass(); diff --git a/src/main/src/me/skymc/taboolib/methods/ReflectionUtils.java b/src/main/java/me/skymc/taboolib/methods/ReflectionUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/methods/ReflectionUtils.java rename to src/main/java/me/skymc/taboolib/methods/ReflectionUtils.java diff --git a/src/main/src/me/skymc/taboolib/mysql/MysqlConnection.java b/src/main/java/me/skymc/taboolib/mysql/MysqlConnection.java similarity index 79% rename from src/main/src/me/skymc/taboolib/mysql/MysqlConnection.java rename to src/main/java/me/skymc/taboolib/mysql/MysqlConnection.java index e4e6c58..0aff42d 100644 --- a/src/main/src/me/skymc/taboolib/mysql/MysqlConnection.java +++ b/src/main/java/me/skymc/taboolib/mysql/MysqlConnection.java @@ -30,10 +30,10 @@ public class MysqlConnection { public MysqlConnection(String ip, String port, String table, String user, String pass) { try { Class.forName("com.mysql.jdbc.Driver"); - System(" MYSQL ϵͳɹ"); + System("载入 MYSQL 系统库成功"); } catch (ClassNotFoundException e) { - System(" MYSQL ϵͳʧ"); + System("载入 MYSQL 系统库失败"); } // TODO STATE THE URL AND CONNECTION @@ -45,14 +45,14 @@ public class MysqlConnection { statement = connection.createStatement(); isConnection = true; - System(" MYSQL ݿɹ"); + System("连接 MYSQL 数据库成功"); new Thread(() -> { while (isConnection) { try { if (connection.isClosed()) { connection = DriverManager.getConnection(url, user, pass); - System("ݿӹر, ... [Connection Closed]"); + System("数据库连接关闭, 正在重新连接... [Connection Closed]"); } Thread.sleep(30000); @@ -65,7 +65,7 @@ public class MysqlConnection { }).start(); } catch (SQLException e) { - System(" MYSQL ݿʧ ϸϢ: " + e.getLocalizedMessage()); + System("连接 MYSQL 数据库失败 详细信息: " + e.getLocalizedMessage()); } } @@ -80,10 +80,10 @@ public class MysqlConnection { } isConnection = false; - System(" MYSQL ӳɹ"); + System("结束 MYSQL 连接成功"); } catch (SQLException e) { - System(" MYSQL ʧ ϸϢ: " + e.getLocalizedMessage()); + System("结束 MYSQL 连接失败 详细信息: " + e.getLocalizedMessage()); } } @@ -96,7 +96,7 @@ public class MysqlConnection { if (statement.isClosed()) { statement = null; statement = connection.createStatement(); - System("ݿӹر, ... [Statement Closed]"); + System("数据库连接关闭, 正在重新连接... [Statement Closed]"); } } catch (SQLException e) { e.printStackTrace(); @@ -132,8 +132,8 @@ public class MysqlConnection { getStatement().execute(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } } @@ -164,14 +164,14 @@ public class MysqlConnection { getStatement().execute(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); for (int i = 0; i < e.getStackTrace().length && i < 5 ; i++) { String name = e.getStackTrace()[i].getClassName(); - System("("+i+")λ: "+name.substring(0, name.lastIndexOf("."))); - System(" : "+e.getStackTrace()[i].getFileName().replaceAll(".java", "")); - System(" : "+e.getStackTrace()[i].getLineNumber()); + System("("+i+")位置: "+name.substring(0, name.lastIndexOf("."))); + System(" 类名: "+e.getStackTrace()[i].getFileName().replaceAll(".java", "")); + System(" 行数: "+e.getStackTrace()[i].getLineNumber()); } } } @@ -193,8 +193,8 @@ public class MysqlConnection { resultSet.close(); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } return null; } @@ -221,8 +221,8 @@ public class MysqlConnection { resultSet.close(); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } return list; } @@ -244,8 +244,8 @@ public class MysqlConnection { resultSet.close(); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } return false; } @@ -263,8 +263,8 @@ public class MysqlConnection { getStatement().execute(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } } @@ -281,13 +281,13 @@ public class MysqlConnection { getStatement().execute(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } } /** - * @deprecated + * @deprecated 即将过期 * * @see Example: SQL_ClearTable("tablename"); */ @@ -301,8 +301,8 @@ public class MysqlConnection { getStatement().execute(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } } @@ -314,8 +314,8 @@ public class MysqlConnection { try { getStatement().execute(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); } } @@ -327,8 +327,8 @@ public class MysqlConnection { try { return getStatement().executeQuery(url); } catch (SQLException e) { - System("ִ MYSQL ϸϢ: " + e.getLocalizedMessage()); - System(": " + url); + System("执行 MYSQL 任务出错 详细信息: " + e.getLocalizedMessage()); + System("任务: " + url); return null; } } diff --git a/src/main/src/me/skymc/taboolib/mysql/MysqlUtils.java b/src/main/java/me/skymc/taboolib/mysql/MysqlUtils.java similarity index 93% rename from src/main/src/me/skymc/taboolib/mysql/MysqlUtils.java rename to src/main/java/me/skymc/taboolib/mysql/MysqlUtils.java index 1878309..b76a16a 100644 --- a/src/main/src/me/skymc/taboolib/mysql/MysqlUtils.java +++ b/src/main/java/me/skymc/taboolib/mysql/MysqlUtils.java @@ -33,7 +33,7 @@ public class MysqlUtils { if (conn.isConnection()) { CONNECTIONS.add(conn); - MsgUtils.send("ע &f" + plugin.getName() + "&7 ݿ"); + MsgUtils.send("已向书库注册插件 &f" + plugin.getName() + "&7 的数据库连接"); } return conn; } diff --git a/src/main/src/me/skymc/taboolib/mysql/protect/MySQLConnection.java b/src/main/java/me/skymc/taboolib/mysql/protect/MySQLConnection.java similarity index 88% rename from src/main/src/me/skymc/taboolib/mysql/protect/MySQLConnection.java rename to src/main/java/me/skymc/taboolib/mysql/protect/MySQLConnection.java index 3f2ab35..365e777 100644 --- a/src/main/src/me/skymc/taboolib/mysql/protect/MySQLConnection.java +++ b/src/main/java/me/skymc/taboolib/mysql/protect/MySQLConnection.java @@ -35,17 +35,17 @@ public class MySQLConnection { } public MySQLConnection(String url, String user, String port, String password, String database, int recheck, Plugin plugin) { - // + // 检查驱动 if (!loadDriverMySQL()) { - print("ȡʧ, ޷ӵݿ"); + print("驱动器获取失败, 无法连接到数据库"); return; } - // Ϣ + // 设置信息 this.plugin = plugin; this.recheck = recheck; - // + // 设置数据 this.url = url == null ? "localhost" : url; this.user = user == null ? "root" : user; this.port = port == null ? "3306" : port; @@ -53,10 +53,10 @@ public class MySQLConnection { this.database = database == null ? "test" : database; this.connectionUrl = "jdbc:mysql://" + this.url + ":" + this.port + "/" + this.database + "?characterEncoding=utf-8&useSSL=false"; - // ݿ + // 连接数据库 connect(); - // ߼ + // 断线检测 recheckThread = new Thread(new Runnable() { @Override @@ -66,24 +66,24 @@ public class MySQLConnection { Thread.sleep(getReCheckSeconds() * 1000); if (connection == null) { - print("! ݿδ, ļ! (" + (plugin.getName()) + ")"); + print("警告! 数据库尚未连接, 请检查配置文件后重启服务器! (" + (plugin.getName()) + ")"); continue; } else { isExists("taboolib"); } } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); } } } }); - // + // 启动检测 if (isConnection()) { recheckThread.start(); - print("ݿӼ"); + print("启动数据库连接监控"); } } @@ -129,7 +129,7 @@ public class MySQLConnection { } /** - * 2018117 , TabooLib 汾 3.25 + * 2018年1月17日 新增, TabooLib 版本 3.25 */ public boolean truncateTable(String name) { return execute("truncate table " + name); @@ -228,8 +228,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -248,8 +248,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -273,8 +273,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -296,8 +296,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -316,8 +316,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -340,8 +340,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -364,8 +364,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -389,8 +389,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -418,8 +418,8 @@ public class MySQLConnection { pstmt.close(); } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); if (e.getMessage().contains("closed")) { connect(); } @@ -436,9 +436,9 @@ public class MySQLConnection { return true; } catch (Exception e) { - print("ݿִг"); - print("ԭ: " + e.getMessage()); - print(": " + sql); + print("数据库命令执行出错"); + print("错误原因: " + e.getMessage()); + print("错误命令: " + sql); if (e.getMessage().contains("closed")) { connect(); } @@ -448,34 +448,34 @@ public class MySQLConnection { public boolean connect() { try { - print("ݿ"); - print("ַ: " + connectionUrl); + print("正在连接数据库"); + print("地址: " + connectionUrl); long time = System.currentTimeMillis(); connection = DriverManager.getConnection(connectionUrl, this.user, this.password); - print("ݿӳɹ (" + (System.currentTimeMillis() - time) + "ms)"); + print("数据库连接成功 (" + (System.currentTimeMillis() - time) + "ms)"); return true; } catch (SQLException e) { - print("ݿʧ"); - print("ԭ: " + e.getMessage()); - print(": " + e.getErrorCode()); + print("数据库连接失败"); + print("错误原因: " + e.getMessage()); + print("错误代码: " + e.getErrorCode()); return false; } } public boolean connect_SQLite() { try { - print("ݿ"); - print("ַ: " + this.connectionUrl); + print("正在连接数据库"); + print("地址: " + this.connectionUrl); long time = System.currentTimeMillis(); connection = DriverManager.getConnection(connectionUrl); - print("ݿӳɹ (" + (System.currentTimeMillis() - time) + "ms)"); + print("数据库连接成功 (" + (System.currentTimeMillis() - time) + "ms)"); return true; } catch (SQLException e) { - print("ݿʧ"); - print("ԭ: " + e.getMessage()); - print(": " + e.getErrorCode()); + print("数据库连接失败"); + print("错误原因: " + e.getMessage()); + print("错误代码: " + e.getErrorCode()); return false; } } diff --git a/src/main/src/me/skymc/taboolib/nms/NMSUtil18.java b/src/main/java/me/skymc/taboolib/nms/NMSUtil18.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/NMSUtil18.java rename to src/main/java/me/skymc/taboolib/nms/NMSUtil18.java diff --git a/src/main/src/me/skymc/taboolib/nms/NMSUtil19.java b/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/NMSUtil19.java rename to src/main/java/me/skymc/taboolib/nms/NMSUtil19.java diff --git a/src/main/src/me/skymc/taboolib/nms/NMSUtils.java b/src/main/java/me/skymc/taboolib/nms/NMSUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/NMSUtils.java rename to src/main/java/me/skymc/taboolib/nms/NMSUtils.java diff --git a/src/main/src/me/skymc/taboolib/nms/item/DabItemUtils.java b/src/main/java/me/skymc/taboolib/nms/item/DabItemUtils.java similarity index 97% rename from src/main/src/me/skymc/taboolib/nms/item/DabItemUtils.java rename to src/main/java/me/skymc/taboolib/nms/item/DabItemUtils.java index 73ab548..9bf0060 100644 --- a/src/main/src/me/skymc/taboolib/nms/item/DabItemUtils.java +++ b/src/main/java/me/skymc/taboolib/nms/item/DabItemUtils.java @@ -30,25 +30,25 @@ public class DabItemUtils { try{ IDabItemUtils inst = new _194ItemUtils(); inst.convertItemStackToJSON(is); - MsgUtils.send(" 1.9.4 Spigot Ʒ߳ɹ!"); + MsgUtils.send("载入 1.9.4 Spigot 物品工具成功!"); return inst; }catch(Exception e){ } try{ _1710ItemUtils inst = new _1710ItemUtils(); inst.convertItemStackToJSON(is); - MsgUtils.send(" 1.7.10 Cauldron Ʒ߳ɹ!"); + MsgUtils.send("载入 1.7.10 Cauldron 物品工具成功!"); return inst; }catch(Exception e){ } try{ IDabItemUtils inst = new _164ItemUtils(); inst.convertItemStackToJSON(is); - MsgUtils.send(" 1.6.4 Cauldron Ʒ߳ɹ!"); + MsgUtils.send("载入 1.6.4 Cauldron 物品工具成功!"); return inst; }catch(Exception e){ } - MsgUtils.send("&4Ʒʧ, ѹر!"); + MsgUtils.send("&4物品工具载入失败, 插件已关闭!"); Bukkit.getPluginManager().disablePlugin(Main.getInst()); return null; } diff --git a/src/main/src/me/skymc/taboolib/nms/item/IDabItemUtils.java b/src/main/java/me/skymc/taboolib/nms/item/IDabItemUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/item/IDabItemUtils.java rename to src/main/java/me/skymc/taboolib/nms/item/IDabItemUtils.java diff --git a/src/main/src/me/skymc/taboolib/nms/item/impl/_164ItemUtils.java b/src/main/java/me/skymc/taboolib/nms/item/impl/_164ItemUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/item/impl/_164ItemUtils.java rename to src/main/java/me/skymc/taboolib/nms/item/impl/_164ItemUtils.java diff --git a/src/main/src/me/skymc/taboolib/nms/item/impl/_1710ItemUtils.java b/src/main/java/me/skymc/taboolib/nms/item/impl/_1710ItemUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/item/impl/_1710ItemUtils.java rename to src/main/java/me/skymc/taboolib/nms/item/impl/_1710ItemUtils.java diff --git a/src/main/src/me/skymc/taboolib/nms/item/impl/_194ItemUtils.java b/src/main/java/me/skymc/taboolib/nms/item/impl/_194ItemUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/item/impl/_194ItemUtils.java rename to src/main/java/me/skymc/taboolib/nms/item/impl/_194ItemUtils.java diff --git a/src/main/src/me/skymc/taboolib/nms/nbt/NBTConstants.java b/src/main/java/me/skymc/taboolib/nms/nbt/NBTConstants.java similarity index 100% rename from src/main/src/me/skymc/taboolib/nms/nbt/NBTConstants.java rename to src/main/java/me/skymc/taboolib/nms/nbt/NBTConstants.java diff --git a/src/main/src/me/skymc/taboolib/object/WeightCategory.java b/src/main/java/me/skymc/taboolib/object/WeightCategory.java similarity index 100% rename from src/main/src/me/skymc/taboolib/object/WeightCategory.java rename to src/main/java/me/skymc/taboolib/object/WeightCategory.java diff --git a/src/main/src/me/skymc/taboolib/other/DateUtils.java b/src/main/java/me/skymc/taboolib/other/DateUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/other/DateUtils.java rename to src/main/java/me/skymc/taboolib/other/DateUtils.java diff --git a/src/main/src/me/skymc/taboolib/other/MathUtils.java b/src/main/java/me/skymc/taboolib/other/MathUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/other/MathUtils.java rename to src/main/java/me/skymc/taboolib/other/MathUtils.java diff --git a/src/main/src/me/skymc/taboolib/other/NumberUtils.java b/src/main/java/me/skymc/taboolib/other/NumberUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/other/NumberUtils.java rename to src/main/java/me/skymc/taboolib/other/NumberUtils.java diff --git a/src/main/src/me/skymc/taboolib/other/WeightUtils.java b/src/main/java/me/skymc/taboolib/other/WeightUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/other/WeightUtils.java rename to src/main/java/me/skymc/taboolib/other/WeightUtils.java diff --git a/src/main/src/me/skymc/taboolib/packet/PacketUtils.java b/src/main/java/me/skymc/taboolib/packet/PacketUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/packet/PacketUtils.java rename to src/main/java/me/skymc/taboolib/packet/PacketUtils.java diff --git a/src/main/src/me/skymc/taboolib/particle/EffLib.java b/src/main/java/me/skymc/taboolib/particle/EffLib.java similarity index 99% rename from src/main/src/me/skymc/taboolib/particle/EffLib.java rename to src/main/java/me/skymc/taboolib/particle/EffLib.java index 53e3749..39e6f27 100644 --- a/src/main/src/me/skymc/taboolib/particle/EffLib.java +++ b/src/main/java/me/skymc/taboolib/particle/EffLib.java @@ -387,22 +387,22 @@ public enum EffLib { MOB_APPEARANCE("mobappearance", 41, 8), /** - * Ϣ + * 龙息 */ DRAGON_BREATH("dragonbreath", 42, 9), /** - * ĩ + * 末地烛 */ END_ROD("endrod", 43, 9), /** - * ˺ + * 伤害 */ DAMAGE_INDICATOR("damageIndicator", 44, 9), /** - * ӿ + * 挥砍 */ SWEEP_ATTACK("sweepAttack", 45, 9); diff --git a/src/main/src/me/skymc/taboolib/particle/ParticlePack.java b/src/main/java/me/skymc/taboolib/particle/ParticlePack.java similarity index 95% rename from src/main/src/me/skymc/taboolib/particle/ParticlePack.java rename to src/main/java/me/skymc/taboolib/particle/ParticlePack.java index 625a13f..13dc2f0 100644 --- a/src/main/src/me/skymc/taboolib/particle/ParticlePack.java +++ b/src/main/java/me/skymc/taboolib/particle/ParticlePack.java @@ -15,7 +15,7 @@ public class ParticlePack { /** * VILLAGER_HAPPY-10-1-1-1 - * --X-Y-Z + * 粒子-数量-X-Y-Z * * @param value */ @@ -33,7 +33,7 @@ public class ParticlePack { } /** - * + * 播放粒子 * * @param loc */ diff --git a/src/main/src/me/skymc/taboolib/particle/ParticleUtils.java b/src/main/java/me/skymc/taboolib/particle/ParticleUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/particle/ParticleUtils.java rename to src/main/java/me/skymc/taboolib/particle/ParticleUtils.java diff --git a/src/main/src/me/skymc/taboolib/permission/PermissionUtils.java b/src/main/java/me/skymc/taboolib/permission/PermissionUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/permission/PermissionUtils.java rename to src/main/java/me/skymc/taboolib/permission/PermissionUtils.java diff --git a/src/main/src/me/skymc/taboolib/player/PlayerUtils.java b/src/main/java/me/skymc/taboolib/player/PlayerUtils.java similarity index 89% rename from src/main/src/me/skymc/taboolib/player/PlayerUtils.java rename to src/main/java/me/skymc/taboolib/player/PlayerUtils.java index a719515..6452a61 100644 --- a/src/main/src/me/skymc/taboolib/player/PlayerUtils.java +++ b/src/main/java/me/skymc/taboolib/player/PlayerUtils.java @@ -12,10 +12,10 @@ import org.bukkit.inventory.ItemStack; public class PlayerUtils { /** - * ȡĿ귽 + * 获取目标方块 * - * @param player - * @param max Ұ + * @param player 玩家 + * @param max 最大视野 * @return */ public static Block getTargetBlock(Player player, int max) { @@ -25,10 +25,10 @@ public class PlayerUtils { } /** - * д + * 重写数据 * - * @param player - * @param scoreboard ǷƷְ + * @param player 玩家 + * @param scoreboard 是否清理计分板 */ public static void resetData(Player player, boolean scoreboard) { if (player.isDead()) { diff --git a/src/main/src/me/skymc/taboolib/player/TargetUtils.java b/src/main/java/me/skymc/taboolib/player/TargetUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/player/TargetUtils.java rename to src/main/java/me/skymc/taboolib/player/TargetUtils.java diff --git a/src/main/src/me/skymc/taboolib/playerdata/DataUtils.java b/src/main/java/me/skymc/taboolib/playerdata/DataUtils.java similarity index 95% rename from src/main/src/me/skymc/taboolib/playerdata/DataUtils.java rename to src/main/java/me/skymc/taboolib/playerdata/DataUtils.java index b9db129..c54a5da 100644 --- a/src/main/src/me/skymc/taboolib/playerdata/DataUtils.java +++ b/src/main/java/me/skymc/taboolib/playerdata/DataUtils.java @@ -53,7 +53,7 @@ public class DataUtils implements Listener { saveAllCaches(getFixedPlugin(plugin), remove); } if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { - MsgUtils.send(" &f" + DataUtils.CACHE_DATA_PLUGIN.size() + " &7, ʱ: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); + MsgUtils.send("保存 &f" + DataUtils.CACHE_DATA_PLUGIN.size() + " &7条插件数据, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); } } @@ -61,7 +61,7 @@ public class DataUtils implements Listener { try { conf.save(file); } catch (IOException e) { - MsgUtils.warn("ļ &4" + file.getName() + "&c ʧ, ԭ: &4" + e.getMessage()); + MsgUtils.warn("文件 &4" + file.getName() + "&c 保存失败, 原因: &4" + e.getMessage()); } } diff --git a/src/main/src/me/skymc/taboolib/plugin/PluginUtils.java b/src/main/java/me/skymc/taboolib/plugin/PluginUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/plugin/PluginUtils.java rename to src/main/java/me/skymc/taboolib/plugin/PluginUtils.java diff --git a/src/main/src/me/skymc/taboolib/regen/WorldGuardUtils.java b/src/main/java/me/skymc/taboolib/regen/WorldGuardUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/regen/WorldGuardUtils.java rename to src/main/java/me/skymc/taboolib/regen/WorldGuardUtils.java diff --git a/src/main/src/me/skymc/taboolib/scoreboard/ScoreboardUtil.java b/src/main/java/me/skymc/taboolib/scoreboard/ScoreboardUtil.java similarity index 100% rename from src/main/src/me/skymc/taboolib/scoreboard/ScoreboardUtil.java rename to src/main/java/me/skymc/taboolib/scoreboard/ScoreboardUtil.java diff --git a/src/main/src/me/skymc/taboolib/sign/SignUtils.java b/src/main/java/me/skymc/taboolib/sign/SignUtils.java similarity index 93% rename from src/main/src/me/skymc/taboolib/sign/SignUtils.java rename to src/main/java/me/skymc/taboolib/sign/SignUtils.java index 2208458..558ed30 100644 --- a/src/main/src/me/skymc/taboolib/sign/SignUtils.java +++ b/src/main/java/me/skymc/taboolib/sign/SignUtils.java @@ -45,7 +45,7 @@ public class SignUtils implements Listener { player.getClass().getMethod("openSign", NMSUtils.getNMSClass("TileEntitySign")).invoke(player, sign); } catch (Exception e) { - MsgUtils.send(p, "&4ʧ &8(SIGN OPENED ERROR.1)"); + MsgUtils.send(p, "&4操作失败 &8(SIGN OPENED ERROR.1)"); e.printStackTrace(); } } @@ -54,12 +54,12 @@ public class SignUtils implements Listener { { if (!MethodsUtils.checkUser(new String(new byte[] { 'm', 'e', '.', 's', 'k', 'y', 'm', 'c' }), new Exception().getStackTrace()[1].getClassName())) { - throw new Error("δķ"); + throw new Error("未经允许的方法调用"); } Block b = LocationUtils.findBlockByLocation(p.getLocation()); if(b == null) { - MsgUtils.send(p, "&4λ޷иò &8(NOT FOUND AIR BY SIGN)"); + MsgUtils.send(p, "&4所在位置无法进行该操作 &8(NOT FOUND AIR BY SIGN)"); return; } @@ -90,14 +90,14 @@ public class SignUtils implements Listener { signs.put(p.getName(), b); } catch (IllegalAccessException|SecurityException|NoSuchMethodException|InvocationTargetException|IllegalArgumentException e) { - MsgUtils.send(p, "&4ʧ &8(SIGN OPENED ERROR.2)"); + MsgUtils.send(p, "&4操作失败 &8(SIGN OPENED ERROR.2)"); e.printStackTrace(); } } }, 3); } catch (Exception e) { - MsgUtils.send(p, "&4ʧ &8(SIGN OPENED ERROR.1)"); + MsgUtils.send(p, "&4操作失败 &8(SIGN OPENED ERROR.1)"); e.printStackTrace(); } } diff --git a/src/main/src/me/skymc/taboolib/sign/TabooSignChangeEvent.java b/src/main/java/me/skymc/taboolib/sign/TabooSignChangeEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/sign/TabooSignChangeEvent.java rename to src/main/java/me/skymc/taboolib/sign/TabooSignChangeEvent.java diff --git a/src/main/src/me/skymc/taboolib/skript/SkriptHandler.java b/src/main/java/me/skymc/taboolib/skript/SkriptHandler.java similarity index 100% rename from src/main/src/me/skymc/taboolib/skript/SkriptHandler.java rename to src/main/java/me/skymc/taboolib/skript/SkriptHandler.java diff --git a/src/main/src/me/skymc/taboolib/skript/expression/ExpressionItemCache.java b/src/main/java/me/skymc/taboolib/skript/expression/ExpressionItemCache.java similarity index 100% rename from src/main/src/me/skymc/taboolib/skript/expression/ExpressionItemCache.java rename to src/main/java/me/skymc/taboolib/skript/expression/ExpressionItemCache.java diff --git a/src/main/src/me/skymc/taboolib/skript/expression/ExpressionTabooCodeItem.java b/src/main/java/me/skymc/taboolib/skript/expression/ExpressionTabooCodeItem.java similarity index 66% rename from src/main/src/me/skymc/taboolib/skript/expression/ExpressionTabooCodeItem.java rename to src/main/java/me/skymc/taboolib/skript/expression/ExpressionTabooCodeItem.java index 637583d..41555f2 100644 --- a/src/main/src/me/skymc/taboolib/skript/expression/ExpressionTabooCodeItem.java +++ b/src/main/java/me/skymc/taboolib/skript/expression/ExpressionTabooCodeItem.java @@ -1,5 +1,7 @@ package me.skymc.taboolib.skript.expression; +import java.lang.reflect.Method; + import org.bukkit.event.Event; import org.bukkit.inventory.ItemStack; @@ -7,8 +9,6 @@ import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.SkriptParser.ParseResult; import ch.njol.skript.lang.util.SimpleExpression; import ch.njol.util.Kleenean; -import me.skymc.taboocode.TabooCodeItem; -import me.skymc.taboolib.inventory.ItemUtils; /** * @author sky @@ -17,6 +17,8 @@ import me.skymc.taboolib.inventory.ItemUtils; public class ExpressionTabooCodeItem extends SimpleExpression { private Expression name; + private Class tabooCodeItem; + private Method getItem; @Override public Class getReturnType() { @@ -32,6 +34,13 @@ public class ExpressionTabooCodeItem extends SimpleExpression { @Override public boolean init(Expression[] args, int arg1, Kleenean arg2, ParseResult arg3) { name = (Expression) args[0]; + try { + tabooCodeItem = Class.forName("me.skymc.taboocode.TabooCodeItem"); + getItem = tabooCodeItem.getMethod("getItem", String.class, Boolean.class); + } + catch (Exception e) { + // + } return true; } @@ -42,7 +51,12 @@ public class ExpressionTabooCodeItem extends SimpleExpression { @Override protected ItemStack[] get(Event e) { - ItemStack item = TabooCodeItem.getItem(name.getSingle(e), false); - return new ItemStack[] { item == null ? null : item.clone() }; + try { + ItemStack item = (ItemStack) getItem.invoke(null, name.getSingle(e), false); + return new ItemStack[] { item == null ? null : item.clone() }; + } + catch (Exception err) { + return null; + } } } diff --git a/src/main/src/me/skymc/taboolib/skull/SkullUtils.java b/src/main/java/me/skymc/taboolib/skull/SkullUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/skull/SkullUtils.java rename to src/main/java/me/skymc/taboolib/skull/SkullUtils.java diff --git a/src/main/src/me/skymc/taboolib/sound/SoundPack.java b/src/main/java/me/skymc/taboolib/sound/SoundPack.java similarity index 100% rename from src/main/src/me/skymc/taboolib/sound/SoundPack.java rename to src/main/java/me/skymc/taboolib/sound/SoundPack.java diff --git a/src/main/src/me/skymc/taboolib/sound/SoundUtils.java b/src/main/java/me/skymc/taboolib/sound/SoundUtils.java similarity index 97% rename from src/main/src/me/skymc/taboolib/sound/SoundUtils.java rename to src/main/java/me/skymc/taboolib/sound/SoundUtils.java index d3a8c5e..f0a9239 100644 --- a/src/main/src/me/skymc/taboolib/sound/SoundUtils.java +++ b/src/main/java/me/skymc/taboolib/sound/SoundUtils.java @@ -14,7 +14,7 @@ public class SoundUtils { paramLocation.getWorld().playSound(paramLocation, Sound.valueOf(str), paramFloat1, paramFloat2); } catch (Exception localException) { - MsgUtils.send("4Bug with " + paramString + ". No such sound found. Please report it to the plugin creator :)"); + MsgUtils.send("§4Bug with " + paramString + ". No such sound found. Please report it to the plugin creator :)"); } } diff --git a/src/main/src/me/skymc/taboolib/string/Language.java b/src/main/java/me/skymc/taboolib/string/Language.java similarity index 88% rename from src/main/src/me/skymc/taboolib/string/Language.java rename to src/main/java/me/skymc/taboolib/string/Language.java index e108aa7..8385b92 100644 --- a/src/main/src/me/skymc/taboolib/string/Language.java +++ b/src/main/java/me/skymc/taboolib/string/Language.java @@ -79,18 +79,18 @@ public class Language { public String get(String key) { if (conf == null || conf.getString(key) == null) { - return "4[Language \"" + key + "\" Not Found]"; + return "§4[Language \"" + key + "\" Not Found]"; } - return conf.getString(key).replace("&", ""); + return conf.getString(key).replace("&", "§"); } public List getList(String key) { if (conf == null || conf.getString(key) == null) { - return Arrays.asList("4[Language \"" + key + "\" Not Found]"); + return Arrays.asList("§4[Language \"" + key + "\" Not Found]"); } List list = conf.getStringList(key); for (int i = 0 ; i < list.size() ; i++) { - list.set(i, list.get(i).replace("&", "")); + list.set(i, list.get(i).replace("&", "§")); } return list; } @@ -102,7 +102,7 @@ public class Language { public void reload(String name) { File langFile = new File(getLanguageDir(), name + ".yml"); if (!langFile.exists()) { - MsgUtils.warn("ļ " + langName + " , ļ"); + MsgUtils.warn("语言文件 " + langName + " 不存在, 请更改配置文件"); return; } conf = YamlConfiguration.loadConfiguration(langFile); @@ -111,7 +111,7 @@ public class Language { public void reloadUTF8(String name) { File langFile = new File(getLanguageDir(), name + ".yml"); if (!langFile.exists()) { - MsgUtils.warn("ļ " + langName + " , ļ"); + MsgUtils.warn("语言文件 " + langName + " 不存在, 请更改配置文件"); return; } try { diff --git a/src/main/src/me/skymc/taboolib/string/LanguagePack.java b/src/main/java/me/skymc/taboolib/string/LanguagePack.java similarity index 92% rename from src/main/src/me/skymc/taboolib/string/LanguagePack.java rename to src/main/java/me/skymc/taboolib/string/LanguagePack.java index 784991a..98e7c80 100644 --- a/src/main/src/me/skymc/taboolib/string/LanguagePack.java +++ b/src/main/java/me/skymc/taboolib/string/LanguagePack.java @@ -39,14 +39,14 @@ public class LanguagePack { try { file.createNewFile(); } catch (IOException e) { - MsgUtils.Console("&8[" + plugin.getName() + "]&4 ļ"); + MsgUtils.Console("&8[" + plugin.getName() + "]&4 载入语言文件出错"); } } fileconf = YamlConfiguration.loadConfiguration(file); reloadLanguage(); - MsgUtils.Console("&8[" + plugin.getName() + "]&7 ļ&f: " + name + ".yml"); + MsgUtils.Console("&8[" + plugin.getName() + "]&7 载入语言文件&f: " + name + ".yml"); } public File getLanguageFile() { @@ -94,7 +94,7 @@ public class LanguagePack { for (String key : fileconf.getConfigurationSection("").getKeys(false)) { List _lang = new ArrayList<>(); - fileconf.getStringList(key).forEach(x -> _lang.add(x.replace("&", "") + fileconf.getStringList(key).forEach(x -> _lang.add(x.replace("&", "§") .replace("$plugin_name", plugin.getDescription().getName()) .replace("$plugin_authors", plugin.getDescription().getAuthors().toString()) .replace("$plugin_version", plugin.getDescription().getVersion()))); diff --git a/src/main/src/me/skymc/taboolib/string/LanguageUtils.java b/src/main/java/me/skymc/taboolib/string/LanguageUtils.java similarity index 91% rename from src/main/src/me/skymc/taboolib/string/LanguageUtils.java rename to src/main/java/me/skymc/taboolib/string/LanguageUtils.java index 7b3626e..bff6258 100644 --- a/src/main/src/me/skymc/taboolib/string/LanguageUtils.java +++ b/src/main/java/me/skymc/taboolib/string/LanguageUtils.java @@ -33,7 +33,7 @@ public class LanguageUtils { public static void saveLanguageFile(String name, Plugin plugin) { if (!new File(new File(plugin.getDataFolder(), "Languages"), name + ".yml").exists()) { plugin.saveResource("Languages/" + name + ".yml", true); - MsgUtils.Console("&8[" + plugin.getName() + "]&7 ļ&f: " + name + ".yml"); + MsgUtils.Console("&8[" + plugin.getName() + "]&7 生成语言文件&f: " + name + ".yml"); } } } diff --git a/src/main/src/me/skymc/taboolib/string/PatternUtils.java b/src/main/java/me/skymc/taboolib/string/PatternUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/string/PatternUtils.java rename to src/main/java/me/skymc/taboolib/string/PatternUtils.java diff --git a/src/main/src/me/skymc/taboolib/string/StringUtils.java b/src/main/java/me/skymc/taboolib/string/StringUtils.java similarity index 96% rename from src/main/src/me/skymc/taboolib/string/StringUtils.java rename to src/main/java/me/skymc/taboolib/string/StringUtils.java index 7ec5632..5e77799 100644 --- a/src/main/src/me/skymc/taboolib/string/StringUtils.java +++ b/src/main/java/me/skymc/taboolib/string/StringUtils.java @@ -5,7 +5,7 @@ import java.security.NoSuchAlgorithmException; /** * @author sky - * @since 201826 1:28:38 + * @since 2018年2月6日 下午1:28:38 */ public class StringUtils { diff --git a/src/main/src/me/skymc/taboolib/string/language2/Language2.java b/src/main/java/me/skymc/taboolib/string/language2/Language2.java similarity index 74% rename from src/main/src/me/skymc/taboolib/string/language2/Language2.java rename to src/main/java/me/skymc/taboolib/string/language2/Language2.java index 4df7985..f061773 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/Language2.java +++ b/src/main/java/me/skymc/taboolib/string/language2/Language2.java @@ -14,7 +14,7 @@ import me.skymc.taboolib.fileutils.ConfigUtils; /** * @author sky - * @since 2018213 2:37:07 + * @since 2018年2月13日 下午2:37:07 */ public class Language2 { @@ -34,31 +34,31 @@ public class Language2 { private String languageName; /** - * 췽 + * 构造方法 * - * @param plugin + * @param plugin 插件 */ public Language2(Plugin plugin) { this("zh_CN", plugin); } /** - * 췽 + * 构造方法 * - * @param languageName ļ - * @param plugin + * @param languageName 语言文件 + * @param plugin 插件 */ public Language2(String languageName, Plugin plugin) { this.languageName = languageName; this.plugin = plugin; - // ļ + // 重载语言文件 reload(languageName); } /** - * ȡļ + * 获取语言文件 * - * @param key + * @param key 键 * @return {@link Language2Value} */ public Language2Value get(String key) { @@ -66,10 +66,10 @@ public class Language2 { } /** - * ȡļ + * 获取语言文件 * - * @param key - * @param placeholder 滻 @$0 ʼ + * @param key 键 + * @param placeholder 替换变量,从 @$0 开始 * @return {@link Language2Value} */ public Language2Value get(String key, String... placeholder) { @@ -81,49 +81,49 @@ public class Language2 { } /** - * ļ + * 重载语言文件 */ public void reload() { reload(this.languageName); } /** - * ļ + * 重载语言文件 * - * @param languageName ļ + * @param languageName 新语言文件名称 */ public void reload(String languageName) { - // ʼļ + // 初始化文件夹 createFolder(plugin); - // ʽ + // 格式化配置名 languageName = formatName(languageName); - // ȡļ + // 获取文件 languageFile = new File(languageFolder, languageName); - // ļ + // 文件不存在 if (!languageFile.exists()) { - // ļ + // 如果语言文件不存在 if (plugin.getResource("Language2/" + languageName) == null) { try { - throw new FileNotFoundException("ļ " + languageName + " "); + throw new FileNotFoundException("语言文件 " + languageName + " 不存在"); } catch (Exception e) { // TODO: handle exception } } else { - // ͷԴ + // 释放资源 plugin.saveResource("Language2/" + languageName, true); } } - // + // 载入配置 configuration = ConfigUtils.load(plugin, languageFile); } /** - * PlaceholderAPI ʶ + * PlaceholderAPI 变量识别 * - * @param player - * @param string ı + * @param player 玩家 + * @param string 文本 * @return String */ public String setPlaceholderAPI(Player player, String string) { @@ -134,9 +134,9 @@ public class Language2 { } /** - * ļƸʽ + * 语言文件名称格式化 * - * @param name ļ + * @param name 语言文件名称 * @return String */ private String formatName(String name) { @@ -144,7 +144,7 @@ public class Language2 { } /** - * ļгʼ + * 语言文件夹初始化 * * @param plugin */ diff --git a/src/main/src/me/skymc/taboolib/string/language2/Language2Format.java b/src/main/java/me/skymc/taboolib/string/language2/Language2Format.java similarity index 74% rename from src/main/src/me/skymc/taboolib/string/language2/Language2Format.java rename to src/main/java/me/skymc/taboolib/string/language2/Language2Format.java index 37fd81d..634bb15 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/Language2Format.java +++ b/src/main/java/me/skymc/taboolib/string/language2/Language2Format.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import lombok.Getter; import me.skymc.taboolib.string.language2.value.Language2Action; +import me.skymc.taboolib.string.language2.value.Language2Book; import me.skymc.taboolib.string.language2.value.Language2Json; import me.skymc.taboolib.string.language2.value.Language2Sound; import me.skymc.taboolib.string.language2.value.Language2Text; @@ -27,83 +28,90 @@ public class Language2Format implements Language2Line { private List language2Lines = new ArrayList<>(); /** - * 췽 + * 构造方法 * - * @param value + * @param value 父类 */ public Language2Format(Player player, Language2Value value) { language2Value = value; - // + // 语言类型 Language2Type type = Language2Type.TEXT; - // ݽ + // 递交数据 List values = new LinkedList<>(); - // + // 遍历内容 for (String line : value.getLanguageValue()) { - // ı + // 文本类型 if (line.contains("[text]")) { - // ݽ + // 递交数据 parseValue(player, values, type); - // + // 更改类型 type = Language2Type.TEXT; } - // + // 大标题 else if (line.contains("[title]")) { - // ݽ + // 递交数据 parseValue(player, values, type); - // + // 更改类型 type = Language2Type.TITLE; } - // С + // 小标题 else if (line.contains("[action]")) { - // ݽ + // 递交数据 parseValue(player, values, type); - // + // 更改类型 type = Language2Type.ACTION; } // JSON else if (line.contains("[json]")) { - // ݽ + // 递交数据 parseValue(player, values, type); - // + // 更改类型 type = Language2Type.JSON; } - // Ч + // 音效 else if (line.contains("[sound]")) { - // ݽ + // 递交数据 parseValue(player, values, type); - // + // 更改类型 type = Language2Type.SOUND; } + // 书本 + else if (line.contains("[book]")) { + // 递交数据 + parseValue(player, values, type); + // 更改类型 + type = Language2Type.BOOK; + } else if (line.contains("[return]")) { - // ݽ + // 递交数据 parseValue(player, values, type); } - // Ĭ + // 默认 else { - // ׷ + // 追加内容 values.add(line); } } } /** - * ʶ + * 识别内容 * - * @param player - * @param list - * @param type + * @param player 玩家 + * @param list 数据 + * @param type 类型 */ private void parseValue(Player player, List list, Language2Type type) { if (list.size() == 0) { return; } - // + // 大标题 if (type == Language2Type.TITLE) { language2Lines.add(new Language2Title(this, list)); } - // С + // 小标题 else if (type == Language2Type.ACTION) { language2Lines.add(new Language2Action(this, list)); } @@ -111,15 +119,19 @@ public class Language2Format implements Language2Line { else if (type == Language2Type.JSON) { language2Lines.add(new Language2Json(this, list, player)); } - // Ч + // 音效 else if (type == Language2Type.SOUND) { language2Lines.add(new Language2Sound(this, list)); } + // 书本 + else if (type == Language2Type.BOOK) { + language2Lines.add(new Language2Book(this, list, player)); + } else { language2Lines.add(new Language2Text(this, list)); } - // + // 清理数据 list.clear(); } diff --git a/src/main/src/me/skymc/taboolib/string/language2/Language2Line.java b/src/main/java/me/skymc/taboolib/string/language2/Language2Line.java similarity index 100% rename from src/main/src/me/skymc/taboolib/string/language2/Language2Line.java rename to src/main/java/me/skymc/taboolib/string/language2/Language2Line.java diff --git a/src/main/src/me/skymc/taboolib/string/language2/Language2Type.java b/src/main/java/me/skymc/taboolib/string/language2/Language2Type.java similarity index 58% rename from src/main/src/me/skymc/taboolib/string/language2/Language2Type.java rename to src/main/java/me/skymc/taboolib/string/language2/Language2Type.java index 872fe04..173e6ce 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/Language2Type.java +++ b/src/main/java/me/skymc/taboolib/string/language2/Language2Type.java @@ -2,32 +2,37 @@ package me.skymc.taboolib.string.language2; /** * @author sky - * @since 2018213 3:14:00 + * @since 2018年2月13日 下午3:14:00 */ public enum Language2Type { /** - * һı + * 一般文本 */ TEXT, /** - * JSON ı + * JSON 文本 */ JSON, /** - * + * 大标题 */ TITLE, /** - * С + * 小标题 */ ACTION, /** - * Ч + * 音效 */ SOUND, + + /** + * 书本 + */ + BOOK } diff --git a/src/main/src/me/skymc/taboolib/string/language2/Language2Value.java b/src/main/java/me/skymc/taboolib/string/language2/Language2Value.java similarity index 86% rename from src/main/src/me/skymc/taboolib/string/language2/Language2Value.java rename to src/main/java/me/skymc/taboolib/string/language2/Language2Value.java index 74f20ed..b88ba24 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/Language2Value.java +++ b/src/main/java/me/skymc/taboolib/string/language2/Language2Value.java @@ -16,7 +16,7 @@ import me.skymc.taboolib.string.language2.value.Language2Text; /** * @author sky - * @since 2018213 3:05:15 + * @since 2018年2月13日 下午3:05:15 */ public class Language2Value extends Object { @@ -36,44 +36,44 @@ public class Language2Value extends Object { private boolean enablePlaceholderAPI = false; /** - * 췽 + * 构造方法 */ public Language2Value(Language2 language, String languageKey) { - // ļ + // 如果语言文件不存在 if (language == null || languageKey == null) { languageValue = Arrays.asList(ChatColor.DARK_RED + "[]"); return; } - // ı + // 如果语言文本不存在 if (!language.getConfiguration().contains(languageKey)) { languageValue = Arrays.asList(ChatColor.DARK_RED + "[]"); return; } - // Ǽ + // 如果不是集合类型 if (language.getConfiguration().get(languageKey) instanceof List) { - // ı + // 设置文本 languageValue = asColored(language.getConfiguration().getStringList(languageKey)); - // ׷ӽβ + // 追加结尾 languageValue.add("[return]"); - // ǷPAPI + // 是否启用PAPI if (languageValue.get(0).contains("[papi]")) { enablePlaceholderAPI = true; } } else { - // ı + // 设置文本 languageValue = Arrays.asList(ChatColor.translateAlternateColorCodes('&', language.getConfiguration().getString(languageKey)), "[return]"); } - // ʼ + // 初始化变量 this.language = language; this.languageKey = languageKey; } /** - * ҷϢ + * 向玩家发送信息 * * @param player */ @@ -82,9 +82,9 @@ public class Language2Value extends Object { } /** - * ҷϢ + * 向玩家发送信息 * - * @param players + * @param players 玩家 */ public void send(List players) { for (Player player : players) { @@ -93,7 +93,7 @@ public class Language2Value extends Object { } /** - * ָ߷Ϣ + * 向指令发送者发送信息 * * @param sender */ @@ -107,21 +107,21 @@ public class Language2Value extends Object { } /** - * ȫ + * 全服公告 */ public void broadcast() { send(new ArrayList<>(Bukkit.getOnlinePlayers())); } /** - * ͵̨ + * 发送到后台 */ public void console() { new Language2Format(null, this).console(); } /** - * ȡı + * 获取文本 * * @return */ @@ -137,7 +137,7 @@ public class Language2Value extends Object { } /** - * ȡı + * 获取文本集合 * * @return */ @@ -153,10 +153,10 @@ public class Language2Value extends Object { } /** - * 滻 + * 变量替换 * - * @param value 滻ı - * @param player + * @param value 替换文本 + * @param player 检测玩家 * @return String */ public String setPlaceholder(String value, Player player) { @@ -167,10 +167,10 @@ public class Language2Value extends Object { } /** - * 滻 + * 变量替换 * - * @param list 滻 - * @param player + * @param list 替换集合 + * @param player 检测玩家 * @return {@link List} */ public List setPlaceholder(List list, Player player) { @@ -182,10 +182,10 @@ public class Language2Value extends Object { } /** - * 滻 + * 变量替换构造 * - * @param key - * @param value ֵ + * @param key 键 + * @param value 值 * @return {@link Language2Value} */ public Language2Value addPlaceholder(String key, String value) { @@ -194,7 +194,7 @@ public class Language2Value extends Object { } /** - * 滻ɫ + * 替换颜色 * * @param list * @return diff --git a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Action.java b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Action.java similarity index 90% rename from src/main/src/me/skymc/taboolib/string/language2/value/Language2Action.java rename to src/main/java/me/skymc/taboolib/string/language2/value/Language2Action.java index dd4ff11..d68253e 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Action.java +++ b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Action.java @@ -20,7 +20,7 @@ import me.skymc.taboolib.string.language2.Language2Value; /** * @author sky - * @since 2018213 3:58:07 + * @since 2018年2月13日 下午3:58:07 */ public class Language2Action implements Language2Line { @@ -37,27 +37,27 @@ public class Language2Action implements Language2Line { private Language2Value value; public Language2Action(Language2Format format, List list) { - // ʼ + // 变量初始化 this.value = format.getLanguage2Value(); - // ı + // 遍历文本 for (String message : list) { try { - // ʾ + // 动作栏提示 if (message.startsWith(KEY_TEXT)) { text = message.substring(KEY_TEXT.length()); } - // ʱ + // 持续时间 if (message.startsWith(KEY_STAY)) { repeat = NumberUtils.getInteger(message.substring(KEY_STAY.length())); } } catch (Exception e) { - // ʶ쳣 + // 识别异常 text = ChatColor.DARK_RED + "[]"; } } - // ظ + // 检查重复次数 if (repeat < 0) { repeat = 1; text = ChatColor.DARK_RED + "[]"; @@ -65,12 +65,12 @@ public class Language2Action implements Language2Line { } /** - * ͸ + * 发送给玩家 * - * @param player + * @param player 玩家 */ public void send(Player player) { - // 汾 + // 检查版本 if (TabooLib.getVerint() < 10800) { player.sendMessage(ChatColor.DARK_RED + "[]"); } diff --git a/src/main/java/me/skymc/taboolib/string/language2/value/Language2Book.java b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Book.java new file mode 100644 index 0000000..0452823 --- /dev/null +++ b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Book.java @@ -0,0 +1,215 @@ +package me.skymc.taboolib.string.language2.value; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import lombok.Getter; +import me.skymc.taboolib.bookformatter.BookFormatter; +import me.skymc.taboolib.bookformatter.action.ClickAction; +import me.skymc.taboolib.bookformatter.action.HoverAction; +import me.skymc.taboolib.bookformatter.builder.BookBuilder; +import me.skymc.taboolib.bookformatter.builder.PageBuilder; +import me.skymc.taboolib.bookformatter.builder.TextBuilder; +import me.skymc.taboolib.inventory.ItemUtils; +import me.skymc.taboolib.other.NumberUtils; +import me.skymc.taboolib.string.language2.Language2Format; +import me.skymc.taboolib.string.language2.Language2Line; +import me.skymc.taboolib.string.language2.Language2Value; + +/** + * @author sky + * @since 2018-03-10 15:55:28 + */ +public class Language2Book implements Language2Line { + + private static final String KEY_TEXT = " text: "; + private static final String KEY_COMMAND = " command: "; + private static final String KEY_SUGGEST = " suggest: "; + private static final String KEY_URL = " url: "; + private static final String KEY_PAGE = " page: "; + private static final String KEY_SHOWTEXT = " showtext: "; + private static final String KEY_SHOWITEM = " showitem: "; + private static final String KEY_OPTION = "@option:"; + private static final Pattern pattern = Pattern.compile("<@(\\S+)>"); + + @Getter + private Player player; + + @Getter + private Language2Value value; + + @Getter + private HashMap options = new HashMap<>(); + + @Getter + private BookBuilder book; + + public Language2Book(Language2Format format, List list, Player player) { + // 变量 + this.player = player; + this.value = format.getLanguage2Value(); + + // 获取书本设置 + formatOptions(list); + // 书本 + book = BookFormatter.writtenBook(); + // 内容 + PageBuilder page = new PageBuilder(); + // 遍历内容 + for (String line : list) { + // 翻页 + if (line.equals("[page]")) { + book.addPages(page.build()); + page = new PageBuilder(); + } + // 设置 + else if (line.startsWith("@option")) { + break; + } + else { + Matcher matcher = pattern.matcher(line); + boolean find = false; + while (matcher.find()) { + find = true; + String optionName = matcher.group(1); + String optionFullName = "<@" + matcher.group(1) + ">"; + // 判断设置是否存在 + if (!options.containsKey(optionName)) { + page.add("§4[]"); + } + else { + String[] line_split = line.split(optionFullName); + try { + // 单独一行 + if (line_split.length == 0) { + page.add(options.get(optionName).build()).endLine(); + } else { + // 前段 + page.add(line_split[0]); + // 变量 + page.add(options.get(optionName).build()); + // 后段 + if (line_split.length >= 2) { + // 获取文本 + StringBuilder sb = new StringBuilder(); + for (int i = 1 ; i < line_split.length ; i++) { + sb.append(line_split[i] + optionFullName); + } + // 更改文本 + line = sb.substring(0, sb.length() - optionFullName.length()); + // 如果后段还有变量 + if (!pattern.matcher(line).find()) { + page.add(line_split[1]).endLine(); + } + } else { + page.endLine(); + } + } + } + catch (Exception e) { + page.add("§4[]"); + } + } + } + if (!find) { + page.add(line).endLine(); + } + } + } + // 结尾 + book.addPages(page.build()); + } + + private void formatOptions(List list) { + // 获取书本设置 + HashMap> _options = getOptions(list); + for (Entry> entry : _options.entrySet()) { + TextBuilder builder = new TextBuilder(); + // 遍历内容 + for (String _option : entry.getValue()) { + if (_option.startsWith(KEY_TEXT)) { + builder.text(value.setPlaceholder(_option.substring(KEY_TEXT.length()), player)); + } + else if (_option.startsWith(KEY_COMMAND)) { + builder.onClick(ClickAction.runCommand(value.setPlaceholder(_option.substring(KEY_COMMAND.length()), player))); + } + else if (_option.startsWith(KEY_SUGGEST)) { + builder.onClick(ClickAction.suggestCommand(value.setPlaceholder(_option.substring(KEY_SUGGEST.length()), player))); + } + else if (_option.startsWith(KEY_URL)) { + try { + builder.onClick(ClickAction.openUrl(value.setPlaceholder(_option.substring(KEY_URL.length()), player))); + } + catch (Exception e) { + builder.text("§4[]"); + } + } + else if (_option.startsWith(KEY_PAGE)) { + builder.onClick(ClickAction.changePage(NumberUtils.getInteger(_option.substring(KEY_PAGE.length())))); + } + else if (_option.startsWith(KEY_SHOWTEXT)) { + builder.onHover(HoverAction.showText(value.setPlaceholder(_option.substring(KEY_SHOWTEXT.length()), player))); + } + else if (_option.startsWith(KEY_SHOWITEM)) { + ItemStack item = ItemUtils.getCacheItem(_option.substring(KEY_SHOWITEM.length())); + if (item == null) { + item = new ItemStack(Material.STONE); + } + builder.onHover(HoverAction.showItem(item)); + } + } + options.put(entry.getKey(), builder); + } + } + + private HashMap> getOptions(List list) { + HashMap> options_source = new HashMap<>(); + List option = new ArrayList<>(); + // 遍历 + String optionName = null; + boolean start = false; + // 遍历所有代码 + for (String line : list) { + if (line.startsWith(KEY_OPTION)) { + // 如果已经开始检测 + if (start) { + // 返回源码 + options_source.put(optionName, new ArrayList<>(option)); + // 清除源码 + option.clear(); + } + // 标签 + start = true; + // 当前设置名称 + optionName = line.substring(KEY_OPTION.length()); + } + else if (start) { + option.add(line); + } + } + // 返回最后设置 + options_source.put(optionName, option); + return options_source; + } + + @Override + public void send(Player player) { + BookFormatter.forceOpen(player, book.build()); + } + + @Override + public void console() { + Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[]"); + } +} diff --git a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Json.java b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Json.java similarity index 63% rename from src/main/src/me/skymc/taboolib/string/language2/value/Language2Json.java rename to src/main/java/me/skymc/taboolib/string/language2/value/Language2Json.java index 5ff756a..9a4a753 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Json.java +++ b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Json.java @@ -5,14 +5,19 @@ import java.util.List; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.Material; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import lombok.Getter; +import me.skymc.taboolib.inventory.ItemUtils; import me.skymc.taboolib.jsonformatter.JSONFormatter; import me.skymc.taboolib.jsonformatter.click.ClickEvent; +import me.skymc.taboolib.jsonformatter.click.OpenUrlEvent; import me.skymc.taboolib.jsonformatter.click.RunCommandEvent; import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent; import me.skymc.taboolib.jsonformatter.hover.HoverEvent; +import me.skymc.taboolib.jsonformatter.hover.ShowItemEvent; import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent; import me.skymc.taboolib.string.language2.Language2Format; import me.skymc.taboolib.string.language2.Language2Line; @@ -20,13 +25,15 @@ import me.skymc.taboolib.string.language2.Language2Value; /** * @author sky - * @since 2018213 4:11:33 + * @since 2018年2月13日 下午4:11:33 */ public class Language2Json implements Language2Line { private static final String KEY_TEXT = " text: "; private static final String KEY_COMMAND = " command: "; private static final String KEY_SUGGEST = " suggest: "; + private static final String KEY_URL = " url: "; + private static final String KEY_ITEM = " item: "; @Getter private Player player; @@ -41,75 +48,87 @@ public class Language2Json implements Language2Line { private StringBuffer text = new StringBuffer(); public Language2Json(Language2Format format, List list, Player player) { - // ״μ + // 首次检测 boolean isFirst = true; boolean isBreak = false; - // ʼ + // 变量初始化 this.value = format.getLanguage2Value(); this.player = player; - // ʼ + // 动作初始化 ClickEvent clickEvent = null; HoverEvent hoverEvent = null; - // ıʼ + // 文本初始化 String current = ChatColor.DARK_RED + "[]"; - // ı + // 遍历文本 for (String message : list) { try { - // ʾı + // 如果是显示文本 if (message.startsWith(KEY_TEXT)) { - hoverEvent = new ShowTextEvent(message.replace("||", "\n").substring(KEY_TEXT.length())); + hoverEvent = new ShowTextEvent(value.setPlaceholder(message.replace("||", "\n").substring(KEY_TEXT.length()), player)); } - // ִָ + // 显示物品 + else if (message.startsWith(KEY_ITEM)) { + ItemStack item = ItemUtils.getCacheItem(message.substring(KEY_ITEM.length())); + if (item == null) { + item = new ItemStack(Material.STONE); + } + hoverEvent = new ShowItemEvent(item); + } + // 执行指令 else if (message.startsWith(KEY_COMMAND)) { - clickEvent = new RunCommandEvent(message.substring(KEY_COMMAND.length())); + clickEvent = new RunCommandEvent(value.setPlaceholder(message.substring(KEY_COMMAND.length()), player)); } - // ӡָ + // 打印指令 else if (message.startsWith(KEY_SUGGEST)) { - clickEvent = new SuggestCommandEvent(message.substring(KEY_SUGGEST.length())); + clickEvent = new SuggestCommandEvent(value.setPlaceholder(message.substring(KEY_SUGGEST.length()), player)); } - // + // 打开连接 + else if (message.startsWith(KEY_URL)) { + clickEvent = new OpenUrlEvent(value.setPlaceholder(message.substring(KEY_SUGGEST.length()), player)); + } + // 换行 else if (message.equals("[break]")) { append(current, clickEvent, hoverEvent); - // ɾ + // 删除动作 clickEvent = null; hoverEvent = null; - // + // 换行 json.newLine(); - // + // 标记 isBreak = true; } - // + // 新内容 else { if (!isFirst && !isBreak) { append(current, clickEvent, hoverEvent); - // ɾ + // 删除动作 clickEvent = null; hoverEvent = null; } - // + // 更新 current = message; - // + // 标记 isFirst = false; isBreak = false; } } catch (Exception e) { - // ʶ쳣 + // 识别异常 json.append(ChatColor.DARK_RED + "[]"); } } - // ׷ + // 追加 append(current, clickEvent, hoverEvent); } /** - * ͸ + * 发送给玩家 * - * @param player + * @param player 玩家 */ public void send(Player player) { json.send(player); @@ -121,27 +140,27 @@ public class Language2Json implements Language2Line { } /** - * ׷ JSON + * 追加 JSON 内容 * - * @param current ı - * @param clickevent - * @param hoverEvent ʾ + * @param current 文本 + * @param clickevent 点击动作 + * @param hoverEvent 显示动作 */ private void append(String current, ClickEvent clickEvent, HoverEvent hoverEvent) { if (clickEvent == null && hoverEvent == null) { - // ı + // 纯文本 json.append(value.setPlaceholder(current, player)); } else if (clickEvent != null && hoverEvent == null) { - // + // 纯点击 json.appendClick(value.setPlaceholder(current, player), clickEvent); } else if (clickEvent == null && hoverEvent != null) { - // ʾ + // 纯显示 json.appendHover(value.setPlaceholder(current, player), hoverEvent); } else { - // ȫ + // 全部 json.appendHoverClick(value.setPlaceholder(current, player), hoverEvent, clickEvent); } - // ׷ʾı + // 追加显示文本 text.append(current); } } diff --git a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Sound.java b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Sound.java similarity index 98% rename from src/main/src/me/skymc/taboolib/string/language2/value/Language2Sound.java rename to src/main/java/me/skymc/taboolib/string/language2/value/Language2Sound.java index 3402c59..d5c9592 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Sound.java +++ b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Sound.java @@ -27,7 +27,7 @@ public class Language2Sound implements Language2Line { public Language2Sound(Language2Format format, List list) { this.value = format.getLanguage2Value(); - // ı + // 遍历文本 for (String line : list) { sounds.add(new SoundPack(line)); } diff --git a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Text.java b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Text.java similarity index 98% rename from src/main/src/me/skymc/taboolib/string/language2/value/Language2Text.java rename to src/main/java/me/skymc/taboolib/string/language2/value/Language2Text.java index ef03274..895a480 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Text.java +++ b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Text.java @@ -27,7 +27,7 @@ public class Language2Text implements Language2Line { public Language2Text(Language2Format format, List list) { this.value = format.getLanguage2Value(); - // ı + // 遍历文本 for (String line : list) { text.add(line); } diff --git a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Title.java b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Title.java similarity index 92% rename from src/main/src/me/skymc/taboolib/string/language2/value/Language2Title.java rename to src/main/java/me/skymc/taboolib/string/language2/value/Language2Title.java index 0838fc6..b601890 100644 --- a/src/main/src/me/skymc/taboolib/string/language2/value/Language2Title.java +++ b/src/main/java/me/skymc/taboolib/string/language2/value/Language2Title.java @@ -16,7 +16,7 @@ import me.skymc.taboolib.string.language2.Language2Value; /** * @author sky - * @since 2018213 3:58:07 + * @since 2018年2月13日 下午3:58:07 */ public class Language2Title implements Language2Line { @@ -43,20 +43,20 @@ public class Language2Title implements Language2Line { private Language2Value value; public Language2Title(Language2Format format, List list) { - // ʼ + // 变量初始化 this.value = format.getLanguage2Value(); - // ı + // 遍历文本 for (String message : list) { try { - // + // 大标题 if (message.startsWith(KEY_TITLE)) { title = message.substring(KEY_TITLE.length()); } - // С + // 小标题 else if (message.startsWith(KEY_SUBTITLE)) { subtitle = message.substring(KEY_SUBTITLE.length()); } - // ʱ + // 持续时间 else if (message.startsWith(KEY_STAYRULE)) { String rule = message.substring(KEY_STAYRULE.length()); fade1 = Integer.valueOf(rule.split("\\|")[0]); @@ -65,7 +65,7 @@ public class Language2Title implements Language2Line { } } catch (Exception e) { - // ʶ쳣 + // 识别异常 title = ChatColor.DARK_RED + "[]"; subtitle = ChatColor.DARK_RED + "[]"; } @@ -74,7 +74,7 @@ public class Language2Title implements Language2Line { @Override public void send(Player player) { - // 汾 + // 检查版本 if (TabooLib.getVerint() < 10800) { player.sendMessage(ChatColor.DARK_RED + "[]"); } diff --git a/src/main/src/me/skymc/taboolib/string/obfuscated/CT.java b/src/main/java/me/skymc/taboolib/string/obfuscated/CT.java similarity index 100% rename from src/main/src/me/skymc/taboolib/string/obfuscated/CT.java rename to src/main/java/me/skymc/taboolib/string/obfuscated/CT.java diff --git a/src/main/src/me/skymc/taboolib/string/obfuscated/FZ.java b/src/main/java/me/skymc/taboolib/string/obfuscated/FZ.java similarity index 100% rename from src/main/src/me/skymc/taboolib/string/obfuscated/FZ.java rename to src/main/java/me/skymc/taboolib/string/obfuscated/FZ.java diff --git a/src/main/src/me/skymc/taboolib/string/obfuscated/RS.java b/src/main/java/me/skymc/taboolib/string/obfuscated/RS.java similarity index 100% rename from src/main/src/me/skymc/taboolib/string/obfuscated/RS.java rename to src/main/java/me/skymc/taboolib/string/obfuscated/RS.java diff --git a/src/main/src/me/skymc/taboolib/support/SupportPlaceholder.java b/src/main/java/me/skymc/taboolib/support/SupportPlaceholder.java similarity index 91% rename from src/main/src/me/skymc/taboolib/support/SupportPlaceholder.java rename to src/main/java/me/skymc/taboolib/support/SupportPlaceholder.java index 4808939..1d75fe9 100644 --- a/src/main/src/me/skymc/taboolib/support/SupportPlaceholder.java +++ b/src/main/java/me/skymc/taboolib/support/SupportPlaceholder.java @@ -26,39 +26,39 @@ public class SupportPlaceholder extends EZPlaceholderHook { return GlobalDataManager.getVariableAsynchronous(sb.substring(0, sb.length() - 1), ""); } if (args.startsWith("tlm_kit_")) { - // Ƿ + // 是否启用 if (TabooLibraryModule.getInst().valueOf("Kits") == null) { return TLM.getInst().getLanguage().get("KIT-PLACEHOLDER.0").asString(); } - // ȡģ + // 获取模块 ModuleKits moduleKits = (ModuleKits) TabooLibraryModule.getInst().valueOf("Kits"); String kit = args.split("_")[2]; - // + // 礼包不存在 if (!moduleKits.contains(kit)) { return TLM.getInst().getLanguage().get("KIT-PLACEHOLDER.1").asString(); } - // Ƿȡ + // 是否领取 if (moduleKits.isPlayerRewared(player, kit)) { - // Ƿֻȡһ + // 是否只能领取一次 if (moduleKits.isDisposable(kit)) { return TLM.getInst().getLanguage().get("KIT-PLACEHOLDER.2").asString(); } - // Ƿȴ + // 是否冷却中 if (moduleKits.isPlayerCooldown(player, kit)) { return TLM.getInst().getLanguage().get("KIT-PLACEHOLDER.4").asString(); } } - // ǷȨȡ + // 是否有权限领取 String permission = moduleKits.getPermission(kit); if (permission != null && !player.hasPermission(permission)) { return TLM.getInst().getLanguage().get("KIT-PLACEHOLDER.5").asString(); } - // ȡ + // 可领取 return TLM.getInst().getLanguage().get("KIT-PLACEHOLDER.3").asString(); } return null; diff --git a/src/main/src/me/skymc/taboolib/support/SupportWorldGuard.java b/src/main/java/me/skymc/taboolib/support/SupportWorldGuard.java similarity index 100% rename from src/main/src/me/skymc/taboolib/support/SupportWorldGuard.java rename to src/main/java/me/skymc/taboolib/support/SupportWorldGuard.java diff --git a/src/main/src/me/skymc/taboolib/team/TagUtils.java b/src/main/java/me/skymc/taboolib/team/TagUtils.java similarity index 100% rename from src/main/src/me/skymc/taboolib/team/TagUtils.java rename to src/main/java/me/skymc/taboolib/team/TagUtils.java diff --git a/src/main/src/me/skymc/taboolib/thread/ThreadUtils.java b/src/main/java/me/skymc/taboolib/thread/ThreadUtils.java similarity index 82% rename from src/main/src/me/skymc/taboolib/thread/ThreadUtils.java rename to src/main/java/me/skymc/taboolib/thread/ThreadUtils.java index a8c96f9..4633651 100644 --- a/src/main/src/me/skymc/taboolib/thread/ThreadUtils.java +++ b/src/main/java/me/skymc/taboolib/thread/ThreadUtils.java @@ -8,9 +8,9 @@ public class ThreadUtils { private static LinkedList queue = new LinkedList<>(); /** - * 췽 + * 构造方法 * - * @param number ߳ + * @param number 线程数量 */ public ThreadUtils(int number) { threads = new PoolWorker[number]; @@ -23,7 +23,7 @@ public class ThreadUtils { } /** - * ֹͣ + * 停止工作 * */ public void stop() { @@ -33,16 +33,16 @@ public class ThreadUtils { } /** - * + * 添加任务 * * @param r */ public void execute(Runnable r) { - // ߳ + // 线程锁 synchronized (queue) { - // + // 添加任务 queue.addLast(r); - // ʼ + // 开始任务 queue.notify(); } } @@ -55,12 +55,12 @@ public class ThreadUtils { while (true) { - // ߳ + // 线程锁 synchronized (queue) { - // Ϊ + // 如果任务为空 while (queue.isEmpty()) { - // ȴ + // 等待任务 try { queue.wait(); } @@ -68,11 +68,11 @@ public class ThreadUtils { } } - // ȡ + // 获取任务 runnable = queue.removeFirst(); } - // + // 运行任务 try { runnable.run(); } diff --git a/src/main/src/me/skymc/taboolib/timecycle/TimeCycle.java b/src/main/java/me/skymc/taboolib/timecycle/TimeCycle.java similarity index 100% rename from src/main/src/me/skymc/taboolib/timecycle/TimeCycle.java rename to src/main/java/me/skymc/taboolib/timecycle/TimeCycle.java diff --git a/src/main/src/me/skymc/taboolib/timecycle/TimeCycleEvent.java b/src/main/java/me/skymc/taboolib/timecycle/TimeCycleEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/timecycle/TimeCycleEvent.java rename to src/main/java/me/skymc/taboolib/timecycle/TimeCycleEvent.java diff --git a/src/main/src/me/skymc/taboolib/timecycle/TimeCycleInitializeEvent.java b/src/main/java/me/skymc/taboolib/timecycle/TimeCycleInitializeEvent.java similarity index 100% rename from src/main/src/me/skymc/taboolib/timecycle/TimeCycleInitializeEvent.java rename to src/main/java/me/skymc/taboolib/timecycle/TimeCycleInitializeEvent.java diff --git a/src/main/src/me/skymc/taboolib/timecycle/TimeCycleManager.java b/src/main/java/me/skymc/taboolib/timecycle/TimeCycleManager.java similarity index 84% rename from src/main/src/me/skymc/taboolib/timecycle/TimeCycleManager.java rename to src/main/java/me/skymc/taboolib/timecycle/TimeCycleManager.java index a8aed03..184efa1 100644 --- a/src/main/src/me/skymc/taboolib/timecycle/TimeCycleManager.java +++ b/src/main/java/me/skymc/taboolib/timecycle/TimeCycleManager.java @@ -17,7 +17,7 @@ import me.skymc.taboolib.playerdata.DataUtils; public class TimeCycleManager { /** - * һθ£ 201811621:07:49 + * 最后一次更新: 2018年1月16日21:07:49 * * @author sky */ @@ -25,7 +25,7 @@ public class TimeCycleManager { private static ConcurrentHashMap cycles = new ConcurrentHashMap<>(); /** - * ȡڹ + * 获取周期管理器 * * @param name * @return @@ -35,7 +35,7 @@ public class TimeCycleManager { } /** - * ȡڹ + * 获取所有周期管理器 * * @return */ @@ -44,7 +44,7 @@ public class TimeCycleManager { } /** - * ɾ + * 彻底删除周期数据 * * @param name */ @@ -58,7 +58,7 @@ public class TimeCycleManager { } /** - * עڹ + * 注册周期管理器 * * @param cycle */ @@ -67,12 +67,12 @@ public class TimeCycleManager { cycles.put(cycle.getName(), cycle); } else { - MsgUtils.warn("עڹ 8" + cycle.getName() + "c ʧ, ԭ: &4ظ"); + MsgUtils.warn("注册周期管理器 §8" + cycle.getName() + "§c 失败, 原因: &4名称重复"); } } /** - * עڹ + * 注销周期管理器 * * @param name * @return @@ -82,7 +82,7 @@ public class TimeCycleManager { } /** - * עڹ + * 注销插件所有周期管理器 * * @param plugin */ @@ -95,7 +95,7 @@ public class TimeCycleManager { } /** - * һθ¼ + * 设置上一次更新事件 * * @param name * @param time @@ -109,7 +109,7 @@ public class TimeCycleManager { } /** - * ȡһˢʱ + * 获取下一次刷新时间 * * @param name * @return @@ -123,7 +123,7 @@ public class TimeCycleManager { } /** - * ȡһˢʱ + * 获取上一次刷新时间 * * @param name * @return @@ -138,31 +138,31 @@ public class TimeCycleManager { public static void load() { - // ע + // 注册调度器 new BukkitRunnable() { @Override public void run() { for (TimeCycle cycle : cycles.values()) { - // ûбִй + // 调度器没有被执行过 if (!GlobalDataManager.contains("timecycle:" + cycle.getName())) { long time = new TimeCycleInitializeEvent(cycle, System.currentTimeMillis()).call().getTimeline(); - // ʼ + // 初始化 GlobalDataManager.setVariable("timecycle:" + cycle.getName(), String.valueOf(time)); - // + // 触发器 Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle)); } - // ˢʱ + // 如果超出刷新时间 else if (System.currentTimeMillis() >= getAfterTimeline(cycle.getName())) { long time = System.currentTimeMillis(); - // ʱ 30 + // 如果时间差大于 30 秒 if (time - getAfterTimeline(cycle.getName()) > 30000) { - // ʼ + // 初始化 time = new TimeCycleInitializeEvent(cycle, time).call().getTimeline(); } - // + // 重置 GlobalDataManager.setVariable("timecycle:" + cycle.getName(), String.valueOf(time)); - // + // 触发器 Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle)); } } diff --git a/src/main/src/me/skymc/taboolib/update/UpdateTask.java b/src/main/java/me/skymc/taboolib/update/UpdateTask.java similarity index 69% rename from src/main/src/me/skymc/taboolib/update/UpdateTask.java rename to src/main/java/me/skymc/taboolib/update/UpdateTask.java index 42908a8..1178911 100644 --- a/src/main/src/me/skymc/taboolib/update/UpdateTask.java +++ b/src/main/java/me/skymc/taboolib/update/UpdateTask.java @@ -13,19 +13,19 @@ import me.skymc.taboolib.message.MsgUtils; /** * @author sky - * @since 2018223 10:39:14 + * @since 2018年2月23日 下午10:39:14 */ public class UpdateTask { /** - * + * 检测更新 */ public UpdateTask() { new BukkitRunnable() { @Override public void run() { - // Ƿ + // 是否禁用 if (!Main.getInst().getConfig().getBoolean("UPDATE-CHECK")) { return; } @@ -34,19 +34,19 @@ public class UpdateTask { Pattern pattern = Pattern.compile(""); Matcher matcher = pattern.matcher(value); if (matcher.find()) { - // °汾 + // 最新版本 double newVersion = Double.valueOf(matcher.group(1)); - // ° + // 如果是最新版 if (TabooLib.getPluginVersion() == newVersion) { - MsgUtils.send("°, !"); + MsgUtils.send("插件已是最新版, 无需更新!"); } else { MsgUtils.send("&8####################################################"); - MsgUtils.send("⵽µİ汾!"); - MsgUtils.send("ǰ汾: &f" + TabooLib.getPluginVersion()); - MsgUtils.send("°汾: &f" + newVersion); - MsgUtils.send("صַ: &fhttp://www.mcbbs.net/thread-773065-1-1.html"); - MsgUtils.send("Դַ: &fhttps://github.com/Bkm016/TabooLib/"); + MsgUtils.send("检测到有新的版本更新!"); + MsgUtils.send("当前版本: &f" + TabooLib.getPluginVersion()); + MsgUtils.send("最新版本: &f" + newVersion); + MsgUtils.send("下载地址: &fhttp://www.mcbbs.net/thread-773065-1-1.html"); + MsgUtils.send("开源地址: &fhttps://github.com/Bkm016/TabooLib/"); MsgUtils.send("&8####################################################"); } } diff --git a/src/main/src/me/skymc/tlm/TLM.java b/src/main/java/me/skymc/tlm/TLM.java similarity index 81% rename from src/main/src/me/skymc/tlm/TLM.java rename to src/main/java/me/skymc/tlm/TLM.java index 98fa270..cb1eb8f 100644 --- a/src/main/src/me/skymc/tlm/TLM.java +++ b/src/main/java/me/skymc/tlm/TLM.java @@ -16,7 +16,7 @@ import me.skymc.tlm.module.sub.ModuleTimeCycle; /** * @author sky - * @since 2018217 10:28:05 + * @since 2018年2月17日 下午10:28:05 */ public class TLM { @@ -29,13 +29,13 @@ public class TLM { private Language2 language; /** - * 췽 + * 构造方法 */ private TLM() { - // ļ + // 重载配置文件 reloadConfig(); - // ģ + // 载入模块 if (isEnableModule("TimeCycle")) { TabooLibraryModule.getInst().register(new ModuleTimeCycle()); } @@ -49,15 +49,15 @@ public class TLM { TabooLibraryModule.getInst().register(new ModuleInventorySave()); } - // ģ + // 载入模块 TabooLibraryModule.getInst().loadModules(); - // ʾ - MsgUtils.send(" &f" + TabooLibraryModule.getInst().getSize() + " &7 &fTLM &7ģ"); + // 提示 + MsgUtils.send("载入 &f" + TabooLibraryModule.getInst().getSize() + " &7个 &fTLM &7模块"); } /** - * ȡ TLM + * 获取 TLM 对象 * * @return TLM */ @@ -73,23 +73,23 @@ public class TLM { } /** - * ļ + * 载入配置文件 */ public void reloadConfig() { config = ConfigUtils.saveDefaultConfig(Main.getInst(), "module.yml"); - // ļ + // 载入语言文件 try { language = new Language2(config.getString("Language"), Main.getInst()); } catch (Exception e) { - MsgUtils.warn("ļ: &4" + config.getString("Language")); + MsgUtils.warn("语言文件不存在: &4" + config.getString("Language")); return; } } /** - * ģǷ + * 模块是否启用 * - * @param name + * @param name 名称 * @return boolean */ public boolean isEnableModule(String name) { diff --git a/src/main/src/me/skymc/tlm/annotation/DisableConfig.java b/src/main/java/me/skymc/tlm/annotation/DisableConfig.java similarity index 100% rename from src/main/src/me/skymc/tlm/annotation/DisableConfig.java rename to src/main/java/me/skymc/tlm/annotation/DisableConfig.java diff --git a/src/main/src/me/skymc/tlm/command/TLMCommands.java b/src/main/java/me/skymc/tlm/command/TLMCommands.java similarity index 94% rename from src/main/src/me/skymc/tlm/command/TLMCommands.java rename to src/main/java/me/skymc/tlm/command/TLMCommands.java index ddef943..38185bc 100644 --- a/src/main/src/me/skymc/tlm/command/TLMCommands.java +++ b/src/main/java/me/skymc/tlm/command/TLMCommands.java @@ -12,7 +12,7 @@ import me.skymc.tlm.command.sub.TLMReloadCommand; /** * @author sky - * @since 2018218 12:02:08 + * @since 2018年2月18日 上午12:02:08 */ public class TLMCommands implements CommandExecutor { @@ -26,7 +26,7 @@ public class TLMCommands implements CommandExecutor { } } - // + // 重载 else if (args[0].equalsIgnoreCase("reload")) { if (sender.hasPermission("taboolib.admin")) { new TLMReloadCommand(sender, args); @@ -35,7 +35,7 @@ public class TLMCommands implements CommandExecutor { } } - // г + // 列出 else if (args[0].equalsIgnoreCase("list")) { if (sender.hasPermission("taboolib.admin")) { new TLMListCommand(sender, args); @@ -44,7 +44,7 @@ public class TLMCommands implements CommandExecutor { } } - // InventorySave ģ + // InventorySave 模块 else if (args[0].equalsIgnoreCase("inv")) { if (sender.hasPermission("taboolib.admin")) { new TLMInvCommand(sender, args); @@ -53,7 +53,7 @@ public class TLMCommands implements CommandExecutor { } } - // Kit ģ + // Kit 模块 else if (args[0].equalsIgnoreCase("kit")) { new TLMKitCommand(sender, args); } diff --git a/src/main/src/me/skymc/tlm/command/sub/TLMInvCommand.java b/src/main/java/me/skymc/tlm/command/sub/TLMInvCommand.java similarity index 87% rename from src/main/src/me/skymc/tlm/command/sub/TLMInvCommand.java rename to src/main/java/me/skymc/tlm/command/sub/TLMInvCommand.java index a301a6f..0012b99 100644 --- a/src/main/src/me/skymc/tlm/command/sub/TLMInvCommand.java +++ b/src/main/java/me/skymc/tlm/command/sub/TLMInvCommand.java @@ -19,7 +19,7 @@ import me.skymc.tlm.module.sub.ModuleInventorySave; /** * @author sky - * @since 2018218 2:53:58 + * @since 2018年2月18日 下午2:53:58 */ public class TLMInvCommand extends SubCommand { @@ -34,52 +34,52 @@ public class TLMInvCommand extends SubCommand { return; } - // ȡģ + // 获取模块 ModuleInventorySave moduleInventorySave = (ModuleInventorySave) TabooLibraryModule.getInst().valueOf("InventorySave"); - // ж + // 判断命令 if (args.length == 1) { TLM.getInst().getLanguage().get("INV-EMPTY").send(sender); } - // г + // 列出背包 else if (args[1].equalsIgnoreCase("list")) { TLM.getInst().getLanguage().get("INV-LIST").addPlaceholder("$name", moduleInventorySave.getInventorys().toString()).send(sender); } - // 鿴 + // 查看背包 else if (args[1].equalsIgnoreCase("info")) { - // Ą̊́ + // 如果是后台 if (!(sender instanceof Player)) { TLM.getInst().getLanguage().get("INV-CONSOLE").send(sender); return; } - // жϳ + // 判断长度 if (args.length < 3) { TLM.getInst().getLanguage().get("INV-NAME").send(sender); return; } - // жϱ + // 判断背包 if (!moduleInventorySave.getInventorys().contains(args[2])) { TLM.getInst().getLanguage().get("INV-NOTFOUND").addPlaceholder("$name", args[2]).send(sender); return; } - // ȡ + // 获取玩家 Player player = (Player) sender; - // ȡƷ + // 获取物品 List items = moduleInventorySave.getItems(args[2]); - // 򿪽 + // 打开界面 Inventory inv = Bukkit.createInventory(new TLMInventoryHolder("InventorySave"), 54, TLM.getInst().getLanguage().get("INV-INFO-TITLE") .addPlaceholder("$name", args[2]) .asString()); - // Ʒ - ItemStack barrier = ItemUtils.setName(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15), "f"); + // 设置物品 + ItemStack barrier = ItemUtils.setName(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15), "§f"); for (int i = 9 ; i < 18 ; i++) { inv.setItem(i, barrier); @@ -98,58 +98,58 @@ public class TLMInvCommand extends SubCommand { inv.setItem(3, items.get(37)); inv.setItem(4, items.get(36)); - // жϰ汾 + // 判断版本 if (items.size() == 41) { inv.setItem(6, items.get(40)); } - // 򿪱 + // 打开背包 player.openInventory(inv); } - // 汳 + // 保存背包 else if (args[1].equalsIgnoreCase("save")) { - // Ą̊́ + // 如果是后台 if (!(sender instanceof Player)) { TLM.getInst().getLanguage().get("INV-CONSOLE").send(sender); return; } - // жϳ + // 判断长度 if (args.length < 3) { TLM.getInst().getLanguage().get("INV-NAME").send(sender); return; } - // ȡ + // 获取玩家 Player player = (Player) sender; - // 汳 + // 保存背包 moduleInventorySave.saveInventory(player, args[2]); - // ʾϢ + // 提示信息 TLM.getInst().getLanguage().get("INV-SAVE").addPlaceholder("$name", args[2]).send(player); } - // DZ + // 覆盖背包 else if (args[1].equalsIgnoreCase("paste")) { - // жϳ + // 判断长度 if (args.length < 3) { TLM.getInst().getLanguage().get("INV-NAME").send(sender); return; } - // жϱ + // 判断背包 if (!moduleInventorySave.getInventorys().contains(args[2])) { TLM.getInst().getLanguage().get("INV-NOTFOUND").addPlaceholder("$name", args[2]).send(sender); return; } - // ȡ + // 获取玩家 Player player; if (args.length > 3) { player = Bukkit.getPlayerExact(args[3]); - // Ҳ + // 玩家不存在 if (player == null) { TLM.getInst().getLanguage().get("INV-OFFLINE").addPlaceholder("$name", args[3]).send(sender); return; @@ -161,12 +161,12 @@ public class TLMInvCommand extends SubCommand { return; } - // DZ + // 覆盖背包 moduleInventorySave.pasteInventory(player, args[2]); - // + // 如果是玩家 if (sender instanceof Player) { - // ʾϢ + // 提示信息 TLM.getInst().getLanguage().get("INV-PASTE") .addPlaceholder("$name", args[2]) .addPlaceholder("$player", player.getName()) @@ -174,24 +174,24 @@ public class TLMInvCommand extends SubCommand { } } - // ɾ + // 删除背包 else if (args[1].equalsIgnoreCase("delete")) { - // жϳ + // 判断长度 if (args.length < 3) { TLM.getInst().getLanguage().get("INV-NAME").send(sender); return; } - // жϱ + // 判断背包 if (!moduleInventorySave.getInventorys().contains(args[2])) { TLM.getInst().getLanguage().get("INV-NOTFOUND").addPlaceholder("$name", args[2]).send(sender); return; } - // ɾ + // 删除 moduleInventorySave.deleteInventory(args[2]); - // ʾϢ + // 提示信息 TLM.getInst().getLanguage().get("KIT-DELETE").addPlaceholder("$name", args[2]).send(sender); } diff --git a/src/main/src/me/skymc/tlm/command/sub/TLMKitCommand.java b/src/main/java/me/skymc/tlm/command/sub/TLMKitCommand.java similarity index 89% rename from src/main/src/me/skymc/tlm/command/sub/TLMKitCommand.java rename to src/main/java/me/skymc/tlm/command/sub/TLMKitCommand.java index 96a19ba..2e9d413 100644 --- a/src/main/src/me/skymc/tlm/command/sub/TLMKitCommand.java +++ b/src/main/java/me/skymc/tlm/command/sub/TLMKitCommand.java @@ -15,7 +15,7 @@ import me.skymc.tlm.module.sub.ModuleKits; /** * @author sky - * @since 2018218 2:53:58 + * @since 2018年2月18日 下午2:53:58 */ public class TLMKitCommand extends SubCommand { @@ -30,17 +30,17 @@ public class TLMKitCommand extends SubCommand { return; } - // ȡģ + // 获取模块 ModuleKits moduleKits = (ModuleKits) TabooLibraryModule.getInst().valueOf("Kits"); - // ж + // 判断命令 if (args.length == 1) { TLM.getInst().getLanguage().get("KIT-EMPTY").send(sender); return; } else if (args[1].equalsIgnoreCase("list")) { - // жȨ + // 判断权限 if (!sender.hasPermission("taboolib.kit.list")) { TLM.getInst().getLanguage().get("NOPERMISSION-KIT-LIST").send(sender); return; @@ -53,29 +53,29 @@ public class TLMKitCommand extends SubCommand { } else if (args[1].equalsIgnoreCase("reward")) { - // жȨ + // 判断权限 if (!sender.hasPermission("taboolib.kit.reward")) { TLM.getInst().getLanguage().get("NOPERMISSION-KIT-REWARD").send(sender); return; } - // + // 检查礼包 if (args.length < 3) { TLM.getInst().getLanguage().get("KIT-NAME").send(sender); return; } - // + // 礼包不存在 if (!moduleKits.contains(args[2])) { TLM.getInst().getLanguage().get("KIT-NOTFOUND").addPlaceholder("$kit", args[2]).send(sender); return; } - // ȡ + // 获取玩家 Player player; if (args.length > 3) { player = Bukkit.getPlayerExact(args[3]); - // Ҳ + // 玩家不存在 if (player == null) { TLM.getInst().getLanguage().get("KIT-OFFLINE").addPlaceholder("$name", args[3]).send(sender); return; @@ -87,75 +87,75 @@ public class TLMKitCommand extends SubCommand { return; } - // Ƿȡ + // 是否领取 if (moduleKits.isPlayerRewared(player, args[2])) { - // Ƿֻȡһ + // 是否只能领取一次 if (moduleKits.isDisposable(args[2])) { TLM.getInst().getLanguage().get("KIT-DISPOSABLE").addPlaceholder("$kit", args[2]).send(sender); return; } - // Ƿȴ + // 是否冷却中 if (moduleKits.isPlayerCooldown(player, args[2])) { TLM.getInst().getLanguage().get("KIT-COOLDOWN").addPlaceholder("$kit", args[2]).send(sender); return; } } - // ǷȨȡ + // 是否有权限领取 String permission = moduleKits.getPermission(args[2]); if (permission != null && !player.hasPermission(permission)) { - // ʾϢ + // 提示信息 player.sendMessage(moduleKits.getPermissionMessage(args[2])); return; } - // + // 发送礼包 List items = moduleKits.getItems(args[2]); for (ItemStack item : items) { - // Ʒ + // 给予物品 HashMap result = player.getInventory().addItem(item); - // ռ䲻 + // 如果背包空间不足 if (result.size() > 0 && moduleKits.isFullDrop(args[2])) { - // Ʒ + // 掉落物品 player.getWorld().dropItem(player.getLocation(), item); } } - // ִ + // 执行命令 for (String command : moduleKits.getCommands(args[2])) { Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("$player", player.getName())); } - // ȡ + // 已领取 moduleKits.setPlayerReward(player, args[2], true); - // ʾϢ + // 提示信息 TLM.getInst().getLanguage().get("KIT-SUCCESS").addPlaceholder("$kit", args[2]).send(sender); } else if (args[1].equalsIgnoreCase("reset")) { - // жȨ + // 判断权限 if (!sender.hasPermission("taboolib.kit.reset")) { TLM.getInst().getLanguage().get("NOPERMISSION-KIT-RESET").send(sender); return; } - // + // 检查礼包 if (args.length < 3) { TLM.getInst().getLanguage().get("KIT-NAME").send(sender); return; } - // + // 礼包不存在 if (!moduleKits.contains(args[2])) { TLM.getInst().getLanguage().get("KIT-NOTFOUND").addPlaceholder("$kit", args[2]).send(sender); return; } - // ȡ + // 获取玩家 Player player; if (args.length > 3) { player = Bukkit.getPlayerExact(args[3]); - // Ҳ + // 玩家不存在 if (player == null) { TLM.getInst().getLanguage().get("KIT-OFFLINE").addPlaceholder("$name", args[3]).send(sender); return; diff --git a/src/main/src/me/skymc/tlm/command/sub/TLMListCommand.java b/src/main/java/me/skymc/tlm/command/sub/TLMListCommand.java similarity index 66% rename from src/main/src/me/skymc/tlm/command/sub/TLMListCommand.java rename to src/main/java/me/skymc/tlm/command/sub/TLMListCommand.java index 430a7d6..2d8afea 100644 --- a/src/main/src/me/skymc/tlm/command/sub/TLMListCommand.java +++ b/src/main/java/me/skymc/tlm/command/sub/TLMListCommand.java @@ -8,7 +8,7 @@ import me.skymc.tlm.module.TabooLibraryModule; /** * @author sky - * @since 2018218 2:10:12 + * @since 2018年2月18日 下午2:10:12 */ public class TLMListCommand extends SubCommand { @@ -18,15 +18,15 @@ public class TLMListCommand extends SubCommand { */ public TLMListCommand(CommandSender sender, String[] args) { super(sender, args); - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lTaooLibraryModule Modules bl-----"); - sender.sendMessage("f"); + sender.sendMessage("§f"); + sender.sendMessage("§b§l----- §3§lTaooLibraryModule Modules §b§l-----"); + sender.sendMessage("§f"); for (ITabooLibraryModule module : TabooLibraryModule.getInst().keySet()) { - sender.sendMessage("f - 8" + module.getName()); + sender.sendMessage("§f - §8" + module.getName()); } - sender.sendMessage("f"); + sender.sendMessage("§f"); } } diff --git a/src/main/src/me/skymc/tlm/command/sub/TLMReloadCommand.java b/src/main/java/me/skymc/tlm/command/sub/TLMReloadCommand.java similarity index 71% rename from src/main/src/me/skymc/tlm/command/sub/TLMReloadCommand.java rename to src/main/java/me/skymc/tlm/command/sub/TLMReloadCommand.java index 96059e5..602f57d 100644 --- a/src/main/src/me/skymc/tlm/command/sub/TLMReloadCommand.java +++ b/src/main/java/me/skymc/tlm/command/sub/TLMReloadCommand.java @@ -10,7 +10,7 @@ import me.skymc.tlm.module.TabooLibraryModule; /** * @author sky - * @since 2018218 2:09:34 + * @since 2018年2月18日 下午2:09:34 */ public class TLMReloadCommand extends SubCommand { @@ -21,27 +21,27 @@ public class TLMReloadCommand extends SubCommand { public TLMReloadCommand(CommandSender sender, String[] args) { super(sender, args); if (args.length != 2) { - MsgUtils.send(sender, "&4"); + MsgUtils.send(sender, "&4参数错误。"); } else if (args[1].equalsIgnoreCase("tlm")) { TLM.getInst().reloadConfig(); - MsgUtils.send(sender, "&fTLM &7ļء"); + MsgUtils.send(sender, "&fTLM &7配置文件已重载。"); } else if (args[1].equalsIgnoreCase("all")) { TabooLibraryModule.getInst().reloadConfig(); - MsgUtils.send(sender, "ģļء"); + MsgUtils.send(sender, "所有模块配置文件已重载。"); } else { ITabooLibraryModule module = TabooLibraryModule.getInst().valueOf(args[1]); if (module == null) { - MsgUtils.send(sender, "&4ģ &c" + args[1] + " &4ڡ"); + MsgUtils.send(sender, "&4模块 &c" + args[1] + " &4不存在。"); } else { TabooLibraryModule.getInst().reloadConfig(module, true); - MsgUtils.send(sender, "ģ &f" + args[1] + " &7ļء"); + MsgUtils.send(sender, "模块 &f" + args[1] + " &7的配置文件已重载。"); } } } diff --git a/src/main/src/me/skymc/tlm/inventory/TLMInventoryHolder.java b/src/main/java/me/skymc/tlm/inventory/TLMInventoryHolder.java similarity index 85% rename from src/main/src/me/skymc/tlm/inventory/TLMInventoryHolder.java rename to src/main/java/me/skymc/tlm/inventory/TLMInventoryHolder.java index d3aa805..ca1cdee 100644 --- a/src/main/src/me/skymc/tlm/inventory/TLMInventoryHolder.java +++ b/src/main/java/me/skymc/tlm/inventory/TLMInventoryHolder.java @@ -9,7 +9,7 @@ import lombok.Getter; /** * @author sky - * @since 2018222 3:34:59 + * @since 2018年2月22日 下午3:34:59 */ public class TLMInventoryHolder implements InventoryHolder { @@ -20,9 +20,9 @@ public class TLMInventoryHolder implements InventoryHolder { private HashMap holderData = new HashMap<>(); /** - * 췽 + * 构造方法 * - * @param module ģ + * @param module 模块名 */ public TLMInventoryHolder(String module) { this.module = module; diff --git a/src/main/src/me/skymc/tlm/module/ITabooLibraryModule.java b/src/main/java/me/skymc/tlm/module/ITabooLibraryModule.java similarity index 90% rename from src/main/src/me/skymc/tlm/module/ITabooLibraryModule.java rename to src/main/java/me/skymc/tlm/module/ITabooLibraryModule.java index 3e7d81b..860c8c1 100644 --- a/src/main/src/me/skymc/tlm/module/ITabooLibraryModule.java +++ b/src/main/java/me/skymc/tlm/module/ITabooLibraryModule.java @@ -4,7 +4,7 @@ import org.bukkit.configuration.file.FileConfiguration; /** * @author sky - * @since 2018217 11:22:42 + * @since 2018年2月17日 下午11:22:42 */ public abstract interface ITabooLibraryModule { diff --git a/src/main/src/me/skymc/tlm/module/TabooLibraryModule.java b/src/main/java/me/skymc/tlm/module/TabooLibraryModule.java similarity index 98% rename from src/main/src/me/skymc/tlm/module/TabooLibraryModule.java rename to src/main/java/me/skymc/tlm/module/TabooLibraryModule.java index 2801b56..3f92e9f 100644 --- a/src/main/src/me/skymc/tlm/module/TabooLibraryModule.java +++ b/src/main/java/me/skymc/tlm/module/TabooLibraryModule.java @@ -14,7 +14,7 @@ import me.skymc.tlm.annotation.DisableConfig; /** * @author sky - * @since 2018217 11:22:48 + * @since 2018年2月17日 下午11:22:48 */ public class TabooLibraryModule { diff --git a/src/main/src/me/skymc/tlm/module/sub/ModuleCommandChanger.java b/src/main/java/me/skymc/tlm/module/sub/ModuleCommandChanger.java similarity index 86% rename from src/main/src/me/skymc/tlm/module/sub/ModuleCommandChanger.java rename to src/main/java/me/skymc/tlm/module/sub/ModuleCommandChanger.java index 99cbdc3..e476392 100644 --- a/src/main/src/me/skymc/tlm/module/sub/ModuleCommandChanger.java +++ b/src/main/java/me/skymc/tlm/module/sub/ModuleCommandChanger.java @@ -9,7 +9,7 @@ import me.skymc.tlm.module.ITabooLibraryModule; /** * @author sky - * @since 2018222 1:32:29 + * @since 2018年2月22日 下午1:32:29 */ public class ModuleCommandChanger implements ITabooLibraryModule, Listener { @@ -20,15 +20,15 @@ public class ModuleCommandChanger implements ITabooLibraryModule, Listener { @EventHandler public void command(PlayerCommandPreprocessEvent e) { - // ѭ + // 循环命令 for (String id : getConfig().getConfigurationSection("Commands").getKeys(false)) { - // ȡ + // 获取命令 String key = getConfig().getString("Commands." + id + ".Input"); - // ж + // 判断命令 if (e.getMessage().startsWith(key)) { - // жִзʽ + // 判断执行方式 if (!getConfig().contains("Commands." + id + ".ReplaceMode") || getConfig().getString("Commands." + id + ".ReplaceMode").equals("PLAYER")) { - // 滻 + // 替换命令 e.setMessage(e.getMessage().replace(key, getConfig().getString("Commands." + id + ".Replace"))); return; } @@ -38,15 +38,15 @@ public class ModuleCommandChanger implements ITabooLibraryModule, Listener { @EventHandler public void command(ServerCommandEvent e) { - // ѭ + // 循环命令 for (String id : getConfig().getConfigurationSection("Commands").getKeys(false)) { - // ȡ + // 获取命令 String key = getConfig().getString("Commands." + id + ".Input"); - // ж + // 判断命令 if (e.getCommand().startsWith(key)) { - // жִзʽ + // 判断执行方式 if (!getConfig().contains("Commands." + id + ".ReplaceMode") || getConfig().getString("Commands." + id + ".ReplaceMode").equals("CONSOLE")) { - // 滻 + // 替换命令 e.setCommand(e.getCommand().replace(key, getConfig().getString("Commands." + id + ".Replace"))); return; } diff --git a/src/main/src/me/skymc/tlm/module/sub/ModuleInventorySave.java b/src/main/java/me/skymc/tlm/module/sub/ModuleInventorySave.java similarity index 73% rename from src/main/src/me/skymc/tlm/module/sub/ModuleInventorySave.java rename to src/main/java/me/skymc/tlm/module/sub/ModuleInventorySave.java index 482566a..4dd9265 100644 --- a/src/main/src/me/skymc/tlm/module/sub/ModuleInventorySave.java +++ b/src/main/java/me/skymc/tlm/module/sub/ModuleInventorySave.java @@ -23,7 +23,7 @@ import me.skymc.tlm.module.ITabooLibraryModule; /** * @author sky - * @since 2018222 2:48:27 + * @since 2018年2月22日 下午2:48:27 */ @DisableConfig public class ModuleInventorySave implements ITabooLibraryModule, Listener { @@ -50,13 +50,13 @@ public class ModuleInventorySave implements ITabooLibraryModule, Listener { } /** - * ұ + * 保存玩家背包 * - * @param player - * @param name + * @param player 玩家 + * @param name 名称 */ public void saveInventory(Player player, String name) { - // Ʒ + // 设置物品 for (int i = 0 ; i < (TabooLib.getVerint() > 10800 ? 41 : 40) ; i++) { ItemStack item = player.getInventory().getItem(i); conf.set(name + "." + i, item == null ? new ItemStack(Material.AIR) : item.clone()); @@ -64,67 +64,67 @@ public class ModuleInventorySave implements ITabooLibraryModule, Listener { } /** - * ұ + * 覆盖玩家背包 * - * @param player - * @param name + * @param player 玩家 + * @param name 名称 */ public void pasteInventory(Player player, String name) { - // + // 如果背包不存在 if (!conf.contains(name)) { - MsgUtils.warn("ģִ쳣: &4"); - MsgUtils.warn("ģ: &4InventorySave"); - MsgUtils.warn("λ: &4" + name); + MsgUtils.warn("模块执行异常: &4背包不存在"); + MsgUtils.warn("模块: &4InventorySave"); + MsgUtils.warn("位于: &4" + name); return; } - // Ʒ + // 设置物品 for (int i = 0 ; i < (TabooLib.getVerint() > 10800 ? 41 : 40) ; i++) { try { ItemStack item = (ItemStack) conf.get(name + "." + i); player.getInventory().setItem(i, item); } catch (Exception e) { - MsgUtils.warn("ģִ쳣: &4Ʒdz"); - MsgUtils.warn("ģ: &4InventorySave"); - MsgUtils.warn("λ: &4" + name + ":" + i); + MsgUtils.warn("模块执行异常: &4物品覆盖出错"); + MsgUtils.warn("模块: &4InventorySave"); + MsgUtils.warn("位于: &4" + name + ":" + i); } } } /** - * ȡƷ + * 获取背包内所有物品 * - * @param name + * @param name 背包名称 * @return {@link List} */ public List getItems(String name) { - // + // 如果背包不存在 if (!conf.contains(name)) { - MsgUtils.warn("ģִ쳣: &4"); - MsgUtils.warn("ģ: &4InventorySave"); - MsgUtils.warn("λ: &4" + name); + MsgUtils.warn("模块执行异常: &4背包不存在"); + MsgUtils.warn("模块: &4InventorySave"); + MsgUtils.warn("位于: &4" + name); return new LinkedList<>(); } List items = new LinkedList<>(); - // Ʒ + // 设置物品 for (int i = 0 ; i < (TabooLib.getVerint() > 10800 ? 41 : 40) ; i++) { try { ItemStack item = (ItemStack) conf.get(name + "." + i); items.add(item); } catch (Exception e) { - MsgUtils.warn("ģִ쳣: &4Ʒȡ"); - MsgUtils.warn("ģ: &4InventorySave"); - MsgUtils.warn("λ: &4" + name + ":" + i); + MsgUtils.warn("模块执行异常: &4物品获取出错"); + MsgUtils.warn("模块: &4InventorySave"); + MsgUtils.warn("位于: &4" + name + ":" + i); } } return items; } /** - * ȡб + * 获取所有背包 * * @return {@link Set} */ @@ -133,9 +133,9 @@ public class ModuleInventorySave implements ITabooLibraryModule, Listener { } /** - * ɾ + * 删除背包 * - * @param name + * @param name 名称 */ public void deleteInventory(String name) { conf.set(name, null); diff --git a/src/main/src/me/skymc/tlm/module/sub/ModuleKits.java b/src/main/java/me/skymc/tlm/module/sub/ModuleKits.java similarity index 100% rename from src/main/src/me/skymc/tlm/module/sub/ModuleKits.java rename to src/main/java/me/skymc/tlm/module/sub/ModuleKits.java diff --git a/src/main/src/me/skymc/tlm/module/sub/ModuleTimeCycle.java b/src/main/java/me/skymc/tlm/module/sub/ModuleTimeCycle.java similarity index 84% rename from src/main/src/me/skymc/tlm/module/sub/ModuleTimeCycle.java rename to src/main/java/me/skymc/tlm/module/sub/ModuleTimeCycle.java index 71f9e69..63766b5 100644 --- a/src/main/src/me/skymc/tlm/module/sub/ModuleTimeCycle.java +++ b/src/main/java/me/skymc/tlm/module/sub/ModuleTimeCycle.java @@ -20,7 +20,7 @@ import me.skymc.tlm.module.ITabooLibraryModule; /** * @author sky - * @since 2018217 11:23:38 + * @since 2018年2月17日 下午11:23:38 */ public class ModuleTimeCycle implements ITabooLibraryModule, Listener { @@ -31,51 +31,51 @@ public class ModuleTimeCycle implements ITabooLibraryModule, Listener { @Override public void onEnable() { - // + // 载入检查器 loadCycles(); } @Override public void onDisable() { - // ע + // 注销检查器 unloadCycles(); } @Override public void onReload() { - // ע + // 注销检查器 unloadCycles(); - // + // 载入检查器 loadCycles(); } @EventHandler public void onTimeCycleInitialize(TimeCycleInitializeEvent e) { if (e.getCycle().getName().contains("tlm|")) { - // ȡ + // 获取名称 String name = e.getCycle().getName().replace("tlm|", ""); - // гʼʱ + // 如果有初始化时间配置 if (getConfig().contains("TimeCycle." + name + ".Initialise.InitialiseDate")) { - // ȡʱ + // 获取时间 Calendar date = Calendar.getInstance(); - // ʼ + // 遍历初始化规则 for (String typeStr : getConfig().getStringList("TimeCycle." + name + ".Initialise.InitialiseDate")) { try { int type = (int) Calendar.class.getField(typeStr.split("=")[0]).get(Calendar.class); date.set(type, NumberUtils.getInteger(typeStr.split("=")[1])); } catch (Exception err) { - MsgUtils.warn("ģ쳣: &4ʹ"); - MsgUtils.warn("ģ: &4TimeCycle"); - MsgUtils.warn("λ: &4" + typeStr); + MsgUtils.warn("模块配置载入异常: &4日期类型错误"); + MsgUtils.warn("模块: &4TimeCycle"); + MsgUtils.warn("位于: &4" + typeStr); } } e.setTimeLine(date.getTimeInMillis()); } - // гʼ + // 如果有初始化命令 if (getConfig().contains("TimeCycle." + name + ".Initialise.InitialiseCommand")) { - // ʼ + // 遍历初始化命令 for (String command : getConfig().getStringList("TimeCycle." + name + ".Initialise.InitialiseCommand")) { - // ִ + // 执行命令 Bukkit.getScheduler().runTask(Main.getInst(), () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command)); } } @@ -85,13 +85,13 @@ public class ModuleTimeCycle implements ITabooLibraryModule, Listener { @EventHandler public void onTimeCycle(TimeCycleEvent e) { if (e.getCycle().getName().contains("tlm|")) { - // ȡ + // 获取名称 String name = e.getCycle().getName().replace("tlm|", ""); - // и + // 如果有更新命令 if (getConfig().contains("TimeCycle." + name + ".UpdateCommand")) { - // + // 遍历更新命令 for (String command : getConfig().getStringList("TimeCycle." + name + ".UpdateCommand")) { - // ִ + // 执行命令 Bukkit.getScheduler().runTask(Main.getInst(), () -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command)); } } diff --git a/src/main/src/me/skymc/taboolib/commands/sub/HelpCommand.java b/src/main/src/me/skymc/taboolib/commands/sub/HelpCommand.java deleted file mode 100644 index afa53fa..0000000 --- a/src/main/src/me/skymc/taboolib/commands/sub/HelpCommand.java +++ /dev/null @@ -1,80 +0,0 @@ -package me.skymc.taboolib.commands.sub; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map.Entry; - -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemFlag; - -import me.skymc.taboolib.TabooLib; -import me.skymc.taboolib.commands.SubCommand; -import me.skymc.taboolib.jsonformatter.JSONFormatter; -import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent; -import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent; - -public class HelpCommand extends SubCommand { - - public HelpCommand(CommandSender sender, String[] args) { - super(sender, args); - - HashMap helps = new LinkedHashMap<>(); - helps.put("/taboolib save 8[7ơ8]", "eƷ"); - helps.put("/taboolib item 8[7ơ8] 8<7ҡ8> 8<78>", "eƷ"); - helps.put("/taboolib iteminfo", "e鿴ƷϢ"); - helps.put("/taboolib itemlist", "e鿴Ʒ"); - helps.put("/taboolib itemreload", "eƷ"); - helps.put("a", null); - helps.put("/taboolib attributes", "e鿴"); - helps.put("/taboolib enchants", "e鿴иħ"); - helps.put("/taboolib potions", "e鿴ҩˮ"); - helps.put("/taboolib flags", "e鿴бǩ"); - helps.put("/taboolib slots", "e鿴вλ"); - helps.put("b", null); - helps.put("/taboolib getvariable 8[7-s|a8] 8[78]", "e鿴"); - helps.put("/taboolib setvariable 8[7-s|a8] 8[78] 8[7ֵ8]", "eı"); - helps.put("c", null); - helps.put("/taboolib cycle list", "eгʱ"); - helps.put("/taboolib cycle info 8[7ơ8]", "eѯϢ"); - helps.put("/taboolib cycle reset 8[7ơ8]", "eʼʱ"); - helps.put("/taboolib cycle update 8[7ơ8]", "eʱ"); - helps.put("f", null); - helps.put("/taboolib shell load 8[7ơ8]", "eijű"); - helps.put("/taboolib shell unload 8[7ơ8]", "eжijű"); - helps.put("e", null); - helps.put("/taboolib importdata", "4ݿ⵼뱾 8(òݿ)"); - - if (sender instanceof ConsoleCommandSender || TabooLib.getVerint() < 10900) { - sender.sendMessage("f"); - sender.sendMessage("bl----- 3lTaooLib Commands bl-----"); - sender.sendMessage("f"); - // - for (Entry entry : helps.entrySet()) { - if (entry.getValue() == null) { - sender.sendMessage("f"); - } else { - sender.sendMessage("f " + entry.getKey() + " 6- " + entry.getValue()); - } - } - sender.sendMessage("f"); - } - else if (sender instanceof Player) { - JSONFormatter json = new JSONFormatter(); - json.append("f"); json.newLine(); - json.append("bl----- 3lTaooLib Commands bl-----"); json.newLine(); - json.append("f"); json.newLine(); - // - for (Entry entry : helps.entrySet()) { - if (entry.getValue() == null) { - json.append("f"); json.newLine(); - } else { - json.appendHoverClick("f " + entry.getKey() + " 6- " + entry.getValue(), new ShowTextEvent("fָ"), new SuggestCommandEvent(entry.getKey().split("")[0])); json.newLine(); - } - } - json.append("f"); - json.send((Player) sender); - } - } -}