Update
This commit is contained in:
parent
ca72acd389
commit
e39981d691
@ -90,7 +90,7 @@ public abstract class PluginLoader {
|
||||
// 释放文检读取
|
||||
Optional.ofNullable(TConfig.getFiles().remove(plugin.getName())).ifPresent(files -> files.forEach(file -> TConfigWatcher.getInst().removeListener(file)));
|
||||
// 注销数据库连接
|
||||
DBSource.getDataSource().entrySet().stream().filter(dataEntry -> dataEntry.getKey().getPlugin().equals(plugin)).map(Map.Entry::getKey).forEach(DBSource::closeDataSource);
|
||||
DBSource.getDataSource().keySet().stream().filter(dbSourceData -> dbSourceData.getPlugin().equals(plugin)).forEach(DBSource::closeDataSource);
|
||||
// 注销调度器
|
||||
Bukkit.getScheduler().cancelTasks(plugin);
|
||||
// 卸载语言文件
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
@ -44,8 +44,9 @@ public class TabooLib {
|
||||
private static double version;
|
||||
|
||||
// 内部语言文件
|
||||
private YamlConfiguration internal = new YamlConfiguration();
|
||||
private final YamlConfiguration internal = new YamlConfiguration();
|
||||
|
||||
@SuppressWarnings("BusyWait")
|
||||
public TabooLib() {
|
||||
inst = this;
|
||||
logger = TLogger.getUnformatted("TabooLib");
|
||||
@ -53,13 +54,13 @@ public class TabooLib {
|
||||
config = TConfig.create(getPlugin(), "settings.yml");
|
||||
// 加载版本号
|
||||
try {
|
||||
version = NumberConversions.toDouble(IO.readFully(Files.getResource("__resources__/version"), Charset.forName("utf-8")));
|
||||
version = NumberConversions.toDouble(IO.readFully(Files.getResource("__resources__/version"), StandardCharsets.UTF_8));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
// 加载内部语言文件
|
||||
try {
|
||||
internal.loadFromString(IO.readFully(Files.getResource("__resources__/lang/internal.yml"), Charset.forName("utf-8")));
|
||||
internal.loadFromString(IO.readFully(Files.getResource("__resources__/lang/internal.yml"), StandardCharsets.UTF_8));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.util.stream.Collectors;
|
||||
* @Author 坏黑
|
||||
* @Since 2019-07-05 15:30
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class TabooLibLoader {
|
||||
|
||||
static Map<String, List<Class>> pluginClasses = Maps.newHashMap();
|
||||
|
@ -12,7 +12,7 @@ public enum Version {
|
||||
|
||||
v1_7(10700), v1_8(10800), v1_9(10900), v1_10(11000), v1_11(11100), v1_12(11200), v1_13(11300), v1_14(11400), v1_15(11500), v1_16(11600), vNull(0);
|
||||
|
||||
private int versionInt;
|
||||
private final int versionInt;
|
||||
|
||||
Version(int versionInt) {
|
||||
this.versionInt = versionInt;
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerAttackEvent extends EventCancellable<PlayerAttackEvent> {
|
||||
|
||||
private Player player;
|
||||
private Entity target;
|
||||
private final Player player;
|
||||
private final Entity target;
|
||||
|
||||
public PlayerAttackEvent(Player player, Entity target) {
|
||||
this.player = player;
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class PlayerJumpEvent extends EventCancellable<PlayerJumpEvent> {
|
||||
|
||||
private Player player;
|
||||
private final Player player;
|
||||
|
||||
public PlayerJumpEvent(Player player) {
|
||||
this.player = player;
|
||||
|
@ -46,7 +46,7 @@ public class ListenerCommand implements Listener {
|
||||
StartupLoader.register(ListenerCommand.class);
|
||||
}
|
||||
|
||||
abstract class Module {
|
||||
abstract static class Module {
|
||||
|
||||
abstract public String[] name();
|
||||
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
public class ListenerPlayerJump implements Listener {
|
||||
|
||||
@TInject
|
||||
private static Cooldown cooldown = new Cooldown("taboolib:jump", 350);
|
||||
private static final Cooldown cooldown = new Cooldown("taboolib:jump", 350);
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onJump(PlayerMoveEvent e) {
|
||||
|
@ -12,6 +12,7 @@ import java.util.List;
|
||||
* @Author sky
|
||||
* @Since 2020-03-24 23:54
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class StartupLoader {
|
||||
|
||||
static List<Class<?>> classList = Lists.newArrayList();
|
||||
|
@ -24,7 +24,7 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
public class InternalPlugin implements Plugin {
|
||||
|
||||
private static InternalPlugin plugin;
|
||||
private static final InternalPlugin plugin;
|
||||
|
||||
public static InternalPlugin getPlugin() {
|
||||
return plugin;
|
||||
|
@ -17,7 +17,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class InternalPluginLoader implements PluginLoader {
|
||||
|
||||
private static JavaPluginLoader loader;
|
||||
private static final JavaPluginLoader loader;
|
||||
|
||||
public static PluginLoader getLoader() {
|
||||
return loader;
|
||||
|
@ -30,12 +30,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class BridgeImpl extends InternalPluginBridge {
|
||||
|
||||
private Object economy;
|
||||
private Object permission;
|
||||
private Method getRegionManager;
|
||||
private boolean placeholder;
|
||||
private final boolean placeholder;
|
||||
private boolean worldguard;
|
||||
|
||||
public BridgeImpl() {
|
||||
|
@ -12,11 +12,11 @@ import java.util.List;
|
||||
*/
|
||||
public class ItemStack {
|
||||
|
||||
private List<String> type;
|
||||
private String name;
|
||||
private String lore;
|
||||
private int damage;
|
||||
private int amount;
|
||||
private final List<String> type;
|
||||
private final String name;
|
||||
private final String lore;
|
||||
private final int damage;
|
||||
private final int amount;
|
||||
|
||||
public ItemStack(String type, String name, String lore, int damage, int amount) {
|
||||
this.type = type == null ? null : Lists.newArrayList(type.split("\\|"));
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
* @Author sky
|
||||
* @Since 2018-09-20 20:47
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract class PathfinderExecutor {
|
||||
|
||||
public abstract Object getEntityInsentient(LivingEntity entity);
|
||||
|
@ -22,12 +22,13 @@ import java.util.Collection;
|
||||
* @Author sky
|
||||
* @Since 2018-09-20 20:57
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class InternalPathfinderExecutor extends PathfinderExecutor {
|
||||
|
||||
private Field pathEntity;
|
||||
private Field pathfinderGoalSelectorSet;
|
||||
private Field controllerJumpCurrent;
|
||||
private boolean v11400 = Version.isAfter(Version.v1_14);
|
||||
private final boolean v11400 = Version.isAfter(Version.v1_14);
|
||||
|
||||
public InternalPathfinderExecutor() {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user