mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 06:59:26 +00:00
Fix build
This commit is contained in:
@@ -2,9 +2,6 @@ plugins {
|
||||
id("io.github.goooler.shadow") version "8.1.8"
|
||||
}
|
||||
|
||||
repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":common"))
|
||||
compileOnly(project(":api"))
|
||||
@@ -26,12 +23,6 @@ dependencies {
|
||||
compileOnly("com.github.ben-manes.caffeine:caffeine:${rootProject.properties["caffeine_version"]}")
|
||||
// COMMONS IO
|
||||
compileOnly("commons-io:commons-io:${rootProject.properties["commons_io_version"]}")
|
||||
// FOP
|
||||
compileOnly("org.apache.pdfbox:fontbox:${rootProject.properties["fontbox_version"]}")
|
||||
}
|
||||
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate ("net.kyori", "net.momirealms.customnameplates.libraries")
|
||||
}
|
||||
// lwjgl
|
||||
implementation("org.lwjgl:lwjgl-freetype:3.3.4")
|
||||
}
|
||||
@@ -51,9 +51,6 @@ import net.momirealms.customnameplates.api.placeholder.SharedPlaceholder;
|
||||
import net.momirealms.customnameplates.api.util.CharacterUtils;
|
||||
import net.momirealms.customnameplates.common.util.Tuple;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.fontbox.ttf.CmapSubtable;
|
||||
import org.apache.fontbox.ttf.TTFParser;
|
||||
import org.apache.fontbox.ttf.TrueTypeFont;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -780,35 +777,7 @@ public class AdvanceManagerImpl implements AdvanceManager {
|
||||
plugin.getPluginLogger().warn(ttfFile.getAbsolutePath() + " is not a .ttf");
|
||||
return;
|
||||
}
|
||||
try (InputStream inputStream = new FileInputStream(ttfFile)) {
|
||||
ttfCache.getParentFile().mkdirs();
|
||||
ttfCache.createNewFile();
|
||||
YamlDocument yml = plugin.getConfigManager().loadData(ttfCache);
|
||||
TTFParser parser = new TTFParser();
|
||||
TrueTypeFont ttf = parser.parseEmbedded(inputStream);
|
||||
CmapSubtable[] cMaps = ttf.getCmap().getCmaps();
|
||||
Set<Integer> codePoints = new HashSet<>();
|
||||
for (CmapSubtable cMap : cMaps) {
|
||||
for (int codepoint = Character.MIN_CODE_POINT; codepoint <= Character.MAX_CODE_POINT; codepoint++) {
|
||||
int glyphId = cMap.getGlyphId(codepoint);
|
||||
if (glyphId != 0) {
|
||||
codePoints.add(codepoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int skippedCodePoint : skippCodePoints) {
|
||||
codePoints.remove(skippedCodePoint);
|
||||
}
|
||||
for (int codePoint : codePoints) {
|
||||
float advanceWidth = ttf.getWidth(Character.toString(codePoint));
|
||||
char[] text = Character.toChars(codePoint);
|
||||
yml.set(CharacterUtils.char2Unicode(text), ((advanceWidth) / ttf.getUnitsPerEm()) * size);
|
||||
}
|
||||
ttf.close();
|
||||
yml.save(ttfCache);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registerCharacterFontData(id, ttfCache, (properties) -> {
|
||||
|
||||
@@ -62,8 +62,6 @@ tasks {
|
||||
relocate("com.github.benmanes.caffeine", "net.momirealms.customnameplates.libraries.caffeine")
|
||||
relocate("net.objecthunter.exp4j", "net.momirealms.customnameplates.libraries.exp4j")
|
||||
relocate("redis.clients.jedis", "net.momirealms.customnameplates.libraries.jedis")
|
||||
relocate("org.apache.fontbox", "net.momirealms.customnameplates.libraries.fontbox")
|
||||
relocate("org.apache.pdfbox", "net.momirealms.customnameplates.libraries.pdfbox")
|
||||
relocate("org.apache.commons.io", "net.momirealms.customnameplates.libraries.commons.io")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ public class BukkitCustomNameplates extends CustomNameplates implements Listener
|
||||
Dependency.H2_DRIVER,
|
||||
Dependency.MONGODB_DRIVER_CORE, Dependency.MONGODB_DRIVER_SYNC, Dependency.MONGODB_DRIVER_BSON,
|
||||
Dependency.HIKARI_CP,
|
||||
Dependency.FONT_BOX, Dependency.PDF_BOX,
|
||||
Dependency.BYTE_BUDDY,
|
||||
Dependency.COMMONS_IO
|
||||
)
|
||||
@@ -204,21 +203,21 @@ public class BukkitCustomNameplates extends CustomNameplates implements Listener
|
||||
if (!this.loaded) return;
|
||||
if (this.scheduledMainTask != null) this.scheduledMainTask.cancel();
|
||||
|
||||
this.configManager.disable();
|
||||
this.actionBarManager.disable();
|
||||
this.bossBarManager.disable();
|
||||
this.unlimitedTagManager.disable();
|
||||
this.advanceManager.disable();
|
||||
this.backgroundManager.disable();
|
||||
this.requirementManager.disable();
|
||||
this.placeholderManager.disable();
|
||||
this.storageManager.disable();
|
||||
this.bubbleManager.disable();
|
||||
this.nameplateManager.disable();
|
||||
this.imageManager.disable();
|
||||
this.chatManager.disable();
|
||||
if (configManager != null) this.configManager.disable();
|
||||
if (actionBarManager != null) this.actionBarManager.disable();
|
||||
if (bossBarManager != null) this.bossBarManager.disable();
|
||||
if (unlimitedTagManager != null) this.unlimitedTagManager.disable();
|
||||
if (advanceManager != null) this.advanceManager.disable();
|
||||
if (backgroundManager != null) this.backgroundManager.disable();
|
||||
if (requirementManager != null) this.requirementManager.disable();
|
||||
if (placeholderManager != null) this.placeholderManager.disable();
|
||||
if (storageManager != null) this.storageManager.disable();
|
||||
if (bubbleManager != null) this.bubbleManager.disable();
|
||||
if (nameplateManager != null) this.nameplateManager.disable();
|
||||
if (imageManager != null) this.imageManager.disable();
|
||||
if (chatManager != null) this.chatManager.disable();
|
||||
|
||||
this.commandManager.unregisterFeatures();
|
||||
if (commandManager != null) this.commandManager.unregisterFeatures();
|
||||
this.joinQuitListeners.clear();
|
||||
HandlerList.unregisterAll(this);
|
||||
|
||||
|
||||
@@ -269,21 +269,6 @@ public enum Dependency {
|
||||
"maven",
|
||||
"slf4j"
|
||||
),
|
||||
FONT_BOX(
|
||||
"org{}apache{}pdfbox",
|
||||
"fontbox",
|
||||
"maven",
|
||||
"fontbox",
|
||||
Relocation.of("fontbox", "org{}apache{}fontbox"),
|
||||
Relocation.of("pdfbox", "org{}apache{}pdfbox")
|
||||
),
|
||||
PDF_BOX(
|
||||
"org{}apache{}pdfbox",
|
||||
"pdfbox-io",
|
||||
"maven",
|
||||
"pdfbox-io",
|
||||
Relocation.of("pdfbox", "org{}apache{}pdfbox")
|
||||
),
|
||||
BYTE_BUDDY(
|
||||
"net{}bytebuddy",
|
||||
"byte-buddy",
|
||||
|
||||
@@ -25,7 +25,5 @@ commons-pool=${commons_pool_version}
|
||||
jedis=${jedis_version}
|
||||
h2-driver=${h2_driver_version}
|
||||
sqlite-driver=${sqlite_driver_version}
|
||||
fontbox=${fontbox_version}
|
||||
pdfbox-io=${pdfbox_io_version}
|
||||
byte-buddy=${byte_buddy_version}
|
||||
commons-io=${commons_io_version}
|
||||
@@ -39,8 +39,6 @@ exp4j_version=0.4.8
|
||||
placeholder_api_version=2.11.6
|
||||
vault_version=1.7
|
||||
guava_version=33.2.0-jre
|
||||
fontbox_version=3.0.3
|
||||
pdfbox_io_version=3.0.3
|
||||
commons_io_version=2.17.0
|
||||
|
||||
# Proxy settings
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
jdk:
|
||||
- openjdk17
|
||||
before_install:
|
||||
- sdk install java 17.0.11-oracle
|
||||
- sdk install java 21.0.3-oracle
|
||||
- sdk use java 17.0.11-oracle
|
||||
Reference in New Issue
Block a user