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

feat: compatible to 1.19

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2022-06-24 18:15:18 +00:00
parent 3f193bbf46
commit 00db90be47
5 changed files with 88 additions and 77 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>MiaoBoard</artifactId>
<version>2.5.1</version>
<version>2.6.0</version>
<description>喵式记分板</description>
<parent>
@ -13,8 +13,10 @@
</parent>
<properties>
<update.description>§a正式版本 2.5.1</update.description>
<update.description>§a正式版本 兼容 1.19 版本</update.description>
<update.changes>
§622-06-25 §afeat: 兼容 1.19 版本;
§621-06-23 §afeat: 解除32个字符限制(1.13+);
§621-05-31 §cfix: 修复记分板切换异常问题;
§619-12-30 §cfix: 修复字符截取错误导致的报错;
§619-10-24 §cfix: 调整默认配置的 time.end 为2099年;

View File

@ -1,71 +1,70 @@
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.listener.SelfListener;
import pw.yumc.MiaoBoard.misc.Checker;
import pw.yumc.MiaoBoard.scoreboard.ScoreBoardManager;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.commands.CommandSub;
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.commands.interfaces.Executor;
/**
* 喵式记分板主类
*
* @author MiaoWoo
* @since 2016年6月4日 上午9:08:13
*/
public class MiaoBoard extends JavaPlugin implements Executor {
private ScoreBoardManager scoreBoardManager;
public ScoreBoardManager getScoreBoardManager() {
return scoreBoardManager;
}
@Cmd(permission = "mb.toggle", executor = Cmd.Executor.PLAYER)
@Help("关闭记分板")
@Sort(2)
public void off(Player player) {
Checker.offList.add(player.getName());
Log.sender(player, "§c记分板已关闭!");
}
@Cmd(permission = "mb.toggle", executor = Cmd.Executor.PLAYER)
@Help("打开记分板")
@Sort(1)
public void on(Player player) {
Checker.offList.remove(player.getName());
Log.sender(player, "§a记分板已打开!");
}
@Override
public void onDisable() {
scoreBoardManager.getSidebarBoard().cancel();
}
@Override
public void onEnable() {
scoreBoardManager.start();
new CommandSub("mb", this);
new PlayerListener();
new SelfListener();
}
@Override
public void onLoad() {
scoreBoardManager = new ScoreBoardManager();
}
@Cmd(permission = "mb.reload")
@Help("重新载入配置文件")
public void reload(CommandSender sender) {
scoreBoardManager.reload();
Log.sender(sender, "§a配置重载完毕!");
}
}
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.listener.SelfListener;
import pw.yumc.MiaoBoard.misc.Checker;
import pw.yumc.MiaoBoard.scoreboard.ScoreBoardManager;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.commands.CommandSub;
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.commands.interfaces.Executor;
/**
* 喵式记分板主类
*
* @author MiaoWoo
* @since 2016年6月4日 上午9:08:13
*/
public class MiaoBoard extends JavaPlugin implements Executor {
private ScoreBoardManager scoreBoardManager;
public ScoreBoardManager getScoreBoardManager() {
return scoreBoardManager;
}
@Cmd(permission = "mb.toggle", executor = Cmd.Executor.PLAYER)
@Help("关闭记分板")
@Sort(2)
public void off(Player player) {
Checker.offList.add(player.getName());
Log.sender(player, "§c记分板已关闭!");
}
@Cmd(permission = "mb.toggle", executor = Cmd.Executor.PLAYER)
@Help("打开记分板")
@Sort(1)
public void on(Player player) {
Checker.offList.remove(player.getName());
Log.sender(player, "§a记分板已打开!");
}
@Override
public void onDisable() {
scoreBoardManager.getSidebarBoard().cancel();
}
@Override
public void onEnable() {
scoreBoardManager.start();
new CommandSub("mb", this);
new PlayerListener();
new SelfListener();
}
@Override
public void onLoad() {
scoreBoardManager = new ScoreBoardManager();
}
@Cmd(permission = "mb.reload")
@Help("重新载入配置文件")
public void reload(CommandSender sender) {
scoreBoardManager.reload();
Log.sender(sender, "§a配置重载完毕!");
}
}

View File

@ -2,11 +2,13 @@ package pw.yumc.MiaoBoard.scoreboard.core;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Team;
import pw.yumc.MiaoBoard.misc.FakePlayer;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.kit.StrKit;
import java.util.ArrayList;
@ -19,8 +21,8 @@ import java.util.List;
*/
public class SidebarBoardPage extends BoardPage {
private static final List<ChatColor> COLORS = Arrays.asList(ChatColor.values());
private static final int BOARD_LINE_MAX_CHARS = 16;
private static final int BOARD_LINE_MAX_CHARS_SUB1 = BOARD_LINE_MAX_CHARS - 1;
private static int BOARD_LINE_MAX_CHARS = 16;
private static int BOARD_LINE_MAX_CHARS_SUB1 = BOARD_LINE_MAX_CHARS - 1;
private static boolean newVer = true;
static {
@ -29,6 +31,13 @@ public class SidebarBoardPage extends BoardPage {
} catch (NoSuchMethodException e) {
newVer = false;
}
try {
Material.valueOf("KELP");
BOARD_LINE_MAX_CHARS = 64;
BOARD_LINE_MAX_CHARS_SUB1 = BOARD_LINE_MAX_CHARS - 1;
Log.console("§a当前服务端支持新版记分板 长度限制为128个字符...");
} catch (IllegalArgumentException e) {
}
}
private final Objective objective;

View File

@ -20,7 +20,7 @@ Boards:
title: '玩家信息'
#记分板权限
permission: mb.default
#记分板内容(不得超过38字符 包括颜色字符 超过部分自动截取)
#记分板内容(不得超过32个字符(1.13+限制为128字符) 包括颜色字符 超过部分自动截取)
lines:
- '&6名 称: &a%player_displayname%'
- '&6世 界: &b%player_world%'
@ -38,7 +38,7 @@ Boards:
title: '服务器信息'
#记分板权限
permission: mb.reload
#记分板内容(不得超过38字符 包括颜色字符 超过部分自动截取)
#记分板内容(不得超过32个字符(1.13+限制为128字符) 包括颜色字符 超过部分自动截取)
lines:
- '&6名 称: &a%plugin_name%'
- '&6版 本: &b%plugin_version%'

View File

@ -1,6 +1,7 @@
name: ${project.artifactId}
description: ${project.description}
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
api-version: 1.13
version: ${project.version}-git-${env.GIT_COMMIT}
author: 喵♂呜
website: ${ciManagement.url}