mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
2.3.0.7
This commit is contained in:
@@ -41,6 +41,13 @@ public interface DataStorageInterface {
|
|||||||
*/
|
*/
|
||||||
StorageType getStorageType();
|
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<Optional<PlayerData>> getPlayerData(UUID uuid);
|
||||||
|
|
||||||
CompletableFuture<Boolean> updatePlayerData(UUID uuid, PlayerData playerData);
|
CompletableFuture<Boolean> updatePlayerData(UUID uuid, PlayerData playerData);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import net.momirealms.customnameplates.paper.setting.CNLocale;
|
|||||||
import net.momirealms.customnameplates.paper.storage.StorageManagerImpl;
|
import net.momirealms.customnameplates.paper.storage.StorageManagerImpl;
|
||||||
import net.momirealms.customnameplates.paper.util.Migration;
|
import net.momirealms.customnameplates.paper.util.Migration;
|
||||||
import net.momirealms.customnameplates.paper.util.ReflectionUtils;
|
import net.momirealms.customnameplates.paper.util.ReflectionUtils;
|
||||||
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -95,6 +96,8 @@ public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin implement
|
|||||||
this.getServer().getPluginManager().registerEvents((VersionManagerImpl) versionManager, this);
|
this.getServer().getPluginManager().registerEvents((VersionManagerImpl) versionManager, this);
|
||||||
if (CNConfig.generatePackOnStart)
|
if (CNConfig.generatePackOnStart)
|
||||||
this.resourcePackManager.generateResourcePack();
|
this.resourcePackManager.generateResourcePack();
|
||||||
|
if (CNConfig.metrics)
|
||||||
|
new Metrics(this, 16649);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import net.momirealms.customnameplates.api.mechanic.placeholder.*;
|
|||||||
import net.momirealms.customnameplates.api.requirement.Requirement;
|
import net.momirealms.customnameplates.api.requirement.Requirement;
|
||||||
import net.momirealms.customnameplates.api.util.LogUtils;
|
import net.momirealms.customnameplates.api.util.LogUtils;
|
||||||
import net.momirealms.customnameplates.common.Pair;
|
import net.momirealms.customnameplates.common.Pair;
|
||||||
|
import net.momirealms.customnameplates.paper.setting.CNConfig;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -242,21 +243,31 @@ public class PlaceholderManagerImpl implements PlaceholderManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadBackGroundTexts(ConfigurationSection section) {
|
private void loadBackGroundTexts(ConfigurationSection section) {
|
||||||
|
if (!CNConfig.backgroundModule) return;
|
||||||
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
|
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
|
||||||
if (!(entry.getValue() instanceof ConfigurationSection innerSection))
|
if (!(entry.getValue() instanceof ConfigurationSection innerSection))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
backGroundTextMap.put(entry.getKey(),
|
if (innerSection.contains("background")) {
|
||||||
BackGroundText.builder()
|
String bg = innerSection.getString("background");
|
||||||
.background(Objects.requireNonNull(plugin.getBackGroundManager().getBackGround(innerSection.getString("background"))))
|
var background = plugin.getBackGroundManager().getBackGround(bg);
|
||||||
.text(innerSection.getString("text", ""))
|
if (background == null) {
|
||||||
.removeShadow(innerSection.getBoolean("remove-shadow"))
|
LogUtils.warn("Background: " + bg + " doesn't exist");
|
||||||
.build()
|
continue;
|
||||||
);
|
}
|
||||||
|
backGroundTextMap.put(entry.getKey(),
|
||||||
|
BackGroundText.builder()
|
||||||
|
.background(background)
|
||||||
|
.text(innerSection.getString("text", ""))
|
||||||
|
.removeShadow(innerSection.getBoolean("remove-shadow"))
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadNameplateTexts(ConfigurationSection section) {
|
private void loadNameplateTexts(ConfigurationSection section) {
|
||||||
|
if (!CNConfig.nameplateModule) return;
|
||||||
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
|
for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
|
||||||
if (!(entry.getValue() instanceof ConfigurationSection innerSection))
|
if (!(entry.getValue() instanceof ConfigurationSection innerSection))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user