1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-12-22 06:49:02 +00:00

feat: 使用新版记分板库

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-04 21:30:12 +08:00
parent 616163cd7d
commit e6b7bb19d6
9 changed files with 70 additions and 52 deletions

View File

@ -20,6 +20,11 @@ public class MiaoBoard extends JavaPlugin implements HandlerCommands {
return config;
}
@Override
public void onEnable() {
}
@Override
public void onLoad() {
config = new FileConfig(this);

View File

@ -4,6 +4,8 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import pw.yumc.MiaoBoard.scoreboard.ScoreBoardManager;
/**
*
* @since 2016年6月24日 下午3:29:39
@ -11,10 +13,10 @@ import org.bukkit.event.player.PlayerQuitEvent;
*/
public class PlayerListener implements Listener {
public void onPlayerJoin(final PlayerJoinEvent e) {
ScoreBoardManager.add(e.getPlayer());
}
public void onPlayerQuit(final PlayerQuitEvent e) {
ScoreBoardManager.remove(e.getPlayer());
}
}

View File

@ -1,11 +0,0 @@
package pw.yumc.MiaoBoard.runnable;
/**
* 线程任务管理类
*
* @since 2016年6月13日 下午5:02:06
* @author
*/
public class TaskManager {
}

View File

@ -1,11 +0,0 @@
package pw.yumc.MiaoBoard.scoreboard;
/**
* 记分板基础接口
*
* @since 2016年6月13日 下午5:02:51
* @author
*/
public interface IScoreBoard {
}

View File

@ -1,13 +0,0 @@
package pw.yumc.MiaoBoard.scoreboard;
import java.util.LinkedList;
/**
*
* @since 2016年6月24日 下午3:38:08
* @author
*/
public class ScoreBoardData {
private String head;
private final LinkedList<String> lines = new LinkedList<>();
}

View File

@ -1,10 +1,30 @@
package pw.yumc.MiaoBoard.scoreboard;
import org.bukkit.entity.Player;
import cn.citycraft.PluginHelper.kit.PKit;
import cn.citycraft.PluginHelper.scoreboard.BoardUpdateFunction;
import cn.citycraft.PluginHelper.scoreboard.SidebarBoard;
import pw.yumc.MiaoBoard.scoreboard.updater.BodyUpdater;
import pw.yumc.MiaoBoard.scoreboard.updater.TitleUpdater;
/**
*
* @since 2016年6月24日 下午3:31:31
* @author
*/
public class ScoreBoardManager {
static SidebarBoard sbd;
public ScoreBoardManager() {
sbd = new SidebarBoard(PKit.i(), new BoardUpdateFunction(new TitleUpdater(), new BodyUpdater()));
}
public static void add(final Player player) {
sbd.addTarget(player);
}
public static void remove(final Player player) {
sbd.removeTarget(player);
}
}

View File

@ -1,15 +0,0 @@
package pw.yumc.MiaoBoard.scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.scoreboard.Scoreboard;
/**
* 简易记分板
*
* @since 2016年6月13日 下午5:06:46
* @author
*/
public class SimpleScoreBoard implements IScoreBoard {
private final Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
}

View File

@ -0,0 +1,21 @@
package pw.yumc.MiaoBoard.scoreboard.updater;
import java.util.List;
import org.bukkit.entity.Player;
import cn.citycraft.PluginHelper.callback.CallBackReturn;
/**
*
* @since 2016年7月4日 下午4:47:17
* @author
*/
public class BodyUpdater extends CallBackReturn.One<Player, List<String>> {
@Override
public List<String> run(final Player param) {
return null;
}
}

View File

@ -0,0 +1,20 @@
package pw.yumc.MiaoBoard.scoreboard.updater;
import org.bukkit.entity.Player;
import cn.citycraft.PluginHelper.callback.CallBackReturn;
import cn.citycraft.PluginHelper.pluginapi.PluginAPI;
/**
*
* @since 2016年7月4日 下午4:47:17
* @author
*/
public class TitleUpdater extends CallBackReturn.One<Player, String> {
@Override
public String run(final Player param) {
return PluginAPI.PlaceholderAPI(param, param.getName());
}
}