mirror of
				https://e.coding.net/circlecloud/MiaoBoard.git
				synced 2025-11-03 17:56:30 +00:00 
			
		
		
		
	@@ -1,18 +1,18 @@
 | 
			
		||||
package pw.yumc.MiaoBoard;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.command.CommandSender;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.plugin.java.JavaPlugin;
 | 
			
		||||
 | 
			
		||||
import pw.yumc.MiaoBoard.listener.PlayerListener;
 | 
			
		||||
import pw.yumc.MiaoBoard.misc.Checker;
 | 
			
		||||
import pw.yumc.MiaoBoard.scoreboard.ScoreBoardManager;
 | 
			
		||||
import pw.yumc.YumCore.bukkit.Log;
 | 
			
		||||
import pw.yumc.YumCore.commands.CommandArgument;
 | 
			
		||||
import pw.yumc.YumCore.commands.CommandExecutor;
 | 
			
		||||
import pw.yumc.YumCore.commands.CommandManager;
 | 
			
		||||
import pw.yumc.YumCore.commands.CommandSub;
 | 
			
		||||
import pw.yumc.YumCore.commands.annotation.Cmd;
 | 
			
		||||
import pw.yumc.YumCore.commands.annotation.Cmd.Executor;
 | 
			
		||||
import pw.yumc.YumCore.commands.annotation.Help;
 | 
			
		||||
import pw.yumc.YumCore.commands.annotation.Sort;
 | 
			
		||||
import pw.yumc.YumCore.commands.interfaces.Executor;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 喵式记分板主类
 | 
			
		||||
@@ -20,27 +20,27 @@ import pw.yumc.YumCore.commands.annotation.Sort;
 | 
			
		||||
 * @since 2016年6月4日 上午9:08:13
 | 
			
		||||
 * @author 喵♂呜
 | 
			
		||||
 */
 | 
			
		||||
public class MiaoBoard extends JavaPlugin implements CommandExecutor {
 | 
			
		||||
public class MiaoBoard extends JavaPlugin implements Executor {
 | 
			
		||||
    private ScoreBoardManager scoreBoardManager;
 | 
			
		||||
 | 
			
		||||
    public ScoreBoardManager getScoreBoardManager() {
 | 
			
		||||
        return scoreBoardManager;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Cmd(permission = "mb.toggle", executor = Executor.PLAYER)
 | 
			
		||||
    @Cmd(permission = "mb.toggle", executor = Cmd.Executor.PLAYER)
 | 
			
		||||
    @Help("关闭记分板")
 | 
			
		||||
    @Sort(2)
 | 
			
		||||
    public void off(final CommandArgument e) {
 | 
			
		||||
        Checker.offList.add(e.getSender().getName());
 | 
			
		||||
        Log.toSender(e.getSender(), "§c记分板已关闭!");
 | 
			
		||||
    public void off(final Player player) {
 | 
			
		||||
        Checker.offList.add(player.getName());
 | 
			
		||||
        Log.sender(player, "§c记分板已关闭!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Cmd(permission = "mb.toggle", executor = Executor.PLAYER)
 | 
			
		||||
    @Cmd(permission = "mb.toggle", executor = Cmd.Executor.PLAYER)
 | 
			
		||||
    @Help("打开记分板")
 | 
			
		||||
    @Sort(1)
 | 
			
		||||
    public void on(final CommandArgument e) {
 | 
			
		||||
        Checker.offList.remove(e.getSender().getName());
 | 
			
		||||
        Log.toSender(e.getSender(), "§a记分板已打开!");
 | 
			
		||||
    public void on(final Player player) {
 | 
			
		||||
        Checker.offList.remove(player.getName());
 | 
			
		||||
        Log.sender(player, "§a记分板已打开!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -51,7 +51,7 @@ public class MiaoBoard extends JavaPlugin implements CommandExecutor {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onEnable() {
 | 
			
		||||
        scoreBoardManager.start();
 | 
			
		||||
        new CommandManager("mb").register(this);
 | 
			
		||||
        new CommandSub("mb").register(this);
 | 
			
		||||
        new PlayerListener();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -62,8 +62,8 @@ public class MiaoBoard extends JavaPlugin implements CommandExecutor {
 | 
			
		||||
 | 
			
		||||
    @Cmd(permission = "mb.reload")
 | 
			
		||||
    @Help("重新载入配置文件")
 | 
			
		||||
    public void reload(final CommandArgument e) {
 | 
			
		||||
    public void reload(final CommandSender sender) {
 | 
			
		||||
        scoreBoardManager.reload();
 | 
			
		||||
        Log.toSender(e.getSender(), "§a配置重载完毕!");
 | 
			
		||||
        Log.sender(sender, "§a配置重载完毕!");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ package pw.yumc.MiaoBoard.config;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import pw.yumc.YumCore.config.InjectConfig;
 | 
			
		||||
import pw.yumc.YumCore.config.inject.InjectConfig;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 记分板配置文件类
 | 
			
		||||
 
 | 
			
		||||
@@ -12,10 +12,10 @@ import java.util.regex.Pattern;
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import cn.citycraft.PluginHelper.kit.StrKit;
 | 
			
		||||
import cn.citycraft.PluginHelper.pluginapi.PluginAPI;
 | 
			
		||||
import me.clip.placeholderapi.PlaceholderAPI;
 | 
			
		||||
import pw.yumc.YumCore.bukkit.P;
 | 
			
		||||
import pw.yumc.YumCore.bukkit.compatible.C;
 | 
			
		||||
import pw.yumc.YumCore.kit.StrKit;
 | 
			
		||||
 | 
			
		||||
public class Replace {
 | 
			
		||||
    public static List<String> $(final Player p, final List<String> text) {
 | 
			
		||||
@@ -31,7 +31,7 @@ public class Replace {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static String p(final Player p, final String text) {
 | 
			
		||||
        return PluginAPI.PlaceholderAPI(p, SimpleRelpace.$(p, text));
 | 
			
		||||
        return PlaceholderAPI.setPlaceholders(p, SimpleRelpace.$(p, text));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static String s(final String text) {
 | 
			
		||||
@@ -141,7 +141,7 @@ public class Replace {
 | 
			
		||||
                try {
 | 
			
		||||
                    final long left = df.parse(time).getTime() - System.currentTimeMillis();
 | 
			
		||||
                    value = String.valueOf(left / 1000);
 | 
			
		||||
                } catch (final ParseException e) {
 | 
			
		||||
                } catch (final ParseException ignored) {
 | 
			
		||||
                }
 | 
			
		||||
                return value;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,9 +5,9 @@ import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.configuration.ConfigurationSection;
 | 
			
		||||
 | 
			
		||||
import pw.yumc.YumCore.config.ConfigNode;
 | 
			
		||||
import pw.yumc.YumCore.config.InjectConfigurationSection;
 | 
			
		||||
import pw.yumc.YumCore.config.Nullable;
 | 
			
		||||
import pw.yumc.YumCore.config.annotation.ConfigNode;
 | 
			
		||||
import pw.yumc.YumCore.config.annotation.Nullable;
 | 
			
		||||
import pw.yumc.YumCore.config.inject.InjectConfigurationSection;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 记分板数据模型类
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import cn.citycraft.PluginHelper.callback.CallBackReturn;
 | 
			
		||||
import pw.yumc.YumCore.callback.CallBackReturn;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,45 +0,0 @@
 | 
			
		||||
package pw.yumc.MiaoBoard.scoreboard.core;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.scoreboard.Objective;
 | 
			
		||||
import org.bukkit.scoreboard.Score;
 | 
			
		||||
import org.bukkit.scoreboard.Team;
 | 
			
		||||
 | 
			
		||||
public class Entry {
 | 
			
		||||
    private final SiderbarBoardPage boardPage;
 | 
			
		||||
    private Team team;
 | 
			
		||||
    private final String id;
 | 
			
		||||
    private String last;
 | 
			
		||||
    private final int index;
 | 
			
		||||
 | 
			
		||||
    public Entry(final SiderbarBoardPage boardPage, final int index) {
 | 
			
		||||
        this.boardPage = boardPage;
 | 
			
		||||
        this.id = String.valueOf(index);
 | 
			
		||||
        this.index = index;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getId() {
 | 
			
		||||
        return id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getIndex() {
 | 
			
		||||
        return index;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Team getTeam() {
 | 
			
		||||
        return team;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void unregister() {
 | 
			
		||||
        if (this.last != null) {
 | 
			
		||||
            this.boardPage.getBoard().resetScores(last);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void update(final String text, final int score) {
 | 
			
		||||
        this.unregister();
 | 
			
		||||
        final Objective objective = boardPage.getObjective();
 | 
			
		||||
        final Score scoreObject = objective.getScore(text);
 | 
			
		||||
        scoreObject.setScore(score);
 | 
			
		||||
        this.last = text;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,14 +1,8 @@
 | 
			
		||||
package pw.yumc.MiaoBoard.scoreboard.core;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.TreeMap;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.plugin.Plugin;
 | 
			
		||||
import org.bukkit.scoreboard.Objective;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
@@ -16,15 +10,6 @@ import org.bukkit.scoreboard.Objective;
 | 
			
		||||
 * @author 尘曲
 | 
			
		||||
 */
 | 
			
		||||
public class SidebarBoard extends Board {
 | 
			
		||||
    private static final TreeMap<Integer, String> coloursById = new TreeMap<>();
 | 
			
		||||
 | 
			
		||||
    static {
 | 
			
		||||
        int i = 0;
 | 
			
		||||
        for (final ChatColor chatColor : ChatColor.values()) {
 | 
			
		||||
            coloursById.put(i++, chatColor.toString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public SidebarBoard(final Plugin plugin, final BoardUpdateFunction updateFunction) {
 | 
			
		||||
        super(plugin, updateFunction);
 | 
			
		||||
    }
 | 
			
		||||
@@ -42,9 +27,7 @@ public class SidebarBoard extends Board {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void update(final Player player) {
 | 
			
		||||
        final SiderbarBoardPage boardPage = this.getBoardPage(player);
 | 
			
		||||
        if (boardPage == null) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (boardPage == null) { return; }
 | 
			
		||||
        String title = null;
 | 
			
		||||
        if (this.getUpdateFunction().getTitleFunction() != null) {
 | 
			
		||||
            title = this.getUpdateFunction().getTitleFunction().run(player);
 | 
			
		||||
@@ -53,41 +36,8 @@ public class SidebarBoard extends Board {
 | 
			
		||||
            player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        final List<String> newContents = this.getUpdateFunction().getBodyFunction().run(player);
 | 
			
		||||
        this.formatBody(newContents);
 | 
			
		||||
        final Objective objective = boardPage.getObjective();
 | 
			
		||||
        objective.setDisplayName(title);
 | 
			
		||||
        for (int i = 0; i < newContents.size(); i++) {
 | 
			
		||||
            objective.getScore(newContents.get(i)).setScore(newContents.size() - i);
 | 
			
		||||
        }
 | 
			
		||||
        int index = 0;
 | 
			
		||||
        if (boardPage.getLastEntries() != null) {
 | 
			
		||||
            for (; index < boardPage.getLastEntries().size() && index < newContents.size(); index++) {
 | 
			
		||||
                final Entry entry = boardPage.getLastEntries().get(index);
 | 
			
		||||
                entry.update(newContents.get(index), newContents.size() - index - 1);
 | 
			
		||||
            }
 | 
			
		||||
            while (index < boardPage.getLastEntries().size()) {
 | 
			
		||||
                final Entry entry = boardPage.getLastEntries().remove(index);
 | 
			
		||||
                entry.unregister();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (boardPage.getLastEntries() == null) {
 | 
			
		||||
            boardPage.setLastEntries(new ArrayList<Entry>());
 | 
			
		||||
        }
 | 
			
		||||
        for (; index < newContents.size(); index++) {
 | 
			
		||||
            final String line = newContents.get(index);
 | 
			
		||||
            final Entry entry = new Entry(boardPage, index);
 | 
			
		||||
            entry.update(line, newContents.size() - index - 1);
 | 
			
		||||
            boardPage.getLastEntries().add(entry);
 | 
			
		||||
        }
 | 
			
		||||
        boardPage.setTitle(title);
 | 
			
		||||
        boardPage.setBody(getUpdateFunction().getBodyFunction().run(player));
 | 
			
		||||
        player.setScoreboard(boardPage.getBoard());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void formatBody(final List<String> texts) {
 | 
			
		||||
        for (int i = 0; i < texts.size(); i++) {
 | 
			
		||||
            final String line = texts.get(i);
 | 
			
		||||
            texts.set(i, line + coloursById.get(i));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,15 @@
 | 
			
		||||
package pw.yumc.MiaoBoard.scoreboard.core;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.lang.Validate;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.scoreboard.DisplaySlot;
 | 
			
		||||
import org.bukkit.scoreboard.Objective;
 | 
			
		||||
import org.bukkit.scoreboard.Team;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
@@ -13,24 +19,93 @@ import org.bukkit.scoreboard.Objective;
 | 
			
		||||
public class SiderbarBoardPage extends BoardPage {
 | 
			
		||||
 | 
			
		||||
    private final Objective objective;
 | 
			
		||||
    private List<Entry> lastEntries;
 | 
			
		||||
 | 
			
		||||
    private static final List<ChatColor> colors = Arrays.asList(ChatColor.values()); //所有颜色
 | 
			
		||||
    private final List<BoardLine> boardLines = new ArrayList<>();// "行"
 | 
			
		||||
 | 
			
		||||
    public SiderbarBoardPage() {
 | 
			
		||||
        super();
 | 
			
		||||
        objective = getBoard().registerNewObjective("default", "dummy");
 | 
			
		||||
        objective.setDisplaySlot(DisplaySlot.SIDEBAR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<Entry> getLastEntries() {
 | 
			
		||||
        return lastEntries;
 | 
			
		||||
        for (int i = 0; i < colors.size(); i++) { //循环所有的颜色
 | 
			
		||||
            final ChatColor color = colors.get(i);
 | 
			
		||||
            final Team team = getBoard().registerNewTeam("MiaoboardLine" + i); //为每个颜色注册一个队伍
 | 
			
		||||
            team.addEntry(color.toString()); //为队伍设置一个"行"
 | 
			
		||||
            boardLines.add(new BoardLine(color, team)); //将"行"添加至列表
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Objective getObjective() {
 | 
			
		||||
        return objective;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setLastEntries(final List<Entry> lastEntries) {
 | 
			
		||||
        this.lastEntries = lastEntries;
 | 
			
		||||
    public void setTitle(String title) {
 | 
			
		||||
        objective.setDisplayName(title);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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.getColor().toString()).setScore(line); //设置"行"
 | 
			
		||||
        String prefix = value;
 | 
			
		||||
        String suffix = null;
 | 
			
		||||
        //分割字符串为前16个和后16个
 | 
			
		||||
        if (value.length() > 16) {
 | 
			
		||||
            prefix = value.substring(0, 16);
 | 
			
		||||
            if (ChatColor.getLastColors(prefix) != null && !Objects.equals(ChatColor.getLastColors(prefix), "") && !Objects.equals(ChatColor.getLastColors(prefix), " ")) {
 | 
			
		||||
                //继承前16个字符的颜色
 | 
			
		||||
                suffix = ChatColor.getLastColors(prefix) + value.substring(16, value.length());
 | 
			
		||||
            } else {
 | 
			
		||||
                suffix = ChatColor.RESET + value.substring(16, value.length());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        boardLine.getTeam().setPrefix(prefix); //设置前16个字符
 | 
			
		||||
        if (suffix != null) {
 | 
			
		||||
            boardLine.getTeam().setSuffix(suffix);//"设置后16个字符"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void clear(int size) {
 | 
			
		||||
        if (size < boardLines.size()) {
 | 
			
		||||
            for (int i = size; i < boardLines.size(); i++) {
 | 
			
		||||
                removeLine(i);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void removeLine(int line) {
 | 
			
		||||
        final BoardLine boardLine = getBoardLine(line);
 | 
			
		||||
        Validate.notNull(boardLine, "Unable to find BoardLine with index of " + line + "."); //确认是否存在
 | 
			
		||||
        getBoard().resetScores(boardLine.getColor().toString()); //删除这个"行"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private BoardLine getBoardLine(int line) {
 | 
			
		||||
        return boardLines.get(line);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setBody(List<String> newContents) {
 | 
			
		||||
        for (int i = 0; i < newContents.size(); i++) {
 | 
			
		||||
            setValue(newContents.size() - i, newContents.get(i));
 | 
			
		||||
        }
 | 
			
		||||
        clear(newContents.size());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    class BoardLine {
 | 
			
		||||
        private final ChatColor color;
 | 
			
		||||
        private final Team team;
 | 
			
		||||
 | 
			
		||||
        public BoardLine(ChatColor color, Team team) {
 | 
			
		||||
            this.color = color;
 | 
			
		||||
            this.team = team;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public ChatColor getColor() {
 | 
			
		||||
            return color;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public Team getTeam() {
 | 
			
		||||
            return team;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,16 @@
 | 
			
		||||
package pw.yumc.MiaoBoard.scoreboard.updater;
 | 
			
		||||
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import cn.citycraft.PluginHelper.callback.CallBackReturn;
 | 
			
		||||
import pw.yumc.MiaoBoard.MiaoBoard;
 | 
			
		||||
import pw.yumc.MiaoBoard.misc.Checker;
 | 
			
		||||
import pw.yumc.MiaoBoard.misc.Replace;
 | 
			
		||||
import pw.yumc.MiaoBoard.model.BoardModel;
 | 
			
		||||
import pw.yumc.YumCore.bukkit.P;
 | 
			
		||||
import pw.yumc.YumCore.callback.CallBackReturn;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 记分板行更新类
 | 
			
		||||
@@ -24,12 +23,8 @@ public class BodyUpdater extends CallBackReturn.One<Player, List<String>> {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<String> run(final Player param) {
 | 
			
		||||
        final Iterator<BoardModel> iterator = plugin.getScoreBoardManager().getModels().iterator();
 | 
			
		||||
        while (iterator.hasNext()) {
 | 
			
		||||
            final BoardModel bmodel = iterator.next();
 | 
			
		||||
            if (Checker.$(param, bmodel)) {
 | 
			
		||||
                return Replace.$(param, bmodel.lines);
 | 
			
		||||
            }
 | 
			
		||||
        for (BoardModel bmodel : plugin.getScoreBoardManager().getModels()) {
 | 
			
		||||
            if (Checker.$(param, bmodel)) { return Replace.$(param, bmodel.lines); }
 | 
			
		||||
        }
 | 
			
		||||
        return Collections.emptyList();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,13 @@
 | 
			
		||||
package pw.yumc.MiaoBoard.scoreboard.updater;
 | 
			
		||||
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.entity.Player;
 | 
			
		||||
 | 
			
		||||
import cn.citycraft.PluginHelper.callback.CallBackReturn;
 | 
			
		||||
import pw.yumc.MiaoBoard.MiaoBoard;
 | 
			
		||||
import pw.yumc.MiaoBoard.misc.Checker;
 | 
			
		||||
import pw.yumc.MiaoBoard.misc.Replace;
 | 
			
		||||
import pw.yumc.MiaoBoard.model.BoardModel;
 | 
			
		||||
import pw.yumc.YumCore.bukkit.P;
 | 
			
		||||
import pw.yumc.YumCore.callback.CallBackReturn;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 记分板标题更新类
 | 
			
		||||
@@ -22,12 +20,8 @@ public class TitleUpdater extends CallBackReturn.One<Player, String> {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String run(final Player param) {
 | 
			
		||||
        final Iterator<BoardModel> iterator = plugin.getScoreBoardManager().getModels().iterator();
 | 
			
		||||
        while (iterator.hasNext()) {
 | 
			
		||||
            final BoardModel bmodel = iterator.next();
 | 
			
		||||
            if (Checker.$(param, bmodel)) {
 | 
			
		||||
                return Replace.$(param, bmodel.title);
 | 
			
		||||
            }
 | 
			
		||||
        for (BoardModel bmodel : plugin.getScoreBoardManager().getModels()) {
 | 
			
		||||
            if (Checker.$(param, bmodel)) { return Replace.$(param, bmodel.title); }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user