From 99f7059daae9b4535bc447ef8c7e4383f7077915 Mon Sep 17 00:00:00 2001
From: 7sat <49030779+7sat@users.noreply.github.com>
Date: Tue, 7 Mar 2023 23:32:20 +0900
Subject: [PATCH] Hotfix for MC1.16~1.17
---
pom.xml | 2 +-
.../dynamicshop/utilities/ConfigUtil.java | 22 ++++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index f7e3f3c..2b6a09e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.sat7
DynamicShop
- 3.12.0
+ 3.12.1
jar
DynamicShop
diff --git a/src/main/java/me/sat7/dynamicshop/utilities/ConfigUtil.java b/src/main/java/me/sat7/dynamicshop/utilities/ConfigUtil.java
index 96959a0..1ef375c 100644
--- a/src/main/java/me/sat7/dynamicshop/utilities/ConfigUtil.java
+++ b/src/main/java/me/sat7/dynamicshop/utilities/ConfigUtil.java
@@ -4,6 +4,7 @@
import lombok.Setter;
import me.sat7.dynamicshop.DynamicShop;
import me.sat7.dynamicshop.files.CustomConfig;
+import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
@@ -41,7 +42,26 @@ public static void Load()
DynamicShop.plugin.saveDefaultConfig();
DynamicShop.plugin.reloadConfig();
- DynamicShop.plugin.getConfig().options().setHeader(header);
+
+ try
+ {
+ if(Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17"))
+ {
+ StringBuilder temp = new StringBuilder();
+ for (String s:header)
+ {
+ temp.append(s);
+ temp.append("\n");
+ }
+ DynamicShop.plugin.getConfig().options().header(temp.toString());
+ }
+ else
+ {
+ DynamicShop.plugin.getConfig().options().setHeader(header);
+ }
+ }
+ catch (Exception ignore){}
+
ConvertV2toV3();
ShopYMLUpdate();