9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-26 02:19:28 +00:00

1.21 support

This commit is contained in:
XiaoMoMi
2024-06-28 02:52:20 +08:00
parent 5ee27c126c
commit 99bfc28be8
8 changed files with 32 additions and 52 deletions

View File

@@ -48,11 +48,11 @@ dependencies {
// api module
implementation(project(":api"))
implementation(project(":common"))
implementation(files("libs/Sparrow-Heart-0.18.jar"))
implementation(files("libs/Sparrow-Heart-0.19.jar"))
// adventure
compileOnly("net.kyori:adventure-api:4.17.0")
compileOnly("net.kyori:adventure-platform-bukkit:4.3.3")
implementation("net.kyori:adventure-api:4.17.0")
implementation("net.kyori:adventure-platform-bukkit:4.3.3")
}
tasks {

Binary file not shown.

Binary file not shown.

View File

@@ -73,8 +73,6 @@ public class CustomNameplatesPluginImpl extends CustomNameplatesPlugin implement
Dependency.SLF4J_SIMPLE,
versionManager.isMojmap() ? Dependency.COMMAND_API_MOJMAP : Dependency.COMMAND_API,
Dependency.BOOSTED_YAML,
Dependency.BIOME_API,
Dependency.ADVENTURE_BUNDLE,
Dependency.MYSQL_DRIVER,
Dependency.MARIADB_DRIVER,
Dependency.MONGODB_DRIVER_SYNC,

View File

@@ -202,24 +202,6 @@ public enum Dependency {
"2.10.1",
null,
"gson"
),
BIOME_API(
"com{}github{}Xiao-MoMi",
"BiomeAPI",
"0.6",
"jitpack",
"biome-api",
Relocation.of("biomeapi", "net{}momirealms{}biomeapi")
),
ADVENTURE_BUNDLE(
"com.github.Xiao-MoMi",
"Adventure-Bundle",
"4.16.0",
"jitpack",
"adventure-bundle",
Relocation.of("adventure", "net{}kyori{}adventure"),
Relocation.of("option", "net{}kyori{}option"),
Relocation.of("examination", "net{}kyori{}examination")
);
private final String mavenRepoPath;

View File

@@ -55,7 +55,7 @@ public class VersionManagerImpl implements VersionManager, Listener {
// Get the server version
String[] split = Bukkit.getServer().getBukkitVersion().split("-")[0].split("\\.");
this.mcVersion = Float.parseFloat(split[1] + "." + split[2]);
this.mcVersion = Float.parseFloat(split[1] + "." + (split.length >= 3 ? split[2] : "0"));
// Get the plugin version
this.pluginVersion = plugin.getDescription().getVersion();

View File

@@ -496,23 +496,23 @@ public class ResourcePackManagerImpl implements ResourcePackManager {
private void setPackFormat() {
plugin.saveResource("ResourcePack" + File.separator + "pack.mcmeta", false);
File format_file = new File(plugin.getDataFolder(), "ResourcePack" + File.separator + "pack.mcmeta");
String line;
StringBuilder sb = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(format_file), StandardCharsets.UTF_8))) {
while ((line = reader.readLine()) != null) {
sb.append(line).append(System.lineSeparator());
}
} catch (IOException e) {
e.printStackTrace();
}
try (BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(new File(plugin.getDataFolder(),
"ResourcePack" + File.separator + "pack.mcmeta")), StandardCharsets.UTF_8))) {
writer.write(sb.toString().replace("%version%", String.valueOf(plugin.getVersionManager().getPackFormat())));
} catch (IOException e) {
e.printStackTrace();
}
// File format_file = new File(plugin.getDataFolder(), "ResourcePack" + File.separator + "pack.mcmeta");
// String line;
// StringBuilder sb = new StringBuilder();
// try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(format_file), StandardCharsets.UTF_8))) {
// while ((line = reader.readLine()) != null) {
// sb.append(line).append(System.lineSeparator());
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// try (BufferedWriter writer = new BufferedWriter(
// new OutputStreamWriter(new FileOutputStream(new File(plugin.getDataFolder(),
// "ResourcePack" + File.separator + "pack.mcmeta")), StandardCharsets.UTF_8))) {
// writer.write(sb.toString().replace("%version%", String.valueOf(plugin.getVersionManager().getPackFormat())));
// } catch (IOException e) {
// e.printStackTrace();
// }
}
public static class ShaderConstants {

View File

@@ -88,13 +88,13 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener {
TeamVisibility.ALWAYS,
TeamCollisionRule.ALWAYS,
TeamColor.WHITE,
true,
true
false,
false
);
if (online == player) continue;
String onlineTeam = teamProvider.getTeam(online, null);
SparrowHeart.getInstance().addClientSideTeam(player, team,
Collections.singletonList(onlineTeam),
SparrowHeart.getInstance().addClientSideTeam(player, onlineTeam,
Collections.singletonList(online.getName()),
"{\"text\":\"\"}",
"{\"text\":\"\"}",
"{\"text\":\"\"}",
@@ -102,8 +102,8 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener {
TeamVisibility.ALWAYS,
TeamCollisionRule.ALWAYS,
TeamColor.WHITE,
true,
true
false,
false
);
}
}
@@ -156,14 +156,14 @@ public class TeamManagerImpl implements TeamManager, PluginMessageListener {
SparrowHeart.getInstance().updateClientSideTeam(
viewer, team,
"{\"text\":\"\"}",
AdventureManagerImpl.getInstance().componentToJson(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(prefix)),
AdventureManagerImpl.getInstance().componentToJson(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(suffix)),
TeamVisibility.ALWAYS,
AdventureManagerImpl.getInstance().getJsonComponentFromMiniMessage(prefix),
AdventureManagerImpl.getInstance().getJsonComponentFromMiniMessage(suffix),
TeamVisibility.valueOf(visibility.name()),
TeamVisibility.ALWAYS,
TeamCollisionRule.ALWAYS,
TeamColor.valueOf(color.name()),
true,
true
false,
false
);
}
}