版本更新至:3.76
调整:开发框架改为 Gradle 新增:Language2 工具新增 [book] 类型
This commit is contained in:
parent
6439e4b780
commit
ad1a21196f
BIN
.gradle/4.5/fileChanges/last-build.bin
Normal file
BIN
.gradle/4.5/fileChanges/last-build.bin
Normal file
Binary file not shown.
BIN
.gradle/4.5/fileContent/annotation-processors.bin
Normal file
BIN
.gradle/4.5/fileContent/annotation-processors.bin
Normal file
Binary file not shown.
BIN
.gradle/4.5/fileContent/fileContent.lock
Normal file
BIN
.gradle/4.5/fileContent/fileContent.lock
Normal file
Binary file not shown.
BIN
.gradle/4.5/fileHashes/fileHashes.bin
Normal file
BIN
.gradle/4.5/fileHashes/fileHashes.bin
Normal file
Binary file not shown.
BIN
.gradle/4.5/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/4.5/fileHashes/fileHashes.lock
Normal file
Binary file not shown.
BIN
.gradle/4.5/fileHashes/resourceHashesCache.bin
Normal file
BIN
.gradle/4.5/fileHashes/resourceHashesCache.bin
Normal file
Binary file not shown.
BIN
.gradle/4.5/taskHistory/taskHistory.bin
Normal file
BIN
.gradle/4.5/taskHistory/taskHistory.bin
Normal file
Binary file not shown.
BIN
.gradle/4.5/taskHistory/taskHistory.lock
Normal file
BIN
.gradle/4.5/taskHistory/taskHistory.lock
Normal file
Binary file not shown.
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
Binary file not shown.
2
.gradle/buildOutputCleanup/cache.properties
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
@ -0,0 +1,2 @@
|
||||
#Sat Mar 10 18:07:09 CST 2018
|
||||
gradle.version=4.5
|
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
Binary file not shown.
0
.gradle/vcsWorkingDirs/gc.properties
Normal file
0
.gradle/vcsWorkingDirs/gc.properties
Normal file
2
.settings/org.eclipse.buildship.core.prefs
Normal file
2
.settings/org.eclipse.buildship.core.prefs
Normal file
@ -0,0 +1,2 @@
|
||||
#Sat Mar 10 18:07:18 CST 2018
|
||||
connection.project.dir=
|
3
.settings/org.eclipse.core.resources.prefs
Normal file
3
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java/me/skymc/taboolib/javashell/JavaShell.java=UTF-8
|
||||
encoding/<project>=UTF-8
|
39
build.gradle
Normal file
39
build.gradle
Normal file
@ -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()
|
||||
}
|
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -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
|
172
gradlew
vendored
Normal file
172
gradlew
vendored
Normal file
@ -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" "$@"
|
84
gradlew.bat
vendored
Normal file
84
gradlew.bat
vendored
Normal file
@ -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
|
@ -4,5 +4,7 @@ Language: 'zh_CN'
|
||||
# 启用模块
|
||||
# 该配置需要重启服务器才会生效
|
||||
EnableModule:
|
||||
#- 'TimeCycle'
|
||||
#- 'Kits'
|
||||
#- 'TimeCycle'
|
||||
#- 'CommandChanger'
|
||||
#- 'InventorySave'
|
@ -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]
|
||||
depend: [Vault]
|
||||
softdepend: [PlaceholderAPI, Skript, TabooCode]
|
||||
loadbefore: [Skript]
|
10
settings.gradle
Normal file
10
settings.gradle
Normal file
@ -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]'
|
BIN
src/.gradle/4.5/taskHistory/taskHistory.bin
Normal file
BIN
src/.gradle/4.5/taskHistory/taskHistory.bin
Normal file
Binary file not shown.
BIN
src/.gradle/4.5/taskHistory/taskHistory.lock
Normal file
BIN
src/.gradle/4.5/taskHistory/taskHistory.lock
Normal file
Binary file not shown.
BIN
src/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
BIN
src/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
Binary file not shown.
2
src/.gradle/buildOutputCleanup/cache.properties
Normal file
2
src/.gradle/buildOutputCleanup/cache.properties
Normal file
@ -0,0 +1,2 @@
|
||||
#Sat Mar 10 19:32:51 CST 2018
|
||||
gradle.version=4.5
|
@ -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;
|
@ -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
|
||||
*/
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ public class AnvilContainer_V1_11_R1 extends ContainerAnvil {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 方法已过期,已有新的方法
|
||||
* @deprecated 方法已过期,已有新的方法
|
||||
*/
|
||||
public static void openAnvil(Player p)
|
||||
{
|
@ -24,7 +24,7 @@ public class AnvilContainer_V1_8_R3 extends ContainerAnvil {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 方法已过期,已有新的方法
|
||||
* @deprecated 方法已过期,已有新的方法
|
||||
*/
|
||||
public static void openAnvil(Player p)
|
||||
{
|
@ -24,7 +24,7 @@ public class AnvilContainer_V1_9_4 extends ContainerAnvil {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 方法已过期,已有新的方法
|
||||
* @deprecated 方法已过期,已有新的方法
|
||||
*/
|
||||
public static void openAnvil(Player p)
|
||||
{
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
||||
|
||||
import static org.bukkit.Achievement.*;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class BookAchievement {
|
||||
|
||||
private static final HashMap<Achievement, String> achievements = new HashMap<>();
|
@ -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);
|
@ -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;
|
||||
}
|
@ -13,37 +13,37 @@ import me.skymc.taboolib.string.language2.Language2Value;
|
||||
|
||||
/**
|
||||
* @author sky
|
||||
* @since 2018年2月13日 下午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("§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");
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -14,23 +14,23 @@ public class AttributesCommand extends SubCommand {
|
||||
public AttributesCommand(CommandSender sender, String[] args) {
|
||||
super(sender, args);
|
||||
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lItemStack Attributes §b§l-----");
|
||||
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");
|
||||
}
|
||||
}
|
@ -15,21 +15,21 @@ public class EnchantCommand extends SubCommand {
|
||||
public EnchantCommand(CommandSender sender, String[] args) {
|
||||
super(sender, args);
|
||||
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lItemStack Enchantments §b§l-----");
|
||||
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");
|
||||
}
|
||||
}
|
@ -14,21 +14,21 @@ public class FlagCommand extends SubCommand {
|
||||
public FlagCommand(CommandSender sender, String[] args) {
|
||||
super(sender, args);
|
||||
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lItemStack Flags §b§l-----");
|
||||
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");
|
||||
}
|
||||
}
|
@ -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<String, String> 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<String, String> 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<String, String> 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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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("导入完成!");
|
||||
}
|
||||
}
|
||||
|
@ -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("§b§l----- §3§lItemStack Info §b§l-----");
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -15,23 +15,23 @@ public class PotionCommand extends SubCommand {
|
||||
public PotionCommand(CommandSender sender, String[] args) {
|
||||
super(sender, args);
|
||||
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lPotionEffect Types §b§l-----");
|
||||
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");
|
||||
}
|
||||
}
|
@ -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已保存");
|
||||
}
|
||||
}
|
||||
|
@ -14,23 +14,23 @@ public class SlotCommand extends SubCommand {
|
||||
public SlotCommand(CommandSender sender, String[] args) {
|
||||
super(sender, args);
|
||||
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lAttribute Slots §b§l-----");
|
||||
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");
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ public class CycleCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
else {
|
||||
MsgUtils.send(sender, "&4Ö¸Áî´íÎó");
|
||||
MsgUtils.send(sender, "&4指令错误");
|
||||
}
|
||||
}
|
||||
|
@ -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("§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");
|
||||
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
|
@ -20,23 +20,23 @@ public class CycleListCommand extends SubCommand {
|
||||
public CycleListCommand(CommandSender sender, String[] args) {
|
||||
super(sender, args);
|
||||
|
||||
sender.sendMessage("§f");
|
||||
sender.sendMessage("§b§l----- §3§lTimeCycle List §b§l-----");
|
||||
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
|
@ -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());
|
||||
}
|
@ -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());
|
||||
}
|
@ -9,7 +9,7 @@ import me.skymc.taboolib.other.NumberUtils;
|
||||
|
||||
/**
|
||||
* @author sky
|
||||
* @since 2018年2月4日 下午8:08:22
|
||||
* @since 2018年2月4日 下午8:08:22
|
||||
*/
|
||||
public class ItemListCommand extends SubCommand {
|
||||
|
@ -22,7 +22,7 @@ import me.skymc.taboolib.inventory.ItemUtils;
|
||||
|
||||
/**
|
||||
* @author sky
|
||||
* @since 2018年2月4日 下午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<String, ItemStack> 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<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
lore.add("§f");
|
||||
lore.add("§f§m ");
|
||||
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);
|
||||
}
|
@ -21,7 +21,7 @@ public class ShellCommand extends SubCommand {
|
||||
}
|
||||
}
|
||||
else {
|
||||
MsgUtils.send(sender, "&4Ö¸Áî´íÎó");
|
||||
MsgUtils.send(sender, "&4指令错误");
|
||||
}
|
||||
}
|
||||
|
@ -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] + " 已载入");
|
||||
}
|
||||
}
|
||||
|
@ -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
|
@ -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() + " (自动注销)");
|
||||
}
|
||||
}
|
||||
}
|
@ -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() + " (自动注销)");
|
||||
}
|
||||
}
|
||||
}
|
@ -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<String, SQLVariable> 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<HashMap<String, Object>> list = Main.getConnection().getValues(Main.getTablePrefix() + "_plugindata", "id", -1, false, "name", "variable", "upgrade");
|
||||
// 循环变量
|
||||
// 循环变量
|
||||
for (HashMap<String, Object> 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);
|
||||
}
|
||||
}
|
@ -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());
|
@ -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);
|
@ -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
|
@ -28,10 +28,10 @@ public class ConfigUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 以 UTF-8 的格式释放配置文件并载入
|
||||
* 以 UTF-8 的格式释放配置文件并载入
|
||||
*
|
||||
* 录入时间:2018年2月10日21: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;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user