mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2026-01-04 15:31:47 +00:00
new default config
This commit is contained in:
@@ -45,4 +45,12 @@ public class FontData {
|
||||
if (fontData == null) return;
|
||||
widthData.putAll(fontData.getWidthData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FontData{" +
|
||||
"widthData=" + widthData +
|
||||
", defaultWidth=" + defaultWidth +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public class BackGroundText {
|
||||
|
||||
public String getValue(OfflinePlayer player) {
|
||||
String parsed = PlaceholderAPI.setPlaceholders(player, text);
|
||||
if (parsed.equals("")) return "";
|
||||
int parsedWidth = FontUtils.getTextWidth(parsed);
|
||||
String bg = FontUtils.surroundNameplateFont(backGround.getBackGroundImage(parsedWidth));
|
||||
return (removeShadow ? "<#FFFEFD>" + bg + "</#FFFEFD>" : bg)+ parsed;
|
||||
|
||||
@@ -203,7 +203,7 @@ public class BackGroundManagerImpl implements BackGroundManager {
|
||||
for (String bg : bg_list) {
|
||||
plugin.saveResource("contents" + File.separator + "backgrounds" + File.separator + bg + ".png", false);
|
||||
}
|
||||
String[] config_list = new String[]{"bedrock_1", "bedrock_2", "bedrock_3"};
|
||||
String[] config_list = new String[]{"bedrock_1", "bedrock_2"};
|
||||
for (String config : config_list) {
|
||||
plugin.saveResource("contents" + File.separator + "backgrounds" + File.separator + config + ".yml", false);
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class WidthManagerImpl implements WidthManager {
|
||||
ASCII_SGA_DATA.registerCharWidth(codePoint, (int) entry.getValue());
|
||||
}
|
||||
|
||||
File accentedCache = new File(plugin.getDataFolder(), "font" + File.separator + "cache" + File.separator + "ascii_sga.yml");
|
||||
File accentedCache = new File(plugin.getDataFolder(), "font" + File.separator + "cache" + File.separator + "accented.yml");
|
||||
YamlConfiguration accentedYML = YamlConfiguration.loadConfiguration(accentedCache);
|
||||
ACCENTED_DATA = new FontData(5);
|
||||
for (Map.Entry<String, Object> entry : accentedYML.getValues(false).entrySet()) {
|
||||
@@ -895,6 +895,7 @@ public class WidthManagerImpl implements WidthManager {
|
||||
ElementNode node = (ElementNode) MiniMessage.miniMessage().deserializeToTree(text);
|
||||
ArrayList<Tuple<String, Key, Boolean>> list = new ArrayList<>();
|
||||
nodeToStringInfo(node, list, Key.of("minecraft", "default"), false);
|
||||
|
||||
int totalLength = 0;
|
||||
for (Tuple<String, Key, Boolean> element : list) {
|
||||
FontData data = getFontData(element.getMid());
|
||||
@@ -923,12 +924,12 @@ public class WidthManagerImpl implements WidthManager {
|
||||
} else if (node instanceof TagNode tagNode) {
|
||||
if (tagNode.tag() instanceof Inserting inserting) {
|
||||
Component component = inserting.value();
|
||||
isBold = component.hasDecoration(TextDecoration.BOLD);
|
||||
var key = component.font();
|
||||
if (key != null) {
|
||||
font = net.momirealms.customnameplates.common.Key.of(key.namespace(), key.value());
|
||||
}
|
||||
if (component instanceof TextComponent textComponent) {
|
||||
isBold = component.hasDecoration(TextDecoration.BOLD);
|
||||
var key = component.font();
|
||||
if (key != null) {
|
||||
font = net.momirealms.customnameplates.common.Key.of(key.namespace(), key.value());
|
||||
}
|
||||
String text = textComponent.content();
|
||||
if (!text.equals(""))
|
||||
list.add(Tuple.of(text, font, isBold));
|
||||
|
||||
@@ -423,7 +423,7 @@ public class RequirementManagerImpl implements RequirementManager {
|
||||
}
|
||||
|
||||
private void registerNumberEqualRequirement() {
|
||||
registerRequirement("==", (args) -> {
|
||||
registerRequirement("=", (args) -> {
|
||||
if (args instanceof ConfigurationSection section) {
|
||||
String v1 = section.getString("value1", "");
|
||||
String v2 = section.getString("value2", "");
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# You can only create "actionbar" section in this config file
|
||||
actionbar:
|
||||
check-frequency: 10
|
||||
check-frequency: 1
|
||||
conditions:
|
||||
permission: "actionbar.show"
|
||||
text-display-order:
|
||||
1:
|
||||
# Measured in ticks
|
||||
duration: 200
|
||||
duration: 1000
|
||||
# Text content
|
||||
text: 'Welcome to my server! %player_name%'
|
||||
text: '%nameplates_conditional_actionbar%'
|
||||
# The frequency of refreshing the text, the lower the value is, the faster the placeholders are updated
|
||||
# measured in ticks, -1 = disable refreshing
|
||||
refresh-frequency: 1
|
||||
@@ -12,23 +12,26 @@ bossbar_1:
|
||||
text-display-order:
|
||||
1:
|
||||
# Measured in ticks
|
||||
duration: 200
|
||||
duration: 100
|
||||
# Text content
|
||||
text: 'Welcome to my server! %player_name%'
|
||||
text: '%nameplates_background_hello%'
|
||||
# The frequency of refreshing the text, the lower the value is, the faster the placeholders are updated
|
||||
# measured in ticks, -1 = disable refreshing
|
||||
refresh-frequency: -1
|
||||
2:
|
||||
duration: 100
|
||||
text: 'Your location: [X: %player_x%, Y: %player_y%, Z: %player_z%]'
|
||||
duration: 200
|
||||
text: '%nameplates_background_time% %nameplates_background_location% %nameplates_background_weather%'
|
||||
refresh-frequency: 1
|
||||
3:
|
||||
duration: 100
|
||||
text: 'This is a message only visible to admins'
|
||||
text: '%nameplates_background_update%'
|
||||
refresh-frequency: -1
|
||||
# Optional
|
||||
# When enabling conditions, make sure that players would see at least one in the order,
|
||||
# otherwise it will fall into a dead cycle
|
||||
conditions:
|
||||
# If your player doesn't meet the conditions, it would be skipped
|
||||
permission: nameplates.admin
|
||||
permission: nameplates.admin
|
||||
equals:
|
||||
value1: '%nameplates_is-latest%'
|
||||
value2: 'false'
|
||||
@@ -1,40 +1,27 @@
|
||||
# %nameplates_conditional_{0}%
|
||||
# custom conditions for your text, make it easier to display different content according to the requirement you set
|
||||
conditional-text:
|
||||
# This is just an example that not actually enabled
|
||||
# It would display the region name with black background if you are in a region. Otherwise it would return nothing
|
||||
region:
|
||||
actionbar:
|
||||
priority_1:
|
||||
text: '%nameplates_background_region%'
|
||||
text: '%nameplates_background_actionbar%'
|
||||
conditions:
|
||||
papi-condition:
|
||||
condition_1:
|
||||
type: '!='
|
||||
papi: '%worldguard_region%'
|
||||
value: ""
|
||||
'!=':
|
||||
value1: '%player_remaining_air%'
|
||||
value2: "300"
|
||||
priority_2:
|
||||
text: ''
|
||||
# It's actually using the same method as the region example above!
|
||||
prefix:
|
||||
priority_1:
|
||||
text: '%nameplates_background_prefix%'
|
||||
text: '%nameplates_static_money_hud%%nameplates_offset_-180%%nameplates_static_other_actionbar%'
|
||||
conditions:
|
||||
papi-condition:
|
||||
condition_1:
|
||||
type: '!='
|
||||
papi: '%vault_prefix%'
|
||||
value: ""
|
||||
priority_2:
|
||||
text: ''
|
||||
# A weather example which is using weather conditions
|
||||
'!equals':
|
||||
value1: '%nameplates_actionbar%'
|
||||
value2: ""
|
||||
priority_3:
|
||||
text: '%nameplates_static_money_hud%'
|
||||
weather:
|
||||
priority_1:
|
||||
text: 'Sun'
|
||||
text: 'Sunny'
|
||||
conditions:
|
||||
weather:
|
||||
- clear
|
||||
priority_2:
|
||||
text: 'Rain'
|
||||
text: 'Rainy'
|
||||
conditions:
|
||||
weather:
|
||||
- rain
|
||||
@@ -48,96 +35,51 @@ conditional-text:
|
||||
conditions:
|
||||
weather:
|
||||
- rainstorm
|
||||
# Plugin would hide the stamina bar when players are in water, so the two bars would not overlap
|
||||
stamina:
|
||||
priority_1:
|
||||
text: '%nameplates_offset_98%%nameplates_vanilla_stamina_hud%%nameplates_offset_-179%'
|
||||
conditions:
|
||||
papi-condition:
|
||||
condition_1:
|
||||
type: '=='
|
||||
papi: '%player_remaining_air%'
|
||||
value: "300"
|
||||
priority_2:
|
||||
text: ''
|
||||
# It would keep the income action message in the middle
|
||||
income_actionbar:
|
||||
priority_1:
|
||||
text: '%nameplates_offset_-180%%nameplates_static_income_actionbar%'
|
||||
conditions:
|
||||
papi-condition:
|
||||
condition_1:
|
||||
type: '!='
|
||||
papi: '%nameplates_actionbar%'
|
||||
value: ""
|
||||
priority_2:
|
||||
text: ''
|
||||
|
||||
# %nameplates_nameplate_{0}%
|
||||
# This placeholder would surround the text with a nameplate
|
||||
nameplate-text:
|
||||
halloween:
|
||||
nameplate: halloween
|
||||
text: '<gradient:#FFD700:#FFA500:#FFD700>Today is Halloween! Trick or treat!</gradient>'
|
||||
|
||||
# %nameplates_background_{0}%
|
||||
# This placeholder would surround the text with a background
|
||||
background-text:
|
||||
prefix:
|
||||
location:
|
||||
background: bedrock_1
|
||||
text: '%vault_prefix% %nameplates_descent_player%'
|
||||
remove-shadow: true
|
||||
position:
|
||||
background: bedrock_1
|
||||
text: '<#FFFEFD>%nameplates_image_compass%</#FFFEFD> %nameplates_descent_position%'
|
||||
text: '%nameplates_image_compass% %nameplates_descent_location%'
|
||||
remove-shadow: true
|
||||
time:
|
||||
background: bedrock_1
|
||||
text: '<#FFFEFD>%nameplates_image_clock%</#FFFEFD> %nameplates_descent_time%'
|
||||
text: '%nameplates_image_clock% %nameplates_descent_time%'
|
||||
remove-shadow: true
|
||||
weather:
|
||||
background: bedrock_1
|
||||
text: '<#FFFEFD>%nameplates_image_weather%</#FFFEFD> %nameplates_descent_weather%'
|
||||
text: '%nameplates_image_weather% %nameplates_descent_weather%'
|
||||
remove-shadow: true
|
||||
hello:
|
||||
background: bedrock_1
|
||||
text: '<#FFFEFD>%nameplates_image_bubble%</#FFFEFD> %nameplates_unicode_hello%'
|
||||
remove-shadow: true
|
||||
region:
|
||||
background: bedrock_1
|
||||
text: '<#FFFEFD>%nameplates_image_compass%</#FFFEFD> %nameplates_descent_region%'
|
||||
text: '%nameplates_image_bubble% %nameplates_unicode_hello%'
|
||||
remove-shadow: true
|
||||
update:
|
||||
background: bedrock_1
|
||||
text: '%nameplates_image_bell% %nameplates_descent_update%'
|
||||
remove-shadow: true
|
||||
other_actionbar:
|
||||
background: bedrock_2
|
||||
text: '<#FFFEFD>%nameplates_image_bell%</#FFFEFD> %nameplates_descent_update%'
|
||||
text: '%nameplates_actionbar%'
|
||||
remove-shadow: true
|
||||
|
||||
# %nameplates_static_{0}%
|
||||
# Plugin would generate offset images to keep the text at a certain position regardless of the length
|
||||
# So the text would be fixed at a certain place, so it's called "static-text"
|
||||
# We often use this feature to create money hud or receive income actionbar sent by other plugins
|
||||
static-text:
|
||||
money_hud:
|
||||
# left/right/middle
|
||||
position: right
|
||||
text: '<#FFFEFD>%nameplates_image_coin%</#FFFEFD> %nameplates_descent_money%'
|
||||
text: '%nameplates_image_coin% %nameplates_descent_money%'
|
||||
value: 180
|
||||
income_actionbar:
|
||||
# It might be a good idea if you set the actionbar position from middle to side
|
||||
other_actionbar:
|
||||
position: middle
|
||||
# remove the font tag if you want to use minecraft:default font
|
||||
text: "<font:nameplates:unicode_ascent_8>%nameplates_actionbar%</font>"
|
||||
text: "%nameplates_background_other_actionbar%"
|
||||
value: 180
|
||||
|
||||
# %nameplates_descent_{0}%
|
||||
# If the character can't show correctly here, use descent-unicode instead
|
||||
# Never put an image inside this section unless you surround your image with "<font:namespace:font> </font>"
|
||||
# For example ItemsAdder, you should use <font:minecraft:default>%img_xxx%</font>
|
||||
# Note: If you want to make an image lower, edit the y position/ascent in that plugin instead of
|
||||
# using descent text or descent unicode because they are designed for characters
|
||||
descent-text:
|
||||
location:
|
||||
text: "Your Location: [X: %player_x%, Y: %player_y%, Z: %player_z%]"
|
||||
text: "Your Location: %player_x%, %player_y%, %player_z%"
|
||||
descent: 5
|
||||
is-unicode: false
|
||||
time:
|
||||
@@ -150,18 +92,17 @@ descent-text:
|
||||
is-unicode: false
|
||||
update:
|
||||
text: "A newer version of CustomNameplates is available!"
|
||||
descent: 3
|
||||
descent: 5
|
||||
is-unicode: false
|
||||
money:
|
||||
text: "%vault_eco_balance%"
|
||||
descent: 13
|
||||
descent: 20
|
||||
is-unicode: false
|
||||
hello:
|
||||
text: "Hello 여보세요 你好 こんにちは, Thanks for using CustomNameplates"
|
||||
descent: 5
|
||||
is-unicode: true
|
||||
|
||||
# %nameplates_switch_{0}%
|
||||
switch-text:
|
||||
season:
|
||||
switch: '%customcrops_season%'
|
||||
@@ -172,8 +113,6 @@ switch-text:
|
||||
'Winter': '<blue>Winter</blue>'
|
||||
default: 'Invalid season'
|
||||
|
||||
# %nameplates_vanilla_{0}%
|
||||
# This is useful for creating a vanilla like hud
|
||||
vanilla-hud:
|
||||
stamina_hud:
|
||||
reverse: true
|
||||
@@ -182,14 +121,10 @@ vanilla-hud:
|
||||
half: stamina_1
|
||||
full: stamina_2
|
||||
placeholder:
|
||||
# value/max-value can be placeholders
|
||||
value: '1.1'
|
||||
max-value: '2'
|
||||
|
||||
# %nameplates_cached_{0}%
|
||||
cached-text:
|
||||
cached:
|
||||
# The text to cache
|
||||
text: '%super_complex_javascript%'
|
||||
# How often is the value refreshed, measured in ms
|
||||
refresh-interval: 10000
|
||||
@@ -16,7 +16,7 @@ minecraft:uniform:
|
||||
|
||||
minecraft:alt:
|
||||
default: 8
|
||||
template:
|
||||
template-loading-sequence:
|
||||
- ascii_sga
|
||||
|
||||
minecraft:asciillager:
|
||||
|
||||
@@ -4,18 +4,18 @@ right-margin: 1
|
||||
left:
|
||||
image: b0
|
||||
height: 14
|
||||
ascent: 9
|
||||
ascent: 12
|
||||
width: 1
|
||||
|
||||
right:
|
||||
image: b0
|
||||
height: 14
|
||||
ascent: 9
|
||||
ascent: 12
|
||||
width: 1
|
||||
|
||||
middle:
|
||||
height: 14
|
||||
ascent: 9
|
||||
ascent: 12
|
||||
1: b1
|
||||
2: b2
|
||||
4: b4
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
left-margin: 1
|
||||
right-margin: 1
|
||||
|
||||
left:
|
||||
image: b0
|
||||
height: 14
|
||||
ascent: -7
|
||||
width: 1
|
||||
|
||||
right:
|
||||
image: b0
|
||||
height: 14
|
||||
ascent: -7
|
||||
width: 1
|
||||
|
||||
middle:
|
||||
height: 14
|
||||
ascent: -7
|
||||
1: b1
|
||||
2: b2
|
||||
4: b4
|
||||
8: b8
|
||||
16: b16
|
||||
32: b32
|
||||
64: b64
|
||||
128: b128
|
||||
@@ -1,4 +1,4 @@
|
||||
image: bell
|
||||
height: 10
|
||||
ascent: 6
|
||||
ascent: 4
|
||||
width: 10
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
image: coin
|
||||
height: 10
|
||||
ascent: -3
|
||||
ascent: -11
|
||||
width: 10
|
||||
|
||||
Reference in New Issue
Block a user