1
0
mirror of https://e.coding.net/circlecloud/MiaoBoard.git synced 2024-11-22 01:49:05 +00:00

feat: 记分板添加开关

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-08-22 00:44:28 +08:00
parent 8954c688a7
commit 2e513d3b9f
3 changed files with 25 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>MiaoBoard</artifactId>
<version>1.4.5</version>
<version>1.4.6</version>
<name>MiaoBoard</name>
<build>
<finalName>${project.name}</finalName>

View File

@ -3,12 +3,14 @@ package pw.yumc.MiaoBoard;
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.commands.CommandArgument;
import pw.yumc.YumCore.commands.CommandExecutor;
import pw.yumc.YumCore.commands.CommandManager;
import pw.yumc.YumCore.commands.annotation.Cmd;
import pw.yumc.YumCore.commands.annotation.Help;
import pw.yumc.YumCore.commands.annotation.Sort;
import pw.yumc.YumCore.statistic.Statistics;
import pw.yumc.YumCore.update.SubscribeTask;
@ -20,6 +22,22 @@ import pw.yumc.YumCore.update.SubscribeTask;
*/
public class MiaoBoard extends JavaPlugin implements CommandExecutor {
@Cmd()
@Help("关闭记分板")
@Sort(2)
public void off(final CommandArgument e) {
Checker.offList.add(e.getSender().getName());
e.getSender().sendMessage("§c记分板已关闭!");
}
@Cmd()
@Help("打开记分板")
@Sort(1)
public void on(final CommandArgument e) {
Checker.offList.remove(e.getSender().getName());
e.getSender().sendMessage("§a记分板已打开!");
}
@Override
public void onDisable() {
ScoreBoardManager.getSidebarBoard().cancel();

View File

@ -1,12 +1,17 @@
package pw.yumc.MiaoBoard.misc;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import pw.yumc.MiaoBoard.model.BoardModel;
public class Checker {
public static List<String> offList = new ArrayList<>();
public static boolean $(final Player player, final BoardModel model) {
return player.hasPermission(model.permission) && dataCheck(model);
return player.hasPermission(model.permission) && dataCheck(model) && !offList.contains(player.getName());
}
public static boolean dataCheck(final BoardModel model) {