diff --git a/src/main/java/com/github/euonmyoji/newhonor/Main.java b/src/main/java/com/github/euonmyoji/newhonor/Main.java index 46df3df..43733b5 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/Main.java +++ b/src/main/java/com/github/euonmyoji/newhonor/Main.java @@ -5,7 +5,7 @@ /** * @author yinyangshi */ -public class Main { +public final class Main { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "你执行插件jar文件干嘛?:D"); JOptionPane.showMessageDialog(null, "真想搞个无限弹对话窗啊#run"); diff --git a/src/main/java/com/github/euonmyoji/newhonor/NewHonor.java b/src/main/java/com/github/euonmyoji/newhonor/NewHonor.java index c527b67..0fde2a8 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/NewHonor.java +++ b/src/main/java/com/github/euonmyoji/newhonor/NewHonor.java @@ -7,13 +7,9 @@ import com.github.euonmyoji.newhonor.data.HonorValueData; import com.github.euonmyoji.newhonor.listener.NewHonorMessageListener; import com.github.euonmyoji.newhonor.listener.UltimateChatEventListener; -import com.github.euonmyoji.newhonor.manager.NucleusManager; -import com.github.euonmyoji.newhonor.manager.PlaceHolderManager; -import com.github.euonmyoji.newhonor.manager.ScoreBoardManager; -import com.github.euonmyoji.newhonor.task.DisplayHonorTaskManager; +import com.github.euonmyoji.newhonor.manager.*; import com.github.euonmyoji.newhonor.task.EffectsOffer; import com.github.euonmyoji.newhonor.task.HaloEffectsOffer; -import com.github.euonmyoji.newhonor.task.TaskManager; import com.google.common.base.Charsets; import com.google.gson.JsonObject; import com.google.gson.JsonParser; diff --git a/src/main/java/com/github/euonmyoji/newhonor/api/configuration/PlayerConfig.java b/src/main/java/com/github/euonmyoji/newhonor/api/configuration/PlayerConfig.java index 2d259ac..89a9f1a 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/api/configuration/PlayerConfig.java +++ b/src/main/java/com/github/euonmyoji/newhonor/api/configuration/PlayerConfig.java @@ -2,7 +2,7 @@ import com.github.euonmyoji.newhonor.NewHonor; import com.github.euonmyoji.newhonor.configuration.HonorConfig; -import com.github.euonmyoji.newhonor.configuration.LanguageManager; +import com.github.euonmyoji.newhonor.manager.LanguageManager; import com.github.euonmyoji.newhonor.configuration.NewHonorConfig; import com.github.euonmyoji.newhonor.data.HonorValueData; import com.github.euonmyoji.newhonor.manager.PlayerConfigManager; diff --git a/src/main/java/com/github/euonmyoji/newhonor/command/AdminCommand.java b/src/main/java/com/github/euonmyoji/newhonor/command/AdminCommand.java index 99fb8f0..c03d63e 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/command/AdminCommand.java +++ b/src/main/java/com/github/euonmyoji/newhonor/command/AdminCommand.java @@ -5,7 +5,7 @@ import com.github.euonmyoji.newhonor.configuration.EffectsConfig; import com.github.euonmyoji.newhonor.configuration.HonorConfig; import com.github.euonmyoji.newhonor.data.HonorValueData; -import com.github.euonmyoji.newhonor.task.TaskManager; +import com.github.euonmyoji.newhonor.manager.TaskManager; import com.github.euonmyoji.newhonor.util.Log; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandResult; @@ -23,12 +23,12 @@ import java.util.Objects; import java.util.stream.Collectors; -import static com.github.euonmyoji.newhonor.configuration.LanguageManager.getText; -import static com.github.euonmyoji.newhonor.configuration.LanguageManager.langBuilder; +import static com.github.euonmyoji.newhonor.manager.LanguageManager.getText; +import static com.github.euonmyoji.newhonor.manager.LanguageManager.langBuilder; import static org.spongepowered.api.text.Text.of; import static org.spongepowered.api.text.serializer.TextSerializers.FORMATTING_CODE; -class AdminCommand { +final class AdminCommand { private static NewHonor plugin = NewHonor.plugin; static CommandSpec refresh = CommandSpec.builder() diff --git a/src/main/java/com/github/euonmyoji/newhonor/command/EffectsCommand.java b/src/main/java/com/github/euonmyoji/newhonor/command/EffectsCommand.java index baae5aa..a97d2e3 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/command/EffectsCommand.java +++ b/src/main/java/com/github/euonmyoji/newhonor/command/EffectsCommand.java @@ -19,7 +19,7 @@ import java.util.Optional; import java.util.stream.Collectors; -class EffectsCommand { +final class EffectsCommand { static CommandSpec delete = CommandSpec.builder() .arguments(GenericArguments.onlyOne(GenericArguments.string(Text.of("effectsID")))) .executor((src, args) -> { diff --git a/src/main/java/com/github/euonmyoji/newhonor/command/HonorCommand.java b/src/main/java/com/github/euonmyoji/newhonor/command/HonorCommand.java index c55ba13..605611d 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/command/HonorCommand.java +++ b/src/main/java/com/github/euonmyoji/newhonor/command/HonorCommand.java @@ -21,7 +21,7 @@ import java.util.UUID; import java.util.stream.Collectors; -import static com.github.euonmyoji.newhonor.configuration.LanguageManager.*; +import static com.github.euonmyoji.newhonor.manager.LanguageManager.*; import static org.spongepowered.api.text.Text.of; import static org.spongepowered.api.text.action.TextActions.runCommand; import static org.spongepowered.api.text.action.TextActions.showText; @@ -29,7 +29,7 @@ /** * @author yinyangshi */ -public class HonorCommand { +public final class HonorCommand { private static String ADMIN_PERMISSION = "newhonor.admin"; private static final HashMap USE_CD = new HashMap<>(); private static String ID_KEY = "id"; diff --git a/src/main/java/com/github/euonmyoji/newhonor/command/SettingsArgs.java b/src/main/java/com/github/euonmyoji/newhonor/command/SettingsArgs.java index ae12248..e2aea07 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/command/SettingsArgs.java +++ b/src/main/java/com/github/euonmyoji/newhonor/command/SettingsArgs.java @@ -9,7 +9,7 @@ import static org.spongepowered.api.text.Text.of; -class SettingsArgs { +final class SettingsArgs { static CommandSpec usehonor = CommandSpec.builder() .arguments(GenericArguments.bool(of("boolean"))) diff --git a/src/main/java/com/github/euonmyoji/newhonor/command/SqlCommand.java b/src/main/java/com/github/euonmyoji/newhonor/command/SqlCommand.java index f804e8d..56b9b11 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/command/SqlCommand.java +++ b/src/main/java/com/github/euonmyoji/newhonor/command/SqlCommand.java @@ -2,8 +2,8 @@ import com.github.euonmyoji.newhonor.NewHonor; import com.github.euonmyoji.newhonor.configuration.LocalPlayerConfig; +import com.github.euonmyoji.newhonor.manager.MysqlManager; import com.github.euonmyoji.newhonor.configuration.NewHonorConfig; -import com.github.euonmyoji.newhonor.configuration.MysqlManager; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.spec.CommandSpec; import org.spongepowered.api.scheduler.Task; @@ -20,7 +20,7 @@ /** * @author yinyangshi */ -class SqlCommand { +final class SqlCommand { static CommandSpec updateToSql = CommandSpec.builder() .executor((src, args) -> { diff --git a/src/main/java/com/github/euonmyoji/newhonor/configuration/HonorConfig.java b/src/main/java/com/github/euonmyoji/newhonor/configuration/HonorConfig.java index 508543b..2c26565 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/configuration/HonorConfig.java +++ b/src/main/java/com/github/euonmyoji/newhonor/configuration/HonorConfig.java @@ -112,7 +112,7 @@ public static boolean isVirtual(String id) { return cfg.getChildrenMap(); } - static Optional getGetMessage(String id, String playername) { + public static Optional getGetMessage(String id, String playername) { //noinspection ConstantConditions 之前有检查 return Optional.ofNullable(cfg.getNode(id, "getMessage").getString(null)) .map(s -> "&r" + s.replace("{playername}", playername)) diff --git a/src/main/java/com/github/euonmyoji/newhonor/configuration/NewHonorConfig.java b/src/main/java/com/github/euonmyoji/newhonor/configuration/NewHonorConfig.java index 0896291..6fa59d8 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/configuration/NewHonorConfig.java +++ b/src/main/java/com/github/euonmyoji/newhonor/configuration/NewHonorConfig.java @@ -2,6 +2,7 @@ import com.github.euonmyoji.newhonor.NewHonor; import com.github.euonmyoji.newhonor.api.configuration.PlayerConfig; +import com.github.euonmyoji.newhonor.manager.MysqlManager; import com.google.common.reflect.TypeToken; import ninja.leaping.configurate.ConfigurationOptions; import ninja.leaping.configurate.commented.CommentedConfigurationNode; @@ -17,8 +18,8 @@ /** * @author yinyangshi */ -public class NewHonorConfig { - static CommentedConfigurationNode cfg; +public final class NewHonorConfig { + public static CommentedConfigurationNode cfg; private static final TypeToken> LIST_STRING_TYPE = new TypeToken>() { }; private static ConfigurationLoader loader; @@ -58,7 +59,7 @@ public static void init() { reload(); } - static Locale getUsingLang() { + public static Locale getUsingLang() { String[] args = cfg.getNode(LANGUAGE).getString(Locale.getDefault().toString()).split("_", 2); return new Locale(args[0], args[1]); } @@ -95,7 +96,7 @@ public static void save() { } } - static Optional> getDefaultOwnHonors() { + public static Optional> getDefaultOwnHonors() { try { return cfg.getNode(DEFAULT_HONORS_SETTINGS, "enable").getBoolean(true) ? Optional.ofNullable(cfg.getNode(DEFAULT_HONORS_SETTINGS, DEFAULT_HONORS).getValue(LIST_STRING_TYPE)) : Optional.empty(); diff --git a/src/main/java/com/github/euonmyoji/newhonor/listener/NewHonorMessageListener.java b/src/main/java/com/github/euonmyoji/newhonor/listener/NewHonorMessageListener.java index 09e69f3..ac29cef 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/listener/NewHonorMessageListener.java +++ b/src/main/java/com/github/euonmyoji/newhonor/listener/NewHonorMessageListener.java @@ -9,7 +9,7 @@ /** * @author yinyangshi */ -public class NewHonorMessageListener { +public final class NewHonorMessageListener { @Listener(order = Order.LAST) public void onChat(MessageChannelEvent.Chat event) { diff --git a/src/main/java/com/github/euonmyoji/newhonor/listener/UltimateChatEventListener.java b/src/main/java/com/github/euonmyoji/newhonor/listener/UltimateChatEventListener.java index 9a3a816..0970f3c 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/listener/UltimateChatEventListener.java +++ b/src/main/java/com/github/euonmyoji/newhonor/listener/UltimateChatEventListener.java @@ -12,7 +12,7 @@ /** * @author yinyangshi */ -public class UltimateChatEventListener { +public final class UltimateChatEventListener { @Listener public void sendCME(SendChannelMessageEvent event) { diff --git a/src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTaskManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/DisplayHonorTaskManager.java similarity index 81% rename from src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTaskManager.java rename to src/main/java/com/github/euonmyoji/newhonor/manager/DisplayHonorTaskManager.java index c6b1cb1..42d8856 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTaskManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/DisplayHonorTaskManager.java @@ -1,6 +1,7 @@ -package com.github.euonmyoji.newhonor.task; +package com.github.euonmyoji.newhonor.manager; import com.github.euonmyoji.newhonor.NewHonor; +import com.github.euonmyoji.newhonor.task.DisplayHonorTask; import org.spongepowered.api.scheduler.Task; import org.spongepowered.api.scoreboard.Team; import org.spongepowered.api.text.Text; @@ -11,8 +12,8 @@ /** * @author yinyangshi */ -public class DisplayHonorTaskManager { - static final HashMap TASKS = new HashMap<>(); +public final class DisplayHonorTaskManager { + public static final HashMap TASKS = new HashMap<>(); public static void submit(String id, List values, Team team, int[] delay) { synchronized (TASKS) { diff --git a/src/main/java/com/github/euonmyoji/newhonor/configuration/LanguageManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/LanguageManager.java similarity index 97% rename from src/main/java/com/github/euonmyoji/newhonor/configuration/LanguageManager.java rename to src/main/java/com/github/euonmyoji/newhonor/manager/LanguageManager.java index 88a7aa9..6c08f75 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/configuration/LanguageManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/LanguageManager.java @@ -1,6 +1,7 @@ -package com.github.euonmyoji.newhonor.configuration; +package com.github.euonmyoji.newhonor.manager; import com.github.euonmyoji.newhonor.NewHonor; +import com.github.euonmyoji.newhonor.configuration.NewHonorConfig; import com.github.euonmyoji.newhonor.util.Util; import com.google.common.base.Charsets; import org.spongepowered.api.Sponge; diff --git a/src/main/java/com/github/euonmyoji/newhonor/configuration/MysqlManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/MysqlManager.java similarity index 97% rename from src/main/java/com/github/euonmyoji/newhonor/configuration/MysqlManager.java rename to src/main/java/com/github/euonmyoji/newhonor/manager/MysqlManager.java index 75cd751..1192323 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/configuration/MysqlManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/MysqlManager.java @@ -1,9 +1,11 @@ -package com.github.euonmyoji.newhonor.configuration; +package com.github.euonmyoji.newhonor.manager; import com.github.euonmyoji.newhonor.NewHonor; import com.github.euonmyoji.newhonor.api.configuration.BasePlayerConfig; import com.github.euonmyoji.newhonor.api.event.PlayerGetHonorEvent; import com.github.euonmyoji.newhonor.api.event.PlayerLoseHonorEvent; +import com.github.euonmyoji.newhonor.configuration.HonorConfig; +import com.github.euonmyoji.newhonor.configuration.NewHonorConfig; import ninja.leaping.configurate.commented.CommentedConfigurationNode; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; @@ -16,14 +18,14 @@ import java.sql.*; import java.util.*; -import static com.github.euonmyoji.newhonor.configuration.NewHonorConfig.cfg; import static com.github.euonmyoji.newhonor.api.configuration.PlayerConfig.*; +import static com.github.euonmyoji.newhonor.configuration.NewHonorConfig.cfg; /** * @author yinyangshi */ -public class MysqlManager { - static boolean enable = false; +public final class MysqlManager { + public static boolean enable = false; private static final String TABLE_NAME = "NewHonorPlayerData"; private static String address; private static short port; @@ -45,7 +47,7 @@ public static void init() { node.getNode("update-encoding").setValue(update_encoding); } - static void reloadSQLInfo() { + public static void reloadSQLInfo() { CommentedConfigurationNode node = cfg.getNode("SQL-settings"); enable = node.getNode("enable").getBoolean(false); address = node.getNode("address").getString("address"); diff --git a/src/main/java/com/github/euonmyoji/newhonor/manager/NucleusManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/NucleusManager.java index bc95704..c35b711 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/manager/NucleusManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/NucleusManager.java @@ -12,7 +12,7 @@ /** * @author yinyangshi */ -public class NucleusManager { +public final class NucleusManager { private static boolean done; public static void doIt() { diff --git a/src/main/java/com/github/euonmyoji/newhonor/manager/PlaceHolderManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/PlaceHolderManager.java index 0d9ba3a..7ec1558 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/manager/PlaceHolderManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/PlaceHolderManager.java @@ -14,7 +14,7 @@ /** * @author yinyangshi */ -public class PlaceHolderManager { +public final class PlaceHolderManager { private static PlaceHolderManager instance; private static final String VALUE_T = "value"; private static final String STR_T = "strvalue"; diff --git a/src/main/java/com/github/euonmyoji/newhonor/manager/PlayerConfigManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/PlayerConfigManager.java index a0beab0..4df9981 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/manager/PlayerConfigManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/PlayerConfigManager.java @@ -2,7 +2,6 @@ import com.github.euonmyoji.newhonor.api.configuration.PlayerConfig; import com.github.euonmyoji.newhonor.configuration.LocalPlayerConfig; -import com.github.euonmyoji.newhonor.configuration.MysqlManager; import java.util.HashMap; diff --git a/src/main/java/com/github/euonmyoji/newhonor/manager/ScoreBoardManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/ScoreBoardManager.java index d2e5982..82f6dec 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/manager/ScoreBoardManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/ScoreBoardManager.java @@ -3,7 +3,6 @@ import com.github.euonmyoji.newhonor.NewHonor; import com.github.euonmyoji.newhonor.api.configuration.PlayerConfig; import com.github.euonmyoji.newhonor.data.HonorValueData; -import com.github.euonmyoji.newhonor.task.DisplayHonorTaskManager; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.scoreboard.Scoreboard; @@ -18,7 +17,7 @@ /** * @author yinyangshi */ -public class ScoreBoardManager { +public final class ScoreBoardManager { public static boolean enable = false; private static Scoreboard scoreboard = Scoreboard.builder().build(); private static final Object LOCK = new Object(); diff --git a/src/main/java/com/github/euonmyoji/newhonor/task/TaskManager.java b/src/main/java/com/github/euonmyoji/newhonor/manager/TaskManager.java similarity index 73% rename from src/main/java/com/github/euonmyoji/newhonor/task/TaskManager.java rename to src/main/java/com/github/euonmyoji/newhonor/manager/TaskManager.java index a48179a..03d4186 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/task/TaskManager.java +++ b/src/main/java/com/github/euonmyoji/newhonor/manager/TaskManager.java @@ -1,6 +1,8 @@ -package com.github.euonmyoji.newhonor.task; +package com.github.euonmyoji.newhonor.manager; import com.github.euonmyoji.newhonor.configuration.EffectsConfig; +import com.github.euonmyoji.newhonor.task.EffectsOffer; +import com.github.euonmyoji.newhonor.task.HaloEffectsOffer; import java.io.IOException; import java.util.List; @@ -8,7 +10,7 @@ /** * @author yinyangshi */ -public class TaskManager { +public final class TaskManager { /** * 更新插件任务缓存 * diff --git a/src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTask.java b/src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTask.java index b777478..b854bcf 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTask.java +++ b/src/main/java/com/github/euonmyoji/newhonor/task/DisplayHonorTask.java @@ -9,7 +9,7 @@ import java.util.List; -import static com.github.euonmyoji.newhonor.task.DisplayHonorTaskManager.TASKS; +import static com.github.euonmyoji.newhonor.manager.DisplayHonorTaskManager.TASKS; /** * @author yinyangshi @@ -22,7 +22,7 @@ public class DisplayHonorTask implements Runnable { private int index; private volatile boolean running = true; - DisplayHonorTask(String id, List values, Team team, int[] delay) { + public DisplayHonorTask(String id, List values, Team team, int[] delay) { if (values.size() > delay.length) { throw new IllegalArgumentException(); } @@ -54,7 +54,7 @@ public void run() { } } - void cancel() { + public void cancel() { synchronized (TASKS) { running = false; TASKS.remove(id); diff --git a/src/main/java/com/github/euonmyoji/newhonor/task/EffectsOffer.java b/src/main/java/com/github/euonmyoji/newhonor/task/EffectsOffer.java index f3b7bd8..6f401df 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/task/EffectsOffer.java +++ b/src/main/java/com/github/euonmyoji/newhonor/task/EffectsOffer.java @@ -38,7 +38,7 @@ public class EffectsOffer { }).name("NewHonor - Effects Offer Task").intervalTicks(Util.INTERVAL_TICKS).submit(NewHonor.plugin); } - static void update(Iterable effects) { + public static void update(Iterable effects) { synchronized (TASK_DATA) { TASK_DATA.clear(); effects.forEach(id -> { diff --git a/src/main/java/com/github/euonmyoji/newhonor/task/HaloEffectsOffer.java b/src/main/java/com/github/euonmyoji/newhonor/task/HaloEffectsOffer.java index 4e9c490..686c57d 100644 --- a/src/main/java/com/github/euonmyoji/newhonor/task/HaloEffectsOffer.java +++ b/src/main/java/com/github/euonmyoji/newhonor/task/HaloEffectsOffer.java @@ -27,7 +27,7 @@ public class HaloEffectsOffer { }).name("NewHonor - Halo Effects Offer Task").intervalTicks(Util.INTERVAL_TICKS).submit(NewHonor.plugin); } - static void update(Iterable effects) { + public static void update(Iterable effects) { synchronized (TASK_DATA) { TASK_DATA.clear(); effects.forEach(id -> {