diff --git a/pom.xml b/pom.xml
index eebad17..51635cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
MiaoBoard
- 2.4.2
+ 2.5.0
喵式记分板
@@ -13,14 +13,15 @@
- §a正式版本 2.4.2
+ §a正式版本 2.5.0
+ §619-12-30 §cfix: 修复字符截取错误导致的报错;
§619-10-24 §cfix: 调整默认配置的 time.end 为2099年;
- §618-03-05 §cfix: 修复1.12不兼容的问题;
- §617-10-15 §cfix: 修复颜色字符分割错误;
- §617-08-15 §cfix: 修复事件未标记为异步的问题
+ §618-03-05 §cfix: 修复1.12不兼容的问题
+ §617-10-15 §cfix: 修复颜色字符分割错误;
+ §617-08-15 §cfix: 修复事件未标记为异步的问题;
§617-06-28 §cfix: 修复T端不兼容的问题;
§617-03-09 §cfix: 修复行更新错误;
§617-03-09 §afeat: 添加记分板更新事件;
diff --git a/src/main/java/pw/yumc/MiaoBoard/MiaoBoard.java b/src/main/java/pw/yumc/MiaoBoard/MiaoBoard.java
index b80c444..56b6b50 100644
--- a/src/main/java/pw/yumc/MiaoBoard/MiaoBoard.java
+++ b/src/main/java/pw/yumc/MiaoBoard/MiaoBoard.java
@@ -18,8 +18,8 @@ import pw.yumc.YumCore.commands.interfaces.Executor;
/**
* 喵式记分板主类
*
+ * @author MiaoWoo
* @since 2016年6月4日 上午9:08:13
- * @author 喵♂呜
*/
public class MiaoBoard extends JavaPlugin implements Executor {
private ScoreBoardManager scoreBoardManager;
diff --git a/src/main/java/pw/yumc/MiaoBoard/config/MiaoBoardConfig.java b/src/main/java/pw/yumc/MiaoBoard/config/MiaoBoardConfig.java
index c70efb9..3b45502 100644
--- a/src/main/java/pw/yumc/MiaoBoard/config/MiaoBoardConfig.java
+++ b/src/main/java/pw/yumc/MiaoBoard/config/MiaoBoardConfig.java
@@ -8,8 +8,8 @@ import pw.yumc.YumCore.config.inject.InjectConfig;
/**
* 记分板配置文件类
*
+ * @author MiaoWoo
* @since 2016年7月21日 下午5:21:13
- * @author 喵♂呜
*/
public class MiaoBoardConfig extends InjectConfig {
public transient static MiaoBoardConfig instance = new MiaoBoardConfig();
diff --git a/src/main/java/pw/yumc/MiaoBoard/event/BodyUpdateEvent.java b/src/main/java/pw/yumc/MiaoBoard/event/BodyUpdateEvent.java
index 2a0c578..4915e08 100644
--- a/src/main/java/pw/yumc/MiaoBoard/event/BodyUpdateEvent.java
+++ b/src/main/java/pw/yumc/MiaoBoard/event/BodyUpdateEvent.java
@@ -9,7 +9,9 @@ import org.bukkit.event.HandlerList;
/**
* 记分板更新事件
- * Created by 蒋天蓓 on 2017/3/7 0007.
+ *
+ * @author MiaoWoo
+ * @date 2017/3/7 0007
*/
public class BodyUpdateEvent extends Event {
private Player player;
diff --git a/src/main/java/pw/yumc/MiaoBoard/event/TitleUpdateEvent.java b/src/main/java/pw/yumc/MiaoBoard/event/TitleUpdateEvent.java
index c46c5bf..f8ea8ea 100644
--- a/src/main/java/pw/yumc/MiaoBoard/event/TitleUpdateEvent.java
+++ b/src/main/java/pw/yumc/MiaoBoard/event/TitleUpdateEvent.java
@@ -6,7 +6,9 @@ import org.bukkit.event.HandlerList;
/**
* 记分板标题更新
- * Created by 蒋天蓓 on 2017/3/7 0007.
+ *
+ * @author MiaoWoo
+ * @date 2017/3/7 0007
*/
public class TitleUpdateEvent extends Event {
private Player player;
diff --git a/src/main/java/pw/yumc/MiaoBoard/listener/PlayerListener.java b/src/main/java/pw/yumc/MiaoBoard/listener/PlayerListener.java
index 4134fbe..5f11b25 100644
--- a/src/main/java/pw/yumc/MiaoBoard/listener/PlayerListener.java
+++ b/src/main/java/pw/yumc/MiaoBoard/listener/PlayerListener.java
@@ -17,8 +17,8 @@ import pw.yumc.YumCore.update.SubscribeTask;
/**
* 玩家监听
*
- * @since 2016年6月24日 下午3:29:39
- * @author 喵♂呜
+ * @author MiaoWoo
+ * @date 2016年6月24日 下午3:29:39
*/
public class PlayerListener implements Listener {
private MiaoBoard plugin = P.getPlugin();
diff --git a/src/main/java/pw/yumc/MiaoBoard/listener/SelfListener.java b/src/main/java/pw/yumc/MiaoBoard/listener/SelfListener.java
index ed101cb..475e8b5 100644
--- a/src/main/java/pw/yumc/MiaoBoard/listener/SelfListener.java
+++ b/src/main/java/pw/yumc/MiaoBoard/listener/SelfListener.java
@@ -15,7 +15,9 @@ import pw.yumc.YumCore.text.Replace;
/**
* 自身记分板监听类
- * Created by 蒋天蓓 on 2017/3/7 0007.
+ *
+ * @author MiaoWoo
+ * @date 2017/3/7 0007
*/
public class SelfListener implements Listener {
private MiaoBoard plugin = P.getPlugin();
diff --git a/src/main/java/pw/yumc/MiaoBoard/misc/Checker.java b/src/main/java/pw/yumc/MiaoBoard/misc/Checker.java
index e542774..0920b08 100644
--- a/src/main/java/pw/yumc/MiaoBoard/misc/Checker.java
+++ b/src/main/java/pw/yumc/MiaoBoard/misc/Checker.java
@@ -7,6 +7,9 @@ import org.bukkit.entity.Player;
import pw.yumc.MiaoBoard.model.BoardModel;
+/**
+ * @author MiaoWoo
+ */
public class Checker {
public static List offList = new ArrayList<>();
diff --git a/src/main/java/pw/yumc/MiaoBoard/misc/FakePlayer.java b/src/main/java/pw/yumc/MiaoBoard/misc/FakePlayer.java
index 43110be..dd68fa0 100644
--- a/src/main/java/pw/yumc/MiaoBoard/misc/FakePlayer.java
+++ b/src/main/java/pw/yumc/MiaoBoard/misc/FakePlayer.java
@@ -13,7 +13,7 @@ import com.google.common.base.Charsets;
* Created with IntelliJ IDEA
*
* @author 喵♂呜
- * Created on 2017/10/15 23:30.
+ * Created on 2017/10/15 23:30.
*/
public class FakePlayer implements OfflinePlayer {
private String name;
diff --git a/src/main/java/pw/yumc/MiaoBoard/model/BoardModel.java b/src/main/java/pw/yumc/MiaoBoard/model/BoardModel.java
index 2ecea8b..ae66a88 100644
--- a/src/main/java/pw/yumc/MiaoBoard/model/BoardModel.java
+++ b/src/main/java/pw/yumc/MiaoBoard/model/BoardModel.java
@@ -12,8 +12,8 @@ import pw.yumc.YumCore.config.inject.InjectConfigurationSection;
/**
* 记分板数据模型类
*
+ * @author MiaoWoo
* @since 2016年7月21日 下午6:58:58
- * @author 喵♂呜
*/
public class BoardModel extends InjectConfigurationSection {
public transient String name;
@@ -32,7 +32,9 @@ public class BoardModel extends InjectConfigurationSection {
* 自动载入配置
*
* @param name
+ * 记分板名称
* @param config
+ * 记分板配置
*/
public BoardModel(String name, final ConfigurationSection config) {
super(config);
diff --git a/src/main/java/pw/yumc/MiaoBoard/scoreboard/ScoreBoardManager.java b/src/main/java/pw/yumc/MiaoBoard/scoreboard/ScoreBoardManager.java
index d4e4120..2756604 100644
--- a/src/main/java/pw/yumc/MiaoBoard/scoreboard/ScoreBoardManager.java
+++ b/src/main/java/pw/yumc/MiaoBoard/scoreboard/ScoreBoardManager.java
@@ -18,8 +18,8 @@ import pw.yumc.YumCore.config.FileConfig;
/**
* 记分板管理类
*
+ * @author MiaoWoo
* @since 2016年6月24日 下午3:31:31
- * @author 喵♂呜
*/
public class ScoreBoardManager {
private Status cot = new Status();
@@ -47,7 +47,9 @@ public class ScoreBoardManager {
private void load() {
bms.clear();
- config.getConfigurationSection("Boards").getKeys(false).forEach(bmn -> bms.add(new BoardModel(bmn, config.getConfigurationSection("Boards." + bmn))));
+ config.getConfigurationSection("Boards")
+ .getKeys(false)
+ .forEach(bmn -> bms.add(new BoardModel(bmn, config.getConfigurationSection("Boards." + bmn))));
bms.sort(Comparator.comparing(o -> o.index));
}
@@ -67,7 +69,7 @@ public class ScoreBoardManager {
C.Player.getOnlinePlayers().forEach(this::addTarget);
}
- private class Status implements Condition {
+ private static class Status implements Condition {
private boolean status = true;
@Override
@@ -75,7 +77,7 @@ public class ScoreBoardManager {
return status;
}
- Status set(final boolean status) {
+ Status set(boolean status) {
this.status = status;
return this;
}
diff --git a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Board.java b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Board.java
index 191e9a1..e1c50a4 100644
--- a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Board.java
+++ b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Board.java
@@ -8,11 +8,11 @@ import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
+import org.jetbrains.annotations.NotNull;
/**
- *
- * @since 2016年7月4日 下午4:40:21
* @author 尘曲
+ * @since 2016年7月4日 下午4:40:21
*/
public abstract class Board implements Iterable {
@@ -69,6 +69,7 @@ public abstract class Board implements Iterable {
return this.targets.containsKey(player);
}
+ @NotNull
@Override
public Iterator iterator() {
return this.targets.keySet().iterator();
diff --git a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/BoardPage.java b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/BoardPage.java
index 6e900a8..3e3cfd9 100644
--- a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/BoardPage.java
+++ b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/BoardPage.java
@@ -4,9 +4,8 @@ import org.bukkit.Bukkit;
import org.bukkit.scoreboard.Scoreboard;
/**
- *
- * @since 2016年7月4日 下午4:40:21
* @author 尘曲
+ * @since 2016年7月4日 下午4:40:21
*/
public abstract class BoardPage {
diff --git a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Condition.java b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Condition.java
index b76fd71..df6b65c 100644
--- a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Condition.java
+++ b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/Condition.java
@@ -1,12 +1,9 @@
package pw.yumc.MiaoBoard.scoreboard.core;
/**
- *
- * @since 2016年7月4日 下午4:40:21
* @author 尘曲
+ * @since 2016年7月4日 下午4:40:21
*/
public interface Condition {
-
boolean get();
-
}
diff --git a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoard.java b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoard.java
index 5c03738..5cf8aa1 100644
--- a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoard.java
+++ b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoard.java
@@ -8,9 +8,8 @@ import pw.yumc.MiaoBoard.event.BodyUpdateEvent;
import pw.yumc.MiaoBoard.event.TitleUpdateEvent;
/**
- *
- * @since 2016年7月4日 下午4:40:21
* @author 尘曲
+ * @since 2016年7月4日 下午4:40:21
*/
public class SidebarBoard extends Board {
public SidebarBoard(final Plugin plugin) {
diff --git a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoardPage.java b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoardPage.java
index 75ee4e6..f479c84 100644
--- a/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoardPage.java
+++ b/src/main/java/pw/yumc/MiaoBoard/scoreboard/core/SidebarBoardPage.java
@@ -15,12 +15,12 @@ import pw.yumc.MiaoBoard.misc.FakePlayer;
import pw.yumc.YumCore.kit.StrKit;
/**
- *
- * @since 2016年7月4日 下午4:40:21
* @author 尘曲
+ * @since 2016年7月4日 下午4:40:21
*/
public class SidebarBoardPage extends BoardPage {
private static boolean newVer = true;
+
static {
try {
Team.class.getDeclaredMethod("addEntry", String.class);
@@ -29,19 +29,21 @@ public class SidebarBoardPage extends BoardPage {
}
}
- private static final List colors = Arrays.asList(ChatColor.values()); //所有颜色
+ private static final List COLORS = Arrays.asList(ChatColor.values());
+ private static final int BOARD_LINE_MAX_CHARS = 16;
+ private static final int BOARD_LINE_MAX_CHARS_SUB1 = BOARD_LINE_MAX_CHARS - 1;
private final Objective objective;
- private final List boardLines = new ArrayList<>();// "行"
- private int maxLine;//用于标注最大行数
+ private final List boardLines = new ArrayList<>();
+ private int maxLine;
public SidebarBoardPage() {
super();
objective = getBoard().registerNewObjective("default", "dummy");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
- for (int i = 0; i < colors.size(); i++) { //循环所有的颜色
- final String name = colors.get(i) + "" + ChatColor.RESET;
- final Team team = getBoard().registerNewTeam("MiaoboardLine" + i); //为每个颜色注册一个队伍
- boardLines.add(new BoardLine(name, team)); //将"行"添加至列表
+ for (int i = 0; i < COLORS.size(); i++) {
+ final String name = COLORS.get(i) + "" + ChatColor.RESET;
+ final Team team = getBoard().registerNewTeam("MiaoboardLine" + i);
+ boardLines.add(new BoardLine(name, team));
}
}
@@ -54,22 +56,26 @@ public class SidebarBoardPage extends BoardPage {
}
public void setValue(int line, String value) {
- final BoardLine boardLine = getBoardLine(line); //得到我们的"行"
- Validate.notNull(boardLine, "Unable to find BoardLine with index of " + line + "."); //确认是否存在
- objective.getScore(boardLine.getName()).setScore(line); //设置"行"
+ final BoardLine boardLine = getBoardLine(line);
+ Validate.notNull(boardLine, "Unable to find BoardLine with index of " + line + ".");
+ objective.getScore(boardLine.getName()).setScore(line);
//分割字符串为前16个和后16个
String prefix = value;
String suffix = "";
- if (value.length() > 16) {
- int splitIndex = value.charAt(15) == '§' ? 15 : 16;
+ if (value.length() > BOARD_LINE_MAX_CHARS) {
+ int splitIndex = value.charAt(BOARD_LINE_MAX_CHARS_SUB1) == ChatColor.COLOR_CHAR ? BOARD_LINE_MAX_CHARS_SUB1 : BOARD_LINE_MAX_CHARS;
prefix = StrKit.substring(value, 0, splitIndex);
- suffix = value.substring(splitIndex, value.length());
+ suffix = value.substring(splitIndex);
// 如果过suffix开头不是颜色符号就把prefix颜色转移到suffix
- if (suffix.charAt(0) != '§') suffix = ChatColor.getLastColors(prefix) + suffix;
- if (suffix.length() > 16) suffix = suffix.substring(16, suffix.length());
+ if (suffix.charAt(0) != ChatColor.COLOR_CHAR) {
+ suffix = ChatColor.getLastColors(prefix) + suffix;
+ }
+ if (suffix.length() > BOARD_LINE_MAX_CHARS) {
+ suffix = StrKit.substring(suffix, 0, BOARD_LINE_MAX_CHARS);
+ }
}
- boardLine.getTeam().setPrefix(prefix); //设置前16个字符
- boardLine.getTeam().setSuffix(suffix); //设置后16个字符
+ boardLine.getTeam().setPrefix(prefix);
+ boardLine.getTeam().setSuffix(suffix);
maxLine = line + 1;
}
@@ -85,8 +91,8 @@ public class SidebarBoardPage extends BoardPage {
public void removeLine(int line) {
final BoardLine boardLine = getBoardLine(line);
- Validate.notNull(boardLine, "Unable to find BoardLine with index of " + line + "."); //确认是否存在
- getBoard().resetScores(boardLine.getName()); //删除这个"行"
+ Validate.notNull(boardLine, "Unable to find BoardLine with index of " + line + ".");
+ getBoard().resetScores(boardLine.getName());
}
private BoardLine getBoardLine(int line) {
@@ -100,7 +106,7 @@ public class SidebarBoardPage extends BoardPage {
clear(newContents.size());
}
- class BoardLine {
+ static class BoardLine {
private String name;
private Team team;
private OfflinePlayer player;
@@ -127,6 +133,5 @@ public class SidebarBoardPage extends BoardPage {
public Team getTeam() {
return team;
}
-
}
}