1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-11-24 02:09:03 +00:00

feat: 添加记分板排序

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-08-16 15:26:03 +08:00
parent aab4867ee9
commit 96baee6208
5 changed files with 30 additions and 5 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>MiaoBoard</artifactId>
<version>1.4.3</version>
<version>1.4.4</version>
<name>MiaoBoard</name>
<build>
<finalName>${project.name}</finalName>
@ -66,7 +66,7 @@
</goals>
<configuration>
<options>
<option>-repackageclasses nul.${project.groupId}.for.${project.artifactId}.class</option>
<option>-repackageclasses nul.j.for.t.class.b</option>
<option>-keep class ${project.groupId}.${project.artifactId}.${project.artifactId}</option>
</options>
<libs>

View File

@ -1,5 +1,6 @@
package pw.yumc.MiaoBoard.misc;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -77,6 +78,10 @@ public class Replace {
switch (key) {
case "version":
return P.getDescription().getVersion();
case "name":
return P.getName();
case "author":
return Arrays.toString(P.getDescription().getAuthors().toArray());
default:
return "";
}

View File

@ -13,6 +13,7 @@ import cn.citycraft.PluginHelper.config.InjectConfigurationSection;
* @author
*/
public class BoardModel extends InjectConfigurationSection {
public int index;
public String title;
public String permission;
public List<String> lines;

View File

@ -1,6 +1,8 @@
package pw.yumc.MiaoBoard.scoreboard;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.bukkit.entity.Player;
@ -41,6 +43,7 @@ public class ScoreBoardManager {
for (final String bmn : config.getConfigurationSection("Boards").getKeys(false)) {
bms.add(new BoardModel(config.getConfigurationSection("Boards." + bmn)));
}
Collections.sort(bms, new BoardComparator());
}
public static void reload() {
@ -57,7 +60,14 @@ public class ScoreBoardManager {
}
}
public static class Status implements Condition {
private static class BoardComparator implements Comparator<BoardModel> {
@Override
public int compare(final BoardModel o1, final BoardModel o2) {
return o2.index > o1.index ? 1 : 0;
}
}
private static class Status implements Condition {
private boolean status = true;
@Override

View File

@ -1,5 +1,5 @@
#配置文件版本号
Version: 1.0
Version: 1.1
#更新时间(单位: Tick)
UpdateTime: 10
@ -10,11 +10,20 @@ DisableWorld:
Boards:
#默认记分板
default:
#记分板顺序(将按照从小到大依次检测 比如 1-5 优先检测 1 符合则显示 不符合 检测 2 ...)
index: 50
#记分板标题
title: '记分板简介'
#记分板权限
permission: mb.default
#记分板内容(不得超过38个字符 包括颜色字符 超过部分自动截取)
lines:
- '&6插件名称: &a%plugin_name%'
- '&7------------------------------'
- '&6插件版本: &b%plugin_version%'
- '&7------------------------------'
- '&6插件作者: &c%plugin_author%'
- '&7------------------------------'
- '&6玩家名称: &a%player_displayname%'
- '&7------------------------------'
- '&6您所在的位置: &b%player_world% &a%player_x%,%player_y%,%player_z%'