Extended names false by default, don't give json on /ld automatically

This commit is contained in:
libraryaddict 2020-04-01 21:39:25 +13:00
parent 901c6ef06f
commit e55f88fc73
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
4 changed files with 37 additions and 36 deletions

View File

@ -397,7 +397,8 @@ public class DisguiseConfig {
setEntityStatusPacketsEnabled(config.getBoolean("PacketsEnabled.EntityStatus"));
setEquipmentPacketsEnabled(config.getBoolean("PacketsEnabled.Equipment"));
setExplicitDisguisePermissions(config.getBoolean("Permissions.ExplicitDisguises"));
setExtendedDisguiseNames(config.getBoolean("ExtendedNames"));
// The default value shall be false if you don't update config
setExtendedDisguiseNames(config.contains("ScoreboardNames") && config.getBoolean("ExtendedNames"));
setHideArmorFromSelf(config.getBoolean("RemoveArmor"));
setHideDisguisedPlayers(config.getBoolean("HideDisguisedPlayersFromTab"));
setHideHeldItemFromSelf(config.getBoolean("RemoveHeldItem"));

View File

@ -50,47 +50,48 @@ public class PacketHandlerAttributes implements IPacketHandler {
return;
}
if (!disguise.isMiscDisguise()) {
packets.clear();
if (disguise.isMiscDisguise()) {
return;
}
List<WrappedAttribute> attributes = new ArrayList<>();
PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
packets.clear();
for (WrappedAttribute attribute : sentPacket.getAttributeCollectionModifier().read(0)) {
if (attribute.getAttributeKey().equals("generic.maxHealth")) {
WrappedAttribute.Builder builder;
List<WrappedAttribute> attributes = new ArrayList<>();
PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES);
if (((LivingWatcher) disguise.getWatcher()).isMaxHealthSet()) {
builder = WrappedAttribute.newBuilder();
builder.attributeKey("generic.maxHealth");
builder.baseValue(((LivingWatcher) disguise.getWatcher()).getMaxHealth());
} else if (DisguiseConfig.isMaxHealthDeterminedByDisguisedEntity()) {
builder = WrappedAttribute.newBuilder(attribute);
} else {
builder = WrappedAttribute.newBuilder();
builder.attributeKey("generic.maxHealth");
builder.baseValue(
DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth());
}
for (WrappedAttribute attribute : sentPacket.getAttributeCollectionModifier().read(0)) {
if (attribute.getAttributeKey().equals("generic.maxHealth")) {
WrappedAttribute.Builder builder;
builder.packet(updateAttributes);
attributes.add(builder.build());
} else if (attribute.getAttributeKey().equals("generic.movementSpeed") &&
disguise.getWatcher() instanceof AbstractHorseWatcher) {
WrappedAttribute.Builder builder = WrappedAttribute.newBuilder(attribute);
builder.packet(updateAttributes);
attributes.add(builder.build());
if (((LivingWatcher) disguise.getWatcher()).isMaxHealthSet()) {
builder = WrappedAttribute.newBuilder();
builder.attributeKey("generic.maxHealth");
builder.baseValue(((LivingWatcher) disguise.getWatcher()).getMaxHealth());
} else if (DisguiseConfig.isMaxHealthDeterminedByDisguisedEntity()) {
builder = WrappedAttribute.newBuilder(attribute);
} else {
builder = WrappedAttribute.newBuilder();
builder.attributeKey("generic.maxHealth");
builder.baseValue(DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth());
}
}
if (!attributes.isEmpty()) {
packets.addPacket(updateAttributes);
builder.packet(updateAttributes);
updateAttributes.getIntegers().write(0, entity.getEntityId());
updateAttributes.getAttributeCollectionModifier().write(0, attributes);
attributes.add(builder.build());
} else if (attribute.getAttributeKey().equals("generic.movementSpeed") &&
disguise.getWatcher() instanceof AbstractHorseWatcher) {
WrappedAttribute.Builder builder = WrappedAttribute.newBuilder(attribute);
builder.packet(updateAttributes);
attributes.add(builder.build());
}
}
if (!attributes.isEmpty()) {
packets.addPacket(updateAttributes);
updateAttributes.getIntegers().write(0, entity.getEntityId());
updateAttributes.getAttributeCollectionModifier().write(0, attributes);
}
}
}

View File

@ -63,7 +63,7 @@ SaveDisguises:
Entities: false
# Do names go beyond the 16 char limit for player disguises?
ExtendedNames: true
ExtendedNames: false
# Do names resolve into scoreboard teams so changing the player name is flawless?
# This will only work properly for names 28 chars or less in length.
# Notch [DragonSlayer lvl: 28]

View File

@ -106,7 +106,6 @@ permissions:
description: Allows player to get meta info
libsdisguises.json:
description: Allows player to parse held item to json
default: true
libsdisguises.scoreboardtest:
description: Test if the scoreboard is valid, this is a simple test.
libsdisguises.config: