This commit is contained in:
parent
6ac28cc04c
commit
315039abbf
@ -174,6 +174,7 @@ Suffix: "]"
|
||||
CustomCost:
|
||||
Enabled: true
|
||||
Cost: 1000
|
||||
MaxLength: 8
|
||||
|
||||
# 玩家称号币初始值
|
||||
DefaultCoin: 0
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.lunadeer</groupId>
|
||||
<artifactId>MiniPlayerTitle</artifactId>
|
||||
<version>2.8.7</version>
|
||||
<version>2.9.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MiniPlayerTitle</name>
|
||||
|
@ -167,8 +167,12 @@ public class Commands implements TabExecutor {
|
||||
line_4.append("可以使用 Minecraft渐变颜色生成器 来生成具有渐变效果的称号")
|
||||
.append(Component.text("[点击在浏览器中打开生成器]", ViewStyles.action_color)
|
||||
.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, "https://ssl.lunadeer.cn:14440/")));
|
||||
Line line_5 = Line.create();
|
||||
line_5.append("最大长度(不含颜色代码):")
|
||||
.append(MiniPlayerTitle.config.getMaxLength().toString());
|
||||
view.addLine(line_1)
|
||||
.addLine(line_2)
|
||||
.addLine(line_5)
|
||||
.addLine(line_3)
|
||||
.addLine(line_4);
|
||||
view.showOn(player);
|
||||
|
@ -211,6 +211,11 @@ public class XPlayer {
|
||||
Notification.error(this._player, "创建称号失败");
|
||||
return;
|
||||
}
|
||||
if (title.getTitleContent().length() > MiniPlayerTitle.config.getMaxLength()) {
|
||||
Notification.error(this._player, "称号长度超过限制,最大字符长度(不含颜色代码): " + MiniPlayerTitle.config.getMaxLength());
|
||||
Title.delete(title.getId());
|
||||
return;
|
||||
}
|
||||
if (exist_titles.contains(title.getTitleContent())) {
|
||||
Notification.error(this._player, "已存在同名称号");
|
||||
Title.delete(title.getId());
|
||||
|
@ -25,6 +25,7 @@ public class ConfigManager {
|
||||
_default_coin = _file.getInt("DefaultCoin", 0);
|
||||
_enable_custom = _file.getBoolean("CustomCost.Enabled", true);
|
||||
_custom_cost = _file.getInt("CustomCost.Cost", 1000);
|
||||
_max_length = _file.getInt("CustomCost.MaxLength", 8);
|
||||
}
|
||||
|
||||
public Boolean isDebug() {
|
||||
@ -90,6 +91,10 @@ public class ConfigManager {
|
||||
return _custom_cost;
|
||||
}
|
||||
|
||||
public Integer getMaxLength() {
|
||||
return _max_length;
|
||||
}
|
||||
|
||||
public void enableCustom(){
|
||||
_enable_custom = true;
|
||||
_file.set("CustomCost.Enabled", true);
|
||||
@ -108,6 +113,12 @@ public class ConfigManager {
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public void setMaxLength(Integer length){
|
||||
_max_length = length;
|
||||
_file.set("CustomCost.MaxLength", length);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
|
||||
private final MiniPlayerTitle _plugin;
|
||||
private FileConfiguration _file;
|
||||
@ -123,4 +134,6 @@ public class ConfigManager {
|
||||
private Integer _default_coin;
|
||||
private Boolean _enable_custom;
|
||||
private Integer _custom_cost;
|
||||
|
||||
private Integer _max_length;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ Suffix: "]"
|
||||
CustomCost:
|
||||
Enabled: true
|
||||
Cost: 1000
|
||||
MaxLength: 8
|
||||
|
||||
DefaultCoin: 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user