mirror of
https://e.coding.net/circlecloud/MiaoBoard.git
synced 2024-11-22 01:49:05 +00:00
feat: 兼容T端服务器
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
95a921cee4
commit
12429b5dd6
@ -10,6 +10,7 @@ import org.bukkit.scoreboard.DisplaySlot;
|
|||||||
import org.bukkit.scoreboard.Objective;
|
import org.bukkit.scoreboard.Objective;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
import pw.yumc.YumCore.bukkit.compatible.C;
|
||||||
import pw.yumc.YumCore.kit.StrKit;
|
import pw.yumc.YumCore.kit.StrKit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,6 +19,14 @@ import pw.yumc.YumCore.kit.StrKit;
|
|||||||
* @author 尘曲
|
* @author 尘曲
|
||||||
*/
|
*/
|
||||||
public class SiderbarBoardPage extends BoardPage {
|
public class SiderbarBoardPage extends BoardPage {
|
||||||
|
private static boolean newVer = true;
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Team.class.getDeclaredMethod("addEntry", String.class);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
newVer = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final List<ChatColor> colors = Arrays.asList(ChatColor.values()); //所有颜色
|
private static final List<ChatColor> colors = Arrays.asList(ChatColor.values()); //所有颜色
|
||||||
private final Objective objective;
|
private final Objective objective;
|
||||||
@ -31,7 +40,12 @@ public class SiderbarBoardPage extends BoardPage {
|
|||||||
for (int i = 0; i < colors.size(); i++) { //循环所有的颜色
|
for (int i = 0; i < colors.size(); i++) { //循环所有的颜色
|
||||||
final ChatColor color = colors.get(i);
|
final ChatColor color = colors.get(i);
|
||||||
final Team team = getBoard().registerNewTeam("MiaoboardLine" + i); //为每个颜色注册一个队伍
|
final Team team = getBoard().registerNewTeam("MiaoboardLine" + i); //为每个颜色注册一个队伍
|
||||||
team.addEntry(color.toString()); //为队伍设置一个"行"
|
//为队伍设置一个"行"
|
||||||
|
if (newVer) {
|
||||||
|
team.addEntry(color.toString());
|
||||||
|
} else {
|
||||||
|
team.addPlayer(C.Player.getOfflinePlayer(color.toString()));
|
||||||
|
}
|
||||||
boardLines.add(new BoardLine(color, team)); //将"行"添加至列表
|
boardLines.add(new BoardLine(color, team)); //将"行"添加至列表
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user