3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-07-06 07:38:03 +02:00

Add option to (not) add the 1.13 scoreboard team color

Dieser Commit ist enthalten in:
KennyTV 2020-01-02 19:34:31 +01:00
Ursprung 617f1d3876
Commit b1c4d563b4
4 geänderte Dateien mit 22 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -11,6 +11,7 @@ import java.util.Map;
public class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.api.ViaBackwardsConfig {
private boolean addCustomEnchantsToLore;
private boolean addTeamColorToPrefix;
public ViaBackwardsConfig(File configFile) {
super(configFile);
@ -24,6 +25,7 @@ public class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.
private void loadFields() {
addCustomEnchantsToLore = getBoolean("add-custom-enchants-into-lore", true);
addTeamColorToPrefix = getBoolean("add-teamcolor-to-prefix", true);
}
@Override
@ -31,6 +33,11 @@ public class ViaBackwardsConfig extends Config implements nl.matsv.viabackwards.
return addCustomEnchantsToLore;
}
@Override
public boolean addTeamColorTo1_13Prefix() {
return addTeamColorToPrefix;
}
@Override
public URL getDefaultConfigURL() {
return getClass().getClassLoader().getResource("assets/viabackwards/config.yml");

Datei anzeigen

@ -8,4 +8,11 @@ public interface ViaBackwardsConfig {
* @return true if enabled
*/
boolean addCustomEnchantsToLore();
/**
* Writes the color of the scoreboard team after the prefix.
*
* @return true if enabled
*/
boolean addTeamColorTo1_13Prefix();
}

Datei anzeigen

@ -239,11 +239,13 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
colour = -1;
}
//TODO team color/prefix handling changed from 1.12.2 to 1.13 and to 1.13.1 again afaik
String prefix = wrapper.read(Type.STRING);
String suffix = wrapper.read(Type.STRING);
prefix = prefix == null || prefix.equals("null") ? "" : ChatRewriter.jsonTextToLegacy(prefix);
prefix += "§" + (colour > -1 && colour <= 15 ? Integer.toHexString(colour) : "r");
if (ViaBackwards.getConfig().addTeamColorTo1_13Prefix()) {
prefix += "§" + (colour > -1 && colour <= 15 ? Integer.toHexString(colour) : "r");
}
prefix = ChatUtil.removeUnusedColor(prefix, 'f', true);
if (prefix.length() > 16) prefix = prefix.substring(0, 16);
if (prefix.endsWith("§")) prefix = prefix.substring(0, prefix.length() - 1);

Datei anzeigen

@ -2,4 +2,7 @@
#
# Writes name and level of custom enchantments into the item's lore.
# Set this to false if you see the entries doubled/if the custom-enchant plugin already writes these into the lore manually.
add-custom-enchants-into-lore: true
add-custom-enchants-into-lore: true
#
# Adds the color of a scoreboard team after its prefix for 1.12 clients on 1.13+ servers.
add-teamcolor-to-prefix: true