Skip to content

Commit

Permalink
🐛 Fix background not initially working if set to transparent #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-MX committed Sep 20, 2024
1 parent 44ff6d2 commit ab83d46
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/main/java/com/mattmx/nametags/NameTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public void onEnable() {

SpigotEntityLibPlatform platform = new SpigotEntityLibPlatform(this);
APIConfig settings = new APIConfig(PacketEvents.getAPI())
.tickTickables()
.trackPlatformEntities()
// .tickTickables()
// .trackPlatformEntities()
.usePlatformLogger();

EntityLib.init(platform, settings);
Expand Down Expand Up @@ -88,9 +88,6 @@ public HashMap<String, ConfigurationSection> getGroups() {
}

public static @NotNull NameTags getInstance() {
if (instance == null)
throw new RuntimeException("NameTags plugin has not initialized yet! Did you forget to depend?");

return instance;
return Objects.requireNonNull(instance, "NameTags plugin has not initialized yet! Did you forget to depend?");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public ConfigDefaultsListener(@NotNull NameTags plugin) {

NameTags.getInstance()
.getEntityManager()
.setDefaultProvider(((entity, meta) -> TextDisplayMetaConfiguration.applyMeta(defaultSection(), meta)));
.setDefaultProvider(((entity, meta) -> {
meta.setUseDefaultBackground(false);
TextDisplayMetaConfiguration.applyMeta(defaultSection(), meta);
}));
}

private ConfigurationSection defaultSection() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ public static void applyMeta(@NotNull ConfigurationSection section, @NotNull Tex
background = NameTags.TRANSPARENT;
}

if (background != to.getBackgroundColor()) {
to.setBackgroundColor(background);
}
to.setBackgroundColor(background);
}

String billboardString = section.getString("billboard");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mattmx.nametags.entity;

import com.github.retrooper.packetevents.util.Vector3f;
import com.mattmx.nametags.NameTags;
import com.mattmx.nametags.event.NameTagEntityCreateEvent;
import me.tofaa.entitylib.meta.display.AbstractDisplayMeta;
import me.tofaa.entitylib.meta.display.TextDisplayMeta;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ depend:

softdepend:
- PlaceholderAPI
- TAB

commands:
nametags-reload:
Expand Down

0 comments on commit ab83d46

Please sign in to comment.