Skip to content

Commit

Permalink
[Layout] Use randomly generated property names for fixes slots instea…
Browse files Browse the repository at this point in the history
…d of building them deterministically
  • Loading branch information
NEZNAMY committed Sep 7, 2024
1 parent 462d383 commit 54a519d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import me.neznamy.tab.shared.Property;
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.TabConstants;
import me.neznamy.tab.shared.config.files.config.LayoutConfiguration.LayoutDefinition.FixedSlotDefinition;
Expand All @@ -20,16 +21,16 @@
@RequiredArgsConstructor
public class FixedSlot extends RefreshableFeature {

private static final StringToComponentCache cache = new StringToComponentCache("LayoutFixedSlot", 1000);
@NotNull private static final StringToComponentCache cache = new StringToComponentCache("LayoutFixedSlot", 1000);

@NotNull private final String propertyName = Property.randomName();
@NotNull private final String skinProperty = Property.randomName();
@NonNull private final LayoutManagerImpl manager;
@Getter private final int slot;
@NonNull private final LayoutPattern pattern;
@NonNull private final UUID id;
@NonNull private final String text;
@NonNull private final String propertyName;
@NonNull private final String skin;
@NonNull private final String skinProperty;
private final int ping;

@NotNull
Expand Down Expand Up @@ -97,9 +98,7 @@ public static FixedSlot fromDefinition(@NotNull FixedSlotDefinition def, @NotNul
pattern,
manager.getUUID(def.slot),
def.text,
"Layout-" + pattern.getName() + "-SLOT-" + def.slot,
def.skin == null || def.skin.isEmpty() ? manager.getConfiguration().getDefaultSkin(def.slot) : def.skin,
"Layout-" + pattern.getName() + "-SLOT-" + def.slot + "-skin",
def.ping == null ? manager.getConfiguration().emptySlotPing : def.ping
);
if (!def.text.isEmpty()) TAB.getInstance().getFeatureManager().registerFeature(TabConstants.Feature.layoutSlot(pattern.getName(), def.slot), f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public void addFixedSlot(int slot, @NonNull String text, int ping) {
@Override
public void addFixedSlot(int slot, @NonNull String text, @NonNull String skin, int ping) {
ensureActive();
fixedSlots.put(slot, new FixedSlot(manager, slot, this, manager.getUUID(slot), text,
"Layout-" + name + "-SLOT-" + slot, skin, "Layout-" + name + "-SLOT-" + slot+ "-skin", ping));
fixedSlots.put(slot, new FixedSlot(manager, slot, this, manager.getUUID(slot), text, skin, ping));
}

@Override
Expand Down

0 comments on commit 54a519d

Please sign in to comment.