mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-28 03:09:14 +00:00
2.2.3.8
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.momirealms'
|
||||
version = '2.2.3.6'
|
||||
version = '2.2.3.8'
|
||||
|
||||
repositories {
|
||||
maven {name = "aliyun-repo"; url = "https://maven.aliyun.com/repository/public/"}
|
||||
@@ -29,6 +29,9 @@ dependencies {
|
||||
compileOnly ("com.comphenix.protocol:ProtocolLib:5.0.0")
|
||||
compileOnly ('net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT')
|
||||
compileOnly ('com.github.LoneDev6:api-itemsadder:3.4.1-r4')
|
||||
|
||||
compileOnly 'com.github.Xiao-MoMi:Custom-Fishing:2.0-beta-4'
|
||||
|
||||
compileOnly ('org.apache.commons:commons-lang3:3.12.0')
|
||||
implementation ('net.kyori:adventure-api:4.14.0')
|
||||
implementation ('net.kyori:adventure-platform-bukkit:4.3.0')
|
||||
|
||||
@@ -90,10 +90,11 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
this.customNameplatesAPI = new CustomNameplatesAPI(this);
|
||||
this.customNameplatesAPI.init();
|
||||
this.registerCommands();
|
||||
this.reload();
|
||||
this.reload(false);
|
||||
AdventureUtils.consoleMessage("[CustomNameplates] Plugin Enabled!");
|
||||
if (ConfigManager.enableBStats) new Metrics(this, 16649);
|
||||
if (ConfigManager.checkUpdate) this.versionHelper.checkUpdate();
|
||||
if (ConfigManager.generatePackOnStart) resourceManager.generateResourcePack();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +143,7 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
new PacketContainer(PacketType.Play.Server.SCOREBOARD_TEAM);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
public void reload(boolean generate) {
|
||||
configManager.unload();
|
||||
messageManager.unload();
|
||||
bossBarManager.unload();
|
||||
@@ -170,7 +171,7 @@ public final class CustomNameplates extends JavaPlugin {
|
||||
actionBarManager.load();
|
||||
placeholderManager.load();
|
||||
|
||||
resourceManager.generateResourcePack();
|
||||
if (generate) resourceManager.generateResourcePack();
|
||||
}
|
||||
|
||||
public static CustomNameplates getInstance() {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ReloadCommand extends AbstractSubCommand {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, List<String> args) {
|
||||
long time1 = System.currentTimeMillis();
|
||||
CustomNameplates.getInstance().reload();
|
||||
CustomNameplates.getInstance().reload(true);
|
||||
AdventureUtils.sendMessage(sender, MessageManager.prefix + MessageManager.reload.replace("{time}", String.valueOf(System.currentTimeMillis() - time1)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,18 +39,24 @@ public class VersionHelper {
|
||||
private final String pluginVersion;
|
||||
private boolean isLatest;
|
||||
private final int pack_format;
|
||||
private final boolean isFolia;
|
||||
private boolean isFolia;
|
||||
|
||||
public VersionHelper(CustomNameplates plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pluginVersion = plugin.getDescription().getVersion();
|
||||
this.initialize();
|
||||
this.pack_format = getPack_format(serverVersion);
|
||||
isFolia = plugin.getServer().getName().equals("DirtyFolia");
|
||||
try {
|
||||
Class.forName("io.papermc.paper.threadedregions.scheduler.AsyncScheduler");
|
||||
this.isFolia = true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
this.isFolia = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
if (serverVersion == null) {
|
||||
System.out.println(Bukkit.getServer().getBukkitVersion());
|
||||
this.serverVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||
String[] split = serverVersion.split("_");
|
||||
int main_ver = Integer.parseInt(split[1]);
|
||||
@@ -110,6 +116,9 @@ public class VersionHelper {
|
||||
|
||||
private int getPack_format(String version) {
|
||||
switch (version) {
|
||||
case "v1_20_R2" -> {
|
||||
return 18;
|
||||
}
|
||||
case "v1_20_R1" -> {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ConfigManager extends Function {
|
||||
public static boolean trChat_Hook;
|
||||
public static boolean ventureChat_Hook;
|
||||
public static boolean extractShader;
|
||||
public static boolean extractLegacyBars;
|
||||
public static boolean extractBars;
|
||||
public static char start_char;
|
||||
public static boolean checkUpdate;
|
||||
@@ -57,6 +58,7 @@ public class ConfigManager extends Function {
|
||||
public static boolean enable1_20_Unicode;
|
||||
public static boolean hideScoreboardNumber;
|
||||
public static boolean iaShaderSupport;
|
||||
public static boolean generatePackOnStart;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -86,6 +88,7 @@ public class ConfigManager extends Function {
|
||||
private void loadResourcePack(ConfigurationSection config) {
|
||||
ConfigurationSection section = config.getConfigurationSection("resource-pack");
|
||||
if (section != null) {
|
||||
generatePackOnStart = !section.getBoolean("disable-generation-on-start", false);
|
||||
namespace = section.getString("namespace", "nameplates");
|
||||
font = section.getString("font", "default");
|
||||
start_char = section.getString("config.left-char", "뀁").charAt(0);
|
||||
@@ -95,6 +98,7 @@ public class ConfigManager extends Function {
|
||||
space_split_folder_path = section.getString("image-path.space-split","font\\base\\");
|
||||
images_folder_path = section.getString("image-path.images","font\\images\\");
|
||||
extractShader = section.getBoolean("extract-shader",true);
|
||||
extractLegacyBars = section.getBoolean("extract-bar-image-legacy",true);
|
||||
extractBars = section.getBoolean("extract-bar-image",true);
|
||||
enable1_20_Unicode = section.getBoolean("support-1_20-unicodes",false);
|
||||
hideScoreboardNumber = section.getBoolean("hide-scoreboard-number",true);
|
||||
|
||||
@@ -240,10 +240,15 @@ public class ResourceManager {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (ConfigManager.extractBars) {
|
||||
if (ConfigManager.extractLegacyBars) {
|
||||
String path = "ResourcePack" + File.separator + "assets" + File.separator + "minecraft" + File.separator + "textures" + File.separator + "gui" + File.separator;
|
||||
plugin.saveResource(path + "bars.png", true);
|
||||
}
|
||||
if (ConfigManager.extractBars) {
|
||||
String path = "ResourcePack" + File.separator + "assets" + File.separator + "minecraft" + File.separator + "textures" + File.separator + "gui" + File.separator + "sprites" + File.separator + "boss_bar" + File.separator;
|
||||
plugin.saveResource(path + "yellow_background.png", true);
|
||||
plugin.saveResource(path + "yellow_progress.png", true);
|
||||
}
|
||||
setPackFormat();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ public class CustomPapiImpl implements Requirement {
|
||||
case "<=" -> papiRequirements.add(new PapiNoLarger(papi, value));
|
||||
case "<" -> papiRequirements.add(new PapiSmaller(papi, value));
|
||||
case ">" -> papiRequirements.add(new PapiGreater(papi, value));
|
||||
case "regex" -> papiRequirements.add(new PapiRegex(papi, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record ExpressionAnd(List<PapiRequirement> requirements) implements PapiRequirement{
|
||||
public record ExpressionAnd(List<PapiRequirement> requirements) implements PapiRequirement {
|
||||
|
||||
@Override
|
||||
public boolean isMet(Player player) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.momirealms.customnameplates.object.requirements.papi;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public record PapiRegex(String papi, String regex) implements PapiRequirement {
|
||||
|
||||
@Override
|
||||
public boolean isMet(Player player) {
|
||||
return PlaceholderAPI.setPlaceholders(player, papi).matches(regex);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 144 B |
Binary file not shown.
|
After Width: | Height: | Size: 144 B |
@@ -1,5 +1,5 @@
|
||||
# Do not change
|
||||
config-version: '18'
|
||||
config-version: '19'
|
||||
|
||||
# bStats
|
||||
metrics: true
|
||||
@@ -8,7 +8,7 @@ metrics: true
|
||||
update-checker: true
|
||||
|
||||
# Language
|
||||
# english/chinese/spanish/russian
|
||||
# english/chinese/spanish/russian/turkish/french
|
||||
lang: english
|
||||
|
||||
# Modules
|
||||
@@ -43,10 +43,14 @@ integrations:
|
||||
VentureChat: false
|
||||
|
||||
resource-pack:
|
||||
# disable resource pack generation on server start
|
||||
disable-generation-on-start: false
|
||||
# extract the shader
|
||||
extract-shader: true
|
||||
# extract the minecraft bars.png
|
||||
# extract the transparent bossbar for 1.20.2+
|
||||
extract-bar-image: true
|
||||
# extract the transparent bars.png for legacy versions
|
||||
extract-bar-image-legacy: true
|
||||
# Your namespace
|
||||
namespace: "nameplates"
|
||||
# Font Name
|
||||
|
||||
Reference in New Issue
Block a user