9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-19 15:09:23 +00:00
This commit is contained in:
XiaoMoMi
2024-02-02 02:19:17 +08:00
parent f7628c2db9
commit c69735ea2b
3 changed files with 28 additions and 7 deletions

View File

@@ -41,6 +41,13 @@ public interface DataStorageInterface {
*/
StorageType getStorageType();
/**
* Get a player's data by uuid
* This player can be an offline one
*
* @param uuid uuid
* @return player data
*/
CompletableFuture<Optional<PlayerData>> getPlayerData(UUID uuid);
CompletableFuture<Boolean> updatePlayerData(UUID uuid, PlayerData playerData);

View File

@@ -43,6 +43,7 @@ import net.momirealms.customnameplates.paper.setting.CNLocale;
import net.momirealms.customnameplates.paper.storage.StorageManagerImpl;
import net.momirealms.customnameplates.paper.util.Migration;
import net.momirealms.customnameplates.paper.util.ReflectionUtils;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.HandlerList;
@@ -95,6 +96,8 @@ public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin implement
this.getServer().getPluginManager().registerEvents((VersionManagerImpl) versionManager, this);
if (CNConfig.generatePackOnStart)
this.resourcePackManager.generateResourcePack();
if (CNConfig.metrics)
new Metrics(this, 16649);
}
@Override

View File

@@ -24,6 +24,7 @@ import net.momirealms.customnameplates.api.mechanic.placeholder.*;
import net.momirealms.customnameplates.api.requirement.Requirement;
import net.momirealms.customnameplates.api.util.LogUtils;
import net.momirealms.customnameplates.common.Pair;
import net.momirealms.customnameplates.paper.setting.CNConfig;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
@@ -242,21 +243,31 @@ public class PlaceholderManagerImpl implements PlaceholderManager {
}
private void loadBackGroundTexts(ConfigurationSection section) {
if (!CNConfig.backgroundModule) return;
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
if (!(entry.getValue() instanceof ConfigurationSection innerSection))
continue;
backGroundTextMap.put(entry.getKey(),
BackGroundText.builder()
.background(Objects.requireNonNull(plugin.getBackGroundManager().getBackGround(innerSection.getString("background"))))
.text(innerSection.getString("text", ""))
.removeShadow(innerSection.getBoolean("remove-shadow"))
.build()
);
if (innerSection.contains("background")) {
String bg = innerSection.getString("background");
var background = plugin.getBackGroundManager().getBackGround(bg);
if (background == null) {
LogUtils.warn("Background: " + bg + " doesn't exist");
continue;
}
backGroundTextMap.put(entry.getKey(),
BackGroundText.builder()
.background(background)
.text(innerSection.getString("text", ""))
.removeShadow(innerSection.getBoolean("remove-shadow"))
.build()
);
}
}
}
private void loadNameplateTexts(ConfigurationSection section) {
if (!CNConfig.nameplateModule) return;
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
if (!(entry.getValue() instanceof ConfigurationSection innerSection))
continue;