This commit is contained in:
sky 2020-04-17 20:06:52 +08:00
parent ca72acd389
commit e39981d691
15 changed files with 26 additions and 20 deletions

View File

@ -90,7 +90,7 @@ public abstract class PluginLoader {
// 释放文检读取 // 释放文检读取
Optional.ofNullable(TConfig.getFiles().remove(plugin.getName())).ifPresent(files -> files.forEach(file -> TConfigWatcher.getInst().removeListener(file))); 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); Bukkit.getScheduler().cancelTasks(plugin);
// 卸载语言文件 // 卸载语言文件

View File

@ -15,7 +15,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.util.NumberConversions; import org.bukkit.util.NumberConversions;
import java.io.File; import java.io.File;
import java.nio.charset.Charset; import java.nio.charset.StandardCharsets;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
/** /**
@ -44,8 +44,9 @@ public class TabooLib {
private static double version; private static double version;
// 内部语言文件 // 内部语言文件
private YamlConfiguration internal = new YamlConfiguration(); private final YamlConfiguration internal = new YamlConfiguration();
@SuppressWarnings("BusyWait")
public TabooLib() { public TabooLib() {
inst = this; inst = this;
logger = TLogger.getUnformatted("TabooLib"); logger = TLogger.getUnformatted("TabooLib");
@ -53,13 +54,13 @@ public class TabooLib {
config = TConfig.create(getPlugin(), "settings.yml"); config = TConfig.create(getPlugin(), "settings.yml");
// 加载版本号 // 加载版本号
try { 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) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
} }
// 加载内部语言文件 // 加载内部语言文件
try { 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) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
} }

View File

@ -23,6 +23,7 @@ import java.util.stream.Collectors;
* @Author 坏黑 * @Author 坏黑
* @Since 2019-07-05 15:30 * @Since 2019-07-05 15:30
*/ */
@SuppressWarnings("rawtypes")
public class TabooLibLoader { public class TabooLibLoader {
static Map<String, List<Class>> pluginClasses = Maps.newHashMap(); static Map<String, List<Class>> pluginClasses = Maps.newHashMap();

View File

@ -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); 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) { Version(int versionInt) {
this.versionInt = versionInt; this.versionInt = versionInt;

View File

@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
public class PlayerAttackEvent extends EventCancellable<PlayerAttackEvent> { public class PlayerAttackEvent extends EventCancellable<PlayerAttackEvent> {
private Player player; private final Player player;
private Entity target; private final Entity target;
public PlayerAttackEvent(Player player, Entity target) { public PlayerAttackEvent(Player player, Entity target) {
this.player = player; this.player = player;

View File

@ -5,7 +5,7 @@ import org.bukkit.entity.Player;
public class PlayerJumpEvent extends EventCancellable<PlayerJumpEvent> { public class PlayerJumpEvent extends EventCancellable<PlayerJumpEvent> {
private Player player; private final Player player;
public PlayerJumpEvent(Player player) { public PlayerJumpEvent(Player player) {
this.player = player; this.player = player;

View File

@ -46,7 +46,7 @@ public class ListenerCommand implements Listener {
StartupLoader.register(ListenerCommand.class); StartupLoader.register(ListenerCommand.class);
} }
abstract class Module { abstract static class Module {
abstract public String[] name(); abstract public String[] name();

View File

@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
public class ListenerPlayerJump implements Listener { public class ListenerPlayerJump implements Listener {
@TInject @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) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onJump(PlayerMoveEvent e) { public void onJump(PlayerMoveEvent e) {

View File

@ -12,6 +12,7 @@ import java.util.List;
* @Author sky * @Author sky
* @Since 2020-03-24 23:54 * @Since 2020-03-24 23:54
*/ */
@SuppressWarnings("rawtypes")
public class StartupLoader { public class StartupLoader {
static List<Class<?>> classList = Lists.newArrayList(); static List<Class<?>> classList = Lists.newArrayList();

View File

@ -24,7 +24,7 @@ import java.util.logging.Logger;
*/ */
public class InternalPlugin implements Plugin { public class InternalPlugin implements Plugin {
private static InternalPlugin plugin; private static final InternalPlugin plugin;
public static InternalPlugin getPlugin() { public static InternalPlugin getPlugin() {
return plugin; return plugin;

View File

@ -17,7 +17,7 @@ import java.util.regex.Pattern;
*/ */
public class InternalPluginLoader implements PluginLoader { public class InternalPluginLoader implements PluginLoader {
private static JavaPluginLoader loader; private static final JavaPluginLoader loader;
public static PluginLoader getLoader() { public static PluginLoader getLoader() {
return loader; return loader;

View File

@ -30,12 +30,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@SuppressWarnings("rawtypes")
public class BridgeImpl extends InternalPluginBridge { public class BridgeImpl extends InternalPluginBridge {
private Object economy; private Object economy;
private Object permission; private Object permission;
private Method getRegionManager; private Method getRegionManager;
private boolean placeholder; private final boolean placeholder;
private boolean worldguard; private boolean worldguard;
public BridgeImpl() { public BridgeImpl() {

View File

@ -12,11 +12,11 @@ import java.util.List;
*/ */
public class ItemStack { public class ItemStack {
private List<String> type; private final List<String> type;
private String name; private final String name;
private String lore; private final String lore;
private int damage; private final int damage;
private int amount; private final int amount;
public ItemStack(String type, String name, String lore, int damage, int amount) { public ItemStack(String type, String name, String lore, int damage, int amount) {
this.type = type == null ? null : Lists.newArrayList(type.split("\\|")); this.type = type == null ? null : Lists.newArrayList(type.split("\\|"));

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.LivingEntity;
* @Author sky * @Author sky
* @Since 2018-09-20 20:47 * @Since 2018-09-20 20:47
*/ */
@SuppressWarnings("rawtypes")
public abstract class PathfinderExecutor { public abstract class PathfinderExecutor {
public abstract Object getEntityInsentient(LivingEntity entity); public abstract Object getEntityInsentient(LivingEntity entity);

View File

@ -22,12 +22,13 @@ import java.util.Collection;
* @Author sky * @Author sky
* @Since 2018-09-20 20:57 * @Since 2018-09-20 20:57
*/ */
@SuppressWarnings("rawtypes")
public class InternalPathfinderExecutor extends PathfinderExecutor { public class InternalPathfinderExecutor extends PathfinderExecutor {
private Field pathEntity; private Field pathEntity;
private Field pathfinderGoalSelectorSet; private Field pathfinderGoalSelectorSet;
private Field controllerJumpCurrent; private Field controllerJumpCurrent;
private boolean v11400 = Version.isAfter(Version.v1_14); private final boolean v11400 = Version.isAfter(Version.v1_14);
public InternalPathfinderExecutor() { public InternalPathfinderExecutor() {
try { try {